[pyfai] 08/10: Imported Upstream version 0.9.2

Frédéric-Emmanuel Picca picca at moszumanska.debian.org
Mon Jan 13 23:05:31 UTC 2014


This is an automated email from the git hooks/post-receive script.

picca pushed a commit to branch experimental
in repository pyfai.

commit f3dbe247e94ca095721eada6d15790a15065c28e
Author: Picca Frédéric-Emmanuel <picca at debian.org>
Date:   Mon Jan 13 23:32:42 2014 +0100

    Imported Upstream version 0.9.2
---
 CHANGELOG.txt                         |     9 +-
 MANIFEST.in                           |     2 +
 PKG-INFO                              |     2 +-
 README.txt                            |    39 +-
 benchmark/benchmark.py                |    14 +-
 calibration/AgBh.D                    |    10 +
 calibration/Au.D                      |     7 +
 calibration/C14H30O.D                 |    13 +
 calibration/CeO2.D                    |    40 +
 calibration/Cr2O3.D                   |    21 +
 calibration/CrOx.D                    |     8 +
 calibration/LaB6.D                    |    61 +
 calibration/Si.D                      |    11 +
 calibration/alpha_Al2O3.D             |    30 +
 doc/pyFAI.pdf                         |   Bin 728856 -> 1226788 bytes
 doc/source/conf.py                    |     2 +-
 doc/source/man/diff_tomo.rst          |     2 +-
 doc/source/man/pyFAI-average.rst      |     2 +
 doc/source/man/scripts.rst            |     4 +-
 doc/source/project.rst                |    99 +-
 doc/source/pyFAI.rst                  |    12 +-
 gui/integration.ui                    |     4 +-
 pyFAI-src/__init__.py                 |     4 +-
 pyFAI-src/argparse.py                 |  2353 +++
 pyFAI-src/azimuthalIntegrator.py      |   873 +-
 pyFAI-src/calibration.py              |   130 +-
 pyFAI-src/detectors.py                |   309 +-
 pyFAI-src/geometry.py                 |   100 +-
 pyFAI-src/geometryRefinement.py       |     8 +-
 pyFAI-src/integrate_widget.py         |    86 +-
 pyFAI-src/io.py                       |   501 +
 pyFAI-src/ocl_azim.py                 |    17 +-
 pyFAI-src/ocl_azim_lut.py             |    12 +-
 pyFAI-src/opencl.py                   |    48 +-
 pyFAI-src/peakPicker.py               |    11 +-
 pyFAI-src/processor.py                |   254 +
 pyFAI-src/spline.py                   |    99 +-
 pyFAI-src/units.py                    |     4 +-
 pyFAI-src/utils.py                    |   198 +-
 pyFAI-src/worker.py                   |   427 +
 scripts/MX-calibrate                  |    11 +-
 scripts/diff_tomo                     |    24 +-
 scripts/pyFAI-integrate               |    23 +-
 scripts/pyFAI-saxs                    |     2 +-
 scripts/pyFAI-waxs                    |     2 +-
 setup.py                              |    80 +-
 src/_distortion.c                     | 10194 +++++-----
 src/_geometry.c                       |  4937 ++---
 src/bilinear.c                        |  5919 +++---
 src/bilinear.pyx                      |    43 +-
 src/fastcrc.c                         |   978 +-
 src/histogram.c                       |  3096 ++-
 src/{fastcrc.c => marchingsquares_.c} |  2658 ++-
 src/marchingsquares_.pyx              |   113 +
 src/reconstruct.c                     |  5476 +++---
 src/reconstruct.pyx                   |    19 +-
 src/relabel.c                         |  4696 ++---
 src/{reconstruct.c => sparse_csr.c}   |  5836 +++---
 src/sparse_csr.pyx                    |    51 +
 src/splitBBox.c                       |  9074 ++++-----
 src/splitBBox.pyx                     |    74 +-
 src/splitBBoxLUT.c                    | 32922 ++++++++++++++------------------
 src/splitBBoxLUT.pyx                  |   790 +-
 src/splitPixel.c                      |  5727 +++---
 test/testAzimuthalIntegrator.py       |    73 +-
 test/testBilinear.py                  |     4 +-
 test/testDetector.py                  |    81 +
 test/testDistortion.py                |     2 +
 test/testGeometry.py                  |    27 +-
 test/testGeometryRefinement.py        |    29 +-
 test/testHistogram.py                 |     3 +-
 test/testIntegrate.py                 |     9 +-
 test/testMask.py                      |    97 +-
 test/testOpenCL.py                    |    13 +-
 test/testPeakPicking.py               |    32 +-
 test/testUtils.py                     |    21 +-
 test/test_all.py                      |     2 +
 test/testimages/Frelon2k.poni         |     4 +-
 test/testimages/LaB6.poni             |     4 +-
 test/testimages/halfccd.poni          |     4 +-
 test/utilstest.py                     |    83 +-
 81 files changed, 51002 insertions(+), 48057 deletions(-)

diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index a6e8aa6..8792570 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -37,4 +37,11 @@
 		New detectors: Dexela and Perkin-Elmer flat panel
 		Automatic refinement of multiple images at various geometries (for MX)
 		Many improvements requested by ID11 and ID13  
-0.9:	
+0.9:	10/2013
+        Add detector S140 from ImXpad, Titan from Agilent, Rayonix
+        Fix issues: 61, 62, 68, 76, 81, 82, 85, 86, 87
+        Enhancement in LImA plugins (better structure)
+        IO module with Ascii/EDF/HDF5 writers 
+        Switch some GUI to pyQtGraph in addition to Qt
+        Correction for solid-angle formula  
+0.9.2:  (01/2014)
\ No newline at end of file
diff --git a/MANIFEST.in b/MANIFEST.in
index 3327ca2..ef338d0 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -4,6 +4,7 @@ recursive-include src  *.c *.h *.pyx *.pxd
 recursive-include benchmark *.py *.spline *.poni
 recursive-include pyFAI-src *.py
 recursive-include gui *.ui
+recursive-include calibration *.D
 include stdeb.cfg
 include setup.cfg
 include MANIFEST.in
@@ -39,6 +40,7 @@ include scripts/pyFAI-waxs
 include scripts/pyFAI-average
 include scripts/check_calib
 include scripts/diff_tomo
+
 include test/testimages/Pilatus1M.poni
 include test/testimages/halfccd.fit2d.edf
 include test/testimages/Frelon2k.edf
diff --git a/PKG-INFO b/PKG-INFO
index a47923f..b128e80 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.0
 Name: pyFAI
-Version: 0.9.0
+Version: 0.9.2
 Summary: Python implementation of fast azimuthal integration
 Home-page: http://forge.epn-campus.eu/azimuthal
 Author: Jérôme Kieffer (python),       Peter Boesecke (geometry), Manuel Sanchez del Rio (algorithm), Vicente Armando Sole (algorithm),       Dimitris Karkoulis (GPU), Jon Wright (adaptations) and Frederic-Emmanuel Picca
diff --git a/README.txt b/README.txt
index 375385e..f8446b7 100644
--- a/README.txt
+++ b/README.txt
@@ -20,19 +20,23 @@ tarball. Download either one and unpack it.
 Developement is done on Github: https://github.com/kif/pyFAI
 
 e.g.
-tar xvzf pyFAI-0.8.0.tar.gz
+tar xvzf pyFAI-0.9.2.tar.gz
 or
-unzip pyFAI-0.8.0.zip
+unzip pyFAI-0.9.2.zip
 
-all files are unpacked into the directory pyFAI-0.8.0. To install these do
+All files are unpacked into the directory pyFAI-0.9.2.
 
-cd pyFAI-0.8.0
+cd pyFAI-0.9.2
+
+Build it & test it. For test pyFAI downloads test images (you may have to setup a proxy configuration like export http_proxy=http://proxy.site.org:3128):
+
+python setup.py build test
 
 and install pyFAI with
 
 python setup.py install
 
-most likely you will need to do this with root privileges (e.g. put sudo
+Most likely you will need to do this with root privileges (e.g. put sudo
 in front of the command).
 
 
@@ -79,27 +83,28 @@ The extra ubuntu packages needed are:
     * python-scipy
     * python-matplotlib
     * python-dev
-
-Only Fabio has to be downloaded separatly and installed
-    * python-fabio (from http://sourceforge.net/projects/fable/files/fabio/)
+    * python-fabio
 
 using apt-get these can be installed as:
 
-sudo apt-get install python-numpy python-scipy python-matplotlib  python-dev
-wget http://sourceforge.net/projects/fable/files/fabio/0.0.7/squeeze/python-fabio_0.0.7-1_amd64.deb/download
-sudo dpkg -i python-fabio_0.0.7-1_amd64.deb
+sudo apt-get install python-numpy python-scipy python-matplotlib  python-dev python-fabio
 
 
 Contributors
 ============
- * Jérôme Kieffer
- * Dimitris Karkoulis
- * Jon Wright
- * Frédéric-Emmanuel Picca
-
+ * Jérôme Kieffer (ESRF)
+ * Dimitris Karkoulis (ESRF)
+ * Jon Wright (ESF)
+ * Frédéric-Emmanuel Picca (Soleil)
+ * Amund Hov (ESRF)
+ * Dodogerstlin @github
+ * Gunthard Benecke (Desy)
+ * Gero Flucke (Desy)
+ 
 Indirect contributors (ideas, ...):
 -----------------------------------
  * Peter Boesecke
  * Manuel Sánchez del Río
  * Vicente Armando Solé
-
+ * Brian Pauw
+ * Veijo Honkimaki 
diff --git a/benchmark/benchmark.py b/benchmark/benchmark.py
index 27d8a9b..87710f6 100755
--- a/benchmark/benchmark.py
+++ b/benchmark/benchmark.py
@@ -154,7 +154,7 @@ out=ai.xrpd_LUT(data,N)""" % (param, fn)
         self.new_curve(results, label)
         gc.collect()
 
-    def bench_cpu1d_ocl_lut(self, devicetype="ALL", platformid=None, deviceid=None):
+    def bench_cpu1d_lut_ocl(self, devicetype="ALL", platformid=None, deviceid=None):
         if (ocl is None):
             print("No pyopencl")
             return
@@ -466,6 +466,9 @@ if __name__ == "__main__":
     parser.add_option("-g", "--gpu",
                       action="store_true", dest="opencl_gpu", default=False,
                       help="perform benchmark using OpenCL on the GPU")
+    parser.add_option("-a", "--acc",
+                      action="store_true", dest="opencl_acc", default=False,
+                      help="perform benchmark using OpenCL on the Accelerator (like XeonPhi/MIC")
     parser.add_option("-s", "--small",
                       action="store_true", dest="small", default=False,
                       help="Limit the size of the dataset to 6 Mpixel images (adviced for python 2.6 where there is a memory-leak)" )
@@ -483,9 +486,12 @@ if __name__ == "__main__":
     b.bench_cpu1d()
     b.bench_cpu1d_lut()
     if options.opencl_cpu:
-        b.bench_cpu1d_ocl_lut("CPU")
+        b.bench_cpu1d_lut_ocl("CPU")
     if options.opencl_gpu:
-        b.bench_cpu1d_ocl_lut("GPU")
+        b.bench_cpu1d_lut_ocl("GPU")
+    if options.opencl_acc:
+        b.bench_cpu1d_lut_ocl("ACC")
+
 #    b.bench_cpu1d_ocl_lut("CPU")
 #    b.bench_gpu1d("gpu", True)
 #    b.bench_gpu1d("gpu", False)
@@ -497,6 +503,8 @@ if __name__ == "__main__":
         b.bench_cpu2d_lut_ocl("CPU")
     if options.opencl_gpu:
         b.bench_cpu2d_lut_ocl("GPU")
+    if options.opencl_acc:
+        b.bench_cpu2d_lut_ocl("ACC")
 
 #    b.bench_cpu2d_lut()
 #    b.bench_cpu2d_lut_ocl()
diff --git a/calibration/AgBh.D b/calibration/AgBh.D
new file mode 100644
index 0000000..28f5abe
--- /dev/null
+++ b/calibration/AgBh.D
@@ -0,0 +1,10 @@
+5.838000000000000256e+01
+2.919000000000000128e+01
+1.946000000000000085e+01
+1.459500000000000064e+01
+1.167600000000000016e+01
+9.730000000000000426e+00
+8.339999999999999858e+00
+7.297500000000000320e+00
+6.486666666666667247e+00
+5.838000000000000078e+00
diff --git a/calibration/Au.D b/calibration/Au.D
new file mode 100644
index 0000000..bfbdc40
--- /dev/null
+++ b/calibration/Au.D
@@ -0,0 +1,7 @@
+# Gold from American mineralogy database. CFC 
+#CELL PARAMETERS:   4.0782  4.0782  4.0782   90.000   90.000   90.000
+    2.3546  
+    2.0391  
+    1.4419  
+    1.2296  
+    1.1773  
diff --git a/calibration/C14H30O.D b/calibration/C14H30O.D
new file mode 100644
index 0000000..e2c505f
--- /dev/null
+++ b/calibration/C14H30O.D
@@ -0,0 +1,13 @@
+39.62137612
+19.69088301
+13.19213037
+9.911401875
+7.938421369
+6.619651252
+5.151512942
+3.986828585
+3.686212563
+2.969631573
+2.538129421
+2.336337449
+2.106523478
diff --git a/calibration/CeO2.D b/calibration/CeO2.D
new file mode 100644
index 0000000..18f296b
--- /dev/null
+++ b/calibration/CeO2.D
@@ -0,0 +1,40 @@
+3.12404
+2.7055
+1.91308
+1.63148
+1.56202
+1.35275
+1.24137
+1.20994
+1.10452
+1.04135
+0.956539
+0.914626
+0.901833
+0.855554
+0.82517
+0.815739
+0.781011
+0.757692
+0.750371
+0.723075
+0.704452
+0.676375
+0.661059
+0.65618
+0.637692
+0.624808
+0.620684
+0.604968
+0.593934
+0.590389
+0.576815
+0.567227
+0.552258
+0.543826
+0.5411
+0.530592
+0.523101
+0.520674
+0.504578
+0.502399
diff --git a/calibration/Cr2O3.D b/calibration/Cr2O3.D
new file mode 100644
index 0000000..3ac6a36
--- /dev/null
+++ b/calibration/Cr2O3.D
@@ -0,0 +1,21 @@
+3.6364  
+2.6676  
+2.4848  
+2.2662  
+2.1788  
+2.0516  
+1.8182  
+1.6744  
+1.5820  
+1.5808  
+1.4673  
+1.4346  
+1.2965  
+1.2909  
+1.2424  
+1.2121  
+1.2121  
+1.1757  
+1.1495  
+1.1331  
+1.1262  
diff --git a/calibration/CrOx.D b/calibration/CrOx.D
new file mode 100644
index 0000000..5a09814
--- /dev/null
+++ b/calibration/CrOx.D
@@ -0,0 +1,8 @@
+3.645
+2.672
+2.487
+2.181
+1.819
+1.676
+1.467
+1.433
diff --git a/calibration/LaB6.D b/calibration/LaB6.D
new file mode 100644
index 0000000..4e0ebae
--- /dev/null
+++ b/calibration/LaB6.D
@@ -0,0 +1,61 @@
+4.156950000000000145e+00
+2.939407534053418480e+00
+2.400016201507815250e+00
+2.078475000000000072e+00
+1.859044555813550215e+00
+1.697067731043755634e+00
+1.469703767026709240e+00
+1.385650000000000048e+00
+1.314543011943694495e+00
+1.253367583842534660e+00
+1.200008100753907625e+00
+1.152930490349233228e+00
+1.110991619567852640e+00
+1.039237500000000036e+00
+1.008208466494784350e+00
+9.798025113511397155e-01
+9.536697349132317036e-01
+9.295222779067751073e-01
+9.071208588165086129e-01
+8.862647178544548199e-01
+8.485338655218778170e-01
+8.313900000000000734e-01
+8.152449679626742052e-01
+8.000054005026049353e-01
+7.719262360350958030e-01
+7.589517618070334981e-01
+7.348518835133546201e-01
+7.236321119250381795e-01
+7.129110435081521535e-01
+7.026527958387414063e-01
+6.928250000000000242e-01
+6.833983702790050740e-01
+6.743463365695233636e-01
+6.572715059718472475e-01
+6.492065194828410268e-01
+6.414313106249179830e-01
+6.339289319441210324e-01
+6.266837919212673302e-01
+6.196815186045167012e-01
+6.129088396380996118e-01
+6.000040503769538125e-01
+5.938499999999999890e-01
+5.878815068106837405e-01
+5.820894295300235166e-01
+5.764652451746166140e-01
+5.710009963065029170e-01
+5.656892436812518410e-01
+5.554958097839263198e-01
+5.506014781701533689e-01
+5.458342760762237011e-01
+5.411887935017357654e-01
+5.322429080370519872e-01
+5.279331779334419661e-01
+5.237264720252357009e-01
+5.196187500000000181e-01
+5.156061899506101387e-01
+5.116851734265371876e-01
+5.078522717169430267e-01
+5.041042332473921750e-01
+5.004379719848882635e-01
+4.968505567572607529e-01
diff --git a/calibration/Si.D b/calibration/Si.D
new file mode 100644
index 0000000..317faed
--- /dev/null
+++ b/calibration/Si.D
@@ -0,0 +1,11 @@
+    3.1354  
+    1.9200  
+    1.6374  
+    1.3577  
+    1.2459  
+    1.1085  
+    1.0452
+    0.9600
+    0.9180
+    0.8587
+    0.8282
diff --git a/calibration/alpha_Al2O3.D b/calibration/alpha_Al2O3.D
new file mode 100644
index 0000000..dc977ff
--- /dev/null
+++ b/calibration/alpha_Al2O3.D
@@ -0,0 +1,30 @@
+3.479
+2.55
+2.378
+2.165 #Weak
+2.084
+1.963 #Weak 
+1.739
+1.601
+1.546
+1.514
+1.511
+1.404
+1.373
+1.335
+1.275
+1.239
+1.234
+1.193
+1.189
+1.160
+1.147
+1.138
+1.125
+1.124
+1.099
+1.082
+1.078
+1.046
+1.042
+1.017
diff --git a/doc/pyFAI.pdf b/doc/pyFAI.pdf
index 7126bec..6f6b3e6 100644
Binary files a/doc/pyFAI.pdf and b/doc/pyFAI.pdf differ
diff --git a/doc/source/conf.py b/doc/source/conf.py
index c73ec6b..0f12069 100644
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -61,7 +61,7 @@ copyright = u'2012, Jerome Kieffer'
 # The short X.Y version.
 version = '0.9'
 # The full version, including alpha/beta/rc tags.
-release = '0.9.0'
+release = '0.9.2'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
diff --git a/doc/source/man/diff_tomo.rst b/doc/source/man/diff_tomo.rst
index 1fe7838..5a5d6d3 100644
--- a/doc/source/man/diff_tomo.rst
+++ b/doc/source/man/diff_tomo.rst
@@ -22,7 +22,7 @@ tips: If the number of files is too large, use double quotes "*.edf"
 Usage:
 ------
 
-diff_tomo [options] files
+diff_tomo [options] -p ponifile imagefiles*
 
 Options:
 --------
diff --git a/doc/source/man/pyFAI-average.rst b/doc/source/man/pyFAI-average.rst
index c08dbf2..4ac9aa4 100644
--- a/doc/source/man/pyFAI-average.rst
+++ b/doc/source/man/pyFAI-average.rst
@@ -29,3 +29,5 @@ Options:
                         Take the mean of the average +/- cutoff * std_dev.
   -f FORMAT, --format=FORMAT
                         Output file/image format (by default EDF)
+  -v, --verbose         switch to verbose/debug mode
+                        
\ No newline at end of file
diff --git a/doc/source/man/scripts.rst b/doc/source/man/scripts.rst
index 30d0911..0413b45 100644
--- a/doc/source/man/scripts.rst
+++ b/doc/source/man/scripts.rst
@@ -1,8 +1,8 @@
 pyFAI scripts manual
 ====================
 
-While pyFAI is first and foremost a python library to be used by developers, a set of scripts is provided to process
-a full diffraction experiment on the command line without knowing anythong about Python:
+While pyFAI is first and foremost a Python library to be used by developers, a set of scripts is provided to process
+a full diffraction experiment on the command line without knowing anything about Python:
 
  * pyFAI-average to merge a set of files like dark-current files or diffracton images using various filters
  * drawMask_pymca to mask out some region of the detector
diff --git a/doc/source/project.rst b/doc/source/project.rst
index 0d711d8..74fed0e 100644
--- a/doc/source/project.rst
+++ b/doc/source/project.rst
@@ -5,17 +5,17 @@ Project structure
 =================
 
 PyFAI is an open source project licensed under the GPL mainly written in Python (v2.6 or 2.7) and heavily relying on the
-python scientific ecosystem: numpy, scipy and matplotlib. It provides high perfromances image treatement thanks to cython and
+python scientific ecosystem: numpy, scipy and matplotlib. It provides high performances image treatment thanks to cython and
 OpenCL... but only a C-compiler is needed to build that.
 
 Programming language
 --------------------
 
-PyFAI is a python project but uses many programming languages:
+PyFAI is a Python project but uses many programming languages:
 
-* 8000 lines of Python (without the tests)
+* 10200 lines of Python (without the tests)
 * 3500 lines of cython which are converted into
-* 139055 lines of C
+* 252000 lines of C
 * 880 lines of OpenCL kernels
 
 Repository:
@@ -58,50 +58,56 @@ As most of the python projects:
 Test suites
 -----------
 
-To run the test an internet connection is needed as 200MB of test images will be downloaded
+To run the test an internet connection is needed as 200MB of test images will be downloaded. 
 ..
 
     python setup.py build test
 
+Setting the environment variable http_proxy can be necessary (depending on your network):
 
-PyFAI comes with 15 test-suites (98 tests in total) representing a coverage of 65%.
+.. 
+ 
+   export http_proxy=http://proxy.site.org/3128
+   
+PyFAI comes with 19 test-suites (109 tests in total) representing a coverage of 65%.
 This ensures both non regression over time and ease the distribution under different platforms:
 pyFAI runs under linux, MacOSX and Windows (in each case in 32 and 64 bits)
 
 .. csv-table:: Supported formats
-   :header: "Name", "Stmts", "Miss", "Cover"
+   :header: "Name", "Stmts", "Exec", "Cover"
    :widths: 50, 8, 8, 8
 
-   "pyFAI/__init__",                 "9",     "3", "67%"
-   "pyFAI/azimuthalIntegrator",   "1097",   "329", "70%"
-   "pyFAI/detectors",              "271",   "105", "61%"
-   "pyFAI/geometry",               "672",   "166", "75%"
-   "pyFAI/geometryRefinement",     "353",   "198", "44%"
-   "pyFAI/ocl_azim",               "304",    "90", "70%"
-   "pyFAI/ocl_azim_lut",           "196",    "29", "85%"
-   "pyFAI/opencl",                 "134",    "42", "69%"
-   "pyFAI/peakPicker",             "609",   "388", "36%"
-   "pyFAI/spline",                 "324",   "217", "33%"
-   "pyFAI/units",                   "36",     "2", "94%"
-   "pyFAI/utils",                  "494",   "196", "60%"
-   "testAzimuthalIntegrator",      "189",    "75", "60%"
-   "testBilinear",                  "40",     "4", "90%"
-   "testDistortion",                "47",     "3", "94%"
-   "testExport",                    "69",     "7", "90%"
-   "testFlat",                      "88",     "9", "90%"
-   "testGeometry",                  "50",     "4", "92%"
-   "testGeometryRefinement",        "53",     "3", "94%"
-   "testHistogram",                "153",    "14", "91%"
-   "testIntegrate",                "136",    "10", "93%"
-   "testMask",                      "85",    "21", "75%"
-   "testOpenCL",                    "89",     "9", "90%"
-   "testPeakPicking",               "70",     "6", "91%"
-   "testPolarization",              "54",    "21", "61%"
-   "testSaxs",                     "102",    "29", "72%"
-   "testUtils",                     "80",     "4", "95%"
-   "test_all",                      "47",     "1", "98%"
-   "utilstest",                    "139",    "88", "37%"
-   "TOTAL",                        "5990",  "2073",   "65%"
+   "pyFAI/__init__            ",    "10",   "7",    "70%" 
+   "pyFAI/azimuthalIntegrator ",    "934",   "687",    "73%"
+   "pyFAI/detectors           ",    "441",   "289",    "65%"
+   "pyFAI/geometry            ",    "718",   "529",    "73%"
+   "pyFAI/geometryRefinement  ",    "361",   "162",    "44%"
+   "pyFAI/ocl_azim            ",    "306",   "215",    "70%"
+   "pyFAI/ocl_azim_lut        ",    "197",   "166",    "84%"
+   "pyFAI/opencl              ",    "140",   "102",    "72%"
+   "pyFAI/peakPicker          ",    "615",   "221",    "35%"
+   "pyFAI/spline              ",    "327",   "108",    "33%"
+   "pyFAI/units               ",    "40",   "35",    "87%"
+   "pyFAI/utils               ",    "596",   "363",    "60%"
+   "testAzimuthalIntegrator   ",    "233",   "156",    "66%"
+   "testBilinear              ",    "39",   "35",    "89%"
+   "testDetector              ",    "35",   "32",    "91%"
+   "testDistortion            ",    "52",   "46",    "88%"
+   "testExport                ",    "68",   "61",    "89%"
+   "testFlat                  ",    "89",   "85",    "95%"
+   "testGeometry              ",    "86",   "82",    "95%"
+   "testGeometryRefinement    ",    "53",   "50",    "94%"
+   "testHistogram             ",    "152",   "138",    "90%"
+   "testIntegrate             ",    "135",   "125",    "92%"
+   "testMask                  ",    "133",   "106",    "79%"
+   "testOpenCL                ",    "96",   "83",    "86%"
+   "testPeakPicking           ",    "83",   "75",    "90%"
+   "testPolarization          ",    "53",   "32",    "60%"
+   "testSaxs                  ",    "101",   "72",    "71%"
+   "testUtils                 ",    "83",   "76",    "91%"
+   "test_all                  ",    "48",   "47",    "97%"
+   "utilstest                 ",    "168",   "84",    "50%"
+   "TOTAL                     ",   "6392",   "4269",    "66%"
 
 
 
@@ -112,13 +118,15 @@ http://www.edna-site.org/pub/debian/binary/
 List of contributors
 --------------------
 
-As of 04/2013 (number of commits in parenthesis):
-
-* Jérôme Kieffer (656)
-* Dimitris Karkoulis (22)
-* Frédéric-Emmanuel Picca (21)
-* Jonathan Wright (6)
-* Amund Hov (1)
+As of 01/2014:
+ * Jérôme Kieffer (ESRF)
+ * Dimitris Karkoulis (ESRF)
+ * Jon Wright (ESF)
+ * Frédéric-Emmanuel Picca (Soleil)
+ * Amund Hov (ESRF)
+ * Dodogerstlin @github
+ * Gunthard Benecke (Desy)
+ * Gero Flucke (Desy)
 
 List of other contributors (ideas or code)
 ------------------------------------------
@@ -134,4 +142,5 @@ List of supporters
 * LinkSCEEM project: initial porting to OpenCL
 * ESRF ID11: Provided manpower in 2012 and 2013 and beamtime
 * ESRF ID13: Provided manpower in 2012 and 2013 and beamtime
-* ESRF ID29: will provide manpower in  2013
+* ESRF ID29: provided manpower in 2013 (MX-calibrate)
+* ESRF ID02: 2014
diff --git a/doc/source/pyFAI.rst b/doc/source/pyFAI.rst
index d6ef30c..3f11371 100644
--- a/doc/source/pyFAI.rst
+++ b/doc/source/pyFAI.rst
@@ -69,14 +69,18 @@ PyFAI executables
 PyFAI was designed to be used by scientists needing a simple and
 effective tool for azimuthal integration. Two command line programs
 *pyFAI-waxs* and *pyFAI-saxs* are provided with pyFAI for performing the
-integration of one or more images. The waxs version outputs result in
+integration of one or more images on the command line. 
+The waxs version outputs result in
 :math:`2\theta /I`, whereas the saxs version outputs result in
-:math:`q/I(/\sigma)`. Options for these programs are parameter file (*poni-file*)
+:math:`q/I(/\sigma)`. Options for these programs are parameter file 
+(*poni-file*)
 describing the geometry and the mask file. They can also do some
 pre-processing like dark-noise subtraction and flat-field correction
 (solid-angle correction is done by default).
 
-A new Grqaphical interface based on Qt is under development
+A new Graphical interface based on Qt is under development:  *pyFAI-integrate*
+offers all options possible for azimuthal integration (dark/flat/polarization, 
+....) in addition to a finer tuning for the computing device selection (CPU/GPU).
 
 Python library
 ..............
@@ -253,4 +257,4 @@ References:
   
 - [FFTw] Frigo M and Johnson S G 
   2005 Proceedings of the IEEE 93 p 216–231
-  
\ No newline at end of file
+  
diff --git a/gui/integration.ui b/gui/integration.ui
index 5fe55bf..22e06ba 100644
--- a/gui/integration.ui
+++ b/gui/integration.ui
@@ -583,10 +583,10 @@
           <item>
            <layout class="QVBoxLayout" name="verticalLayout_9">
             <item>
-             <widget class="QLineEdit" name="rad_pt"/>
+             <widget class="QLineEdit" name="nbpt_rad"/>
             </item>
             <item>
-             <widget class="QLineEdit" name="azim_pt"/>
+             <widget class="QLineEdit" name="nbpt_azim"/>
             </item>
            </layout>
           </item>
diff --git a/pyFAI-src/__init__.py b/pyFAI-src/__init__.py
index 7b14cf8..db77a78 100644
--- a/pyFAI-src/__init__.py
+++ b/pyFAI-src/__init__.py
@@ -1,5 +1,5 @@
-
-version = "0.9.0"
+version = "0.9.2"
+date = "2014-01"
 import sys, logging
 logging.basicConfig()
 
diff --git a/pyFAI-src/argparse.py b/pyFAI-src/argparse.py
new file mode 100644
index 0000000..717b660
--- /dev/null
+++ b/pyFAI-src/argparse.py
@@ -0,0 +1,2353 @@
+# -*- coding: utf-8 -*-
+
+# Copyright © 2006-2009 Steven J. Bethard <steven.bethard at gmail.com>.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy
+# of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+"""Command-line parsing library
+
+This module is an optparse-inspired command-line parsing library that:
+
+    - handles both optional and positional arguments
+    - produces highly informative usage messages
+    - supports parsers that dispatch to sub-parsers
+
+The following is a simple usage example that sums integers from the
+command-line and writes the result to a file::
+
+    parser = argparse.ArgumentParser(
+        description='sum the integers at the command line')
+    parser.add_argument(
+        'integers', metavar='int', nargs='+', type=int,
+        help='an integer to be summed')
+    parser.add_argument(
+        '--log', default=sys.stdout, type=argparse.FileType('w'),
+        help='the file where the sum should be written')
+    args = parser.parse_args()
+    args.log.write('%s' % sum(args.integers))
+    args.log.close()
+
+The module contains the following public classes:
+
+    - ArgumentParser -- The main entry point for command-line parsing. As the
+        example above shows, the add_argument() method is used to populate
+        the parser with actions for optional and positional arguments. Then
+        the parse_args() method is invoked to convert the args at the
+        command-line into an object with attributes.
+
+    - ArgumentError -- The exception raised by ArgumentParser objects when
+        there are errors with the parser's actions. Errors raised while
+        parsing the command-line are caught by ArgumentParser and emitted
+        as command-line messages.
+
+    - FileType -- A factory for defining types of files to be created. As the
+        example above shows, instances of FileType are typically passed as
+        the type= argument of add_argument() calls.
+
+    - Action -- The base class for parser actions. Typically actions are
+        selected by passing strings like 'store_true' or 'append_const' to
+        the action= argument of add_argument(). However, for greater
+        customization of ArgumentParser actions, subclasses of Action may
+        be defined and passed as the action= argument.
+
+    - HelpFormatter, RawDescriptionHelpFormatter, RawTextHelpFormatter,
+        ArgumentDefaultsHelpFormatter -- Formatter classes which
+        may be passed as the formatter_class= argument to the
+        ArgumentParser constructor. HelpFormatter is the default,
+        RawDescriptionHelpFormatter and RawTextHelpFormatter tell the parser
+        not to change the formatting for help text, and
+        ArgumentDefaultsHelpFormatter adds information about argument defaults
+        to the help.
+
+All other classes in this module are considered implementation details.
+(Also note that HelpFormatter and RawDescriptionHelpFormatter are only
+considered public as object names -- the API of the formatter objects is
+still considered an implementation detail.)
+"""
+
+__version__ = '1.1'
+__all__ = [
+    'ArgumentParser',
+    'ArgumentError',
+    'Namespace',
+    'Action',
+    'FileType',
+    'HelpFormatter',
+    'RawDescriptionHelpFormatter',
+    'RawTextHelpFormatter',
+    'ArgumentDefaultsHelpFormatter',
+]
+
+
+import copy as _copy
+import os as _os
+import re as _re
+import sys as _sys
+import textwrap as _textwrap
+
+from gettext import gettext as _
+
+try:
+    _set = set
+except NameError:
+    from sets import Set as _set
+
+try:
+    _basestring = basestring
+except NameError:
+    _basestring = str
+
+try:
+    _sorted = sorted
+except NameError:
+
+    def _sorted(iterable, reverse=False):
+        result = list(iterable)
+        result.sort()
+        if reverse:
+            result.reverse()
+        return result
+
+
+def _callable(obj):
+    return hasattr(obj, '__call__') or hasattr(obj, '__bases__')
+
+# silence Python 2.6 buggy warnings about Exception.message
+if _sys.version_info[:2] == (2, 6):
+    import warnings
+    warnings.filterwarnings(
+        action='ignore',
+        message='BaseException.message has been deprecated as of Python 2.6',
+        category=DeprecationWarning,
+        module='argparse')
+
+
+SUPPRESS = '==SUPPRESS=='
+
+OPTIONAL = '?'
+ZERO_OR_MORE = '*'
+ONE_OR_MORE = '+'
+PARSER = 'A...'
+REMAINDER = '...'
+
+# =============================
+# Utility functions and classes
+# =============================
+
+class _AttributeHolder(object):
+    """Abstract base class that provides __repr__.
+
+    The __repr__ method returns a string in the format::
+        ClassName(attr=name, attr=name, ...)
+    The attributes are determined either by a class-level attribute,
+    '_kwarg_names', or by inspecting the instance __dict__.
+    """
+
+    def __repr__(self):
+        type_name = type(self).__name__
+        arg_strings = []
+        for arg in self._get_args():
+            arg_strings.append(repr(arg))
+        for name, value in self._get_kwargs():
+            arg_strings.append('%s=%r' % (name, value))
+        return '%s(%s)' % (type_name, ', '.join(arg_strings))
+
+    def _get_kwargs(self):
+        return _sorted(self.__dict__.items())
+
+    def _get_args(self):
+        return []
+
+
+def _ensure_value(namespace, name, value):
+    if getattr(namespace, name, None) is None:
+        setattr(namespace, name, value)
+    return getattr(namespace, name)
+
+
+# ===============
+# Formatting Help
+# ===============
+
+class HelpFormatter(object):
+    """Formatter for generating usage messages and argument help strings.
+
+    Only the name of this class is considered a public API. All the methods
+    provided by the class are considered an implementation detail.
+    """
+
+    def __init__(self,
+                 prog,
+                 indent_increment=2,
+                 max_help_position=24,
+                 width=None):
+
+        # default setting for width
+        if width is None:
+            try:
+                width = int(_os.environ['COLUMNS'])
+            except (KeyError, ValueError):
+                width = 80
+            width -= 2
+
+        self._prog = prog
+        self._indent_increment = indent_increment
+        self._max_help_position = max_help_position
+        self._width = width
+
+        self._current_indent = 0
+        self._level = 0
+        self._action_max_length = 0
+
+        self._root_section = self._Section(self, None)
+        self._current_section = self._root_section
+
+        self._whitespace_matcher = _re.compile(r'\s+')
+        self._long_break_matcher = _re.compile(r'\n\n\n+')
+
+    # ===============================
+    # Section and indentation methods
+    # ===============================
+    def _indent(self):
+        self._current_indent += self._indent_increment
+        self._level += 1
+
+    def _dedent(self):
+        self._current_indent -= self._indent_increment
+        assert self._current_indent >= 0, 'Indent decreased below 0.'
+        self._level -= 1
+
+    class _Section(object):
+
+        def __init__(self, formatter, parent, heading=None):
+            self.formatter = formatter
+            self.parent = parent
+            self.heading = heading
+            self.items = []
+
+        def format_help(self):
+            # format the indented section
+            if self.parent is not None:
+                self.formatter._indent()
+            join = self.formatter._join_parts
+            for func, args in self.items:
+                func(*args)
+            item_help = join([func(*args) for func, args in self.items])
+            if self.parent is not None:
+                self.formatter._dedent()
+
+            # return nothing if the section was empty
+            if not item_help:
+                return ''
+
+            # add the heading if the section was non-empty
+            if self.heading is not SUPPRESS and self.heading is not None:
+                current_indent = self.formatter._current_indent
+                heading = '%*s%s:\n' % (current_indent, '', self.heading)
+            else:
+                heading = ''
+
+            # join the section-initial newline, the heading and the help
+            return join(['\n', heading, item_help, '\n'])
+
+    def _add_item(self, func, args):
+        self._current_section.items.append((func, args))
+
+    # ========================
+    # Message building methods
+    # ========================
+    def start_section(self, heading):
+        self._indent()
+        section = self._Section(self, self._current_section, heading)
+        self._add_item(section.format_help, [])
+        self._current_section = section
+
+    def end_section(self):
+        self._current_section = self._current_section.parent
+        self._dedent()
+
+    def add_text(self, text):
+        if text is not SUPPRESS and text is not None:
+            self._add_item(self._format_text, [text])
+
+    def add_usage(self, usage, actions, groups, prefix=None):
+        if usage is not SUPPRESS:
+            args = usage, actions, groups, prefix
+            self._add_item(self._format_usage, args)
+
+    def add_argument(self, action):
+        if action.help is not SUPPRESS:
+
+            # find all invocations
+            get_invocation = self._format_action_invocation
+            invocations = [get_invocation(action)]
+            for subaction in self._iter_indented_subactions(action):
+                invocations.append(get_invocation(subaction))
+
+            # update the maximum item length
+            invocation_length = max([len(s) for s in invocations])
+            action_length = invocation_length + self._current_indent
+            self._action_max_length = max(self._action_max_length,
+                                          action_length)
+
+            # add the item to the list
+            self._add_item(self._format_action, [action])
+
+    def add_arguments(self, actions):
+        for action in actions:
+            self.add_argument(action)
+
+    # =======================
+    # Help-formatting methods
+    # =======================
+    def format_help(self):
+        help = self._root_section.format_help()
+        if help:
+            help = self._long_break_matcher.sub('\n\n', help)
+            help = help.strip('\n') + '\n'
+        return help
+
+    def _join_parts(self, part_strings):
+        return ''.join([part
+                        for part in part_strings
+                        if part and part is not SUPPRESS])
+
+    def _format_usage(self, usage, actions, groups, prefix):
+        if prefix is None:
+            prefix = _('usage: ')
+
+        # if usage is specified, use that
+        if usage is not None:
+            usage = usage % dict(prog=self._prog)
+
+        # if no optionals or positionals are available, usage is just prog
+        elif usage is None and not actions:
+            usage = '%(prog)s' % dict(prog=self._prog)
+
+        # if optionals and positionals are available, calculate usage
+        elif usage is None:
+            prog = '%(prog)s' % dict(prog=self._prog)
+
+            # split optionals from positionals
+            optionals = []
+            positionals = []
+            for action in actions:
+                if action.option_strings:
+                    optionals.append(action)
+                else:
+                    positionals.append(action)
+
+            # build full usage string
+            format = self._format_actions_usage
+            action_usage = format(optionals + positionals, groups)
+            usage = ' '.join([s for s in [prog, action_usage] if s])
+
+            # wrap the usage parts if it's too long
+            text_width = self._width - self._current_indent
+            if len(prefix) + len(usage) > text_width:
+
+                # break usage into wrappable parts
+                part_regexp = r'\(.*?\)+|\[.*?\]+|\S+'
+                opt_usage = format(optionals, groups)
+                pos_usage = format(positionals, groups)
+                opt_parts = _re.findall(part_regexp, opt_usage)
+                pos_parts = _re.findall(part_regexp, pos_usage)
+                assert ' '.join(opt_parts) == opt_usage
+                assert ' '.join(pos_parts) == pos_usage
+
+                # helper for wrapping lines
+                def get_lines(parts, indent, prefix=None):
+                    lines = []
+                    line = []
+                    if prefix is not None:
+                        line_len = len(prefix) - 1
+                    else:
+                        line_len = len(indent) - 1
+                    for part in parts:
+                        if line_len + 1 + len(part) > text_width:
+                            lines.append(indent + ' '.join(line))
+                            line = []
+                            line_len = len(indent) - 1
+                        line.append(part)
+                        line_len += len(part) + 1
+                    if line:
+                        lines.append(indent + ' '.join(line))
+                    if prefix is not None:
+                        lines[0] = lines[0][len(indent):]
+                    return lines
+
+                # if prog is short, follow it with optionals or positionals
+                if len(prefix) + len(prog) <= 0.75 * text_width:
+                    indent = ' ' * (len(prefix) + len(prog) + 1)
+                    if opt_parts:
+                        lines = get_lines([prog] + opt_parts, indent, prefix)
+                        lines.extend(get_lines(pos_parts, indent))
+                    elif pos_parts:
+                        lines = get_lines([prog] + pos_parts, indent, prefix)
+                    else:
+                        lines = [prog]
+
+                # if prog is long, put it on its own line
+                else:
+                    indent = ' ' * len(prefix)
+                    parts = opt_parts + pos_parts
+                    lines = get_lines(parts, indent)
+                    if len(lines) > 1:
+                        lines = []
+                        lines.extend(get_lines(opt_parts, indent))
+                        lines.extend(get_lines(pos_parts, indent))
+                    lines = [prog] + lines
+
+                # join lines into usage
+                usage = '\n'.join(lines)
+
+        # prefix with 'usage:'
+        return '%s%s\n\n' % (prefix, usage)
+
+    def _format_actions_usage(self, actions, groups):
+        # find group indices and identify actions in groups
+        group_actions = _set()
+        inserts = {}
+        for group in groups:
+            try:
+                start = actions.index(group._group_actions[0])
+            except ValueError:
+                continue
+            else:
+                end = start + len(group._group_actions)
+                if actions[start:end] == group._group_actions:
+                    for action in group._group_actions:
+                        group_actions.add(action)
+                    if not group.required:
+                        inserts[start] = '['
+                        inserts[end] = ']'
+                    else:
+                        inserts[start] = '('
+                        inserts[end] = ')'
+                    for i in range(start + 1, end):
+                        inserts[i] = '|'
+
+        # collect all actions format strings
+        parts = []
+        for i, action in enumerate(actions):
+
+            # suppressed arguments are marked with None
+            # remove | separators for suppressed arguments
+            if action.help is SUPPRESS:
+                parts.append(None)
+                if inserts.get(i) == '|':
+                    inserts.pop(i)
+                elif inserts.get(i + 1) == '|':
+                    inserts.pop(i + 1)
+
+            # produce all arg strings
+            elif not action.option_strings:
+                part = self._format_args(action, action.dest)
+
+                # if it's in a group, strip the outer []
+                if action in group_actions:
+                    if part[0] == '[' and part[-1] == ']':
+                        part = part[1:-1]
+
+                # add the action string to the list
+                parts.append(part)
+
+            # produce the first way to invoke the option in brackets
+            else:
+                option_string = action.option_strings[0]
+
+                # if the Optional doesn't take a value, format is:
+                #    -s or --long
+                if action.nargs == 0:
+                    part = '%s' % option_string
+
+                # if the Optional takes a value, format is:
+                #    -s ARGS or --long ARGS
+                else:
+                    default = action.dest.upper()
+                    args_string = self._format_args(action, default)
+                    part = '%s %s' % (option_string, args_string)
+
+                # make it look optional if it's not required or in a group
+                if not action.required and action not in group_actions:
+                    part = '[%s]' % part
+
+                # add the action string to the list
+                parts.append(part)
+
+        # insert things at the necessary indices
+        for i in _sorted(inserts, reverse=True):
+            parts[i:i] = [inserts[i]]
+
+        # join all the action items with spaces
+        text = ' '.join([item for item in parts if item is not None])
+
+        # clean up separators for mutually exclusive groups
+        open = r'[\[(]'
+        close = r'[\])]'
+        text = _re.sub(r'(%s) ' % open, r'\1', text)
+        text = _re.sub(r' (%s)' % close, r'\1', text)
+        text = _re.sub(r'%s *%s' % (open, close), r'', text)
+        text = _re.sub(r'\(([^|]*)\)', r'\1', text)
+        text = text.strip()
+
+        # return the text
+        return text
+
+    def _format_text(self, text):
+        if '%(prog)' in text:
+            text = text % dict(prog=self._prog)
+        text_width = self._width - self._current_indent
+        indent = ' ' * self._current_indent
+        return self._fill_text(text, text_width, indent) + '\n\n'
+
+    def _format_action(self, action):
+        # determine the required width and the entry label
+        help_position = min(self._action_max_length + 2,
+                            self._max_help_position)
+        help_width = self._width - help_position
+        action_width = help_position - self._current_indent - 2
+        action_header = self._format_action_invocation(action)
+
+        # ho nelp; start on same line and add a final newline
+        if not action.help:
+            tup = self._current_indent, '', action_header
+            action_header = '%*s%s\n' % tup
+
+        # short action name; start on the same line and pad two spaces
+        elif len(action_header) <= action_width:
+            tup = self._current_indent, '', action_width, action_header
+            action_header = '%*s%-*s  ' % tup
+            indent_first = 0
+
+        # long action name; start on the next line
+        else:
+            tup = self._current_indent, '', action_header
+            action_header = '%*s%s\n' % tup
+            indent_first = help_position
+
+        # collect the pieces of the action help
+        parts = [action_header]
+
+        # if there was help for the action, add lines of help text
+        if action.help:
+            help_text = self._expand_help(action)
+            help_lines = self._split_lines(help_text, help_width)
+            parts.append('%*s%s\n' % (indent_first, '', help_lines[0]))
+            for line in help_lines[1:]:
+                parts.append('%*s%s\n' % (help_position, '', line))
+
+        # or add a newline if the description doesn't end with one
+        elif not action_header.endswith('\n'):
+            parts.append('\n')
+
+        # if there are any sub-actions, add their help as well
+        for subaction in self._iter_indented_subactions(action):
+            parts.append(self._format_action(subaction))
+
+        # return a single string
+        return self._join_parts(parts)
+
+    def _format_action_invocation(self, action):
+        if not action.option_strings:
+            metavar, = self._metavar_formatter(action, action.dest)(1)
+            return metavar
+
+        else:
+            parts = []
+
+            # if the Optional doesn't take a value, format is:
+            #    -s, --long
+            if action.nargs == 0:
+                parts.extend(action.option_strings)
+
+            # if the Optional takes a value, format is:
+            #    -s ARGS, --long ARGS
+            else:
+                default = action.dest.upper()
+                args_string = self._format_args(action, default)
+                for option_string in action.option_strings:
+                    parts.append('%s %s' % (option_string, args_string))
+
+            return ', '.join(parts)
+
+    def _metavar_formatter(self, action, default_metavar):
+        if action.metavar is not None:
+            result = action.metavar
+        elif action.choices is not None:
+            choice_strs = [str(choice) for choice in action.choices]
+            result = '{%s}' % ','.join(choice_strs)
+        else:
+            result = default_metavar
+
+        def format(tuple_size):
+            if isinstance(result, tuple):
+                return result
+            else:
+                return (result, ) * tuple_size
+        return format
+
+    def _format_args(self, action, default_metavar):
+        get_metavar = self._metavar_formatter(action, default_metavar)
+        if action.nargs is None:
+            result = '%s' % get_metavar(1)
+        elif action.nargs == OPTIONAL:
+            result = '[%s]' % get_metavar(1)
+        elif action.nargs == ZERO_OR_MORE:
+            result = '[%s [%s ...]]' % get_metavar(2)
+        elif action.nargs == ONE_OR_MORE:
+            result = '%s [%s ...]' % get_metavar(2)
+        elif action.nargs == REMAINDER:
+            result = '...'
+        elif action.nargs == PARSER:
+            result = '%s ...' % get_metavar(1)
+        else:
+            formats = ['%s' for _ in range(action.nargs)]
+            result = ' '.join(formats) % get_metavar(action.nargs)
+        return result
+
+    def _expand_help(self, action):
+        params = dict(vars(action), prog=self._prog)
+        for name in list(params):
+            if params[name] is SUPPRESS:
+                del params[name]
+        for name in list(params):
+            if hasattr(params[name], '__name__'):
+                params[name] = params[name].__name__
+        if params.get('choices') is not None:
+            choices_str = ', '.join([str(c) for c in params['choices']])
+            params['choices'] = choices_str
+        return self._get_help_string(action) % params
+
+    def _iter_indented_subactions(self, action):
+        try:
+            get_subactions = action._get_subactions
+        except AttributeError:
+            pass
+        else:
+            self._indent()
+            for subaction in get_subactions():
+                yield subaction
+            self._dedent()
+
+    def _split_lines(self, text, width):
+        text = self._whitespace_matcher.sub(' ', text).strip()
+        return _textwrap.wrap(text, width)
+
+    def _fill_text(self, text, width, indent):
+        text = self._whitespace_matcher.sub(' ', text).strip()
+        return _textwrap.fill(text, width, initial_indent=indent,
+                                           subsequent_indent=indent)
+
+    def _get_help_string(self, action):
+        return action.help
+
+
+class RawDescriptionHelpFormatter(HelpFormatter):
+    """Help message formatter which retains any formatting in descriptions.
+
+    Only the name of this class is considered a public API. All the methods
+    provided by the class are considered an implementation detail.
+    """
+
+    def _fill_text(self, text, width, indent):
+        return ''.join([indent + line for line in text.splitlines(True)])
+
+
+class RawTextHelpFormatter(RawDescriptionHelpFormatter):
+    """Help message formatter which retains formatting of all help text.
+
+    Only the name of this class is considered a public API. All the methods
+    provided by the class are considered an implementation detail.
+    """
+
+    def _split_lines(self, text, width):
+        return text.splitlines()
+
+
+class ArgumentDefaultsHelpFormatter(HelpFormatter):
+    """Help message formatter which adds default values to argument help.
+
+    Only the name of this class is considered a public API. All the methods
+    provided by the class are considered an implementation detail.
+    """
+
+    def _get_help_string(self, action):
+        help = action.help
+        if '%(default)' not in action.help:
+            if action.default is not SUPPRESS:
+                defaulting_nargs = [OPTIONAL, ZERO_OR_MORE]
+                if action.option_strings or action.nargs in defaulting_nargs:
+                    help += ' (default: %(default)s)'
+        return help
+
+
+# =====================
+# Options and Arguments
+# =====================
+
+def _get_action_name(argument):
+    if argument is None:
+        return None
+    elif argument.option_strings:
+        return  '/'.join(argument.option_strings)
+    elif argument.metavar not in (None, SUPPRESS):
+        return argument.metavar
+    elif argument.dest not in (None, SUPPRESS):
+        return argument.dest
+    else:
+        return None
+
+
+class ArgumentError(Exception):
+    """An error from creating or using an argument (optional or positional).
+
+    The string value of this exception is the message, augmented with
+    information about the argument that caused it.
+    """
+
+    def __init__(self, argument, message):
+        self.argument_name = _get_action_name(argument)
+        self.message = message
+
+    def __str__(self):
+        if self.argument_name is None:
+            format = '%(message)s'
+        else:
+            format = 'argument %(argument_name)s: %(message)s'
+        return format % dict(message=self.message,
+                             argument_name=self.argument_name)
+
+
+class ArgumentTypeError(Exception):
+    """An error from trying to convert a command line string to a type."""
+    pass
+
+
+# ==============
+# Action classes
+# ==============
+
+class Action(_AttributeHolder):
+    """Information about how to convert command line strings to Python objects.
+
+    Action objects are used by an ArgumentParser to represent the information
+    needed to parse a single argument from one or more strings from the
+    command line. The keyword arguments to the Action constructor are also
+    all attributes of Action instances.
+
+    Keyword Arguments:
+
+        - option_strings -- A list of command-line option strings which
+            should be associated with this action.
+
+        - dest -- The name of the attribute to hold the created object(s)
+
+        - nargs -- The number of command-line arguments that should be
+            consumed. By default, one argument will be consumed and a single
+            value will be produced.  Other values include:
+                - N (an integer) consumes N arguments (and produces a list)
+                - '?' consumes zero or one arguments
+                - '*' consumes zero or more arguments (and produces a list)
+                - '+' consumes one or more arguments (and produces a list)
+            Note that the difference between the default and nargs=1 is that
+            with the default, a single value will be produced, while with
+            nargs=1, a list containing a single value will be produced.
+
+        - const -- The value to be produced if the option is specified and the
+            option uses an action that takes no values.
+
+        - default -- The value to be produced if the option is not specified.
+
+        - type -- The type which the command-line arguments should be converted
+            to, should be one of 'string', 'int', 'float', 'complex' or a
+            callable object that accepts a single string argument. If None,
+            'string' is assumed.
+
+        - choices -- A container of values that should be allowed. If not None,
+            after a command-line argument has been converted to the appropriate
+            type, an exception will be raised if it is not a member of this
+            collection.
+
+        - required -- True if the action must always be specified at the
+            command line. This is only meaningful for optional command-line
+            arguments.
+
+        - help -- The help string describing the argument.
+
+        - metavar -- The name to be used for the option's argument with the
+            help string. If None, the 'dest' value will be used as the name.
+    """
+
+    def __init__(self,
+                 option_strings,
+                 dest,
+                 nargs=None,
+                 const=None,
+                 default=None,
+                 type=None,
+                 choices=None,
+                 required=False,
+                 help=None,
+                 metavar=None):
+        self.option_strings = option_strings
+        self.dest = dest
+        self.nargs = nargs
+        self.const = const
+        self.default = default
+        self.type = type
+        self.choices = choices
+        self.required = required
+        self.help = help
+        self.metavar = metavar
+
+    def _get_kwargs(self):
+        names = [
+            'option_strings',
+            'dest',
+            'nargs',
+            'const',
+            'default',
+            'type',
+            'choices',
+            'help',
+            'metavar',
+        ]
+        return [(name, getattr(self, name)) for name in names]
+
+    def __call__(self, parser, namespace, values, option_string=None):
+        raise NotImplementedError(_('.__call__() not defined'))
+
+
+class _StoreAction(Action):
+
+    def __init__(self,
+                 option_strings,
+                 dest,
+                 nargs=None,
+                 const=None,
+                 default=None,
+                 type=None,
+                 choices=None,
+                 required=False,
+                 help=None,
+                 metavar=None):
+        if nargs == 0:
+            raise ValueError('nargs for store actions must be > 0; if you '
+                             'have nothing to store, actions such as store '
+                             'true or store const may be more appropriate')
+        if const is not None and nargs != OPTIONAL:
+            raise ValueError('nargs must be %r to supply const' % OPTIONAL)
+        super(_StoreAction, self).__init__(
+            option_strings=option_strings,
+            dest=dest,
+            nargs=nargs,
+            const=const,
+            default=default,
+            type=type,
+            choices=choices,
+            required=required,
+            help=help,
+            metavar=metavar)
+
+    def __call__(self, parser, namespace, values, option_string=None):
+        setattr(namespace, self.dest, values)
+
+
+class _StoreConstAction(Action):
+
+    def __init__(self,
+                 option_strings,
+                 dest,
+                 const,
+                 default=None,
+                 required=False,
+                 help=None,
+                 metavar=None):
+        super(_StoreConstAction, self).__init__(
+            option_strings=option_strings,
+            dest=dest,
+            nargs=0,
+            const=const,
+            default=default,
+            required=required,
+            help=help)
+
+    def __call__(self, parser, namespace, values, option_string=None):
+        setattr(namespace, self.dest, self.const)
+
+
+class _StoreTrueAction(_StoreConstAction):
+
+    def __init__(self,
+                 option_strings,
+                 dest,
+                 default=False,
+                 required=False,
+                 help=None):
+        super(_StoreTrueAction, self).__init__(
+            option_strings=option_strings,
+            dest=dest,
+            const=True,
+            default=default,
+            required=required,
+            help=help)
+
+
+class _StoreFalseAction(_StoreConstAction):
+
+    def __init__(self,
+                 option_strings,
+                 dest,
+                 default=True,
+                 required=False,
+                 help=None):
+        super(_StoreFalseAction, self).__init__(
+            option_strings=option_strings,
+            dest=dest,
+            const=False,
+            default=default,
+            required=required,
+            help=help)
+
+
+class _AppendAction(Action):
+
+    def __init__(self,
+                 option_strings,
+                 dest,
+                 nargs=None,
+                 const=None,
+                 default=None,
+                 type=None,
+                 choices=None,
+                 required=False,
+                 help=None,
+                 metavar=None):
+        if nargs == 0:
+            raise ValueError('nargs for append actions must be > 0; if arg '
+                             'strings are not supplying the value to append, '
+                             'the append const action may be more appropriate')
+        if const is not None and nargs != OPTIONAL:
+            raise ValueError('nargs must be %r to supply const' % OPTIONAL)
+        super(_AppendAction, self).__init__(
+            option_strings=option_strings,
+            dest=dest,
+            nargs=nargs,
+            const=const,
+            default=default,
+            type=type,
+            choices=choices,
+            required=required,
+            help=help,
+            metavar=metavar)
+
+    def __call__(self, parser, namespace, values, option_string=None):
+        items = _copy.copy(_ensure_value(namespace, self.dest, []))
+        items.append(values)
+        setattr(namespace, self.dest, items)
+
+
+class _AppendConstAction(Action):
+
+    def __init__(self,
+                 option_strings,
+                 dest,
+                 const,
+                 default=None,
+                 required=False,
+                 help=None,
+                 metavar=None):
+        super(_AppendConstAction, self).__init__(
+            option_strings=option_strings,
+            dest=dest,
+            nargs=0,
+            const=const,
+            default=default,
+            required=required,
+            help=help,
+            metavar=metavar)
+
+    def __call__(self, parser, namespace, values, option_string=None):
+        items = _copy.copy(_ensure_value(namespace, self.dest, []))
+        items.append(self.const)
+        setattr(namespace, self.dest, items)
+
+
+class _CountAction(Action):
+
+    def __init__(self,
+                 option_strings,
+                 dest,
+                 default=None,
+                 required=False,
+                 help=None):
+        super(_CountAction, self).__init__(
+            option_strings=option_strings,
+            dest=dest,
+            nargs=0,
+            default=default,
+            required=required,
+            help=help)
+
+    def __call__(self, parser, namespace, values, option_string=None):
+        new_count = _ensure_value(namespace, self.dest, 0) + 1
+        setattr(namespace, self.dest, new_count)
+
+
+class _HelpAction(Action):
+
+    def __init__(self,
+                 option_strings,
+                 dest=SUPPRESS,
+                 default=SUPPRESS,
+                 help=None):
+        super(_HelpAction, self).__init__(
+            option_strings=option_strings,
+            dest=dest,
+            default=default,
+            nargs=0,
+            help=help)
+
+    def __call__(self, parser, namespace, values, option_string=None):
+        parser.print_help()
+        parser.exit()
+
+
+class _VersionAction(Action):
+
+    def __init__(self,
+                 option_strings,
+                 version=None,
+                 dest=SUPPRESS,
+                 default=SUPPRESS,
+                 help=None):
+        super(_VersionAction, self).__init__(
+            option_strings=option_strings,
+            dest=dest,
+            default=default,
+            nargs=0,
+            help=help)
+        self.version = version
+
+    def __call__(self, parser, namespace, values, option_string=None):
+        version = self.version
+        if version is None:
+            version = parser.version
+        formatter = parser._get_formatter()
+        formatter.add_text(version)
+        parser.exit(message=formatter.format_help())
+
+
+class _SubParsersAction(Action):
+
+    class _ChoicesPseudoAction(Action):
+
+        def __init__(self, name, help):
+            sup = super(_SubParsersAction._ChoicesPseudoAction, self)
+            sup.__init__(option_strings=[], dest=name, help=help)
+
+    def __init__(self,
+                 option_strings,
+                 prog,
+                 parser_class,
+                 dest=SUPPRESS,
+                 help=None,
+                 metavar=None):
+
+        self._prog_prefix = prog
+        self._parser_class = parser_class
+        self._name_parser_map = {}
+        self._choices_actions = []
+
+        super(_SubParsersAction, self).__init__(
+            option_strings=option_strings,
+            dest=dest,
+            nargs=PARSER,
+            choices=self._name_parser_map,
+            help=help,
+            metavar=metavar)
+
+    def add_parser(self, name, **kwargs):
+        # set prog from the existing prefix
+        if kwargs.get('prog') is None:
+            kwargs['prog'] = '%s %s' % (self._prog_prefix, name)
+
+        # create a pseudo-action to hold the choice help
+        if 'help' in kwargs:
+            help = kwargs.pop('help')
+            choice_action = self._ChoicesPseudoAction(name, help)
+            self._choices_actions.append(choice_action)
+
+        # create the parser and add it to the map
+        parser = self._parser_class(**kwargs)
+        self._name_parser_map[name] = parser
+        return parser
+
+    def _get_subactions(self):
+        return self._choices_actions
+
+    def __call__(self, parser, namespace, values, option_string=None):
+        parser_name = values[0]
+        arg_strings = values[1:]
+
+        # set the parser name if requested
+        if self.dest is not SUPPRESS:
+            setattr(namespace, self.dest, parser_name)
+
+        # select the parser
+        try:
+            parser = self._name_parser_map[parser_name]
+        except KeyError:
+            tup = parser_name, ', '.join(self._name_parser_map)
+            msg = _('unknown parser %r (choices: %s)' % tup)
+            raise ArgumentError(self, msg)
+
+        # parse all the remaining options into the namespace
+        parser.parse_args(arg_strings, namespace)
+
+
+# ==============
+# Type classes
+# ==============
+
+class FileType(object):
+    """Factory for creating file object types
+
+    Instances of FileType are typically passed as type= arguments to the
+    ArgumentParser add_argument() method.
+
+    Keyword Arguments:
+        - mode -- A string indicating how the file is to be opened. Accepts the
+            same values as the builtin open() function.
+        - bufsize -- The file's desired buffer size. Accepts the same values as
+            the builtin open() function.
+    """
+
+    def __init__(self, mode='r', bufsize=None):
+        self._mode = mode
+        self._bufsize = bufsize
+
+    def __call__(self, string):
+        # the special argument "-" means sys.std{in,out}
+        if string == '-':
+            if 'r' in self._mode:
+                return _sys.stdin
+            elif 'w' in self._mode:
+                return _sys.stdout
+            else:
+                msg = _('argument "-" with mode %r' % self._mode)
+                raise ValueError(msg)
+
+        # all other arguments are used as file names
+        if self._bufsize:
+            return open(string, self._mode, self._bufsize)
+        else:
+            return open(string, self._mode)
+
+    def __repr__(self):
+        args = [self._mode, self._bufsize]
+        args_str = ', '.join([repr(arg) for arg in args if arg is not None])
+        return '%s(%s)' % (type(self).__name__, args_str)
+
+# ===========================
+# Optional and Positional Parsing
+# ===========================
+
+class Namespace(_AttributeHolder):
+    """Simple object for storing attributes.
+
+    Implements equality by attribute names and values, and provides a simple
+    string representation.
+    """
+
+    def __init__(self, **kwargs):
+        for name in kwargs:
+            setattr(self, name, kwargs[name])
+
+    def __eq__(self, other):
+        return vars(self) == vars(other)
+
+    def __ne__(self, other):
+        return not (self == other)
+
+    def __contains__(self, key):
+        return key in self.__dict__
+
+
+class _ActionsContainer(object):
+
+    def __init__(self,
+                 description,
+                 prefix_chars,
+                 argument_default,
+                 conflict_handler):
+        super(_ActionsContainer, self).__init__()
+
+        self.description = description
+        self.argument_default = argument_default
+        self.prefix_chars = prefix_chars
+        self.conflict_handler = conflict_handler
+
+        # set up registries
+        self._registries = {}
+
+        # register actions
+        self.register('action', None, _StoreAction)
+        self.register('action', 'store', _StoreAction)
+        self.register('action', 'store_const', _StoreConstAction)
+        self.register('action', 'store_true', _StoreTrueAction)
+        self.register('action', 'store_false', _StoreFalseAction)
+        self.register('action', 'append', _AppendAction)
+        self.register('action', 'append_const', _AppendConstAction)
+        self.register('action', 'count', _CountAction)
+        self.register('action', 'help', _HelpAction)
+        self.register('action', 'version', _VersionAction)
+        self.register('action', 'parsers', _SubParsersAction)
+
+        # raise an exception if the conflict handler is invalid
+        self._get_handler()
+
+        # action storage
+        self._actions = []
+        self._option_string_actions = {}
+
+        # groups
+        self._action_groups = []
+        self._mutually_exclusive_groups = []
+
+        # defaults storage
+        self._defaults = {}
+
+        # determines whether an "option" looks like a negative number
+        self._negative_number_matcher = _re.compile(r'^-\d+$|^-\d*\.\d+$')
+
+        # whether or not there are any optionals that look like negative
+        # numbers -- uses a list so it can be shared and edited
+        self._has_negative_number_optionals = []
+
+    # ====================
+    # Registration methods
+    # ====================
+    def register(self, registry_name, value, object):
+        registry = self._registries.setdefault(registry_name, {})
+        registry[value] = object
+
+    def _registry_get(self, registry_name, value, default=None):
+        return self._registries[registry_name].get(value, default)
+
+    # ==================================
+    # Namespace default accessor methods
+    # ==================================
+    def set_defaults(self, **kwargs):
+        self._defaults.update(kwargs)
+
+        # if these defaults match any existing arguments, replace
+        # the previous default on the object with the new one
+        for action in self._actions:
+            if action.dest in kwargs:
+                action.default = kwargs[action.dest]
+
+    def get_default(self, dest):
+        for action in self._actions:
+            if action.dest == dest and action.default is not None:
+                return action.default
+        return self._defaults.get(dest, None)
+
+
+    # =======================
+    # Adding argument actions
+    # =======================
+    def add_argument(self, *args, **kwargs):
+        """
+        add_argument(dest, ..., name=value, ...)
+        add_argument(option_string, option_string, ..., name=value, ...)
+        """
+
+        # if no positional args are supplied or only one is supplied and
+        # it doesn't look like an option string, parse a positional
+        # argument
+        chars = self.prefix_chars
+        if not args or len(args) == 1 and args[0][0] not in chars:
+            if args and 'dest' in kwargs:
+                raise ValueError('dest supplied twice for positional argument')
+            kwargs = self._get_positional_kwargs(*args, **kwargs)
+
+        # otherwise, we're adding an optional argument
+        else:
+            kwargs = self._get_optional_kwargs(*args, **kwargs)
+
+        # if no default was supplied, use the parser-level default
+        if 'default' not in kwargs:
+            dest = kwargs['dest']
+            if dest in self._defaults:
+                kwargs['default'] = self._defaults[dest]
+            elif self.argument_default is not None:
+                kwargs['default'] = self.argument_default
+
+        # create the action object, and add it to the parser
+        action_class = self._pop_action_class(kwargs)
+        if not _callable(action_class):
+            raise ValueError('unknown action "%s"' % action_class)
+        action = action_class(**kwargs)
+
+        # raise an error if the action type is not callable
+        type_func = self._registry_get('type', action.type, action.type)
+        if not _callable(type_func):
+            raise ValueError('%r is not callable' % type_func)
+
+        return self._add_action(action)
+
+    def add_argument_group(self, *args, **kwargs):
+        group = _ArgumentGroup(self, *args, **kwargs)
+        self._action_groups.append(group)
+        return group
+
+    def add_mutually_exclusive_group(self, **kwargs):
+        group = _MutuallyExclusiveGroup(self, **kwargs)
+        self._mutually_exclusive_groups.append(group)
+        return group
+
+    def _add_action(self, action):
+        # resolve any conflicts
+        self._check_conflict(action)
+
+        # add to actions list
+        self._actions.append(action)
+        action.container = self
+
+        # index the action by any option strings it has
+        for option_string in action.option_strings:
+            self._option_string_actions[option_string] = action
+
+        # set the flag if any option strings look like negative numbers
+        for option_string in action.option_strings:
+            if self._negative_number_matcher.match(option_string):
+                if not self._has_negative_number_optionals:
+                    self._has_negative_number_optionals.append(True)
+
+        # return the created action
+        return action
+
+    def _remove_action(self, action):
+        self._actions.remove(action)
+
+    def _add_container_actions(self, container):
+        # collect groups by titles
+        title_group_map = {}
+        for group in self._action_groups:
+            if group.title in title_group_map:
+                msg = _('cannot merge actions - two groups are named %r')
+                raise ValueError(msg % (group.title))
+            title_group_map[group.title] = group
+
+        # map each action to its group
+        group_map = {}
+        for group in container._action_groups:
+
+            # if a group with the title exists, use that, otherwise
+            # create a new group matching the container's group
+            if group.title not in title_group_map:
+                title_group_map[group.title] = self.add_argument_group(
+                    title=group.title,
+                    description=group.description,
+                    conflict_handler=group.conflict_handler)
+
+            # map the actions to their new group
+            for action in group._group_actions:
+                group_map[action] = title_group_map[group.title]
+
+        # add container's mutually exclusive groups
+        # NOTE: if add_mutually_exclusive_group ever gains title= and
+        # description= then this code will need to be expanded as above
+        for group in container._mutually_exclusive_groups:
+            mutex_group = self.add_mutually_exclusive_group(
+                required=group.required)
+
+            # map the actions to their new mutex group
+            for action in group._group_actions:
+                group_map[action] = mutex_group
+
+        # add all actions to this container or their group
+        for action in container._actions:
+            group_map.get(action, self)._add_action(action)
+
+    def _get_positional_kwargs(self, dest, **kwargs):
+        # make sure required is not specified
+        if 'required' in kwargs:
+            msg = _("'required' is an invalid argument for positionals")
+            raise TypeError(msg)
+
+        # mark positional arguments as required if at least one is
+        # always required
+        if kwargs.get('nargs') not in [OPTIONAL, ZERO_OR_MORE]:
+            kwargs['required'] = True
+        if kwargs.get('nargs') == ZERO_OR_MORE and 'default' not in kwargs:
+            kwargs['required'] = True
+
+        # return the keyword arguments with no option strings
+        return dict(kwargs, dest=dest, option_strings=[])
+
+    def _get_optional_kwargs(self, *args, **kwargs):
+        # determine short and long option strings
+        option_strings = []
+        long_option_strings = []
+        for option_string in args:
+            # error on strings that don't start with an appropriate prefix
+            if not option_string[0] in self.prefix_chars:
+                msg = _('invalid option string %r: '
+                        'must start with a character %r')
+                tup = option_string, self.prefix_chars
+                raise ValueError(msg % tup)
+
+            # strings starting with two prefix characters are long options
+            option_strings.append(option_string)
+            if option_string[0] in self.prefix_chars:
+                if len(option_string) > 1:
+                    if option_string[1] in self.prefix_chars:
+                        long_option_strings.append(option_string)
+
+        # infer destination, '--foo-bar' -> 'foo_bar' and '-x' -> 'x'
+        dest = kwargs.pop('dest', None)
+        if dest is None:
+            if long_option_strings:
+                dest_option_string = long_option_strings[0]
+            else:
+                dest_option_string = option_strings[0]
+            dest = dest_option_string.lstrip(self.prefix_chars)
+            if not dest:
+                msg = _('dest= is required for options like %r')
+                raise ValueError(msg % option_string)
+            dest = dest.replace('-', '_')
+
+        # return the updated keyword arguments
+        return dict(kwargs, dest=dest, option_strings=option_strings)
+
+    def _pop_action_class(self, kwargs, default=None):
+        action = kwargs.pop('action', default)
+        return self._registry_get('action', action, action)
+
+    def _get_handler(self):
+        # determine function from conflict handler string
+        handler_func_name = '_handle_conflict_%s' % self.conflict_handler
+        try:
+            return getattr(self, handler_func_name)
+        except AttributeError:
+            msg = _('invalid conflict_resolution value: %r')
+            raise ValueError(msg % self.conflict_handler)
+
+    def _check_conflict(self, action):
+
+        # find all options that conflict with this option
+        confl_optionals = []
+        for option_string in action.option_strings:
+            if option_string in self._option_string_actions:
+                confl_optional = self._option_string_actions[option_string]
+                confl_optionals.append((option_string, confl_optional))
+
+        # resolve any conflicts
+        if confl_optionals:
+            conflict_handler = self._get_handler()
+            conflict_handler(action, confl_optionals)
+
+    def _handle_conflict_error(self, action, conflicting_actions):
+        message = _('conflicting option string(s): %s')
+        conflict_string = ', '.join([option_string
+                                     for option_string, action
+                                     in conflicting_actions])
+        raise ArgumentError(action, message % conflict_string)
+
+    def _handle_conflict_resolve(self, action, conflicting_actions):
+
+        # remove all conflicting options
+        for option_string, action in conflicting_actions:
+
+            # remove the conflicting option
+            action.option_strings.remove(option_string)
+            self._option_string_actions.pop(option_string, None)
+
+            # if the option now has no option string, remove it from the
+            # container holding it
+            if not action.option_strings:
+                action.container._remove_action(action)
+
+
+class _ArgumentGroup(_ActionsContainer):
+
+    def __init__(self, container, title=None, description=None, **kwargs):
+        # add any missing keyword arguments by checking the container
+        update = kwargs.setdefault
+        update('conflict_handler', container.conflict_handler)
+        update('prefix_chars', container.prefix_chars)
+        update('argument_default', container.argument_default)
+        super_init = super(_ArgumentGroup, self).__init__
+        super_init(description=description, **kwargs)
+
+        # group attributes
+        self.title = title
+        self._group_actions = []
+
+        # share most attributes with the container
+        self._registries = container._registries
+        self._actions = container._actions
+        self._option_string_actions = container._option_string_actions
+        self._defaults = container._defaults
+        self._has_negative_number_optionals = \
+            container._has_negative_number_optionals
+
+    def _add_action(self, action):
+        action = super(_ArgumentGroup, self)._add_action(action)
+        self._group_actions.append(action)
+        return action
+
+    def _remove_action(self, action):
+        super(_ArgumentGroup, self)._remove_action(action)
+        self._group_actions.remove(action)
+
+
+class _MutuallyExclusiveGroup(_ArgumentGroup):
+
+    def __init__(self, container, required=False):
+        super(_MutuallyExclusiveGroup, self).__init__(container)
+        self.required = required
+        self._container = container
+
+    def _add_action(self, action):
+        if action.required:
+            msg = _('mutually exclusive arguments must be optional')
+            raise ValueError(msg)
+        action = self._container._add_action(action)
+        self._group_actions.append(action)
+        return action
+
+    def _remove_action(self, action):
+        self._container._remove_action(action)
+        self._group_actions.remove(action)
+
+
+class ArgumentParser(_AttributeHolder, _ActionsContainer):
+    """Object for parsing command line strings into Python objects.
+
+    Keyword Arguments:
+        - prog -- The name of the program (default: sys.argv[0])
+        - usage -- A usage message (default: auto-generated from arguments)
+        - description -- A description of what the program does
+        - epilog -- Text following the argument descriptions
+        - parents -- Parsers whose arguments should be copied into this one
+        - formatter_class -- HelpFormatter class for printing help messages
+        - prefix_chars -- Characters that prefix optional arguments
+        - fromfile_prefix_chars -- Characters that prefix files containing
+            additional arguments
+        - argument_default -- The default value for all arguments
+        - conflict_handler -- String indicating how to handle conflicts
+        - add_help -- Add a -h/-help option
+    """
+
+    def __init__(self,
+                 prog=None,
+                 usage=None,
+                 description=None,
+                 epilog=None,
+                 version=None,
+                 parents=[],
+                 formatter_class=HelpFormatter,
+                 prefix_chars='-',
+                 fromfile_prefix_chars=None,
+                 argument_default=None,
+                 conflict_handler='error',
+                 add_help=True):
+
+        if version is not None:
+            import warnings
+            warnings.warn(
+                """The "version" argument to ArgumentParser is deprecated. """
+                """Please use """
+                """"add_argument(..., action='version', version="N", ...)" """
+                """instead""", DeprecationWarning)
+
+        superinit = super(ArgumentParser, self).__init__
+        superinit(description=description,
+                  prefix_chars=prefix_chars,
+                  argument_default=argument_default,
+                  conflict_handler=conflict_handler)
+
+        # default setting for prog
+        if prog is None:
+            prog = _os.path.basename(_sys.argv[0])
+
+        self.prog = prog
+        self.usage = usage
+        self.epilog = epilog
+        self.version = version
+        self.formatter_class = formatter_class
+        self.fromfile_prefix_chars = fromfile_prefix_chars
+        self.add_help = add_help
+
+        add_group = self.add_argument_group
+        self._positionals = add_group(_('positional arguments'))
+        self._optionals = add_group(_('optional arguments'))
+        self._subparsers = None
+
+        # register types
+        def identity(string):
+            return string
+        self.register('type', None, identity)
+
+        # add help and version arguments if necessary
+        # (using explicit default to override global argument_default)
+        if self.add_help:
+            self.add_argument(
+                '-h', '--help', action='help', default=SUPPRESS,
+                help=_('show this help message and exit'))
+        if self.version:
+            self.add_argument(
+                '-v', '--version', action='version', default=SUPPRESS,
+                version=self.version,
+                help=_("show program's version number and exit"))
+
+        # add parent arguments and defaults
+        for parent in parents:
+            self._add_container_actions(parent)
+            try:
+                defaults = parent._defaults
+            except AttributeError:
+                pass
+            else:
+                self._defaults.update(defaults)
+
+    # =======================
+    # Pretty __repr__ methods
+    # =======================
+    def _get_kwargs(self):
+        names = [
+            'prog',
+            'usage',
+            'description',
+            'version',
+            'formatter_class',
+            'conflict_handler',
+            'add_help',
+        ]
+        return [(name, getattr(self, name)) for name in names]
+
+    # ==================================
+    # Optional/Positional adding methods
+    # ==================================
+    def add_subparsers(self, **kwargs):
+        if self._subparsers is not None:
+            self.error(_('cannot have multiple subparser arguments'))
+
+        # add the parser class to the arguments if it's not present
+        kwargs.setdefault('parser_class', type(self))
+
+        if 'title' in kwargs or 'description' in kwargs:
+            title = _(kwargs.pop('title', 'subcommands'))
+            description = _(kwargs.pop('description', None))
+            self._subparsers = self.add_argument_group(title, description)
+        else:
+            self._subparsers = self._positionals
+
+        # prog defaults to the usage message of this parser, skipping
+        # optional arguments and with no "usage:" prefix
+        if kwargs.get('prog') is None:
+            formatter = self._get_formatter()
+            positionals = self._get_positional_actions()
+            groups = self._mutually_exclusive_groups
+            formatter.add_usage(self.usage, positionals, groups, '')
+            kwargs['prog'] = formatter.format_help().strip()
+
+        # create the parsers action and add it to the positionals list
+        parsers_class = self._pop_action_class(kwargs, 'parsers')
+        action = parsers_class(option_strings=[], **kwargs)
+        self._subparsers._add_action(action)
+
+        # return the created parsers action
+        return action
+
+    def _add_action(self, action):
+        if action.option_strings:
+            self._optionals._add_action(action)
+        else:
+            self._positionals._add_action(action)
+        return action
+
+    def _get_optional_actions(self):
+        return [action
+                for action in self._actions
+                if action.option_strings]
+
+    def _get_positional_actions(self):
+        return [action
+                for action in self._actions
+                if not action.option_strings]
+
+    # =====================================
+    # Command line argument parsing methods
+    # =====================================
+    def parse_args(self, args=None, namespace=None):
+        args, argv = self.parse_known_args(args, namespace)
+        if argv:
+            msg = _('unrecognized arguments: %s')
+            self.error(msg % ' '.join(argv))
+        return args
+
+    def parse_known_args(self, args=None, namespace=None):
+        # args default to the system args
+        if args is None:
+            args = _sys.argv[1:]
+
+        # default Namespace built from parser defaults
+        if namespace is None:
+            namespace = Namespace()
+
+        # add any action defaults that aren't present
+        for action in self._actions:
+            if action.dest is not SUPPRESS:
+                if not hasattr(namespace, action.dest):
+                    if action.default is not SUPPRESS:
+                        default = action.default
+                        if isinstance(action.default, _basestring):
+                            default = self._get_value(action, default)
+                        setattr(namespace, action.dest, default)
+
+        # add any parser defaults that aren't present
+        for dest in self._defaults:
+            if not hasattr(namespace, dest):
+                setattr(namespace, dest, self._defaults[dest])
+
+        # parse the arguments and exit if there are any errors
+        try:
+            return self._parse_known_args(args, namespace)
+        except ArgumentError:
+            err = _sys.exc_info()[1]
+            self.error(str(err))
+
+    def _parse_known_args(self, arg_strings, namespace):
+        # replace arg strings that are file references
+        if self.fromfile_prefix_chars is not None:
+            arg_strings = self._read_args_from_files(arg_strings)
+
+        # map all mutually exclusive arguments to the other arguments
+        # they can't occur with
+        action_conflicts = {}
+        for mutex_group in self._mutually_exclusive_groups:
+            group_actions = mutex_group._group_actions
+            for i, mutex_action in enumerate(mutex_group._group_actions):
+                conflicts = action_conflicts.setdefault(mutex_action, [])
+                conflicts.extend(group_actions[:i])
+                conflicts.extend(group_actions[i + 1:])
+
+        # find all option indices, and determine the arg_string_pattern
+        # which has an 'O' if there is an option at an index,
+        # an 'A' if there is an argument, or a '-' if there is a '--'
+        option_string_indices = {}
+        arg_string_pattern_parts = []
+        arg_strings_iter = iter(arg_strings)
+        for i, arg_string in enumerate(arg_strings_iter):
+
+            # all args after -- are non-options
+            if arg_string == '--':
+                arg_string_pattern_parts.append('-')
+                for arg_string in arg_strings_iter:
+                    arg_string_pattern_parts.append('A')
+
+            # otherwise, add the arg to the arg strings
+            # and note the index if it was an option
+            else:
+                option_tuple = self._parse_optional(arg_string)
+                if option_tuple is None:
+                    pattern = 'A'
+                else:
+                    option_string_indices[i] = option_tuple
+                    pattern = 'O'
+                arg_string_pattern_parts.append(pattern)
+
+        # join the pieces together to form the pattern
+        arg_strings_pattern = ''.join(arg_string_pattern_parts)
+
+        # converts arg strings to the appropriate and then takes the action
+        seen_actions = _set()
+        seen_non_default_actions = _set()
+
+        def take_action(action, argument_strings, option_string=None):
+            seen_actions.add(action)
+            argument_values = self._get_values(action, argument_strings)
+
+            # error if this argument is not allowed with other previously
+            # seen arguments, assuming that actions that use the default
+            # value don't really count as "present"
+            if argument_values is not action.default:
+                seen_non_default_actions.add(action)
+                for conflict_action in action_conflicts.get(action, []):
+                    if conflict_action in seen_non_default_actions:
+                        msg = _('not allowed with argument %s')
+                        action_name = _get_action_name(conflict_action)
+                        raise ArgumentError(action, msg % action_name)
+
+            # take the action if we didn't receive a SUPPRESS value
+            # (e.g. from a default)
+            if argument_values is not SUPPRESS:
+                action(self, namespace, argument_values, option_string)
+
+        # function to convert arg_strings into an optional action
+        def consume_optional(start_index):
+
+            # get the optional identified at this index
+            option_tuple = option_string_indices[start_index]
+            action, option_string, explicit_arg = option_tuple
+
+            # identify additional optionals in the same arg string
+            # (e.g. -xyz is the same as -x -y -z if no args are required)
+            match_argument = self._match_argument
+            action_tuples = []
+            while True:
+
+                # if we found no optional action, skip it
+                if action is None:
+                    extras.append(arg_strings[start_index])
+                    return start_index + 1
+
+                # if there is an explicit argument, try to match the
+                # optional's string arguments to only this
+                if explicit_arg is not None:
+                    arg_count = match_argument(action, 'A')
+
+                    # if the action is a single-dash option and takes no
+                    # arguments, try to parse more single-dash options out
+                    # of the tail of the option string
+                    chars = self.prefix_chars
+                    if arg_count == 0 and option_string[1] not in chars:
+                        action_tuples.append((action, [], option_string))
+                        for char in self.prefix_chars:
+                            option_string = char + explicit_arg[0]
+                            explicit_arg = explicit_arg[1:] or None
+                            optionals_map = self._option_string_actions
+                            if option_string in optionals_map:
+                                action = optionals_map[option_string]
+                                break
+                        else:
+                            msg = _('ignored explicit argument %r')
+                            raise ArgumentError(action, msg % explicit_arg)
+
+                    # if the action expect exactly one argument, we've
+                    # successfully matched the option; exit the loop
+                    elif arg_count == 1:
+                        stop = start_index + 1
+                        args = [explicit_arg]
+                        action_tuples.append((action, args, option_string))
+                        break
+
+                    # error if a double-dash option did not use the
+                    # explicit argument
+                    else:
+                        msg = _('ignored explicit argument %r')
+                        raise ArgumentError(action, msg % explicit_arg)
+
+                # if there is no explicit argument, try to match the
+                # optional's string arguments with the following strings
+                # if successful, exit the loop
+                else:
+                    start = start_index + 1
+                    selected_patterns = arg_strings_pattern[start:]
+                    arg_count = match_argument(action, selected_patterns)
+                    stop = start + arg_count
+                    args = arg_strings[start:stop]
+                    action_tuples.append((action, args, option_string))
+                    break
+
+            # add the Optional to the list and return the index at which
+            # the Optional's string args stopped
+            assert action_tuples
+            for action, args, option_string in action_tuples:
+                take_action(action, args, option_string)
+            return stop
+
+        # the list of Positionals left to be parsed; this is modified
+        # by consume_positionals()
+        positionals = self._get_positional_actions()
+
+        # function to convert arg_strings into positional actions
+        def consume_positionals(start_index):
+            # match as many Positionals as possible
+            match_partial = self._match_arguments_partial
+            selected_pattern = arg_strings_pattern[start_index:]
+            arg_counts = match_partial(positionals, selected_pattern)
+
+            # slice off the appropriate arg strings for each Positional
+            # and add the Positional and its args to the list
+            for action, arg_count in zip(positionals, arg_counts):
+                args = arg_strings[start_index: start_index + arg_count]
+                start_index += arg_count
+                take_action(action, args)
+
+            # slice off the Positionals that we just parsed and return the
+            # index at which the Positionals' string args stopped
+            positionals[:] = positionals[len(arg_counts):]
+            return start_index
+
+        # consume Positionals and Optionals alternately, until we have
+        # passed the last option string
+        extras = []
+        start_index = 0
+        if option_string_indices:
+            max_option_string_index = max(option_string_indices)
+        else:
+            max_option_string_index = -1
+        while start_index <= max_option_string_index:
+
+            # consume any Positionals preceding the next option
+            next_option_string_index = min([
+                index
+                for index in option_string_indices
+                if index >= start_index])
+            if start_index != next_option_string_index:
+                positionals_end_index = consume_positionals(start_index)
+
+                # only try to parse the next optional if we didn't consume
+                # the option string during the positionals parsing
+                if positionals_end_index > start_index:
+                    start_index = positionals_end_index
+                    continue
+                else:
+                    start_index = positionals_end_index
+
+            # if we consumed all the positionals we could and we're not
+            # at the index of an option string, there were extra arguments
+            if start_index not in option_string_indices:
+                strings = arg_strings[start_index:next_option_string_index]
+                extras.extend(strings)
+                start_index = next_option_string_index
+
+            # consume the next optional and any arguments for it
+            start_index = consume_optional(start_index)
+
+        # consume any positionals following the last Optional
+        stop_index = consume_positionals(start_index)
+
+        # if we didn't consume all the argument strings, there were extras
+        extras.extend(arg_strings[stop_index:])
+
+        # if we didn't use all the Positional objects, there were too few
+        # arg strings supplied.
+        if positionals:
+            self.error(_('too few arguments'))
+
+        # make sure all required actions were present
+        for action in self._actions:
+            if action.required:
+                if action not in seen_actions:
+                    name = _get_action_name(action)
+                    self.error(_('argument %s is required') % name)
+
+        # make sure all required groups had one option present
+        for group in self._mutually_exclusive_groups:
+            if group.required:
+                for action in group._group_actions:
+                    if action in seen_non_default_actions:
+                        break
+
+                # if no actions were used, report the error
+                else:
+                    names = [_get_action_name(action)
+                             for action in group._group_actions
+                             if action.help is not SUPPRESS]
+                    msg = _('one of the arguments %s is required')
+                    self.error(msg % ' '.join(names))
+
+        # return the updated namespace and the extra arguments
+        return namespace, extras
+
+    def _read_args_from_files(self, arg_strings):
+        # expand arguments referencing files
+        new_arg_strings = []
+        for arg_string in arg_strings:
+
+            # for regular arguments, just add them back into the list
+            if arg_string[0] not in self.fromfile_prefix_chars:
+                new_arg_strings.append(arg_string)
+
+            # replace arguments referencing files with the file content
+            else:
+                try:
+                    args_file = open(arg_string[1:])
+                    try:
+                        arg_strings = []
+                        for arg_line in args_file.read().splitlines():
+                            for arg in self.convert_arg_line_to_args(arg_line):
+                                arg_strings.append(arg)
+                        arg_strings = self._read_args_from_files(arg_strings)
+                        new_arg_strings.extend(arg_strings)
+                    finally:
+                        args_file.close()
+                except IOError:
+                    err = _sys.exc_info()[1]
+                    self.error(str(err))
+
+        # return the modified argument list
+        return new_arg_strings
+
+    def convert_arg_line_to_args(self, arg_line):
+        return [arg_line]
+
+    def _match_argument(self, action, arg_strings_pattern):
+        # match the pattern for this action to the arg strings
+        nargs_pattern = self._get_nargs_pattern(action)
+        match = _re.match(nargs_pattern, arg_strings_pattern)
+
+        # raise an exception if we weren't able to find a match
+        if match is None:
+            nargs_errors = {
+                None: _('expected one argument'),
+                OPTIONAL: _('expected at most one argument'),
+                ONE_OR_MORE: _('expected at least one argument'),
+            }
+            default = _('expected %s argument(s)') % action.nargs
+            msg = nargs_errors.get(action.nargs, default)
+            raise ArgumentError(action, msg)
+
+        # return the number of arguments matched
+        return len(match.group(1))
+
+    def _match_arguments_partial(self, actions, arg_strings_pattern):
+        # progressively shorten the actions list by slicing off the
+        # final actions until we find a match
+        result = []
+        for i in range(len(actions), 0, -1):
+            actions_slice = actions[:i]
+            pattern = ''.join([self._get_nargs_pattern(action)
+                               for action in actions_slice])
+            match = _re.match(pattern, arg_strings_pattern)
+            if match is not None:
+                result.extend([len(string) for string in match.groups()])
+                break
+
+        # return the list of arg string counts
+        return result
+
+    def _parse_optional(self, arg_string):
+        # if it's an empty string, it was meant to be a positional
+        if not arg_string:
+            return None
+
+        # if it doesn't start with a prefix, it was meant to be positional
+        if not arg_string[0] in self.prefix_chars:
+            return None
+
+        # if the option string is present in the parser, return the action
+        if arg_string in self._option_string_actions:
+            action = self._option_string_actions[arg_string]
+            return action, arg_string, None
+
+        # if it's just a single character, it was meant to be positional
+        if len(arg_string) == 1:
+            return None
+
+        # if the option string before the "=" is present, return the action
+        if '=' in arg_string:
+            option_string, explicit_arg = arg_string.split('=', 1)
+            if option_string in self._option_string_actions:
+                action = self._option_string_actions[option_string]
+                return action, option_string, explicit_arg
+
+        # search through all possible prefixes of the option string
+        # and all actions in the parser for possible interpretations
+        option_tuples = self._get_option_tuples(arg_string)
+
+        # if multiple actions match, the option string was ambiguous
+        if len(option_tuples) > 1:
+            options = ', '.join([option_string
+                for action, option_string, explicit_arg in option_tuples])
+            tup = arg_string, options
+            self.error(_('ambiguous option: %s could match %s') % tup)
+
+        # if exactly one action matched, this segmentation is good,
+        # so return the parsed action
+        elif len(option_tuples) == 1:
+            option_tuple, = option_tuples
+            return option_tuple
+
+        # if it was not found as an option, but it looks like a negative
+        # number, it was meant to be positional
+        # unless there are negative-number-like options
+        if self._negative_number_matcher.match(arg_string):
+            if not self._has_negative_number_optionals:
+                return None
+
+        # if it contains a space, it was meant to be a positional
+        if ' ' in arg_string:
+            return None
+
+        # it was meant to be an optional but there is no such option
+        # in this parser (though it might be a valid option in a subparser)
+        return None, arg_string, None
+
+    def _get_option_tuples(self, option_string):
+        result = []
+
+        # option strings starting with two prefix characters are only
+        # split at the '='
+        chars = self.prefix_chars
+        if option_string[0] in chars and option_string[1] in chars:
+            if '=' in option_string:
+                option_prefix, explicit_arg = option_string.split('=', 1)
+            else:
+                option_prefix = option_string
+                explicit_arg = None
+            for option_string in self._option_string_actions:
+                if option_string.startswith(option_prefix):
+                    action = self._option_string_actions[option_string]
+                    tup = action, option_string, explicit_arg
+                    result.append(tup)
+
+        # single character options can be concatenated with their arguments
+        # but multiple character options always have to have their argument
+        # separate
+        elif option_string[0] in chars and option_string[1] not in chars:
+            option_prefix = option_string
+            explicit_arg = None
+            short_option_prefix = option_string[:2]
+            short_explicit_arg = option_string[2:]
+
+            for option_string in self._option_string_actions:
+                if option_string == short_option_prefix:
+                    action = self._option_string_actions[option_string]
+                    tup = action, option_string, short_explicit_arg
+                    result.append(tup)
+                elif option_string.startswith(option_prefix):
+                    action = self._option_string_actions[option_string]
+                    tup = action, option_string, explicit_arg
+                    result.append(tup)
+
+        # shouldn't ever get here
+        else:
+            self.error(_('unexpected option string: %s') % option_string)
+
+        # return the collected option tuples
+        return result
+
+    def _get_nargs_pattern(self, action):
+        # in all examples below, we have to allow for '--' args
+        # which are represented as '-' in the pattern
+        nargs = action.nargs
+
+        # the default (None) is assumed to be a single argument
+        if nargs is None:
+            nargs_pattern = '(-*A-*)'
+
+        # allow zero or one arguments
+        elif nargs == OPTIONAL:
+            nargs_pattern = '(-*A?-*)'
+
+        # allow zero or more arguments
+        elif nargs == ZERO_OR_MORE:
+            nargs_pattern = '(-*[A-]*)'
+
+        # allow one or more arguments
+        elif nargs == ONE_OR_MORE:
+            nargs_pattern = '(-*A[A-]*)'
+
+        # allow any number of options or arguments
+        elif nargs == REMAINDER:
+            nargs_pattern = '([-AO]*)'
+
+        # allow one argument followed by any number of options or arguments
+        elif nargs == PARSER:
+            nargs_pattern = '(-*A[-AO]*)'
+
+        # all others should be integers
+        else:
+            nargs_pattern = '(-*%s-*)' % '-*'.join('A' * nargs)
+
+        # if this is an optional action, -- is not allowed
+        if action.option_strings:
+            nargs_pattern = nargs_pattern.replace('-*', '')
+            nargs_pattern = nargs_pattern.replace('-', '')
+
+        # return the pattern
+        return nargs_pattern
+
+    # ========================
+    # Value conversion methods
+    # ========================
+    def _get_values(self, action, arg_strings):
+        # for everything but PARSER args, strip out '--'
+        if action.nargs not in [PARSER, REMAINDER]:
+            arg_strings = [s for s in arg_strings if s != '--']
+
+        # optional argument produces a default when not present
+        if not arg_strings and action.nargs == OPTIONAL:
+            if action.option_strings:
+                value = action.const
+            else:
+                value = action.default
+            if isinstance(value, _basestring):
+                value = self._get_value(action, value)
+                self._check_value(action, value)
+
+        # when nargs='*' on a positional, if there were no command-line
+        # args, use the default if it is anything other than None
+        elif (not arg_strings and action.nargs == ZERO_OR_MORE and
+              not action.option_strings):
+            if action.default is not None:
+                value = action.default
+            else:
+                value = arg_strings
+            self._check_value(action, value)
+
+        # single argument or optional argument produces a single value
+        elif len(arg_strings) == 1 and action.nargs in [None, OPTIONAL]:
+            arg_string, = arg_strings
+            value = self._get_value(action, arg_string)
+            self._check_value(action, value)
+
+        # REMAINDER arguments convert all values, checking none
+        elif action.nargs == REMAINDER:
+            value = [self._get_value(action, v) for v in arg_strings]
+
+        # PARSER arguments convert all values, but check only the first
+        elif action.nargs == PARSER:
+            value = [self._get_value(action, v) for v in arg_strings]
+            self._check_value(action, value[0])
+
+        # all other types of nargs produce a list
+        else:
+            value = [self._get_value(action, v) for v in arg_strings]
+            for v in value:
+                self._check_value(action, v)
+
+        # return the converted value
+        return value
+
+    def _get_value(self, action, arg_string):
+        type_func = self._registry_get('type', action.type, action.type)
+        if not _callable(type_func):
+            msg = _('%r is not callable')
+            raise ArgumentError(action, msg % type_func)
+
+        # convert the value to the appropriate type
+        try:
+            result = type_func(arg_string)
+
+        # ArgumentTypeErrors indicate errors
+        except ArgumentTypeError:
+            name = getattr(action.type, '__name__', repr(action.type))
+            msg = str(_sys.exc_info()[1])
+            raise ArgumentError(action, msg)
+
+        # TypeErrors or ValueErrors also indicate errors
+        except (TypeError, ValueError):
+            name = getattr(action.type, '__name__', repr(action.type))
+            msg = _('invalid %s value: %r')
+            raise ArgumentError(action, msg % (name, arg_string))
+
+        # return the converted value
+        return result
+
+    def _check_value(self, action, value):
+        # converted value must be one of the choices (if specified)
+        if action.choices is not None and value not in action.choices:
+            tup = value, ', '.join(map(repr, action.choices))
+            msg = _('invalid choice: %r (choose from %s)') % tup
+            raise ArgumentError(action, msg)
+
+    # =======================
+    # Help-formatting methods
+    # =======================
+    def format_usage(self):
+        formatter = self._get_formatter()
+        formatter.add_usage(self.usage, self._actions,
+                            self._mutually_exclusive_groups)
+        return formatter.format_help()
+
+    def format_help(self):
+        formatter = self._get_formatter()
+
+        # usage
+        formatter.add_usage(self.usage, self._actions,
+                            self._mutually_exclusive_groups)
+
+        # description
+        formatter.add_text(self.description)
+
+        # positionals, optionals and user-defined groups
+        for action_group in self._action_groups:
+            formatter.start_section(action_group.title)
+            formatter.add_text(action_group.description)
+            formatter.add_arguments(action_group._group_actions)
+            formatter.end_section()
+
+        # epilog
+        formatter.add_text(self.epilog)
+
+        # determine help from format above
+        return formatter.format_help()
+
+    def format_version(self):
+        import warnings
+        warnings.warn(
+            'The format_version method is deprecated -- the "version" '
+            'argument to ArgumentParser is no longer supported.',
+            DeprecationWarning)
+        formatter = self._get_formatter()
+        formatter.add_text(self.version)
+        return formatter.format_help()
+
+    def _get_formatter(self):
+        return self.formatter_class(prog=self.prog)
+
+    # =====================
+    # Help-printing methods
+    # =====================
+    def print_usage(self, file=None):
+        if file is None:
+            file = _sys.stdout
+        self._print_message(self.format_usage(), file)
+
+    def print_help(self, file=None):
+        if file is None:
+            file = _sys.stdout
+        self._print_message(self.format_help(), file)
+
+    def print_version(self, file=None):
+        import warnings
+        warnings.warn(
+            'The print_version method is deprecated -- the "version" '
+            'argument to ArgumentParser is no longer supported.',
+            DeprecationWarning)
+        self._print_message(self.format_version(), file)
+
+    def _print_message(self, message, file=None):
+        if message:
+            if file is None:
+                file = _sys.stderr
+            file.write(message)
+
+    # ===============
+    # Exiting methods
+    # ===============
+    def exit(self, status=0, message=None):
+        if message:
+            self._print_message(message, _sys.stderr)
+        _sys.exit(status)
+
+    def error(self, message):
+        """error(message: string)
+
+        Prints a usage message incorporating the message to stderr and
+        exits.
+
+        If you override this in a subclass, it should not return -- it
+        should either exit or raise an exception.
+        """
+        self.print_usage(_sys.stderr)
+        self.exit(2, _('%s: error: %s\n') % (self.prog, message))
diff --git a/pyFAI-src/azimuthalIntegrator.py b/pyFAI-src/azimuthalIntegrator.py
index 4efe986..174bfac 100644
--- a/pyFAI-src/azimuthalIntegrator.py
+++ b/pyFAI-src/azimuthalIntegrator.py
@@ -27,8 +27,8 @@ __author__ = "Jérôme Kieffer"
 __contact__ = "Jerome.Kieffer at ESRF.eu"
 __license__ = "GPLv3+"
 __copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
-__date__ = "11/12/2012"
-__status__ = "beta"
+__date__ = "04/09/2013"
+__status__ = "stable"
 __docformat__ = 'restructuredtext'
 
 import os
@@ -39,17 +39,20 @@ import types
 import threading
 import gc
 import numpy
-from numpy import rad2deg, deg2rad, pi
+from math import pi
+from numpy import rad2deg
 EPS32 = (1.0 + numpy.finfo(numpy.float32).eps)
-from .geometry import Geometry
+from . import geometry
+Geometry = geometry.Geometry
 from . import units
+from . import utils
 import fabio
 error = None
 try:
     from . import ocl_azim  # IGNORE:F0401
     from . import opencl
 except ImportError as error:  # IGNORE:W0703
-    logger.error("Unable to import pyFAI.ocl_azim")
+    logger.warning("Unable to import pyFAI.ocl_azim")
     ocl_azim = None
     ocl = None
 else:
@@ -58,7 +61,7 @@ else:
 try:
     from . import splitBBoxLUT
 except ImportError as error:  # IGNORE:W0703
-    logger.error("Unable to import pyFAI.splitBBoxLUT for"
+    logger.warning("Unable to import pyFAI.splitBBoxLUT for"
                  " Look-up table based azimuthal integration")
     splitBBoxLUT = None
 
@@ -97,6 +100,8 @@ except ImportError as error:
 del error  # just to see how clever pylint is !
 
 
+
+
 class AzimuthalIntegrator(Geometry):
     """
     This class is an azimuthal integrator based on P. Boesecke's
@@ -145,10 +150,10 @@ class AzimuthalIntegrator(Geometry):
         #
         # mask and maskfile are properties pointing to self.detector
 
-        self._flatfield = None  # just a placeholder
-        self._darkcurrent = None  # just a placeholder
-        self._flatfield_crc = None  # just a placeholder
-        self._darkcurrent_crc = None  # just a placeholder
+        self._flatfield = None
+        self._darkcurrent = None
+        self._flatfield_crc = None
+        self._darkcurrent_crc = None
         self.flatfiles = None
         self.darkfiles = None
 
@@ -240,7 +245,40 @@ class AzimuthalIntegrator(Geometry):
             mask = numpy.where(numpy.logical_not(mask))
         return mask
 
-    def xrpd_numpy(self, data, nbPt, filename=None, correctSolidAngle=1,
+    def dark_correction(self, data, dark=None):
+        """
+        Correct for Dark-current effects.
+        If dark is not defined, correct for a dark set by "set_darkfiles"
+
+        @param data: input ndarray with the image
+        @param dark: ndarray with dark noise or None
+        @return: 2tuple: corrected_data, dark_actually used (or None)
+        """
+        if dark is not None:
+            return data - dark, dark
+        elif self._darkcurrent is not None:
+            return data - self._darkcurrent, self._darkcurrent
+        return data, None
+
+
+    def flat_correction(self, data, flat=None):
+        """
+        Correct for flat field.
+        If flat is not defined, correct for a flat set by "set_flatfiles"
+
+        @param data: input ndarray with the image
+        @param dark: ndarray with dark noise or None
+        @return: 2tuple: corrected_data, flat_actually used (or None)
+        """
+        if flat is not None:
+            return data / flat, flat
+        if self._flatfield is not None:
+            return data / self._flatfield, self._flatfield
+        else:
+            return data, None
+
+
+    def xrpd_numpy(self, data, nbPt, filename=None, correctSolidAngle=True,
                    tthRange=None, mask=None, dummy=None, delta_dummy=None,
                    polarization_factor=None, dark=None, flat=None):
         """
@@ -316,21 +354,21 @@ class AzimuthalIntegrator(Geometry):
         mask = self.makeMask(data, mask, dummy, delta_dummy, mode="where")
         tth = self.twoThetaArray(data.shape)[mask]
         data = numpy.ascontiguousarray(data, dtype=numpy.float32)
-        if dark is None:
-            dark = self.darkcurrent
-        if dark is not None:
-            data -= dark
-        if flat is None:
-            flat = self.flatfield
-        elif flat is not None:
-            data /= flat
+
+        data, dark = self.dark_correction(data, dark)
+        data, flat = self.flat_correction(data, flat)
+
         if correctSolidAngle:
             data /= self.solidAngleArray(data.shape)
+
         if polarization_factor is not None:
             data /= self.polarization(data.shape, factor=polarization_factor)
+
         data = data[mask]
+
         if tthRange is not None:
-            tthRange = (numpy.deg2rad(tthRange[0]), numpy.deg2rad(tthRange[-1]) * EPS32)
+            tthRange = (utils.deg2rad(tthRange[0]),
+                        utils.deg2rad(tthRange[-1]) * EPS32)
         else:
             tthRange = (tth.min(), tth.max() * EPS32)
         if nbPt not in self._nbPixCache:
@@ -343,11 +381,11 @@ class AzimuthalIntegrator(Geometry):
                                  range=tthRange)
         tthAxis = 90.0 * (b[1:] + b[:-1]) / pi
         I = val / self._nbPixCache[nbPt]
-        if filename:
-            self.save1D(filename, tthAxis, I, None, "2th_deg", dark, flat, polarization_factor)
+        self.save1D(filename, tthAxis, I, None, "2th_deg",
+                    dark, flat, polarization_factor)
         return tthAxis, I
 
-    def xrpd_cython(self, data, nbPt, filename=None, correctSolidAngle=1,
+    def xrpd_cython(self, data, nbPt, filename=None, correctSolidAngle=True,
                     tthRange=None, mask=None, dummy=None, delta_dummy=None,
                     polarization_factor=None, dark=None, flat=None,
                     pixelSize=None):
@@ -377,21 +415,20 @@ class AzimuthalIntegrator(Geometry):
         mask = self.makeMask(data, mask, dummy, delta_dummy, mode="where")
         tth = self.twoThetaArray(data.shape)[mask]
         data = numpy.ascontiguousarray(data, dtype=numpy.float32)
-        if dark is None:
-            dark = self.darkcurrent
-        if dark is not None:
-            data -= dark
-        if flat is None:
-            flat = self.flatfield
-        if flat is not None:
-            data /= flat
+
+        data, dark = self.dark_correction(data, dark)
+        data, flat = self.flat_correction(data, flat)
+
         if correctSolidAngle:
             data /= self.solidAngleArray(data.shape)
+
         if polarization_factor is not None:
             data /= self.polarization(data.shape, factor=polarization_factor)
+
         data = data[mask]
+
         if tthRange is not None:
-            tthRange = tuple([numpy.deg2rad(i) for i in tthRange])
+            tthRange = (utils.deg2rad(tthRange[0]),utils.deg2rad(tthRange[-1]))
         if dummy is None:
             dummy = 0.0
         tthAxis, I, _, _ = histogram.histogram(pos=tth,
@@ -401,11 +438,11 @@ class AzimuthalIntegrator(Geometry):
                                                pixelSize_in_Pos=pixelSize,
                                                dummy=dummy)
         tthAxis = rad2deg(tthAxis)
-        if filename:
-            self.save1D(filename, tthAxis, I, None, "2th_deg", dark, flat, polarization_factor)
+        self.save1D(filename, tthAxis, I, None, "2th_deg",
+                    dark, flat, polarization_factor)
         return tthAxis, I
 
-    def xrpd_splitBBox(self, data, nbPt, filename=None, correctSolidAngle=1,
+    def xrpd_splitBBox(self, data, nbPt, filename=None, correctSolidAngle=True,
                        tthRange=None, chiRange=None, mask=None,
                        dummy=None, delta_dummy=None,
                        polarization_factor=None, dark=None, flat=None):
@@ -509,26 +546,36 @@ class AzimuthalIntegrator(Geometry):
         else:
             chi = None
             dchi = None
+
         tth = self.twoThetaArray(data.shape)
         dtth = self.delta2Theta(data.shape)
+
         if tthRange is not None:
-            tthRange = tuple([numpy.deg2rad(i) for i in tthRange[:2]])
+            tthRange = (utils.deg2rad(tthRange[0]),utils.deg2rad(tthRange[-1]))
+
         if chiRange is not None:
-            chiRange = tuple([numpy.deg2rad(i) for i in chiRange[:2]])
+             chiRange = [utils.deg2rad(chiRange[0]), utils.deg2rad(chiRange[-1])]
+
         if flat is None:
             flat = self.flatfield
+
         if dark is None:
             dark = self.darkcurrent
+
         if correctSolidAngle:
             solidangle = self.solidAngleArray(data.shape)
         else:
             solidangle = None
-        if polarization_factor is None :
+
+        if polarization_factor is None:
             polarization = None
         else:
             polarization = self.polarization(data.shape, polarization_factor)
+
+        # ??? what about makeMask like with other methods
         if mask is None:
             mask = self.mask
+
         # outPos, outMerge, outData, outCount
         tthAxis, I, _, _ = splitBBox.histoBBox1d(weights=data,
                                                  pos0=tth,
@@ -547,12 +594,11 @@ class AzimuthalIntegrator(Geometry):
                                                  polarization=polarization,
                                                  )
         tthAxis = rad2deg(tthAxis)
-        if filename:
-            self.save1D(filename, tthAxis, I, None, "2th_deg", dark, flat, polarization_factor)
+        self.save1D(filename, tthAxis, I, None, "2th_deg", dark, flat, polarization_factor)
         return tthAxis, I
 
     def xrpd_splitPixel(self, data, nbPt,
-                        filename=None, correctSolidAngle=1,
+                        filename=None, correctSolidAngle=True,
                         tthRange=None, chiRange=None, mask=None,
                         dummy=None, delta_dummy=None,
                         polarization_factor=None, dark=None, flat=None):
@@ -651,19 +697,25 @@ class AzimuthalIntegrator(Geometry):
                                    flat=flat)
 
         pos = self.cornerArray(data.shape)
+
         if correctSolidAngle:
             solidangle = self.solidAngleArray(data.shape)
         else:
             solidangle = None
+
         if polarization_factor is None:
             polarization = None
         else:
             polarization = self.polarization(data.shape, polarization_factor)
 
         if tthRange is not None:
-            tthRange = tuple([numpy.deg2rad(i) for i in tthRange])
+            tthRange = (utils.deg2rad(tthRange[0]),utils.deg2rad(tthRange[-1]))
+
         if chiRange is not None:
-            chiRange = tuple([numpy.deg2rad(i) for i in chiRange])
+            chiRange = [utils.deg2rad(chiRange[0]), utils.deg2rad(chiRange[-1])]
+
+        # ??? what about dark and flat computation like with other methods ?
+
         tthAxis, I, _, _ = splitPixel.fullSplit1D(pos=pos,
                                                   weights=data,
                                                   bins=nbPt,
@@ -678,13 +730,13 @@ class AzimuthalIntegrator(Geometry):
                                                   polarization=polarization,
                                                   )
         tthAxis = rad2deg(tthAxis)
-        if filename:
-            self.save1D(filename, tthAxis, I, None, "2th_deg", dark, flat, polarization_factor)
+        self.save1D(filename, tthAxis, I, None, "2th_deg",
+                    dark, flat, polarization_factor)
         return tthAxis, I
     # Default implementation:
     xrpd = xrpd_splitBBox
 
-    def xrpd_OpenCL(self, data, nbPt, filename=None, correctSolidAngle=1,
+    def xrpd_OpenCL(self, data, nbPt, filename=None, correctSolidAngle=True,
                     dark=None, flat=None,
                     tthRange=None, mask=None, dummy=None, delta_dummy=None,
                     devicetype="gpu", useFp64=True,
@@ -805,10 +857,12 @@ class AzimuthalIntegrator(Geometry):
             flat = self.flatfield
         if flat is None:
             flat = 1
+
         if dark is None:
             dark = self.darkcurrent
         if dark is not None:
             data = data.astype(numpy.float32) - dark
+
         if self._ocl_integrator is None:
             with self._ocl_sem:
                 if self._ocl_integrator is None:
@@ -840,8 +894,8 @@ class AzimuthalIntegrator(Geometry):
                     pos0 = self.twoThetaArray(shape)
                     delta_pos0 = self.delta2Theta(shape)
                     if tthRange is not None and len(tthRange) > 1:
-                        pos0_min = numpy.deg2rad(min(tthRange))
-                        pos0_maxin = numpy.deg2rad(max(tthRange))
+                        pos0_min = utils.deg2rad(min(tthRange))
+                        pos0_maxin = utils.deg2rad(max(tthRange))
                     else:
                         pos0_min = pos0.min()
                         pos0_maxin = pos0.max()
@@ -872,8 +926,7 @@ class AzimuthalIntegrator(Geometry):
                     self._ocl_integrator.unsetMask()
             tthAxis, I, _, = self._ocl_integrator.execute(data)
         tthAxis = rad2deg(tthAxis)
-        if filename:
-            self.save1D(filename, tthAxis, I, None, "2th_deg")  # , dark, flat, polarization_factor)
+        self.save1D(filename, tthAxis, I, None, "2th_deg")  # , dark, flat, polarization_factor)
         return tthAxis, I
 
     def setup_LUT(self, shape, nbPt, mask=None,
@@ -971,10 +1024,10 @@ class AzimuthalIntegrator(Geometry):
                                             allow_pos0_neg=False,
                                             unit=unit)
 
-    def xrpd_LUT(self, data, nbPt, filename=None, correctSolidAngle=1,
+    def xrpd_LUT(self, data, nbPt, filename=None, correctSolidAngle=True,
                  tthRange=None, chiRange=None, mask=None,
                  dummy=None, delta_dummy=None,
-                 safe=True):
+                 safe=True, dark=None, flat=None):
         """
         Calculate the powder diffraction pattern from an image.
 
@@ -1053,8 +1106,6 @@ class AzimuthalIntegrator(Geometry):
 
         """
 
-        shape = data.shape
-        mask_crc = None
         if not splitBBoxLUT:
             logger.warning("Look-up table implementation not available:"
                            " falling back on old method !")
@@ -1065,115 +1116,32 @@ class AzimuthalIntegrator(Geometry):
                                        tthRange=tthRange,
                                        mask=mask,
                                        dummy=dummy,
-                                       delta_dummy=delta_dummy)
-
-        with self._lut_sem:
-            reset = None
-            if self._lut_integrator is None:
-                reset = "init"
-                if tthRange is None:
-                    pos0_range = None
-                else:
-                    pos0_range = [numpy.deg2rad(i) for i in tthRange]
-                if chiRange is None:
-                    pos1_range = None
-                else:
-                    pos1_range = [numpy.deg2rad(i) for i in chiRange]
-
-                if mask is None:
-                    mask = self.detector.mask
-                    # access to private member! no, not provate,
-                    # internal; moreover just a read access on it !!!
-                    mask_crc = self.detector._mask_crc
-                else:
-                    mask_crc = crc32(mask)
-
-            elif safe:
-                if tthRange is None:
-                    pos0_range = None
-                else:
-                    pos0_range = [numpy.deg2rad(i) for i in tthRange]
-                if chiRange is None:
-                    pos1_range = None
-                else:
-                    pos1_range = [numpy.deg2rad(i) for i in chiRange]
-
-                if mask is None:
-                    mask = self.detector.mask
-                    mask_crc = self.detector._mask_crc
-                else:
-                    mask_crc = crc32(mask)
-
-                if (mask is not None) and \
-                        (not self._lut_integrator.check_mask):
-                    reset = "mask but LUT was without mask"
-                elif (mask is None) and (self._lut_integrator.check_mask):
-                    reset = "no mask but LUT has mask"
-                elif (mask is not None) and \
-                        (self._lut_integrator.mask_checksum != mask_crc):
-                    reset = "mask changed"
-                if (pos0_range is None) and \
-                        (self._lut_integrator.pos0Range is not None):
-                    reset = "radial_range was defined in LUT"
-                elif (pos0_range is not None) and \
-                    (self._lut_integrator.pos0Range !=
-                            (min(pos0_range), max(pos0_range) * EPS32)):
-                    reset = ("radial_range is defined"
-                             " but not the same as in LUT")
-                if (pos1_range is None) and\
-                        (self._lut_integrator.pos1Range is not None):
-                    reset = ("azimuth_range not defined"
-                             " and LUT had azimuth_range defined")
-                elif (pos1_range is not None) and \
-                        (self._lut_integrator.pos1Range !=
-                        (min(pos1_range), max(pos1_range) * EPS32)):
-                    reset = ("azimuth_range requested and"
-                             " LUT's azimuth_range don't match")
-            if reset:
-                logger.debug("xrpd_LUT: Resetting integrator because %s" %
-                             reset)
-                try:
-                    self._lut_integrator = self.setup_LUT(shape, nbPt, mask,
-                                       pos0_range, pos1_range,
-                                       mask_checksum=mask_crc)
-                except MemoryError:  # LUT method is hungry...
-                    logger.warning("MemoryError:"
-                                   " falling back on forward implementation")
-                    self._ocl_lut_integr = None
-                    gc.collect()
-                    return self.xrpd_splitBBox(
-                        data=data, nbPt=nbPt, filename=filename,
-                        correctSolidAngle=correctSolidAngle,
-                        tthRange=tthRange, mask=mask,
-                        dummy=dummy, delta_dummy=delta_dummy)
-            if correctSolidAngle:
-                solid_angle_array = self.solidAngleArray(shape, correctSolidAngle)
-            else:
-                solid_angle_array = None
-            try:
-                tthAxis, I, _, _ = self._lut_integrator.integrate(data,
-                                                                solidAngle=solid_angle_array,
-                                                                dummy=dummy, delta_dummy=delta_dummy)
-            except MemoryError:  # LUT method is hungry...
-                logger.warning("MemoryError:"
-                               " falling back on forward implementation")
-                self._ocl_lut_integr = None
-                gc.collect()
-                return self.xrpd_splitBBox(
-                    data=data, nbPt=nbPt, filename=filename,
-                    correctSolidAngle=correctSolidAngle,
-                    tthRange=tthRange, mask=mask,
-                    dummy=dummy, delta_dummy=delta_dummy)
-        tthAxis = 180.0 * self._lut_integrator.outPos / pi
-        if filename:
-            self.save1D(filename, tthAxis, I, None, "2th_deg")  # , dark, flat, polarization_factor)
-        return tthAxis, I
-
-    def xrpd_LUT_OCL(self, data, nbPt, filename=None, correctSolidAngle=1,
+                                       delta_dummy=delta_dummy,
+                                       flat=flat,
+                                       dark=dark)
+        return self.integrate1d(data,
+                                nbPt,
+                                filename=filename,
+                                correctSolidAngle=correctSolidAngle,
+                                variance=None,
+                                error_model=None,
+                                radial_range=tthRange,
+                                azimuth_range=chiRange,
+                                mask=mask,
+                                dummy=dummy,
+                                delta_dummy=delta_dummy,
+                                polarization_factor=None,
+                                dark=dark,
+                                flat=flat,
+                                method="lut",
+                                unit="2th_deg",
+                                safe=safe)
+
+    def xrpd_LUT_OCL(self, data, nbPt, filename=None, correctSolidAngle=True,
                      tthRange=None, chiRange=None, mask=None,
                      dummy=None, delta_dummy=None,
                      safe=True, devicetype="all",
-                     platformid=None, deviceid=None):
+                     platformid=None, deviceid=None, dark=None, flat=None):
 
         """
         Calculate the powder diffraction pattern from a set of data,
@@ -1268,7 +1236,6 @@ class AzimuthalIntegrator(Geometry):
         *deviceid* you can chose a specific device (computer
         specific).
         """
-        shape = data.shape
         if not (splitBBoxLUT and ocl_azim_lut):
             logger.warning("Look-up table implementation not available:"
                            " falling back on old method !")
@@ -1280,110 +1247,32 @@ class AzimuthalIntegrator(Geometry):
                                        mask=mask,
                                        dummy=dummy,
                                        delta_dummy=delta_dummy)
-        if correctSolidAngle:
-            solid_angle_array = self.solidAngleArray(shape, correctSolidAngle)
-            solid_angle_crc = self._dssa_crc
-        else:
-            solid_angle_array = None
-            solid_angle_crc = None
-        mask_crc = None
-        with self._lut_sem:
-            reset = None
-            if self._lut_integrator is None:
-                reset = "init"
-                if tthRange is None:
-                    pos0_range = None
-                else:
-                    pos0_range = [numpy.deg2rad(i) for i in tthRange]
-                if chiRange is None:
-                    pos1_range = None
-                else:
-                    pos1_range = [numpy.deg2rad(i) for i in chiRange]
-
-                if mask is None:
-                    mask = self.detector.mask
-                    mask_crc = self.detector._mask_crc
-                else:
-                    mask_crc = crc32(mask)
-            if (not reset) and safe:
-                if tthRange is None:
-                    pos0_range = None
-                else:
-                    pos0_range = [numpy.deg2rad(i) for i in tthRange]
-                if chiRange is None:
-                    pos1_range = None
-                else:
-                    pos1_range = [numpy.deg2rad(i) for i in chiRange]
-
-                if mask is None:
-                    mask = self.detector.mask
-                    mask_crc = self.detector._mask_crc
-                else:
-                    mask_crc = crc32(mask)
-
-                if (mask is not None) and\
-                        (not self._lut_integrator.check_mask):
-                    reset = "mask but LUT was without mask"
-                elif (mask is None) and (self._lut_integrator.check_mask):
-                    reset = "no mask but LUT has mask"
-                elif (mask is not None) and\
-                        (self._lut_integrator.mask_checksum != mask_crc):
-                    reset = "mask changed"
-                if (pos0_range is None) and\
-                        (self._lut_integrator.pos0Range is not None):
-                    reset = "radial_range was defined in LUT"
-                elif (pos0_range is not None) and\
-                        (self._lut_integrator.pos0Range !=
-                            (min(pos0_range), max(pos0_range) * EPS32)):
-                    reset = ("radial_range is defined"
-                             " but not the same as in LUT")
-                if (pos1_range is None) and\
-                        (self._lut_integrator.pos1Range is not None):
-                    reset = ("azimuth_range not defined and"
-                             " LUT had azimuth_range defined")
-                elif (pos1_range is not None) and\
-                        (self._lut_integrator.pos1Range !=
-                        (min(pos1_range), max(pos1_range) * EPS32)):
-                    reset = ("azimuth_range requested and"
-                             " LUT's azimuth_range don't match")
-
-            if reset:
-                logger.debug("xrpd_LUT_OCL:"
-                             " Resetting integrator because of %s" % reset)
-                try:
-                    self._lut_integrator = self.setup_LUT(shape, nbPt, mask,
-                                       tthRange, chiRange,
-                                       mask_checksum=mask_crc)
-                except MemoryError:  # LUT method is hungry...
-                    logger.warning("MemoryError:"
-                                   " falling back on forward implementation")
-                    self._ocl_lut_integr = None
-                    gc.collect()
-                    return self.xrpd_splitBBox(
-                        data=data, nbPt=nbPt, filename=filename,
-                        correctSolidAngle=correctSolidAngle,
-                        tthRange=tthRange, mask=mask,
-                        dummy=dummy, delta_dummy=delta_dummy)
-
-            tthAxis = 180.0 * self._lut_integrator.outPos / pi
-            with self._ocl_lut_sem:
-                if (self._ocl_lut_integr is None) or \
-                        (self._ocl_lut_integr.on_device["lut"] != self._lut_integrator.lut_checksum):
-                    self._ocl_lut_integr = ocl_azim_lut.OCL_LUT_Integrator(
-                        self._lut_integrator.lut,
-                        self._lut_integrator.size,
-                        devicetype, platformid=platformid, deviceid=deviceid,
-                        checksum=self._lut_integrator.lut_checksum)
-                I, _, _ = self._ocl_lut_integr.integrate(
-                    data, solidAngle=solid_angle_array,
-                    solidAngle_checksum=solid_angle_crc,
-                    dummy=dummy, delta_dummy=delta_dummy)
-        if filename:
-            self.save1D(filename, tthAxis, I, None, "2th_deg")  # dark, flat, polarization
-        return tthAxis, I
+        meth = "lut_ocl"
+        if platformid and deviceid:
+            meth += "_%i,%i" % (platformid, deviceid)
+        elif devicetype != "all":
+            meth += "_" + devicetype
+
+        return self.integrate1d(data,
+                                nbPt,
+                                filename=filename,
+                                correctSolidAngle=correctSolidAngle,
+                                variance=None,
+                                error_model=None,
+                                radial_range=tthRange,
+                                azimuth_range=chiRange,
+                                mask=mask,
+                                dummy=dummy,
+                                delta_dummy=delta_dummy,
+                                polarization_factor=None,
+                                dark=dark,
+                                flat=flat,
+                                method=meth,
+                                unit="2th_deg",
+                                safe=safe)
 
     def xrpd2_numpy(self, data, nbPt2Th, nbPtChi=360,
-                    filename=None, correctSolidAngle=1,
+                    filename=None, correctSolidAngle=True,
                     dark=None, flat=None,
                     tthRange=None, chiRange=None,
                     mask=None, dummy=None, delta_dummy=None):
@@ -1456,15 +1345,10 @@ class AzimuthalIntegrator(Geometry):
         shape = data.shape
         tth = self.twoThetaArray(shape)[mask]
         chi = self.chiArray(shape)[mask]
+        data, dark = self.dark_correction(data, dark)
+        data, flat = self.flat_correction(data, flat)
         data = data.astype(numpy.float32)[mask]
-        if dark is None:
-            dark = self.darkcurrent
-        if dark is not None:
-            data -= dark[mask]
-        if flat is None:
-            flat = self.flatfield
-        if flat is not None:
-            data /= flat[mask]
+
         if correctSolidAngle is not None:
             data /= self.solidAngleArray(shape, correctSolidAngle)[mask]
 
@@ -1472,8 +1356,9 @@ class AzimuthalIntegrator(Geometry):
             tthRange = [deg2rad(tthRange[0]), deg2rad(tthRange[-1])]
         else:
             tthRange = [tth.min(), tth.max() * EPS32]
+
         if chiRange is not None:
-            chiRange = [deg2rad(chiRange[0]), deg2rad(chiRange[-1])]
+            chiRange = [utils.deg2rad(chiRange[0]), utils.deg2rad(chiRange[-1])]
         else:
             chiRange = [chi.min(), chi.max() * EPS32]
 
@@ -1489,13 +1374,12 @@ class AzimuthalIntegrator(Geometry):
                                                   weights=data,
                                                   range=[chiRange, tthRange])
         I = val / self._nbPixCache[bins]
-        if filename:
-            self.save2D(filename, I, bins2Th, binsChi)  # , dark, flat, polarization_factor)
+        self.save2D(filename, I, bins2Th, binsChi)  # , dark, flat, polarization_factor)
 
         return I, bins2Th, binsChi
 
     def xrpd2_histogram(self, data, nbPt2Th, nbPtChi=360,
-                        filename=None, correctSolidAngle=1,
+                        filename=None, correctSolidAngle=True,
                         dark=None, flat=None,
                         tthRange=None, chiRange=None, mask=None,
                         dummy=None, delta_dummy=None):
@@ -1580,20 +1464,24 @@ class AzimuthalIntegrator(Geometry):
                                     delta_dummy=delta_dummy)
 
         mask = self.makeMask(data, mask, dummy, delta_dummy, mode="numpy")
-        shape = data.shape
         tth = self.twoThetaArray(data.shape)[mask]
         chi = self.chiArray(data.shape)[mask]
         data = data.astype(numpy.float32)[mask]
+
+        # ??? idem here
         if dark is None:
             dark = self.darkcurrent
         if dark is not None:
             data -= dark[mask]
+
         if flat is None:
             flat = self.flatfield
         if flat is not None:
             data /= flat[mask]
+
         if correctSolidAngle is not None:
             data /= self.solidAngleArray(data.shape)[mask]
+
         if dummy is None:
             dummy = 0.0
             I, binsChi, bins2Th, _, _ = histogram.histogram2d(pos0=chi, pos1=tth,
@@ -1603,12 +1491,11 @@ class AzimuthalIntegrator(Geometry):
                                       dummy=dummy)
         bins2Th = rad2deg(bins2Th)
         binsChi = rad2deg(binsChi)
-        if filename:
-            self.save2D(filename, I, bins2Th, binsChi)  # , dark, flat, polarization_factor)
+        self.save2D(filename, I, bins2Th, binsChi)  # , dark, flat, polarization_factor)
         return I, bins2Th, binsChi
 
     def xrpd2_splitBBox(self, data, nbPt2Th, nbPtChi=360,
-                        filename=None, correctSolidAngle=1,
+                        filename=None, correctSolidAngle=True,
                         tthRange=None, chiRange=None, mask=None,
                         dummy=None, delta_dummy=None,
                         polarization_factor=None, dark=None, flat=None):
@@ -1707,18 +1594,24 @@ class AzimuthalIntegrator(Geometry):
         chi = self.chiArray(data.shape)
         dtth = self.delta2Theta(data.shape)
         dchi = self.deltaChi(data.shape)
+
         if tthRange is not None:
-            tthRange = tuple([numpy.deg2rad(i) for i in tthRange])
+            tthRange = (utils.deg2rad(tthRange[0]), utils.deg2rad(tthRange[-1]))
+
         if chiRange is not None:
-            chiRange = tuple([numpy.deg2rad(i) for i in chiRange])
+            chiRange = [utils.deg2rad(chiRange[0]), utils.deg2rad(chiRange[-1])]
+
         if dark is None:
             dark = self.darkcurrent
+
         if flat is None:
             flat = self.flatfield
+
         if correctSolidAngle:
             solidangle = self.solidAngleArray(data.shape)
         else:
             solidangle = None
+
         if polarization_factor is None:
             polarization = None
         else:
@@ -1741,12 +1634,12 @@ class AzimuthalIntegrator(Geometry):
                                   polarization=polarization)
         bins2Th = rad2deg(bins2Th)
         binsChi = rad2deg(binsChi)
-        if filename:
-            self.save2D(filename, I, bins2Th, binsChi, dark=dark, flat=flat, polarization_factor=polarization_factor)
+        self.save2D(filename, I, bins2Th, binsChi, dark=dark, flat=flat,
+                    polarization_factor=polarization_factor)
         return I, bins2Th, binsChi
 
     def xrpd2_splitPixel(self, data, nbPt2Th, nbPtChi=360,
-                         filename=None, correctSolidAngle=1,
+                         filename=None, correctSolidAngle=True,
                          tthRange=None, chiRange=None, mask=None,
                          dummy=None, delta_dummy=None,
                          polarization_factor=None, dark=None, flat=None):
@@ -1847,19 +1740,28 @@ class AzimuthalIntegrator(Geometry):
                 flat=flat)
 
         pos = self.cornerArray(data.shape)
+
         if correctSolidAngle:
             solidangle = self.solidAngleArray(data.shape)
         else:
             solidangle = None
+
         if polarization_factor is None:
             polarization = None
         else:
             polarization = self.polarization(data.shape, polarization_factor)
 
+        if dark is None:
+            dark = self.darkcurrent
+
+        if flat is None:
+            flat = self.flatfield
+
         if tthRange is not None:
-            tthRange = tuple([numpy.deg2rad(i) for i in tthRange])
+            tthRange = (utils.deg2rad(tthRange[0]), utils.deg2rad(tthRange[-1]))
+
         if chiRange is not None:
-            chiRange = tuple([numpy.deg2rad(i) for i in chiRange])
+            chiRange = [utils.deg2rad(chiRange[0]), utils.deg2rad(chiRange[-1])]
 
         I, bins2Th, binsChi, _, _ = splitPixel.fullSplit2D(pos=pos,
                                    weights=data,
@@ -1875,8 +1777,8 @@ class AzimuthalIntegrator(Geometry):
                                    polarization=polarization,)
         bins2Th = rad2deg(bins2Th)
         binsChi = rad2deg(binsChi)
-        if filename:
-            self.save2D(filename, I, bins2Th, binsChi, dark=dark, flat=flat, polarization_factor=polarization_factor)
+        self.save2D(filename, I, bins2Th, binsChi, dark=dark, flat=flat,
+                    polarization_factor=polarization_factor)
         return I, bins2Th, binsChi
     xrpd2 = xrpd2_splitBBox
 
@@ -1904,12 +1806,12 @@ class AzimuthalIntegrator(Geometry):
         return out
 
     def integrate1d(self, data, nbPt, filename=None,
-                    correctSolidAngle=1,
+                    correctSolidAngle=True,
                     variance=None, error_model=None,
                     radial_range=None, azimuth_range=None,
                     mask=None, dummy=None, delta_dummy=None,
                     polarization_factor=None, dark=None, flat=None,
-                    method="lut", unit=units.Q, safe=True):
+                    method="lut", unit=units.Q, safe=True, normalization_factor=None):
         """
         Calculate the azimuthal integrated Saxs curve in q(nm^-1) by
         default
@@ -1950,6 +1852,8 @@ class AzimuthalIntegrator(Geometry):
         @type unit: pyFAI.units.Enum
         @param safe: Do some extra checks to ensure LUT is still valid. False is faster.
         @type safe: bool
+        @param normalization_factor: Value of a normalization monitor
+        @type normalization_factor: float
 
         @return: azimuthaly regrouped data, 2theta pos. and chi pos.
         @rtype: 3-tuple of ndarrays
@@ -1957,18 +1861,23 @@ class AzimuthalIntegrator(Geometry):
         method = method.lower()
         unit = units.to_unit(unit)
         pos0_scale = 1.0  # nota we need anyway to make a copy !
+
         if mask is None:
             mask = self.mask
+
         shape = data.shape
         pos0_scale = unit.scale
+
         if radial_range:
             radial_range = tuple([i / pos0_scale for i in radial_range])
+
         if variance is not None:
             assert variance.size == data.size
         elif error_model:
             error_model = error_model.lower()
             if error_model == "poisson":
                 variance = numpy.ascontiguousarray(data, numpy.float32)
+
         if azimuth_range is not None:
             azimuth_range = tuple([numpy.deg2rad(i) for i in azimuth_range])
             chi = self.chiArray(shape)
@@ -1979,6 +1888,7 @@ class AzimuthalIntegrator(Geometry):
             solidangle = self.solidAngleArray(shape, correctSolidAngle)
         else:
             solidangle = None
+
         if polarization_factor is None:
             polarization = None
         else:
@@ -1986,6 +1896,7 @@ class AzimuthalIntegrator(Geometry):
 
         if dark is None:
             dark = self.darkcurrent
+
         if flat is None:
             flat = self.flatfield
 
@@ -2195,57 +2106,9 @@ class AzimuthalIntegrator(Geometry):
                                                            )
                     sigma = numpy.sqrt(a) / numpy.maximum(b, 1)
 
-        if (I is None) and ("cython" in method):
-            if histogram is None:
-                logger.warning("pyFAI.histogram is not available,"
-                               " falling back on numpy")
-                method = "numpy"
-            else:
-                logger.debug("integrate1d uses cython implementation")
-                data = numpy.ascontiguousarray(data, dtype=numpy.float32)
-                mask = self.makeMask(data, mask, dummy, delta_dummy,
-                                     mode="numpy")
-                pos0 = self.array_from_unit(shape, "center", unit)
-                if radial_range is not None:
-                    mask *= (pos0 >= min(radial_range))
-                    mask *= (pos0 <= max(radial_range))
-                if azimuth_range is not None:
-                    chiMin, chiMax = azimuth_range
-                    chi = self.chiArray(shape)
-                    mask *= (chi >= chiMin) * (chi <= chiMax)
-                mask = numpy.where(mask)
-                pos0 = pos0[mask]
-                if variance is not None:
-                    variance = variance[mask]
-                if dark is not None:
-                    data -= dark
-                if flat is not None:
-                    data /= flat
-                if polarization is not None:
-                    data /= polarization
-                if solidangle is not None:
-                    data /= solidangle
-                data = data[mask]
-                if dummy is None:
-                    dummy = 0
-                qAxis, I, a, b = histogram.histogram(pos=pos0,
-                                                     weights=data,
-                                                     bins=nbPt,
-                                                     pixelSize_in_Pos=0,
-                                                     dummy=dummy)
-                if error_model == "azimuthal":
-                    variance = (data - self.calcfrom1d(qAxis * pos0_scale, I, dim1_unit=unit, correctSolidAngle=False)[mask]) ** 2
-                if variance is not None:
-                    _, var1d, a, b = histogram.histogram(pos=pos0,
-                                                         weights=variance,
-                                                         bins=nbPt,
-                                                         pixelSize_in_Pos=1,
-                                                         dummy=dummy)
-                    sigma = numpy.sqrt(a) / numpy.maximum(b, 1)
-
         if I is None:
-            logger.debug("integrate1d uses Numpy implementation")
-            data = numpy.ascontiguousarray(data, dtype=numpy.float32)
+            #Common part for  Numpy and Cython
+            data = data.astype(numpy.float32)
             mask = self.makeMask(data, mask, dummy, delta_dummy, mode="numpy")
             pos0 = self.array_from_unit(shape, "center", unit)
             if radial_range is not None:
@@ -2270,6 +2133,33 @@ class AzimuthalIntegrator(Geometry):
                 variance = variance[mask]
             if radial_range is None:
                 radial_range = (pos0.min(), pos0.max() * EPS32)
+
+            if ("cython" in method):
+                if histogram is not None:
+                    logger.debug("integrate1d uses cython implementation")
+                    if dummy is None:
+                        dummy = 0
+                    qAxis, I, a, b = histogram.histogram(pos=pos0,
+                                                         weights=data,
+                                                         bins=nbPt,
+                                                         pixelSize_in_Pos=0,
+                                                         dummy=dummy)
+                    if error_model == "azimuthal":
+                        variance = (data - self.calcfrom1d(qAxis * pos0_scale, I, dim1_unit=unit, correctSolidAngle=False)[mask]) ** 2
+                    if variance is not None:
+                        _, var1d, a, b = histogram.histogram(pos=pos0,
+                                                             weights=variance,
+                                                             bins=nbPt,
+                                                             pixelSize_in_Pos=1,
+                                                             dummy=dummy)
+                        sigma = numpy.sqrt(a) / numpy.maximum(b, 1)
+                else:
+                    logger.warning("pyFAI.histogram is not available,"
+                               " falling back on numpy")
+                    method = "numpy"
+        if I is None:
+            logger.debug("integrate1d uses Numpy implementation")
+            method = "numpy"
             ref, b = numpy.histogram(pos0, nbPt, range=radial_range)
             qAxis = (b[1:] + b[:-1]) / 2.0
             count = numpy.maximum(1, ref)
@@ -2282,19 +2172,26 @@ class AzimuthalIntegrator(Geometry):
             I = val / count
         if pos0_scale:
             qAxis = qAxis * pos0_scale
-        if filename:
-            self.save1D(filename, qAxis, I, sigma, unit, dark, flat, polarization_factor)
+        if normalization_factor:
+            I /= normalization_factor
+            if sigma is not None:
+                sigma /= normalization_factor
+
+        self.save1D(filename, qAxis, I, sigma, unit,
+                    dark, flat, polarization_factor, normalization_factor)
+
         if sigma is not None:
             return qAxis, I, sigma
         else:
             return qAxis, I
 
     def integrate2d(self, data, nbPt_rad, nbPt_azim=360,
-                    filename=None, correctSolidAngle=1, variance=None,
+                    filename=None, correctSolidAngle=True, variance=None,
                     error_model=None, radial_range=None, azimuth_range=None,
                     mask=None, dummy=None, delta_dummy=None,
                     polarization_factor=None, dark=None, flat=None,
-                    method="bbox", unit=units.Q, safe=True):
+                    method="bbox", unit=units.Q, safe=True,
+                    normalization_factor=None):
         """
         Calculate the azimuthal regrouped 2d image in q(nm^-1)/deg by default
 
@@ -2336,6 +2233,8 @@ class AzimuthalIntegrator(Geometry):
         @type unit: pyFAI.units.Enum
         @param safe: Do some extra checks to ensure LUT is still valid. False is faster.
         @type safe: bool
+        @param normalization_factor: Value of a normalization monitor
+        @type normalization_factor: float
 
         @return: azimuthaly regrouped data, 2theta pos. and chi pos.
         @rtype: 3-tuple of ndarrays (2d, 1d, 1d)
@@ -2347,14 +2246,17 @@ class AzimuthalIntegrator(Geometry):
         if mask is None:
             mask = self.mask
         shape = data.shape
+
         if radial_range:
-            radial_range = tuple([i / pos0_scale  for i in radial_range])
+            radial_range = tuple([i / pos0_scale for i in radial_range])
+
         if variance is not None:
             assert variance.size == data.size
         elif error_model:
             error_model = error_model.lower()
             if error_model == "poisson":
                 variance = numpy.ascontiguousarray(data, numpy.float32)
+
         if azimuth_range is not None:
             azimuth_range = tuple([numpy.deg2rad(i) for i in azimuth_range])
 
@@ -2362,6 +2264,7 @@ class AzimuthalIntegrator(Geometry):
             solidangle = self.solidAngleArray(shape, correctSolidAngle)
         else:
             solidangle = None
+
         if polarization_factor is None:
             polarization = None
         else:
@@ -2369,6 +2272,7 @@ class AzimuthalIntegrator(Geometry):
 
         if dark is None:
             dark = self.darkcurrent
+
         if flat is None:
             flat = self.flatfield
 
@@ -2463,11 +2367,6 @@ class AzimuthalIntegrator(Geometry):
                             I = I.T
                             bins_rad = self._lut_integrator.outPos0  # this will be copied later
                             bins_azim = self._lut_integrator.outPos1
-#                            if error_model == "azimuthal":
-#                                variance = (data - self.calcfrom1d(qAxis * pos0_scale, I, dim1_unit=unit)) ** 2
-#                            if variance is not None:
-#                                var1d, a, b = self._ocl_lut_integr.integrate(variance, solidAngle=None, dummy=dummy, delta_dummy=delta_dummy)
-#                                sigma = numpy.sqrt(a) / numpy.maximum(b, 1)
                     else:
                         I, bins_rad, bins_azim, _, _ = self._lut_integrator.integrate(data, dark=dark, flat=flat,
                                                                                       solidAngle=solidangle,
@@ -2475,12 +2374,6 @@ class AzimuthalIntegrator(Geometry):
                                                                                       delta_dummy=delta_dummy,
                                                                                       polarization=polarization)
 
-#                        if error_model == "azimuthal":
-#                            variance = (data - self.calcfrom1d(qAxis * pos0_scale, I, dim1_unit=unit)) ** 2
-#                        if variance is not None:
-#                            qAxis, I, a, b = self._lut_integrator.integrate(variance, solidAngle=None, dummy=dummy, delta_dummy=delta_dummy)
-#                            sigma = numpy.sqrt(a) / numpy.maximum(b, 1)
-
         if (I is None) and ("splitpix" in method):
             if splitPixel is None:
                 logger.warning("splitPixel is not available;"
@@ -2501,20 +2394,6 @@ class AzimuthalIntegrator(Geometry):
                                                                       flat=flat,
                                                                       solidangle=solidangle,
                                                                       polarization=polarization)
-#                if error_model == "azimuthal":
-#                    variance = (data - self.calcfrom1d(qAxis * pos0_scale, I, dim1_unit=unit)) ** 2
-#                if variance is not None:
-#                    qa, var1d, a, b = splitPixel.fullSplit1D(pos=pos,
-#                                                             weights=variance,
-#                                                             bins=nbPt,
-#                                                             pos0Range=radial_range,
-#                                                             pos1Range=azimuth_range,
-#                                                             dummy=dummy,
-#                                                             delta_dummy=delta_dummy,
-#                                                             mask=mask,
-#                                                             )
-#                    sigma = numpy.sqrt(a) / numpy.maximum(b, 1)
-
         if (I is None) and ("bbox" in method):
             if splitBBox is None:
                 logger.warning("splitBBox is not available;"
@@ -2541,125 +2420,85 @@ class AzimuthalIntegrator(Geometry):
                                                                       flat=flat,
                                                                       solidangle=solidangle,
                                                                       polarization=polarization)
-#                if error_model == "azimuthal":
-#                    variance = (data - self.calcfrom1d(qAxis * pos0_scale, I, dim1_unit=unit)) ** 2
-#                if variance is not None:
-#                    qa, var1d, a, b = splitBBox.histoBBox1d(weights=variance,
-#                                                      pos0=pos0,
-#                                                      delta_pos0=dpos0,
-#                                                      pos1=chi,
-#                                                      delta_pos1=dchi,
-#                                                      bins=nbPt,
-#                                                      pos0Range=radial_range,
-#                                                      pos1Range=azimuth_range,
-#                                                      dummy=dummy,
-#                                                      delta_dummy=delta_dummy,
-#                                                      mask=mask,
-#                                                      )
-#                    sigma = numpy.sqrt(a) / numpy.maximum(b, 1)
-
-        if (I is None) and ("cython" in method):
-            if histogram is None:
-                logger.warning("Cython histogram is not available;"
-                               " falling back on numpy histogram")
-                method = "numpy"
+
+        if (I is None):
+            logger.debug("integrate2d uses cython implementation")
+            data = data.astype(numpy.float32) # it is important to make a copy see issue #88
+            mask = self.makeMask(data, mask, dummy, delta_dummy,
+                                 mode="numpy")
+            pos0 = self.array_from_unit(shape, "center", unit)
+            pos1 = self.chiArray(shape)
+
+            if radial_range is not None:
+                mask *= (pos0 >= min(radial_range)) * (pos0 <= max(radial_range))
             else:
-                logger.debug("integrate2d uses cython implementation")
-                data = numpy.ascontiguousarray(data, dtype=numpy.float32)
-                mask = self.makeMask(data, mask, dummy, delta_dummy,
-                                     mode="numpy")
-                pos0 = self.array_from_unit(shape, "center", unit)
-                pos1 = self.chiArray(shape)
-                if radial_range is not None:
-                    mask *= (pos0 >= min(radial_range))
-                    mask *= (pos0 <= min(radial_range))
-                if azimuth_range is not None:
-                    mask *= (pos1 >= min(azimuth_range))
-                    mask *= (pos1 <= max(azimuth_range))
-                if variance is not None:
-                    variance = variance[mask]
-                if dark is not None:
-                    data -= dark
-                if flat is not None:
-                    data /= flat
-                if polarization is not None:
-                    data /= polarization
-                if solidangle is not None:
-                    data /= solidangle
-                data = data[mask]
-                pos0 = pos0[mask]
-                pos1 = pos1[mask]
-                if dummy is None:
-                    dummy = 0
-                I, bins_azim, bins_rad, _a, _b = histogram.histogram2d(pos0=pos1,
-                                                                       pos1=pos0,
-                                                                       weights=data,
-                                                                       bins=(nbPt_azim, nbPt_rad),
-                                                                       split=False,
-                                                                       dummy=dummy)
-#                if error_model == "azimuthal":
-#                    variance = (data - self.calcfrom1d(qAxis * pos0_scale, I, dim1_unit=unit, correctSolidAngle=False)[mask]) ** 2
-#                if variance is not None:
-#                    qa, var1d, a, b = histogram.histogram(pos=q,
-#                                                   weights=variance,
-#                                                   bins=nbPt,
-#                                                   pixelSize_in_Pos=1,
-#                                                   dummy=dummy)
-#                    sigma = numpy.sqrt(a) / numpy.maximum(b, 1)
+                radial_range = [pos0.min(), pos0.max() * EPS32]
+
+            if azimuth_range is not None:
+                mask *= (pos1 >= min(azimuth_range)) * (pos1 <= max(azimuth_range))
+            else:
+                azimuth_range = [pos1.min(), pos1.max() * EPS32]
+
+            if variance is not None:
+                variance = variance[mask]
 
-        if I is None:
-            logger.debug("integrate2d uses Numpy implementation")
-            data = numpy.ascontiguousarray(data, dtype=numpy.float32)
-            mask = self.makeMask(data, mask, dummy, delta_dummy, mode="numpy")
             if dark is not None:
                 data -= dark
+
             if flat is not None:
                 data /= flat
+
             if polarization is not None:
                 data /= polarization
+
             if solidangle is not None:
                 data /= solidangle
-            pos0 = self.array_from_unit(shape, "center", unit)
-            pos1 = self.chiArray(shape)
-            if radial_range is not None:
-                mask *= (pos0 >= min(radial_range))
-                mask *= (pos0 <= min(radial_range))
-            else:
-                radial_range = [pos0.min(), pos0.max() * EPS32]
-            if azimuth_range is not None:
-                mask *= (pos1 >= min(azimuth_range))
-                mask *= (pos1 <= max(azimuth_range))
-            else:
-                azimuth_range = [pos1.min(), pos1.max() * EPS32]
+
             data = data[mask]
             pos0 = pos0[mask]
             pos1 = pos1[mask]
-#            if variance is not None:
-#                variance = variance[mask]
+            if ("cython" in method):
+                if histogram is None:
+                    logger.warning("Cython histogram is not available;"
+                                   " falling back on numpy histogram")
+                    method = "numpy"
+                else:
+                    if dummy is None:
+                        dummy = 0
+                    I, bins_azim, bins_rad, _a, _b = histogram.histogram2d(pos0=pos1,
+                                                                           pos1=pos0,
+                                                                           weights=data,
+                                                                           bins=(nbPt_azim, nbPt_rad),
+                                                                           split=False,
+                                                                           dummy=dummy)
+
+        if I is None:
+            logger.debug("integrate2d uses Numpy implementation")
             ref, b, c = numpy.histogram2d(pos1, pos0, (nbPt_azim, nbPt_rad), range=[azimuth_range, radial_range])
             bins_azim = (b[1:] + b[:-1]) / 2.0
             bins_rad = (c[1:] + c[:-1]) / 2.0
             count = numpy.maximum(1, ref)
             val, b, c = numpy.histogram2d(pos1, pos0, (nbPt_azim, nbPt_rad),
                                           weights=data, range=[azimuth_range, radial_range])
-#            if error_model == "azimuthal":
-#                variance = (data - self.calcfrom1d(qAxis * pos0_scale, I, dim1_unit=unit, correctSolidAngle=False)[mask]) ** 2
-#            if variance is not None:
-#                var1d, b = numpy.histogram(pos0, nbPt, weights=variance)
-#                sigma = numpy.sqrt(var1d) / count
             I = val / count
         # I know I make copies ....
         bins_rad = bins_rad * pos0_scale
         bins_azim = bins_azim * 180.0 / pi
-        if filename:
-            self.save2D(filename, I, bins_rad, bins_azim, sigma, unit, dark=dark, flat=flat, polarization_factor=polarization_factor)
+
+        if normalization_factor:
+            I /= normalization_factor
+
+        self.save2D(filename, I, bins_rad, bins_azim, sigma, unit,
+                    dark=dark, flat=flat, polarization_factor=polarization_factor,
+                    normalization_factor=normalization_factor)
         if sigma is not None:
             return I, bins_rad, bins_azim, sigma
         else:
             return I, bins_rad, bins_azim
 
+
     def saxs(self, data, nbPt, filename=None,
-             correctSolidAngle=1, variance=None,
+             correctSolidAngle=True, variance=None,
              error_model=None, qRange=None, chiRange=None,
              mask=None, dummy=None, delta_dummy=None,
              polarization_factor=None, dark=None, flat=None,
@@ -2723,10 +2562,17 @@ class AzimuthalIntegrator(Geometry):
         else:
             return out
 
-    def makeHeaders(self, hdr="#", dark=None, flat=None, polarization_factor=None):
+    def makeHeaders(self, hdr="#", dark=None, flat=None,
+                    polarization_factor=None, normalization_factor=None):
         """
         @param hdr: string used as comment in the header
         @type hdr: str
+        @param dark: save the darks filenames (default: no)
+        @type dark: ???
+        @param flat: save the flat filenames (default: no)
+        @type flat: ???
+        @param polarization_factor: the polarization factor
+        @type polarization_factor: float
 
         @return: the header
         @rtype: str
@@ -2764,15 +2610,43 @@ class AzimuthalIntegrator(Geometry):
                     headerLst.append("Flat field: %s" % self.flatfiles)
                 else:
                     headerLst.append("Flat field: Done with unknown file")
+            if polarization_factor is None and self._polarization is not None:
+                polarization_factor = self._polarization_factor
             headerLst.append("Polarization factor: %s" % polarization_factor)
+            headerLst.append("Normalization factor: %s" % normalization_factor)
             self.header = os.linesep.join([hdr + " " + i for i in headerLst])
         return self.header
 
-    def save1D(self, filename, dim1, I, error=None, dim1_unit=units.TTH, dark=None, flat=None, polarization_factor=None):
+    def save1D(self, filename, dim1, I, error=None, dim1_unit=units.TTH,
+               dark=None, flat=None, polarization_factor=None, normalization_factor=None):
+        """
+        @param filename: the filename used to save the 1D integration
+        @type filename: str
+        @param dim1: the x coordinates of the integrated curve
+        @type dim1: numpy.ndarray
+        @param I: The integrated intensity
+        @type I: numpy.mdarray
+        @param error: the error bar for each intensity
+        @type error: numpy.ndarray or None
+        @param dim1_unit: the unit of the dim1 array
+        @type dim1_unit: pyFAI.units.Unit
+        @param dark: save the darks filenames (default: no)
+        @type dark: ???
+        @param flat: save the flat filenames (default: no)
+        @type flat: ???
+        @param polarization_factor: the polarization factor
+        @type polarization_factor: float
+        @param normalization_factor: the monitor value
+        @type normalization_factor: float
+
+        This method save the result of a 1D integration.
+        """
         dim1_unit = units.to_unit(dim1_unit)
         if filename:
             with open(filename, "w") as f:
-                f.write(self.makeHeaders(dark=dark, flat=flat, polarization_factor=polarization_factor))
+                f.write(self.makeHeaders(dark=dark, flat=flat,
+                                         polarization_factor=polarization_factor,
+                                         normalization_factor=normalization_factor))
                 f.write("%s# --> %s%s" % (os.linesep, filename, os.linesep))
                 if error is None:
                     f.write("#%14s %14s %s" % (dim1_unit.REPR, "I ", os.linesep))
@@ -2783,10 +2657,42 @@ class AzimuthalIntegrator(Geometry):
                     f.write(os.linesep.join(["%14.6e  %14.6e %14.6e" % (t, i, s) for t, i, s in zip(dim1, I, error)]))
                 f.write(os.linesep)
 
-    def save2D(self, filename, I, dim1, dim2, error=None, dim1_unit=units.TTH, dark=None, flat=None, polarization_factor=None):
+    def save2D(self, filename, I, dim1, dim2, error=None, dim1_unit=units.TTH,
+               dark=None, flat=None, polarization_factor=None, normalization_factor=None):
+        """
+        @param filename: the filename used to save the 2D histogram
+        @type filename: str
+        @param dim1: the 1st coordinates of the histogram
+        @type dim1: numpy.ndarray
+        @param dim1: the 2nd coordinates of the histogram
+        @type dim1: numpy.ndarray
+        @param I: The integrated intensity
+        @type I: numpy.mdarray
+        @param error: the error bar for each intensity
+        @type error: numpy.ndarray or None
+        @param dim1_unit: the unit of the dim1 array
+        @type dim1_unit: pyFAI.units.Unit
+        @param dark: save the darks filenames (default: no)
+        @type dark: ???
+        @param flat: save the flat filenames (default: no)
+        @type flat: ???
+        @param polarization_factor: the polarization factor
+        @type polarization_factor: float
+        @param normalization_factor: the monitor value
+        @type normalization_factor: float
+
+        This method save the result of a 2D integration.
+        """
+        if not filename:
+            return
+
         dim1_unit = units.to_unit(dim1_unit)
-        header_keys = ["dist", "poni1", "poni2", "rot1", "rot2", "rot3", "chi_min", "chi_max", dim1_unit.REPR + "_min", dim1_unit.REPR + "_max", "pixelX", "pixelY",
-                       "dark", "flat", "polarization"]
+        header_keys = ["dist", "poni1", "poni2", "rot1", "rot2", "rot3",
+                       "chi_min", "chi_max",
+                       dim1_unit.REPR + "_min",
+                       dim1_unit.REPR + "_max",
+                       "pixelX", "pixelY",
+                       "dark", "flat", "polarization_factor", "normalization_factor"]
         header = {"dist": str(self._dist),
                   "poni1": str(self._poni1),
                   "poni2": str(self._poni2),
@@ -2799,7 +2705,9 @@ class AzimuthalIntegrator(Geometry):
                   dim1_unit.REPR + "_max": str(dim1.max()),
                   "pixelX": str(self.pixel2),  # this is not a bug ... most people expect dim1 to be X
                   "pixelY": str(self.pixel1),  # this is not a bug ... most people expect dim2 to be Y
-                  "polarization": str(polarization_factor)}
+                  "polarization_factor": str(polarization_factor),
+                  "normalization_factor":str(normalization_factor)
+                  }
 
         if self.splineFile:
             header["spline"] = str(self.splineFile)
@@ -2819,11 +2727,11 @@ class AzimuthalIntegrator(Geometry):
             header["key"] = f2d[key]
         try:
             img = fabio.edfimage.edfimage(data=I.astype("float32"),
-                                    header=header,
-                                    header_keys=header_keys)
+                                          header=header,
+                                          header_keys=header_keys)
 
             if error is not None:
-                img.appendFrame(data=error, header={"EDF_DataBlockID":"1.Image.Error"})
+                img.appendFrame(data=error, header={"EDF_DataBlockID": "1.Image.Error"})
             img.write(filename)
         except IOError:
             logger.error("IOError while writing %s" % filename)
@@ -2874,10 +2782,16 @@ class AzimuthalIntegrator(Geometry):
 
     def set_darkfiles(self, files=None, method="mean"):
         """
-        Set the dark current from one or mutliple files, avaraged according to the method provided
+        @param files: file(s) used to compute the dark.
+        @type files: str or list(str) or None
+        @param method: method used to compute the dark, "mean" or "median"
+        @type method: str
+
+        Set the dark current from one or mutliple files, avaraged
+        according to the method provided
         """
         if type(files) in types.StringTypes:
-            files = [i.strip for i in files.split(",")]
+            files = [i.strip() for i in files.split(",")]
         elif not files:
             files = []
         if len(files) == 0:
@@ -2886,14 +2800,21 @@ class AzimuthalIntegrator(Geometry):
             self.set_darkcurrent(fabio.open(files[0]).data.astype(numpy.float32))
             self.darkfiles = files[0]
         else:
-            self.set_darkcurrent(utils.averageDark(files), method)
+            self.set_darkcurrent(utils.averageImages(files, filter_=method, format=None, threshold=0))
             self.darkfiles = "%s(%s)" % (method, ",".join(files))
+
     def set_flatfiles(self, files, method="mean"):
         """
-        Set the flat field from one or mutliple files, avaraged according to the method provided
+        @param files: file(s) used to compute the dark.
+        @type files: str or list(str) or None
+        @param method: method used to compute the dark, "mean" or "median"
+        @type method: str
+
+        Set the flat field from one or mutliple files, averaged
+        according to the method provided
         """
         if type(files) in types.StringTypes:
-            files = [i.strip for i in files.split(",")]
+            files = [i.strip() for i in files.split(",")]
         elif not files:
             files = []
         if len(files) == 0:
@@ -2902,5 +2823,5 @@ class AzimuthalIntegrator(Geometry):
             self.set_flatfield(fabio.open(files[0]).data.astype(numpy.float32))
             self.flatfiles = files[0]
         else:
-            self.set_flatfield(utils.averageDark(files), method)
+            self.set_flatfield(utils.averageImages(files, filter_=method, format=None, threshold=0))
             self.flatfiles = "%s(%s)" % (method, ",".join(files))
diff --git a/pyFAI-src/calibration.py b/pyFAI-src/calibration.py
index f907935..e751a5f 100644
--- a/pyFAI-src/calibration.py
+++ b/pyFAI-src/calibration.py
@@ -33,7 +33,7 @@ __author__ = "Jerome Kieffer"
 __contact__ = "Jerome.Kieffer at ESRF.eu"
 __license__ = "GPLv3+"
 __copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
-__date__ = "07/06/2013"
+__date__ = "15/07/2013"
 __status__ = "development"
 
 import os, sys, time, logging, types
@@ -51,7 +51,7 @@ from . import units
 from .utils import averageImages, measure_offset, expand_args
 from .azimuthalIntegrator import AzimuthalIntegrator
 from .units import hc
-from . import version
+from . import version as PyFAI_VERSION
 
 matplotlib.interactive(True)
 
@@ -72,19 +72,19 @@ class AbstractCalibration(object):
 
         @param dataFiles: list of filenames containing data images
         @param darkFiles: list of filenames containing dark current images
-
+        @param flatFiles: list of filenames containing flat images
+        @param pixelSize: size of the pixel in meter as 2 tuple
+        @param splineFile: file containing the distortion of the taper
+        @param detector: Detector name or instance
+        @param spacing_file: file containing the spacing of Miller plans (in decreasing order, in Angstrom, space separated)
+        @param wavelength: radiation wavelength in meter
         """
-        self.dataFiles = dataFiles or []
-        self.darkFiles = darkFiles or []
-        self.flatFiles = flatFiles or []
+        self.dataFiles = dataFiles
+        self.darkFiles = darkFiles
+        self.flatFiles = flatFiles
         self.pointfile = None
 
-        if type(detector) in types.StringTypes:
-            self.detector = detector_factory(detector)
-        elif isinstance(detector, Detector):
-            self.detector = detector
-        else:
-            self.detector = Detector()
+        self.detector = self.get_detector(detector)
 
         if splineFile and os.path.isfile(splineFile):
             self.detector.splineFile = os.path.abspath(splineFile)
@@ -129,23 +129,44 @@ class AbstractCalibration(object):
         self.keep = True
 
     def __repr__(self):
-        lst = ["Calibration object:",
-             "data= " + ", ".join(self.dataFiles),
-             "dark= " + ", ".join(self.darkFiles),
-             "flat= " + ", ".join(self.flatFiles),
-             "fixed=" + ", ".join(self.fixed)]
+        lst = ["Calibration object:"]
+        if self.dataFiles:
+            lst.append("data= " + ", ".join(self.dataFiles))
+        else:
+            lst.append("data= None")
+        if self.darkFiles:
+            lst.append("dark= " + ", ".join(self.darkFiles))
+        else:
+            lst.append("dark= None")
+        if self.flatFiles:
+            lst.append("flat= " + ", ".join(self.flatFiles))
+        else:
+            lst.append("flat= None")
+        if self.fixed:
+            lst.append("fixed=" + ", ".join(self.fixed))
+        else:
+            lst.append("fixed= None")
         lst.append(self.detector.__repr__())
         return os.linesep.join(lst)
 
-    def configure_parser(self, version="%prog " + version, usage="%prog [options] inputfile.edf",
+    def get_detector(self, detector):
+        if type(detector) in types.StringTypes:
+            try:
+                return detector_factory(detector)
+            except RuntimeError:
+                sys.exit(-1)
+        elif isinstance(detector, Detector):
+            return detector
+        else:
+            return Detector()
+
+    def configure_parser(self, version="%prog from pyFAI version " + PyFAI_VERSION,
+                         usage="%prog [options] inputfile.edf",
                          description=None, epilog=None):
         """Common configuration for parsers
         """
         self.parser = OptionParser(usage=usage, version=version,
                               description=description, epilog=epilog)
-#        self.parser.add_option("-V", "--version", dest="version", action="store_true",
-#                          help="print version of the program and quit",
-#                          default=False)
         self.parser.add_option("-o", "--out", dest="outfile",
                           help="Filename where processed image is saved", metavar="FILE",
                           default="merged.edf")
@@ -278,11 +299,9 @@ class AbstractCalibration(object):
                 logger.error("No flat file exists !!!")
                 self.flatFiles = None
 
-        if options.mask and os.path.isfile(options.mask):
-            self.mask = (fabio.open(options.mask).data != 0)
 
         if options.detector_name:
-            self.detector = detector_factory(options.detector_name)
+            self.detector = self.get_detector(options.detector_name)
             self.ai.detector = self.detector
         if options.spline:
             if "Pilatus" in self.detector.name:
@@ -292,19 +311,30 @@ class AbstractCalibration(object):
             else:
                 logger.error("Unknown spline file %s" % (options.spline))
 
+        if options.mask and os.path.isfile(options.mask):
+            self.mask = (fabio.open(options.mask).data != 0)
+        else:  # Use default mask provided by detector
+            self.mask = self.detector.mask
+
+
         self.pointfile = options.npt
-        self.spacing_file = os.path.abspath(options.spacing)
-        if not os.path.isfile(self.spacing_file):
+        if (not options.spacing) or (not os.path.isfile(options.spacing)):
             logger.error("No such d-Spacing file: %s" % options.spacing)
             self.spacing_file = None
+        else:
+            self.spacing_file = options.spacing
         if self.spacing_file is None:
-            self.read_dSpacingFile()
+            self.read_dSpacingFile(True)
+        else:
+            self.spacing_file = os.path.abspath(self.spacing_file)
         if options.wavelength:
             self.ai.wavelength = self.wavelength = 1e-10 * options.wavelength
         elif options.energy:
             self.ai.wavelength = self.wavelength = 1e-10 * hc / options.energy
-        else:
-            self.read_wavelength()
+#        else:
+            # This should be read from the poni. It it is missing; it is called in preprocess.
+#            self.read_wavelength()
+#            pass
         if options.distance:
             self.ai.dist = 1e-3 * options.distance
         if options.poni1 is not None:
@@ -317,8 +347,6 @@ class AbstractCalibration(object):
             self.ai.rot2 = options.rot2
         if options.rot3 is not None:
             self.ai.rot3 = options.rot3
-        if options.mask is not None:
-            self.mask = (fabio.open(options.mask).data != 0)
         self.dataFiles = expand_args(args)
         if not self.dataFiles:
             raise RuntimeError("Please provide some calibration images ... "
@@ -351,6 +379,12 @@ class AbstractCalibration(object):
         self.nPt_2D_azim = options.nPt_2D_azim
         self.nPt_2D_rad = options.nPt_2D_rad
         self.unit = units.to_unit(options.unit)
+        if options.background is not None:
+            try:
+                self.cutBackground = float(options.background)
+            except Exception:
+                self.cutBackground = True
+
         return options, args
 
     def get_pixelSize(self, ans):
@@ -403,7 +437,7 @@ class AbstractCalibration(object):
             while not os.path.isfile(ans):
                 ans = raw_input("Please enter the name of the file"
                                 " containing the d-spacing:\t").strip()
-            self.spacing_file = ans
+            self.spacing_file = os.path.abspath(ans)
 
     def read_wavelength(self):
         """Read the wavelength"""
@@ -430,13 +464,15 @@ class AbstractCalibration(object):
 
         self.basename = os.path.splitext(self.outfile)[0]
         self.pointfile = self.basename + ".npt"
-
+#        self.peakPicker.points.wavelength
+        if self.wavelength is None:
+            self.wavelength = self.ai.wavelength
         self.peakPicker = PeakPicker(self.outfile, reconst=self.reconstruct, mask=self.mask,
                                      pointfile=self.pointfile, dSpacing=self.spacing_file,
                                      wavelength=self.ai.wavelength)
         if not self.keep:
             self.peakPicker.points.reset()
-            self.peakPicker.points.wavelength = self.wavelength
+            self.peakPicker.points.wavelength = self.ai.wavelength
         if not self.peakPicker.points.dSpacing:
             self.read_dSpacingFile()
             self.peakPicker.points.load_dSpacing(self.spacing_file)
@@ -475,6 +511,7 @@ class AbstractCalibration(object):
                     self.geoRef.refine2_wavelength(1000000, fix=self.fixed)
                     print(self.geoRef)
                     count += 1
+                self.peakPicker.points.setWavelength_change2th(self.geoRef.wavelength)
             self.geoRef.save(self.basename + ".poni")
             self.geoRef.del_ttha()
             self.geoRef.del_dssa()
@@ -593,10 +630,10 @@ class AbstractCalibration(object):
                                 polarization_factor=self.polarization_factor,
                                 method="splitbbox")
         t4 = time.time()
-        img = self.geoRef.integrate2d(self.peakPicker.data, self.nPt_2D_rad, self.nPt_2D_azim,
+        img, pos_rad, pos_azim = self.geoRef.integrate2d(self.peakPicker.data, self.nPt_2D_rad, self.nPt_2D_azim,
                                 filename=self.basename + ".azim", unit=self.unit,
                                 polarization_factor=self.polarization_factor,
-                                method="splitbbox")[0]
+                                method="splitbbox")
         t5 = time.time()
         print (os.linesep.join(["Timings:",
                                 " * two theta array generation %.3fs" % (t1 - t0),
@@ -610,7 +647,9 @@ class AbstractCalibration(object):
             xrpd.set_title("1D integration")
             xrpd.set_xlabel(self.unit)
             xrpd.set_ylabel("Intensity")
-            xrpd2.imshow(numpy.log(img - img.min() + 1e-3), origin="lower")
+            xrpd2.imshow(numpy.log(img - img.min() + 1e-3), origin="lower",
+                         extent=[pos_rad.min(), pos_rad.max(), pos_azim.min(), pos_azim.max()],
+                         aspect="auto")
             xrpd2.set_title("2D regrouping")
             xrpd2.set_xlabel(self.unit)
             xrpd2.set_ylabel("Azimuthal angle (deg)")
@@ -659,7 +698,7 @@ and the 6 refined parameters (distance, center, rotation) and wavelength.
 An 1D and 2D diffraction patterns are also produced. (.dat and .azim files)
         """
         usage = "%prog [options] -w 1 -D detector -S calibrant.D imagefile.edf"
-        self.configure_parser(usage=usage,description=description,epilog=epilog)  # common
+        self.configure_parser(usage=usage, description=description, epilog=epilog)  # common
         self.parser.add_option("-r", "--reconstruct", dest="reconstruct",
               help="Reconstruct image where data are masked or <0  (for Pilatus "\
               "detectors or detectors with modules)",
@@ -685,11 +724,6 @@ decrease the value if arcs are mixed together.""", default=None)
             self.labelPattern = [[1] * 3] * 3
         else:
             self.labelPattern = [[0, 1, 0], [1, 1, 1], [0, 1, 0]]
-        if options.background is not None:
-            try:
-                self.cutBackground = float(options.background)
-            except Exception:
-                self.cutBackground = True
 
         if options.pixel is not None:
             self.get_pixelSize(options.pixel)
@@ -929,10 +963,9 @@ class CheckCalib(object):
 calibration and everything else like flat-field correction, distortion
 correction. Maybe the future lies over there ...
         """
-        parser = OptionParser(usage=usage, version="%prog " + version, description=description)
-#        parser.add_option("-V", "--version", dest="version", action="store_true",
-#                          help="print version of the program and quit", metavar="FILE",
-#                          default=False)
+        parser = OptionParser(usage=usage,
+                              version="%prog from pyFAI version " + PyFAI_VERSION,
+                              description=description)
         parser.add_option("-v", "--verbose",
                           action="store_true", dest="verbose", default=False,
                           help="switch to debug mode")
@@ -954,9 +987,6 @@ correction. Maybe the future lies over there ...
         if options.verbose:
             logger.setLevel(logging.DEBUG)
 
-#        if options.version:
-#            print("Check calibrarion: version %s" % version)
-#            sys.exit(0)
         if options.mask is not None:
             self.mask = (fabio.open(options.mask).data != 0)
         args = expand_args(args)
diff --git a/pyFAI-src/detectors.py b/pyFAI-src/detectors.py
index e90b817..932c788 100644
--- a/pyFAI-src/detectors.py
+++ b/pyFAI-src/detectors.py
@@ -28,7 +28,7 @@ __author__ = "Jérôme Kieffer"
 __contact__ = "Jerome.Kieffer at ESRF.eu"
 __license__ = "GPLv3+"
 __copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
-__date__ = "29/11/2012"
+__date__ = "29/08/2012"
 __status__ = "stable"
 
 import os
@@ -38,7 +38,8 @@ import numpy
 
 logger = logging.getLogger("pyFAI.detectors")
 
-from pyFAI.spline import Spline
+from pyFAI import spline
+from pyFAI.utils import lazy_property
 try:
     from pyFAI.fastcrc import crc32
 except ImportError:
@@ -54,16 +55,20 @@ class Detector(object):
     Generic class representing a 2D detector
     """
     force_pixel = False
+    isDetector = True #used to recognize detector classes
     def __init__(self, pixel1=None, pixel2=None, splineFile=None):
         """
         @param pixel1: size of the pixel in meter along the slow dimension (often Y)
         @type pixel1: float
-        @param pixel2: size of the pixel in meter along the fast dimension (ofter x)
+        @param pixel2: size of the pixel in meter along the fast dimension (often X)
         @type pixel2: float
         @param splineFile: path to file containing the geometric correction.
         @type splineFile: str
         """
-        self.name = self.__class__.__name__
+        try:  
+            self.name = self.__class__.name
+        except:
+            self.name = self.__class__.__name__
         self._pixel1 = None
         self._pixel2 = None
         if pixel1:
@@ -87,6 +92,39 @@ class Detector(object):
             return "Undefined detector"
         return "Detector %s\t Spline= %s\t PixelSize= %.3e, %.3e m" % \
             (self.name, self.splineFile, self._pixel1, self._pixel2)
+    def set_config(self, config):
+        """
+        Sets the configuration of the detector. This implies:
+        - Orientation: integers 
+        - Binning
+        - ROI
+        
+        The configuration is either a python dictionnary or a JSON string or a file containing this JSON configuration
+        
+        keys in that dictionnary are :
+        "orientation": integers from 0 to 7
+        "binning": integer or 2-tuple of integers. If only one integer is provided, 
+        "offset": coordinate (in pixels) of the start of the detector 
+        """
+
+        raise NotImplementedError
+
+    def set_config(self, config):
+        """
+        Sets the configuration of the detector. This implies:
+        - Orientation: integers 
+        - Binning
+        - ROI
+        
+        The configuration is either a python dictionnary or a JSON string or a file containing this JSON configuration
+        
+        keys in that dictionnary are :
+        "orientation": integers from 0 to 7
+        "binning": integer or 2-tuple of integers. If only one integer is provided, 
+        "offset": coordinate (in pixels) of the start of the detector 
+        """
+
+        raise NotImplementedError
 
     def get_splineFile(self):
         return self._splineFile
@@ -94,7 +132,7 @@ class Detector(object):
     def set_splineFile(self, splineFile):
         if splineFile is not None:
             self._splineFile = os.path.abspath(splineFile)
-            self.spline = Spline(self._splineFile)
+            self.spline = spline.Spline(self._splineFile)
             # NOTA : X is axis 1 and Y is Axis 0
             self._pixel2, self._pixel1 = self.spline.getPixelSize()
             self._splineCache = {}
@@ -438,6 +476,42 @@ class Pilatus(Detector):
         p2 = (self._pixel2 * (delta2 + 0.5 + d2))
         return p1, p2
 
+class Pilatus100k(Pilatus):
+    """
+    Pilatus 100k detector
+    """
+    def __init__(self, pixel1=172e-6, pixel2=172e-6):
+        Pilatus.__init__(self, pixel1, pixel2)
+        self.max_shape = (195, 487)
+
+
+class Pilatus200k(Pilatus):
+    """
+    Pilatus 200k detector
+    """
+    def __init__(self, pixel1=172e-6, pixel2=172e-6):
+        Pilatus.__init__(self, pixel1, pixel2)
+        self.max_shape = (407, 487)
+
+
+class Pilatus300k(Pilatus):
+    """
+    Pilatus 300k detector
+    """
+    def __init__(self, pixel1=172e-6, pixel2=172e-6):
+        Pilatus.__init__(self, pixel1, pixel2)
+        self.max_shape = (619, 487)
+
+
+class Pilatus300kw(Pilatus):
+    """
+    Pilatus 300k-wide detector
+    """
+    def __init__(self, pixel1=172e-6, pixel2=172e-6):
+        Pilatus.__init__(self, pixel1, pixel2)
+        self.max_shape = (195, 1475)
+
+
 class Pilatus1M(Pilatus):
     """
     Pilatus 1M detector
@@ -454,7 +528,7 @@ class Pilatus2M(Pilatus):
     force_pixel = True
     def __init__(self, pixel1=172e-6, pixel2=172e-6):
         Pilatus.__init__(self, pixel1, pixel2)
-        self.max_shape = (1475, 1679)
+        self.max_shape = (1679, 1475)
 
 
 class Pilatus6M(Pilatus):
@@ -477,6 +551,18 @@ class Fairchild(Detector):
         self.name = "Fairchild Condor 486:90"
         self.max_shape = (4096, 4096)
 
+class Titan(Detector):
+    """
+    Titan CCD detector from Agilent. Mask not handled
+    """
+    force_pixel = True
+    def __init__(self, pixel1=60e-6, pixel2=60e-6):
+        Detector.__init__(self, pixel1, pixel2)
+        self.name = "Titan 2k x 2k"
+        self.max_shape = (2048, 2048)
+
+
+
 
 class Dexela2923(Detector):
     """
@@ -554,19 +640,18 @@ class Xpad_flat(Detector):
         discards the first line and raw form all modules:
         those are 2.5x bigger and often mis - behaving
         """
-        with self._sem:
-            if (self.max_shape[0] or self.max_shape[1]) is None:
-                raise NotImplementedError("Generic Xpad detector does not"
-                                          " know the max size ...")
-            mask = numpy.zeros(self.max_shape, dtype=numpy.int8)
-            # workinng in dim0 = Y
-            for i in range(0, self.max_shape[0], self.MODULE_SIZE[0]):
-                mask[i, :] = 1
-                mask[i + self.MODULE_SIZE[0] - 1, :] = 1
-            # workinng in dim1 = X
-            for i in range(0, self.max_shape[1], self.MODULE_SIZE[1]):
-                mask[:, i ] = 1
-                mask[:, i + self.MODULE_SIZE[1] - 1] = 1
+        if (self.max_shape[0] or self.max_shape[1]) is None:
+            raise NotImplementedError("Generic Xpad detector does not"
+                                      " know the max size ...")
+        mask = numpy.zeros(self.max_shape, dtype=numpy.int8)
+        # workinng in dim0 = Y
+        for i in range(0, self.max_shape[0], self.MODULE_SIZE[0]):
+            mask[i, :] = 1
+            mask[i + self.MODULE_SIZE[0] - 1, :] = 1
+        # workinng in dim1 = X
+        for i in range(0, self.max_shape[1], self.MODULE_SIZE[1]):
+            mask[:, i ] = 1
+            mask[:, i + self.MODULE_SIZE[1] - 1] = 1
         return mask
 
     def calc_cartesian_positions(self, d1=None, d2=None):
@@ -608,6 +693,121 @@ class Xpad_flat(Detector):
         p2 = self.pixel2 * (0.5 + c2)
         return p1, p2
 
+
+def _pixels_compute_center(pixels_size):
+    """
+    given a list of pixel size, this method return the center of each
+    pixels. This method is generic.
+
+    @param pixels_size: the size of the pixels.
+    @type length: ndarray
+
+    @return: the center-coordinates of each pixels 0..length
+    @rtype: ndarray
+    """
+    center = pixels_size.cumsum()
+    tmp = center.copy()
+    center[1:] += tmp[:-1]
+    center /= 2.
+
+    return center
+
+def _pixels_extract_coordinates(coordinates, pixels):
+    """
+    given a list of pixel coordinates, return the correspondig
+    pixels coordinates extracted from the coodinates array.
+
+    @param coodinates: the pixels coordinates
+    @type coordinates: ndarray 1D (pixels -> coordinates)
+    @param pixels: the list of pixels to extract.
+    @type pixels: ndarray 1D(calibration) or 2D(integration)
+
+    @return: the pixels coordinates
+    @rtype: ndarray
+    """
+    return coordinates[pixels] if (pixels is not None) else coordinates
+
+class ImXPadS140(Detector):
+    """
+    ImXPad detector: ImXPad s140 detector with 2x7modules
+    """
+    MODULE_SIZE = (120, 80)  # number of pixels per module (y, x)
+    MAX_SHAPE = (240, 560)  # max size of the detector
+    PIXEL_SIZE = (130e-6, 130e-6)
+    force_pixel = True
+    name = "Imxpad S140"
+
+    class __metaclass__(type):
+
+        @lazy_property
+        def COORDINATES(cls):
+            """
+            cache used to store the coordinates of the y, x, detector
+            pixels. These array are compute only once for all
+            instances.
+            """
+            return tuple(_pixels_compute_center(cls._pixels_size(n, m, p))
+                         for n, m, p in zip(cls.MAX_SHAPE,
+                                            cls.MODULE_SIZE,
+                                            cls.PIXEL_SIZE))
+
+    @staticmethod
+    def _pixels_size(length, module_size, pixel_size):
+        """
+        given the length (in pixel) of the detector, the size of a
+        module (in pixels) and the pixel_size (in meter). this method
+        return the length of each pixels 0..length.
+
+        @param length: the number of pixel to compute
+        @type length: int
+        @param module_size: the number of pixel of one module
+        @type module_size: int
+        @param pixel_size: the size of one pixels (meter per pixel)
+        @type length: float
+
+        @return: the coordinates of each pixels 0..length
+        @rtype: ndarray
+        """
+        size = numpy.ones(length)
+        n = length // module_size
+        for i in range(1, n):
+            size[i * module_size - 1] = 2.5
+            size[i * module_size] = 2.5
+        return pixel_size * size
+
+    def __init__(self, pixel1=130e-6, pixel2=130e-6):
+        Detector.__init__(self, pixel1, pixel2)
+        self.name = "ImXPad S140"
+        self.max_shape = self.MAX_SHAPE
+
+    def __repr__(self):
+        return "Detector %s\t PixelSize= %.3e, %.3e m" % \
+            (self.name, self.pixel1, self.pixel2)
+
+
+    def calc_cartesian_positions(self, d1=None, d2=None):
+        """
+        Calculate the position of each pixel center in cartesian coordinate
+        and in meter of a couple of coordinates.
+        The half pixel offset is taken into account here !!!
+
+        @param d1: the Y pixel positions (slow dimension)
+        @type d1: ndarray (1D or 2D)
+        @param d2: the X pixel positions (fast dimension)
+        @type d2: ndarray (1D or 2D)
+
+        @return: position in meter of the center of each pixels.
+        @rtype: ndarray
+
+        d1 and d2 must have the same shape, returned array will have
+        the same shape.
+
+        """
+        return tuple(_pixels_extract_coordinates(coordinates, pixels)
+                     for coordinates, pixels in zip(ImXPadS140.COORDINATES,
+                                                    (d1, d2)))
+
+
 class Perkin(Detector):
     """
     Perkin detector
@@ -619,32 +819,71 @@ class Perkin(Detector):
         self.name = "Perkin detector"
         self.max_shape = (2048, 2048)
 
+class RayonixMx225(Detector):
+    """
+    Rayonix mx225 2D detector
+    """
+    force_pixel = True
+    def __init__(self):
+        Detector.__init__(self, pixel1=73e-6, pixel2=73e-6)
+        self.max_shape = (3072, 3072)
+        self.name = "Rayonix mx225"
 
-ALL_DETECTORS = {"pilatus1m": Pilatus1M,
-                 "pilatus2m": Pilatus2M,
-                 "pilatus6m": Pilatus6M,
-                 "condor": Fairchild,
-                 "fairchild": Fairchild,
-                 "frelon": FReLoN,
-                 "xpad": Xpad_flat,
-                 "xpad_flat": Xpad_flat,
-                 "basler": Basler,
-                 "dexela2923": Dexela2923,
-                 "perkin": Perkin,
-                 "detector": Detector}
+class RayonixMx300(Detector):
+    """
+    Rayonix mx300 2D detector
+    """
+    force_pixel = True
+    def __init__(self):
+        Detector.__init__(self, pixel1=73e-6, pixel2=73e-6)
+        self.max_shape = (4096, 4096)
+        self.name = "Rayonix mx300"
 
+class RayonixMx325(Detector):
+    """
+    Rayonix mx325 2D detector
+    """
+    force_pixel = True
+    def __init__(self):
+        Detector.__init__(self, pixel1=79e-6, pixel2=79e-6)
+        self.max_shape = (4096, 4096)
+        self.name = "Rayonix mx325"
+
+ALL_DETECTORS = {}
+#Init time creation of the dict of all detectors
+local_dict = locals()
+for obj_name in dir():
+    obj_class = local_dict.get(obj_name)
+    if "isDetector" in dir(obj_class):
+        try:
+            obj_inst = obj_class()
+        except:
+            logger.debug("Unable to instanciate %s" % obj_name)
+            pass
+        else:
+            ALL_DETECTORS[obj_name.lower()] = obj_class
+            ALL_DETECTORS[obj_inst.name.lower().replace(" ", "_")] = obj_class
 
-def detector_factory(name):
+def detector_factory(name, config=None):
     """
     A kind of factory...
     @param name: name of a detector
     @type name: str
+    @param config: configuration of the detector
+    @type config: dict or JSON representation of it.
 
-    @return: an instance of the right detector
+    @return: an instance of the right detector, set-up if possible
     @rtype: pyFAI.detectors.Detector
     """
     name = name.lower()
     if name in ALL_DETECTORS:
-        return ALL_DETECTORS[name]()
+        mydet = ALL_DETECTORS[name]()
+        if config is not None:
+            mydet.set_config(config)
+        return mydet
     else:
-        raise RuntimeError("Detector %s is unknown !" % (name))
+        msg = ("Detector %s is unknown !, "
+               "please select one from %s" % (name, ALL_DETECTORS.keys()))
+        logger.error(msg)
+        raise RuntimeError(msg)
+
diff --git a/pyFAI-src/geometry.py b/pyFAI-src/geometry.py
index a87704d..d0429e4 100644
--- a/pyFAI-src/geometry.py
+++ b/pyFAI-src/geometry.py
@@ -193,7 +193,7 @@ class Geometry(object):
         self._dttha = None
         self._dssa = None
         self._dssa_crc = None  # checksum associated with _dssa
-        self._dssa_order = 1  # by default we correct for 1/cos(2th), fit2d corrects for 1/cos^3(2th)
+        self._dssa_order = 3  # by default we correct for 1/cos(2th), fit2d corrects for 1/cos^3(2th)
         self._chia = None
         self._dchia = None
         self._qa = None
@@ -211,6 +211,10 @@ class Geometry(object):
         self._polarization_axis_offset = 0
         self._polarization = None
         self._polarization_crc = None  # checksum associated with _polarization
+        self._cosa = None      #cosine of the incidance angle
+        self._transmission_normal = None
+        self._transmission_corr = None
+        self._transmission_crc = None
 
         if detector:
             if type(detector) in types.StringTypes:
@@ -745,9 +749,19 @@ class Geometry(object):
                     self._dra = delta.max(axis= -1)
         return self._dra
 
+    def cosIncidance(self, d1, d2):
+        """
+        Calculate the incidence angle (alpha) for current pixels (P). 
+        The poni is at incidence angle=1 so cos(alpha) = 1
+        
+        """
+        p1, p2 = self._calcCartesianPositions(d1, d2)
+        cosa = self._dist / numpy.sqrt(self._dist * self._dist + p1 * p1 + p2 * p2)
+        return cosa
+
     def diffSolidAngle(self, d1, d2):
         """
-        Calulate the solid angle of the current pixels (P) versus the PONI (C)
+        Calculate the solid angle of the current pixels (P) versus the PONI (C)
 
                   Omega(P)    A cos(a)     SC^2         3       SC^3
         dOmega = --------- = --------- x --------- = cos (a) = ------
@@ -759,9 +773,6 @@ class Geometry(object):
         @param d2: 1d or 2d set of points (same size&shape as d1)
         @return: solid angle correction array
         """
-        p1, p2 = self._calcCartesianPositions(d1, d2)
-#        p1 = (0.5 + d1) * self.pixel1 - self._poni1
-#        p2 = (0.5 + d2) * self.pixel2 - self._poni2
         ds = 1.0
 
         # #######################################################
@@ -780,11 +791,13 @@ class Geometry(object):
             dY = sY[1:, : ] - sY[:-1, :]
             ds = (dX + 1.0) * (dY + 1.0)
 
-        dsa = ds * self._dist ** self._dssa_order / (self._dist ** 2 + p1 ** 2 + p2 ** 2) ** (self._dssa_order * 0.5)
+        if self._cosa is None:
+            self._cosa = self.cosIncidance(d1, d2)
+        dsa = ds * self._cosa ** self._dssa_order
 
         return dsa
 
-    def solidAngleArray(self, shape, order=1):
+    def solidAngleArray(self, shape, order=3):
         """
         Generate an array of the given shape with the solid angle of
         the current element two-theta(i,j) for all elements.
@@ -795,9 +808,10 @@ class Geometry(object):
         @param order:
         """
         if self._dssa is None:
-#            with self._sem:
-#                if self._dssa is None:
-            self._dssa_order = int(order)
+            if order is True:
+                self._dssa_order = 3.0
+            else:
+                self._dssa_order = float(order)
             self._dssa = numpy.fromfunction(self.diffSolidAngle,
                                             shape, dtype=numpy.float32)
             self._dssa_crc = crc32(self._dssa)
@@ -816,7 +830,7 @@ class Geometry(object):
                          " 2 to the X axis %s") % os.linesep)
                 f.write("# Calibration done at %s%s" % (time.ctime(), os.linesep))
                 if self.detector.name != "Detector":
-                    f.write("Detector: %s%s" % (self.detector.name,
+                    f.write("Detector: %s%s" % (self.detector.__class__.__name__,
                                                 os.linesep))
                 f.write("PixelSize1: %s%s" % (self.pixel1, os.linesep))
                 f.write("PixelSize2: %s%s" % (self.pixel2, os.linesep))
@@ -1097,10 +1111,14 @@ class Geometry(object):
 
         """
         if shape is None:
-            if self._ttha is None:
-                raise RuntimeError(("You should provide a shape if the"
-                                    " geometry is not yet initiallized"))
-            shape = self._ttha.shape
+            for i in ["_ttha", "_dttha", "_dssa", "_chia", "_dchia", "_qa", "_dqa", "_ra", "_dra"]:
+                ary = self.__getattribute__(i)
+                if ary is not None:
+                    shape = ary.shape
+                    break
+        if shape is None:
+            raise RuntimeError(("You should provide a shape if the"
+                                " geometry is not yet initiallized"))
 
 
         if factor is None:
@@ -1125,6 +1143,51 @@ class Geometry(object):
                 self._polarization_crc = crc32(self._polarization)
                 return self._polarization
 
+    def calc_transmission(self, t0, shape=None):
+        """
+        Defines the absorption correction for a phosphor screen or a scintillator
+        from t0, the normal transmission of the screen.
+        
+        Icor = Iobs(1-t0)/(1-exp(ln(t0)/cos(incidence)))
+                 1-exp(ln(t0)/cos(incidence)
+        let t = -----------------------------
+                          1 - t0
+        See reference on:
+        J. Appl. Cryst. (2002). 35, 356–359 G. Wu et al.  CCD phosphor
+        
+        @param t0: value of the normal transmission (from 0 to 1)
+        @param shape: shape of the array
+        @return: actual  
+        """
+        if t0 < 0 or t0 > 1:
+            logger.error("Impossible value for normal transmission: %s" % t0)
+            return
+
+        with self._sem:
+            if (t0 == self._transmission_normal) \
+                and (shape is None \
+                     or (shape == self._transmission_corr.shape)):
+                return self._transmission_corr
+
+        if self._cosa is None:
+            if shape is None:
+                for i in ["_ttha", "_dttha", "_dssa", "_chia", "_dchia", "_qa", "_dqa", "_ra", "_dra"]:
+                    ary = self.__getattribute__(i)
+                    if ary is not None:
+                        shape = ary.shape
+                        break
+            if shape is None:
+                raise RuntimeError(("You should provide a shape if the"
+                                    " geometry is not yet initiallized"))
+
+        with self._sem:
+            self._transmission_normal = t0
+            if self._cosa is None:
+                self._cosa = numpy.fromfunction(self.cosIncidance, shape, dtype=numpy.float32)
+            self._transmission_corr = (1.0 - numpy.exp(numpy.log(t0) / self._cosa)) / (1 - t0)
+            self._transmission_crc = crc32(self._transmission_corr)
+        return self._transmission_corr
+
     def reset(self):
         """
         reset most arrays that are cached: used when a parameter
@@ -1145,7 +1208,12 @@ class Geometry(object):
         self._corner4Dqa = None
         self._corner4Dra = None
         self._polarization = None
-        self._polarization_factor = 0
+        self._polarization_factor = None
+        self._transmission_normal = None
+        self._transmission_corr = None
+        self._transmission_crc = None
+        self._cosa = None
+
 
     def calcfrom1d(self, tth, I, shape=None, mask=None,
                    dim1_unit=units.TTH, correctSolidAngle=True):
diff --git a/pyFAI-src/geometryRefinement.py b/pyFAI-src/geometryRefinement.py
index 84e5f14..92ae974 100644
--- a/pyFAI-src/geometryRefinement.py
+++ b/pyFAI-src/geometryRefinement.py
@@ -38,7 +38,8 @@ import logging
 import numpy
 import types
 from math import pi
-from pyFAI.azimuthalIntegrator import AzimuthalIntegrator
+from . import azimuthalIntegrator
+AzimuthalIntegrator = azimuthalIntegrator.AzimuthalIntegrator
 from scipy.optimize import fmin, leastsq, fmin_slsqp, anneal
 
 if os.name != "nt":
@@ -77,9 +78,9 @@ class GeometryRefinement(AzimuthalIntegrator):
         @param dSpacing: filename or list or array or vector containing the d-spacing (in Angstrom)
 
         """
-        self.data = numpy.array(data, dtype="float64")
+        self.data = numpy.array(data, dtype=numpy.float64)
         assert self.data.ndim == 2
-        assert self.data.shape[1] == 3
+        assert self.data.shape[1] in [ 3, 4] #3 for non weighted, 4 for weighted refinement
         assert self.data.shape[0]>0
 
         if (pixel1 is None) and (pixel2 is None) and (splineFile is None) and (detector is None):
@@ -138,6 +139,7 @@ class GeometryRefinement(AzimuthalIntegrator):
 
     def set_tolerance(self, value=10):
         """
+        Set the tolerance for a refinement of the geometry; in percent of the original value 
 
         @param value: Tolerance as a percentage
 
diff --git a/pyFAI-src/integrate_widget.py b/pyFAI-src/integrate_widget.py
index 75dfc86..4b2f786 100644
--- a/pyFAI-src/integrate_widget.py
+++ b/pyFAI-src/integrate_widget.py
@@ -47,8 +47,8 @@ from PyQt4 import QtCore, QtGui, uic
 from PyQt4.QtCore import SIGNAL
 import pyFAI, fabio
 from pyFAI.opencl import ocl
-from pyFAI.utils import float_, int_, str_
-UIC = op.join(op.dirname(__file__), "integration.ui")
+from pyFAI.utils import float_, int_, str_, get_ui_file
+UIC = get_ui_file("integration.ui")
 
 FROM_PYMCA = "From PyMca"
 
@@ -65,7 +65,11 @@ class AIWidget(QtGui.QWidget):
         self.name = None
         self._sem = threading.Semaphore()
         QtGui.QWidget.__init__(self)
-        uic.loadUi(UIC, self)
+        try:
+            uic.loadUi(UIC, self)
+        except AttributeError as error:
+            logger.error("I looks like your installation suffers from this bug: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=697348")
+            raise RuntimeError("Please upgrade your installation of PyQt (or apply the patch)")
         self.all_detectors = pyFAI.detectors.ALL_DETECTORS.keys()
         self.all_detectors.sort()
         self.detector.addItems([i.capitalize() for i in self.all_detectors])
@@ -92,6 +96,7 @@ class AIWidget(QtGui.QWidget):
 
         self.restore()
         self.progressBar.setValue(0)
+        self.hdf5_path = None
 
     def proceed(self):
         with self._sem:
@@ -137,9 +142,9 @@ class AIWidget(QtGui.QWidget):
             else:
                 kwarg["polarization_factor"] = None
 
-            kwarg["nbPt_rad"] = int(str(self.rad_pt.text()).strip())
+            kwarg["nbPt_rad"] = int(str(self.nbpt_rad.text()).strip())
             if self.do_2D.isChecked():
-                kwarg["nbPt_azim"] = int(str(self.azim_pt.text()).strip())
+                kwarg["nbPt_azim"] = int(str(self.nbpt_azim.text()).strip())
 
             if self.do_OpenCL.isChecked():
                 platform = ocl.get_platform(self.platform.currentText())
@@ -194,7 +199,9 @@ class AIWidget(QtGui.QWidget):
                         out[i] = self.ai.integrate2d(**kwarg)[0]
 
                 else:
-                    out = numpy.zeros((self.input_data.shape[0], kwarg["nbPt_rad"]), dtype=numpy.float32)
+                    if "nbPt_rad" in kwarg:  # convert nbPt_rad -> nbPt
+                            kwarg["nbPt"] = kwarg.pop("nbPt_rad")
+                    out = numpy.zeros((self.input_data.shape[0], kwarg["nbPt"]), dtype=numpy.float32)
                     for i in range(self.input_data.shape[0]):
                         self.progressBar.setValue(100.0 * i / self.input_data.shape[0])
                         kwarg["data"] = self.input_data[i]
@@ -207,49 +214,51 @@ class AIWidget(QtGui.QWidget):
                     hdf5 = h5py.File(self.output_path)
                     if self.fast_dim:
                         if "nbPt_azim" in kwarg:
-                            ds = hdf5.create_dataset("diffraction",(1,self.fast_dim,kwarg["nbPt_azim"],kwarg["nbPt_rad"]),
-                                                      dtype = numpy.float32,
-                                                      chunks=(1,self.fast_dim,kwarg["nbPt_azim"],kwarg["nbPt_rad"]),
-                                                      maxshape=(None,self.fast_dim,kwarg["nbPt_azim"],kwarg["nbPt_rad"]))
+                            ds = hdf5.create_dataset("diffraction", (1, self.fast_dim, kwarg["nbPt_azim"], kwarg["nbPt_rad"]),
+                                                      dtype=numpy.float32,
+                                                      chunks=(1, self.fast_dim, kwarg["nbPt_azim"], kwarg["nbPt_rad"]),
+                                                      maxshape=(None, self.fast_dim, kwarg["nbPt_azim"], kwarg["nbPt_rad"]))
                         else:
-                            ds = hdf5.create_dataset("diffraction",(1,self.fast_dim,kwarg["nbPt_rad"]),
-                                                      dtype = numpy.float32,
-                                                      chunks=(1,self.fast_dim,kwarg["nbPt_rad"]),
-                                                      maxshape=(None,self.fast_dim,kwarg["nbPt_rad"]))
+                            ds = hdf5.create_dataset("diffraction", (1, self.fast_dim, kwarg["nbPt_rad"]),
+                                                      dtype=numpy.float32,
+                                                      chunks=(1, self.fast_dim, kwarg["nbPt_rad"]),
+                                                      maxshape=(None, self.fast_dim, kwarg["nbPt_rad"]))
                     else:
                         if "nbPt_azim" in kwarg:
-                            ds = hdf5.create_dataset("diffraction",(1,kwarg["nbPt_azim"],kwarg["nbPt_rad"]),
-                                                      dtype = numpy.float32,
-                                                      chunks=(1,kwarg["nbPt_azim"],kwarg["nbPt_rad"]),
-                                                      maxshape=(None,kwarg["nbPt_azim"],kwarg["nbPt_rad"]))
+                            ds = hdf5.create_dataset("diffraction", (1, kwarg["nbPt_azim"], kwarg["nbPt_rad"]),
+                                                      dtype=numpy.float32,
+                                                      chunks=(1, kwarg["nbPt_azim"], kwarg["nbPt_rad"]),
+                                                      maxshape=(None, kwarg["nbPt_azim"], kwarg["nbPt_rad"]))
                         else:
-                            ds = hdf5.create_dataset("diffraction",(1,kwarg["nbPt_rad"]),
-                                                      dtype = numpy.float32,
-                                                      chunks=(1,kwarg["nbPt_rad"]),
-                                                      maxshape=(None,kwarg["nbPt_rad"]))
+                            ds = hdf5.create_dataset("diffraction", (1, kwarg["nbPt_rad"]),
+                                                      dtype=numpy.float32,
+                                                      chunks=(1, kwarg["nbPt_rad"]),
+                                                      maxshape=(None, kwarg["nbPt_rad"]))
 
                 for i, item in enumerate(self.input_data):
                     self.progressBar.setValue(100.0 * i / len(self.input_data))
                     logger.debug("processing %s" % item)
                     if (type(item) in types.StringTypes) and op.exists(item):
                         kwarg["data"] = fabio.open(item).data
-                        if self.hdf5_path is not None:
+                        if self.hdf5_path is None:
                             if self.output_path and op.isdir(self.output_path):
-                                outpath = op.join(self.output_path,op.splitext(op.basename(item))[0])
-                            if kwarg.get("nbPt_azim"):
+                                outpath = op.join(self.output_path, op.splitext(op.basename(item))[0])
+                            else:
+                                outpath = op.splitext(item)[0]
+                            if "nbPt_azim" in kwarg:
                                 kwarg["filename"] = outpath + ".azim"
                             else:
                                 kwarg["filename"] = outpath + ".dat"
-                                if kwarg.get("nbPt_rad"):
-                                    kwarg["nbPt"] = kwarg.pop("nbPt_rad")
                     else:
                         logger.warning("item is not a file ... guessing it is a numpy array")
                         kwarg["data"] = item
                         kwarg["filename"] = None
                     if kwarg.get("nbPt_azim"):
-                        res=self.ai.integrate2d(**kwarg)[0]
+                        res = self.ai.integrate2d(**kwarg)[0]
                     else:
-                        res=self.ai.integrate1d(**kwarg)[0]
+                        if "nbPt_rad" in kwarg:  # convert nbPt_rad -> nbPt
+                            kwarg["nbPt"] = kwarg.pop("nbPt_rad")
+                        res = self.ai.integrate1d(**kwarg)[0]
                     out.append(res)
                     #TODO manage HDF5 stuff !!!
             logger.info("Processing Done in %.3fs !" % (time.time() - start_time))
@@ -296,9 +305,9 @@ class AIWidget(QtGui.QWidget):
                     "dark_current":str(self.dark_current.text()).strip(),
                     "flat_field":str(self.flat_field.text()).strip(),
                     "polarization_factor":float_(self.polarization_factor.value()),
-                    "rad_pt":int_(self.rad_pt.text()),
+                    "nbpt_rad":int_(self.nbpt_rad.text()),
                     "do_2D":bool(self.do_2D.isChecked()),
-                    "azim_pt":int_(self.azim_pt.text()),
+                    "nbpt_azim":int_(self.nbpt_azim.text()),
                     "chi_discontinuity_at_0": bool(self.chi_discontinuity_at_0.isChecked()),
                     "do_solid_angle": bool(self.do_solid_angle.isChecked()),
                     "do_radial_range": bool(self.do_radial_range.isChecked()),
@@ -319,10 +328,13 @@ class AIWidget(QtGui.QWidget):
             to_save["unit"] = "2th_rad"
         elif self.r_mm.isChecked():
             to_save["unit"] = "r_mm"
-
-        with open(filename, "w") as myFile:
-            json.dump(to_save, myFile, indent=4)
-        logger.debug("Saved")
+        try:
+            with open(filename, "w") as myFile:
+                json.dump(to_save, myFile, indent=4)
+        except IOError as error:
+            logger.error("Error while saving config: %s" % error)
+        else:
+            logger.debug("Saved")
 
     def restore(self, filename=".azimint.json"):
         """
@@ -360,9 +372,9 @@ class AIWidget(QtGui.QWidget):
                         "dark_current":lambda a:self.dark_current.setText(str_(a)),
                         "flat_field":lambda a:self.flat_field.setText(str_(a)),
                         "polarization_factor":self.polarization_factor.setValue,
-                        "rad_pt":lambda a:self.rad_pt.setText(str_(a)),
+                        "nbpt_rad":lambda a:self.nbpt_rad.setText(str_(a)),
                         "do_2D":self.do_2D.setChecked,
-                        "azim_pt":lambda a:self.azim_pt.setText(str_(a)),
+                        "nbpt_azim":lambda a:self.nbpt_azim.setText(str_(a)),
                         "chi_discontinuity_at_0": self.chi_discontinuity_at_0.setChecked,
                         "do_radial_range": self.do_radial_range.setChecked,
                         "do_azimuthal_range": self.do_azimuthal_range.setChecked,
diff --git a/pyFAI-src/io.py b/pyFAI-src/io.py
new file mode 100644
index 0000000..94943fc
--- /dev/null
+++ b/pyFAI-src/io.py
@@ -0,0 +1,501 @@
+# !/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+#    Project: Azimuthal integration
+#             https://github.com/kif
+#
+#
+#    Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
+#
+#    Principal author:       Jérôme Kieffer (Jerome.Kieffer at ESRF.eu)
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+
+
+
+__author__ = "Jerome Kieffer"
+__contact__ = "Jerome.Kieffer at ESRF.eu"
+__license__ = "GPLv3+"
+__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
+__date__ = "04/11/2013"
+__status__ = "beta"
+__docformat__ = 'restructuredtext'
+__doc__ = """
+
+Module for "high-performance" writing in either 1D with Ascii , or 2D with FabIO 
+or even nD with n varying from  2 to 4 using HDF5 
+
+Stand-alone module which tries to offer interface to HDF5 via H5Py and 
+capabilities to write EDF or other formats using fabio.
+
+Can be imported without h5py but then limited to fabio & ascii formats.
+
+TODO:
+* add monitor to HDF5
+"""
+import sys
+import os
+import time
+import threading
+import logging
+logger = logging.getLogger("pyFAI.io")
+import types
+import numpy
+import posixpath
+import json
+try:
+    import h5py
+except ImportError:
+    h5py = None
+    logger.debug("h5py is missing")
+
+import fabio
+from . import units
+
+def getIsoTime(forceTime=None):
+    """
+    @param forceTime: enforce a given time (current by default)
+    @type forceTime: float
+    @return: the current time as an ISO8601 string
+    @rtype: string  
+    """
+    if forceTime is None:
+        forceTime = time.time()
+    localtime = time.localtime(forceTime)
+    gmtime = time.gmtime(forceTime)
+    tz_h = localtime.tm_hour - gmtime.tm_hour
+    tz_m = localtime.tm_min - gmtime.tm_min
+    return "%s%+03i:%02i" % (time.strftime("%Y-%m-%dT%H:%M:%S", localtime), tz_h, tz_m)
+
+class Writer(object):
+    """
+    Abstract class for writers. 
+    """
+    CONFIG_ITEMS = ["filename", "dirname", "extension", "subdir", "hpath"]
+    def __init__(self, filename=None, extension=None):
+        """
+        
+        """
+        self.filename = filename
+        self._sem = threading.Semaphore()
+        self.dirname = None
+        self.subdir = None
+        self.extension = extension
+        self.fai_cfg = {}
+        self.lima_cfg = {}
+
+
+    def __repr__(self):
+        return "Generic writer on file %s" % (self.filename)
+
+    def init(self, fai_cfg=None, lima_cfg=None):
+        """
+        Creates the directory that will host the output file(s) 
+        @param fai_cfg: configuration for worker
+        @param lima_cfg: configuration for acquisition 
+        """
+
+        with self._sem:
+            if fai_cfg is not None:
+                self.fai_cfg = fai_cfg
+            if lima_cfg is not None:
+                self.lima_cfg = lima_cfg
+            if self.filename is not None:
+                dirname = os.path.dirname(self.filename)
+                if not os.path.exists(dirname):
+                    try:
+                        os.makedirs(dirname)
+                    except Exception as err:
+                        logger.info("Problem while creating directory %s: %s" % (dirname, err))
+    def flush(self, *arg, **kwarg):
+        """
+        To be implemented
+        """
+        pass
+
+    def write(self, data):
+        """
+        To be implemented
+        """
+        pass
+
+    def setJsonConfig(self, json_config=None):
+        """
+        Sets the JSON configuration
+        """
+
+        if type(json_config) in types.StringTypes:
+            if os.path.isfile(json_config):
+                config = json.load(open(json_config, "r"))
+            else:
+                 config = json.loads(json_config)
+        else:
+            config = dict(json_config)
+        for k, v in  config.items():
+            if k in self.CONFIG_ITEMS:
+                self.__setattr__(k, v)
+
+class HDF5Writer(Writer):
+    """
+    Class allowing to write HDF5 Files.
+    
+    """
+    CONFIG = "pyFAI"
+    DATASET_NAME = "data"
+    def __init__(self, filename, hpath="data", fast_scan_width=None):
+        """
+        Constructor of an HDF5 writer:
+        
+        @param filename: name of the file
+        @param hpath: name of the group: it will contain data (2-4D dataset), [tth|q|r] and pyFAI, group containing the configuration
+        @param fast_scan_width: set it to define the width of 
+        """
+        Writer.__init__(self, filename)
+        self.hpath = hpath
+        self.fast_scan_width = None
+        if fast_scan_width is not None:
+            try:
+                self.fast_scan_width = int(fast_scan_width)
+            except:
+                pass
+        self.hdf5 = None
+        self.group = None
+        self.dataset = None
+        self.pyFAI_grp = None
+        self.radial_values = None
+        self.azimuthal_values = None
+        self.chunk = None
+        self.shape = None
+        self.ndim = None
+
+    def __repr__(self):
+        return "HDF5 writer on file %s:%s %sinitialized" % (self.filename, self.hpath, "" if self._initialized else "un")
+
+    def init(self, fai_cfg=None, lima_cfg=None):
+        """
+        Initializes the HDF5 file for writing
+        @param fai_cfg: the configuration of the worker as a dictionary
+        """
+        Writer.init(self, fai_cfg, lima_cfg)
+        with self._sem:
+            #TODO: this is Debug statement
+            open("fai_cfg.json", "w").write(json.dumps(self.fai_cfg, indent=4))
+            open("lima_cfg.json", "w").write(json.dumps(self.lima_cfg, indent=4))
+            self.fai_cfg["nbpt_rad"] = self.fai_cfg.get("nbpt_rad", 1000)
+            if h5py:
+                try:
+                    self.hdf5 = h5py.File(self.filename)
+                except IOError: #typically a corrupted HDF5 file !
+                    os.unlink(self.filename)
+                    self.hdf5 = h5py.File(self.filename)
+            else:
+                logger.error("No h5py library, no chance")
+                raise RuntimeError("No h5py library, no chance")
+            self.group = self.hdf5.require_group(self.hpath)
+            self.group.attrs["NX_class"] = "NXentry"
+            self.pyFAI_grp = self.hdf5.require_group(posixpath.join(self.hpath, self.CONFIG))
+            self.pyFAI_grp.attrs["desc"] = "PyFAI worker configuration"
+            for key, value in self.fai_cfg.items():
+                if value is None:
+                    continue
+                try:
+                    self.pyFAI_grp[key] = value
+                except:
+                    print("Unable to set %s: %s" % (key, value))
+                    self.close()
+                    sys.exit(1)
+            rad_name, rad_unit = str(self.fai_cfg.get("unit", "2th_deg")).split("_", 1)
+            self.radial_values = self.group.require_dataset(rad_name, (self.fai_cfg["nbpt_rad"],), numpy.float32)
+            if self.fai_cfg.get("nbpt_azim", 0) > 1:
+                self.azimuthal_values = self.group.require_dataset("chi", (self.fai_cfg["nbpt_azim"],), numpy.float32)
+                self.azimuthal_values.attrs["unit"] = "deg"
+                self.radial_values.attrs["interpretation"] = "scalar"
+                self.radial_values.attrs["long name"] = "Azimuthal angle"
+
+            self.radial_values.attrs["unit"] = rad_unit
+            self.radial_values.attrs["interpretation"] = "scalar"
+            self.radial_values.attrs["long name"] = "diffraction radial direction"
+            if self.fast_scan_width:
+                self.fast_motor = self.group.require_dataset("fast", (self.fast_scan_width,) , numpy.float32)
+                self.fast_motor.attrs["long name"] = "Fast motor position"
+                self.fast_motor.attrs["interpretation"] = "scalar"
+                self.fast_motor.attrs["axis"] = "1"
+                self.radial_values.attrs["axis"] = "2"
+                if self.azimuthal_values is not None:
+                    chunk = 1, self.fast_scan_width, self.fai_cfg["nbpt_azim"], self.fai_cfg["nbpt_rad"]
+                    self.ndim = 4
+                    self.azimuthal_values.attrs["axis"] = "3"
+                else:
+                    chunk = 1, self.fast_scan_width, self.fai_cfg["nbpt_rad"]
+                    self.ndim = 3
+            else:
+                self.radial_values.attrs["axis"] = "1"
+                if self.azimuthal_values is not None:
+                    chunk = 1, self.fai_cfg["nbpt_azim"], self.fai_cfg["nbpt_rad"]
+                    self.ndim = 3
+                    self.azimuthal_values.attrs["axis"] = "2"
+                else:
+                    chunk = 1, self.fai_cfg["nbpt_rad"]
+                    self.ndim = 2
+
+            if self.DATASET_NAME in self.group:
+                del self.group[self.DATASET_NAME]
+            shape = list(chunk)
+            if self.lima_cfg.get("number_of_frames", 0) > 0:
+                if self.fast_scan_width is not None:
+                    size[0] = 1 + self.lima_cfg["number_of_frames"] // self.fast_scan_width
+                else:
+                    size[0] = self.lima_cfg["number_of_frames"]
+            self.dataset = self.group.require_dataset(self.DATASET_NAME, shape, dtype=numpy.float32, chunks=chunk,
+                                                      maxshape=(None,) + chunk[1:])
+            if self.fai_cfg.get("nbpt_azim", 0) > 1:
+                self.dataset.attrs["interpretation"] = "image"
+            else:
+                self.dataset.attrs["interpretation"] = "spectrum"
+            self.dataset.attrs["signal"] = "1"
+            self.chunk = chunk
+            self.shape = chunk
+            name = "Mapping " if self.fast_scan_width else "Scanning "
+            name += "2D" if self.fai_cfg.get("nbpt_azim", 0) > 1 else "1D"
+            name += " experiment"
+            self.group["title"] = name
+            self.group["program"] = "PyFAI"
+            self.group["start_time"] = getIsoTime()
+
+
+
+    def flush(self, radial=None, azimuthal=None):
+        """
+        Update some data like axis units and so on.
+        
+        @param radial: position in radial direction
+        @param  azimuthal: position in azimuthal direction
+        """
+        with self._sem:
+            if not self.hdf5:
+                raise RuntimeError('No opened file')
+            if radial is not None:
+                if radial.shape == self.radial_values.shape:
+                    self.radial_values[:] = radial
+                else:
+                    logger.warning("Unable to assign radial axis position")
+            if azimuthal is not None:
+                if azimuthal.shape == self.azimuthal_values.shape:
+                    self.azimuthal_values[:] = azimuthal
+                else:
+                    logger.warning("Unable to assign azimuthal axis position")
+            self.hdf5.flush()
+
+    def close(self):
+        with self._sem:
+            if self.hdf5:
+                self.flush()
+                self.hdf5.close()
+                self.hdf5 = None
+
+    def write(self, data, index=0):
+        """
+        Minimalistic method to limit the overhead.
+        """
+        with self._sem:
+            if self.dataset is None:
+                logger.warning("Writer not initialized !")
+                return
+            if self.azimuthal_values is None:
+                data = data[:, 1] #take the second column only aka I
+            if self.fast_scan_width:
+                index0, index1 = (index // self.fast_scan_width, index % self.fast_scan_width)
+                if index0 >= self.dataset.shape[0]:
+                    self.dataset.resize(index0 + 1, axis=0)
+                self.dataset[index0, index1] = data
+            else:
+                if index >= self.dataset.shape[0]:
+                    self.dataset.resize(index + 1, axis=0)
+                self.dataset[index] = data
+
+class AsciiWriter(Writer):
+    """
+    Ascii file writer (.xy or .dat) 
+    """
+    def __init__(self, filename=None, prefix="fai_", extension=".dat"):
+        """
+        
+        """
+        Writer.__init__(self, filename, extension)
+        self.header = None
+        if os.path.isdir(filename):
+            self.directory = filename
+        else:
+            self.directory = os.path.dirname(filename)
+        self.prefix = prefix
+        self.index_format = "%04i"
+        self.start_index = 0
+
+    def __repr__(self):
+        return "Ascii writer on file %s" % (self.filename)
+
+    def init(self, fai_cfg=None, lima_cfg=None):
+        """
+        Creates the directory that will host the output file(s) 
+        
+        """
+        Writer.init(self, fai_cfg, lima_cfg)
+        with self._sem:
+            headerLst = ["", "== Detector =="]
+            if "detector" in self.fai_cfg:
+                headerLst.append("Detector: %s" % self.fai_cfg["detector"])
+            if "splineFile" in self.fai_cfg:
+                headerLst.append("SplineFile: %s" % self.fai_cfg["splineFile"])
+            if  "pixel1" in self.fai_cfg:
+                headerLst.append("PixelSize: %.3e, %.3e m" % (self.fai_cfg["pixel1"], self.fai_cfg["pixel2"]))
+            if "mask_file" in self.fai_cfg:
+                headerLst.append("MaskFile: %s" % (self.fai_cfg["mask_file"]))
+
+            headerLst.append("== pyFAI calibration ==")
+            if "poni1" in self.fai_cfg:
+                headerLst.append("PONI: %.3e, %.3e m" % (self.fai_cfg["poni1"], self.fai_cfg["poni2"]))
+            if "dist" in self.fai_cfg:
+                headerLst.append("Distance Sample to Detector: %s m" % self.fai_cfg["dist"])
+            if "rot1" in self.fai_cfg:
+                headerLst.append("Rotations: %.6f %.6f %.6f rad" % (self.fai_cfg["rot1"], self.fai_cfg["rot2"], self.fai_cfg["rot3"]))
+            if "wavelength" in self.fai_cfg:
+                headerLst.append("Wavelength: %s" % self.fai_cfg["wavelength"])
+            if "dark_current" in self.fai_cfg:
+                headerLst.append("Dark current: %s" % self.fai_cfg["dark_current"])
+            if "flat_field" in self.fai_cfg:
+                headerLst.append("Flat field: %s" % self.fai_cfg["flat_field"])
+            if "polarization_factor" in self.fai_cfg:
+                headerLst.append("Polarization factor: %s" % self.fai_cfg["polarization_factor"])
+            headerLst.append("")
+            if "do_poisson" in self.fai_cfg:
+                headerLst.append("%14s %14s %s" % (self.fai_cfg["unit"], "I", "sigma"))
+            else:
+                headerLst.append("%14s %14s" % (self.fai_cfg["unit"], "I"))
+#            headerLst.append("")
+            self.header = os.linesep.join([""] + ["# " + i for i in headerLst] + [""])
+        self.prefix = lima_cfg.get("prefix", self.prefix)
+        self.index_format = lima_cfg.get("index_format", self.index_format)
+        self.start_index = lima_cfg.get("start_index", self.start_index)
+        if not self.subdir:
+            self.directory = lima_cfg.get("directory", self.directory)
+        elif self.subdir.startswith("/"):
+            self.directory = self.subdir
+        else:
+            self.directory = os.path.join(lima_cfg.get("directory", self.directory), self.subdir)
+        if not os.path.exists(self.directory):
+            logger.warning("Output directory: %s does not exist,creating it" % self.directory)
+            try:
+                os.makedirs(self.directory)
+            except Exception as error:
+                logger.info("Problem while creating directory %s: %s" % (self.directory, error))
+
+
+    def write(self, data, index=0):
+        filename = os.path.join(self.directory, self.prefix + (self.index_format % (self.start_index + index)) + self.extension)
+        if filename:
+            with open(filename, "w") as f:
+                f.write("# Processing time: %s%s" % (getIsoTime(), self.header))
+                numpy.savetxt(f, data)
+
+class FabioWriter(Writer):
+    """
+    Image file writer based on FabIO 
+    
+    TODO !!!
+    """
+    def __init__(self, filename=None):
+        """
+        
+        """
+        Writer.__init__(self, filename)
+        self.header = None
+        self.directory = None
+        self.prefix = None
+        self.index_format = "%04i"
+        self.start_index = 0
+        self.fabio_class = None
+
+    def __repr__(self):
+        return "Image writer on file %s" % (self.filename)
+
+    def init(self, fai_cfg=None, lima_cfg=None):
+        """
+        Creates the directory that will host the output file(s) 
+        
+        """
+        Writer.init(self, fai_cfg, lima_cfg)
+        with self._sem:
+            dim1_unit = units.to_unit(fai_cfg["unit"])
+            header_keys = ["dist", "poni1", "poni2", "rot1", "rot2", "rot3",
+                           "chi_min", "chi_max",
+                           dim1_unit.REPR + "_min",
+                           dim1_unit.REPR + "_max",
+                           "pixelX", "pixelY",
+                           "dark", "flat", "polarization_factor", "normalization_factor"]
+            header = {"dist": str(fai_cfg.get("dist")),
+                      "poni1": str(fai_cfg.get("poni1")),
+                      "poni2": str(fai_cfg.get("poni2")),
+                      "rot1": str(fai_cfg.get("rot1")),
+                      "rot2": str(fai_cfg.get("rot1")),
+                      "rot3": str(fai_cfg.get("dist")),
+                      "chi_min": str(fai_cfg.get("dist")),
+                      "chi_max": str(fai_cfg.get("dist")),
+                      dim1_unit.REPR + "_min": str(fai_cfg.get("dist")),
+                      dim1_unit.REPR + "_max": str(fai_cfg.get("dist")),
+                      "pixelX": str(fai_cfg.get("dist")),  # this is not a bug ... most people expect dim1 to be X
+                      "pixelY": str(fai_cfg.get("dist")),  # this is not a bug ... most people expect dim2 to be Y
+                      "polarization_factor": str(fai_cfg.get("dist")),
+                      "normalization_factor":str(fai_cfg.get("dist")),
+                      }
+
+            if self.splineFile:
+                header["spline"] = str(self.splineFile)
+
+            if dark is not None:
+                if self.darkfiles:
+                    header["dark"] = self.darkfiles
+                else:
+                    header["dark"] = 'unknown dark applied'
+            if flat is not None:
+                if self.flatfiles:
+                    header["flat"] = self.flatfiles
+                else:
+                    header["flat"] = 'unknown flat applied'
+            f2d = self.getFit2D()
+            for key in f2d:
+                header["key"] = f2d[key]
+        self.prefix = prefix
+        self.index_format = index_format
+        self.start_index = start_index
+        if not self.subdir:
+            self.directory = directory
+        elif self.subdir.startswith("/"):
+            self.directory = self.subdir
+        else:
+            self.directory = os.path.join(directory, self.subdir)
+        if not os.path.exists(self.directory):
+            logger.warning("Output directory: %s does not exist,creating it" % self.directory)
+            try:
+                os.makedirs(self.directory)
+            except Exception as error:
+                logger.info("Problem while creating directory %s: %s" % (self.directory, error))
+
+
+    def write(self, data, index=0):
+        filename = os.path.join(self.directory, self.prefix + (self.index_format % (self.start_index + index)) + self.extension)
+        if filename:
+            with open(filename, "w") as f:
+                f.write("# Processing time: %s%s" % (getIsoTime(), self.header))
+                numpy.savetxt(f, data)
diff --git a/pyFAI-src/ocl_azim.py b/pyFAI-src/ocl_azim.py
index be04b74..827bb43 100644
--- a/pyFAI-src/ocl_azim.py
+++ b/pyFAI-src/ocl_azim.py
@@ -46,7 +46,8 @@ import os
 import logging
 import threading
 import numpy
-from pyFAI.opencl import ocl, pyopencl
+from .utils import get_cl_file
+from .opencl import ocl, pyopencl
 if pyopencl:
     mf = pyopencl.mem_flags
 else:
@@ -280,22 +281,24 @@ class Integrator1d(object):
 
     def _compile_kernels(self, kernel_file=None):
         """
-
+        Compile the kernel
+        
+        @param kernel_file: filename of the kernel (to test other kernels)
         """
         kernel_name = "ocl_azim_kernel_2.cl"
         if kernel_file is None:
             if os.path.isfile(kernel_name):
                 kernel_file = os.path.abspath(kernel_name)
             else:
-                kernel_file = \
-                    os.path.join(os.path.dirname(os.path.abspath(__file__)),
-                                 kernel_name)
+                kernel_file = get_cl_file(kernel_name)
         else:
             kernel_file = str(kernel_file)
-        kernel_src = open(kernel_file).read()
+
+        with open(kernel_file, "r") as kernelFile:
+            kernel_src = kernelFile.read()
 
         compile_options = "-D BLOCK_SIZE=%i  -D BINS=%i -D NN=%i" % \
-            (self.BLOCK_SIZE, self.nBins, self.nData)
+                            (self.BLOCK_SIZE, self.nBins, self.nData)
         if self.useFp64:
             compile_options += " -D ENABLE_FP64"
 
diff --git a/pyFAI-src/ocl_azim_lut.py b/pyFAI-src/ocl_azim_lut.py
index 5f2f279..def53f4 100644
--- a/pyFAI-src/ocl_azim_lut.py
+++ b/pyFAI-src/ocl_azim_lut.py
@@ -33,14 +33,15 @@ import os, gc, logging
 import threading
 import hashlib
 import numpy
-from opencl import ocl, pyopencl
-from splitBBoxLUT import HistoBBox1d
+from .opencl import ocl, pyopencl
+from .splitBBoxLUT import HistoBBox1d
+from .utils import get_cl_file
 if pyopencl:
     mf = pyopencl.mem_flags
 else:
     raise ImportError("pyopencl is not installed")
 try:
-    from fastcrc import crc32
+    from .fastcrc import crc32
 except:
     from zlib import crc32
 logger = logging.getLogger("pyFAI.ocl_azim_lut")
@@ -164,10 +165,11 @@ class OCL_LUT_Integrator(object):
             if os.path.isfile(kernel_name):
                 kernel_file = os.path.abspath(kernel_name)
             else:
-                kernel_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), kernel_name)
+                kernel_file = get_cl_file(kernel_name)
         else:
             kernel_file = str(kernel_file)
-        kernel_src = open(kernel_file).read()
+        with open(kernel_file, "r") as kernelFile:
+            kernel_src = kernelFile.read()
 
         compile_options = "-D NBINS=%i  -D NIMAGE=%i -D NLUT=%i -D ON_CPU=%i" % \
                 (self.bins, self.size, self.lut_size, int(self.device_type == "CPU"))
diff --git a/pyFAI-src/opencl.py b/pyFAI-src/opencl.py
index e85bbeb..e51bef1 100644
--- a/pyFAI-src/opencl.py
+++ b/pyFAI-src/opencl.py
@@ -28,8 +28,8 @@ __author__ = "Jerome Kieffer"
 __contact__ = "Jerome.Kieffer at ESRF.eu"
 __license__ = "GPLv3+"
 __copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
-__date__ = "31/01/2013"
-__status__ = "beta"
+__date__ = "21/11/2013"
+__status__ = "stable"
 
 import os, logging
 logger = logging.getLogger("pyFAI.opencl")
@@ -38,12 +38,12 @@ try:
     import pyopencl
 #    from pyFAI.opencl import ocl
 except ImportError:
-    logger.error("Unable to import pyOpenCl. Please install it from: http://pypi.python.org/pypi/pyopencl")
+    logger.warning("Unable to import pyOpenCl. Please install it from: http://pypi.python.org/pypi/pyopencl")
     pyopencl = None
 
-FLOP_PER_CORE = {"GPU": 64,  # GPU, Fermi at least perform 64 flops per cycle/multicore, G80 were at 24 or 48 ...
-                  "CPU": 4  # CPU, at least intel's have 4 operation per cycle
-                  }
+FLOP_PER_CORE = { "GPU": 64, # GPU, Fermi at least perform 64 flops per cycle/multicore, G80 were at 24 or 48 ...
+                  "CPU": 4,  # CPU, at least intel's have 4 operation per cycle
+                  "ACC": 8}  # ACC: the Xeon-phi (MIC) appears to be able to process 8 Flops per hyperthreaded-core
 NVIDIA_FLOP_PER_CORE = {(1, 0): 24,  # Guessed !
                          (1, 1): 24,  # Measured on G98 [Quadro NVS 295]
                          (1, 2): 24,  # Guessed !
@@ -58,11 +58,11 @@ class Device(object):
     """
     Simple class that contains the structure of an OpenCL device
     """
-    def __init__(self, name="None", type=None, version=None, driver_version=None,
+    def __init__(self, name="None", dtype=None, version=None, driver_version=None,
                  extensions="", memory=None, available=None,
-                 cores=None, frequency=None, flop_core=None, id=0):
+                 cores=None, frequency=None, flop_core=None, idx=0):
         self.name = name.strip()
-        self.type = type
+        self.type = dtype
         self.version = version
         self.driver_version = driver_version
         self.extensions = extensions.split()
@@ -70,9 +70,9 @@ class Device(object):
         self.available = available
         self.cores = cores
         self.frequency = frequency
-        self.id = id
+        self.id = idx
         if not flop_core:
-            flop_core = FLOP_PER_CORE.get(type, 1)
+            flop_core = FLOP_PER_CORE.get(dtype, 1)
         if cores and frequency:
             self.flops = cores * frequency * flop_core
         else:
@@ -86,13 +86,13 @@ class Platform(object):
     """
     Simple class that contains the structure of an OpenCL platform
     """
-    def __init__(self, name="None", vendor="None", version=None, extensions=None, id=0):
+    def __init__(self, name="None", vendor="None", version=None, extensions=None, idx=0):
         self.name = name.strip()
         self.vendor = vendor.strip()
         self.version = version
         self.extensions = extensions.split()
         self.devices = []
-        self.id = id
+        self.id = idx
 
     def __repr__(self):
         return "%s" % self.name
@@ -126,8 +126,8 @@ class OpenCL(object):
     """
     platforms = []
     if pyopencl:
-        for id, platform in enumerate(pyopencl.get_platforms()):
-            pypl = Platform(platform.name, platform.vendor, platform.version, platform.extensions, id)
+        for idx, platform in enumerate(pyopencl.get_platforms()):
+            pypl = Platform(platform.name, platform.vendor, platform.version, platform.extensions, idx)
             for idd, device in enumerate(platform.get_devices()):
                 ####################################################
                 # Nvidia does not report int64 atomics (we are using) ...
@@ -136,7 +136,9 @@ class OpenCL(object):
                 extensions = device.extensions
                 if (pypl.vendor == "NVIDIA Corporation") and ('cl_khr_fp64' in extensions):
                                 extensions += ' cl_khr_int64_base_atomics cl_khr_int64_extended_atomics'
-                devtype = pyopencl.device_type.to_string(device.type)
+                devtype = pyopencl.device_type.to_string(device.type).upper()
+                if len(devtype) > 3:
+                    devtype = devtype[:3]
                 if (pypl.vendor == "NVIDIA Corporation") and (devtype == "GPU") and "compute_capability_major_nv" in dir(device):
                     comput_cap = device.compute_capability_major_nv, device.compute_capability_minor_nv
                     flop_core = NVIDIA_FLOP_PER_CORE.get(comput_cap, min(NVIDIA_FLOP_PER_CORE.values()))
@@ -179,7 +181,7 @@ class OpenCL(object):
                 out = self.platforms[platid]
         return out
 
-    def select_device(self, type="ALL", memory=None, extensions=[], best=True):
+    def select_device(self, dtype="ALL", memory=None, extensions=[], best=True, **kwargs):
         """
         Select a device based on few parameters (at the end, keep the one with most memory)
 
@@ -188,11 +190,16 @@ class OpenCL(object):
         @param extensions: list of extensions to be present
         @param best: shall we look for the
         """
-        type = type.upper()
+        if "type" in kwargs:
+            dtype = kwargs["type"].upper()
+        else:
+            dtype = dtype.upper()
+        if len(dtype) > 3:
+            dtype = dtype[:3]
         best_found = None
         for platformid, platform in enumerate(self.platforms):
             for deviceid, device in enumerate(platform.devices):
-                if (type in ["ALL", "DEF"]) or (device.type == type):
+                if (dtype in ["ALL", "DEF"]) or (device.type == dtype):
                     if (memory is None) or (memory <= device.memory):
                         found = True
                         for ext in extensions:
@@ -230,7 +237,7 @@ class OpenCL(object):
             if useFp64:
                 ids = ocl.select_device(type=devicetype, extensions=["cl_khr_int64_base_atomics"])
             else:
-                ids = ocl.select_device(type=devicetype)
+                ids = ocl.select_device(dtype=devicetype)
             if ids:
                 platformid = ids[0]
                 deviceid = ids[1]
@@ -245,3 +252,4 @@ if pyopencl:
     ocl = OpenCL()
 else:
     ocl = None
+
diff --git a/pyFAI-src/peakPicker.py b/pyFAI-src/peakPicker.py
index b66a2ef..5115528 100644
--- a/pyFAI-src/peakPicker.py
+++ b/pyFAI-src/peakPicker.py
@@ -105,8 +105,13 @@ class PeakPicker(object):
         if maximize:
             mng = pylab.get_current_fig_manager()
 #            print mng.window.maxsize()
-            event = Event(1920, 1200)  # *mng.window.maxsize())
-            mng.resize(event)
+            # *mng.window.maxsize())
+            win_shape = (1920, 1080)
+            event = Event(*win_shape)
+            try:
+                mng.resize(event)
+            except TypeError:
+                 mng.resize(*win_shape)
             self.fig.canvas.draw()
         self.fig.canvas.mpl_connect('button_press_event', self.onclick)
 
@@ -206,7 +211,7 @@ class PeakPicker(object):
                     logging.info("Removing No group point (non existing?)")
                 else:
                     logging.info("Removing point group #%i (%5.1f %5.1f) containing %i subpoints" % (len(self.points), poped_points[0][0], poped_points[0][1], len(poped_points)))
-
+                self.fig.canvas.draw()
                 sys.stdout.flush()
 
     def readFloatFromKeyboard(self, text, dictVar):
diff --git a/pyFAI-src/processor.py b/pyFAI-src/processor.py
new file mode 100644
index 0000000..99938e2
--- /dev/null
+++ b/pyFAI-src/processor.py
@@ -0,0 +1,254 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+#    Project: Azimuthal integration
+#             https://github.com/kif/pyFAI
+#
+#
+#    Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
+#
+#    Principal author:       Jérôme Kieffer (Jerome.Kieffer at ESRF.eu)
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+__author__ = "Jérôme Kieffer"
+__contact__ = "Jerome.Kieffer at ESRF.eu"
+__license__ = "GPLv3+"
+__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
+__date__ = "04/09/2013"
+__status__ = "developement"
+__docformat__ = 'restructuredtext'
+
+import os
+import logging
+import types
+from threading import Semaphore
+import fabio
+logger = logging.getLogger("pyFAI.processor")
+from . import azimuthalIntegratory
+from .detectors import detector_factory
+AzimuthalIntegrator = azimuthalIntegrator.AzimuthalIntegrator
+
+class Processor(object):
+    """
+    This class can be set-up from a configuration file to define an azimuthal integrator
+    with all pre-processing and all post processing configured
+    """
+    def __init__(self, config=None):
+        self.ai = AzimuthalIntegrator()
+        self.config = {}
+        self.config_file = "azimInt.json"
+        self.nbpt_azim = 0
+        if type(config) == dict:
+            self.config = config
+        elif type(config) in types.StringTypes:
+            if os.path.isfile(config):
+                self.config = json.load(open(config, "r"))
+                self.config_file(config)
+            else:
+                self.config = json.loads(config)
+        if self.config:
+            self.configure()
+
+    def __repr__(self):
+        """
+        pretty print of myself
+        """
+        lstout = ["Azimuthal Integrator:", self.ai.__repr__(),
+                "Input image shape: %s" % list(self.shapeIn),
+                "Number of points in radial direction: %s" % self.nbpt_rad,
+                "Number of points in azimuthal direction: %s" % self.nbpt_azim,
+                "Unit in radial dimension: %s" % self.unit.REPR,
+                "Correct for solid angle: %s" % self.correct_solid_angle,
+                "Polarization factor: %s" % self.polarization,
+                "Dark current image: %s" % self.dark_current_image,
+                "Flat field image: %s" % self.flat_field_image,
+                "Mask image: %s" % self.mask_image,
+                "Dummy: %s,\tDelta_Dummy: %s" % (self.dummy, self.delta_dummy),
+                "Directory: %s, \tExtension: %s" % (self.subdir, self.extension)]
+        return os.linesep.join(lstout)
+
+    def do_2D(self):
+        return self.nbpt_azim > 1
+
+    def reset(self):
+        """
+        this is just to force the integrator to initialize
+        """
+        logger.debug("did a reset")
+        self.ai.reset()
+
+    def configure(self, config=None):
+
+        if config is None:
+            config = self.config
+        if not config:
+            config = {}
+
+        if "poni" in config:
+            poni = config["poni"]
+            if poni and os.path.isfile(poni):
+                self.ai = AzimuthalIntegrator.loads(poni)
+        else:
+            self.ai = AzimuthalIntegrator()
+        detector = config.get("detector", "detector")
+        self.ai.detector = detector_factory(detector)
+
+        if "wavelength" in config:
+            wavelength = config["wavelength"]
+            try:
+                fwavelength = float(wavelength)
+            except ValueError:
+                logger.error("Unable to convert wavelength to float: %s" % wavelength)
+            else:
+                if fwavelength <= 0 or fwavelength > 1e-6:
+                    logger.warning("Wavelength is in meter ... unlikely value %s" % fwavelength)
+                self.ai.wavelength = fwavelength
+
+        splineFile = config.get("splineFile")
+        if splineFile and os.path.isfile(splineFile):
+            self.ai.detector.splineFile = splineFile
+        self.ai.pixel1 = float(config.get("pixel1", 1))
+        self.ai.pixel2 = float(config.get("pixel2", 1))
+        self.ai.dist = config.get("dist", 1)
+        self.ai.poni1 = config.get("poni1", 0)
+        self.ai.poni2 = config.get("poni2", 0)
+        self.ai.rot1 = config.get("rot1", 0)
+        self.ai.rot2 = config.get("rot2", 0)
+        self.ai.rot3 = config.get("rot3", 0)
+
+
+        if config.get("chi_discontinuity_at_0"):
+            self.ai.setChiDiscAtZero()
+        else:
+            self.ai.setChiDiscAtPi()
+
+
+        mask_file = config.get("mask_file")
+        do_mask = config.get("do_mask")
+        if mask_file and os.path.exists(mask_file) and do_mask:
+            try:
+                mask = fabio.open(mask_file).data
+            except Exception as error:
+                logger.error("Unable to load mask file %s, error %s" % (mask_file, error))
+            else:
+                self.ai.mask = mask
+                self.mask_image = os.path.abspath(mask_file)
+
+        self.ai.set_darkfiles([i.strip() for i in config.get("dark_current", "").split(",")
+                               if os.path.isfile(i.strip())])
+        self.ai.set_flatfiles([i.strip() for i in config.get("flat_field", "").split(",")
+                               if os.path.isfile(i.strip())])
+        self.dark_current_image = self.ai.darkfiles
+        self.flat_field_image = self.ai.flatfiles
+        if config.get("do_2D"):
+            self.nbpt_azim = int(config.get("nbpt_azim"))
+        else:
+            self.nbpt_azim = 1
+        if config.get("nbpt_rad"):
+            self.nbpt_rad = int(config.get("nbpt_rad"))
+        self.unit = pyFAI.units.to_unit(config.get("unit", pyFAI.units.TTH_DEG))
+        self.do_poisson = config.get("do_poisson")
+        if config.get("do_polarization"):
+            self.polarization = config.get("polarization")
+        else:
+            self.polarization = None
+        logger.info(self.ai.__repr__())
+        self.reset()
+        # For now we do not calculate the LUT as the size of the input image is unknown
+
+    def get_config(self):
+        """
+        retrieves the configuration 
+        """
+        to_save = { "poni": str(self.poni.text()).strip(),
+                    "detector": str(self.detector.currentText()).lower(),
+                    "wavelength":float_(self.wavelength.text()),
+                    "splineFile":str(self.splineFile.text()).strip(),
+                    "pixel1": float_(self.pixel1.text()),
+                    "pixel2":float_(self.pixel2.text()),
+                    "dist":float_(self.dist.text()),
+                    "poni1":float_(self.poni1.text()),
+                    "poni2":float_(self.poni2.text()),
+                    "rot1":float_(self.rot1.text()),
+                    "rot2":float_(self.rot2.text()),
+                    "rot3":float_(self.rot3.text()),
+                    "do_dummy": bool(self.do_dummy.isChecked()),
+                    "do_mask":  bool(self.do_mask.isChecked()),
+                    "do_dark": bool(self.do_dark.isChecked()),
+                    "do_flat": bool(self.do_flat.isChecked()),
+                    "do_polarization":bool(self.do_polarization.isChecked()),
+                    "val_dummy":float_(self.val_dummy.text()),
+                    "delta_dummy":float_(self.delta_dummy.text()),
+                    "mask_file":str(self.mask_file.text()).strip(),
+                    "dark_current":str(self.dark_current.text()).strip(),
+                    "flat_field":str(self.flat_field.text()).strip(),
+                    "polarization_factor":float_(self.polarization_factor.value()),
+                    "nbpt_rad":int_(self.rad_pt.text()),
+                    "do_2D":bool(self.do_2D.isChecked()),
+                    "nbpt_azim":int_(self.azim_pt.text()),
+                    "chi_discontinuity_at_0": bool(self.chi_discontinuity_at_0.isChecked()),
+                    "do_solid_angle": bool(self.do_solid_angle.isChecked()),
+                    "do_radial_range": bool(self.do_radial_range.isChecked()),
+                    "do_azimuthal_range": bool(self.do_azimuthal_range.isChecked()),
+                    "do_poisson": bool(self.do_poisson.isChecked()),
+                    "radial_range_min":float_(self.radial_range_min.text()),
+                    "radial_range_max":float_(self.radial_range_max.text()),
+                    "azimuth_range_min":float_(self.azimuth_range_min.text()),
+                    "azimuth_range_max":float_(self.azimuth_range_max.text()),
+                   }
+        if self.q_nm.isChecked():
+            to_save["unit"] = "q_nm^-1"
+        elif self.q_A.isChecked():
+            to_save["unit"] = "q_A^-1"
+        elif self.tth_deg.isChecked():
+            to_save["unit"] = "2th_deg"
+        elif self.tth_rad.isChecked():
+            to_save["unit"] = "2th_rad"
+        elif self.r_mm.isChecked():
+            to_save["unit"] = "r_mm"
+        try:
+            with open(filename, "w") as myFile:
+                json.dump(to_save, myFile, indent=4)
+        except IOError as error:
+            logger.error("Error while saving config: %s" % error)
+        else:
+            logger.debug("Saved")
+
+    def save_config(self, filename=None):
+        if not filename:
+            filename = self.config_file
+
+
+    def warmup(self):
+        """
+        Reset and Process a dummy image to ensure eveything is initialized
+        """
+        self.shapeIn
+        self.ai.reset()
+
+        if self.do_2D():
+            threading.Thread(target=self.ai.integrate2d,
+                                 name="init2d",
+                                 args=(numpy.zeros(self.shapeIn, dtype=numpy.float32),
+                                        self.nbpt_rad, self.nbpt_azim),
+                                 kwargs=dict(method="lut", unit=self.unit)
+                                 ).start()
+        else:
+            threading.Thread(target=self.ai.integrate1d,
+                                 name="init1d",
+                                 args=(numpy.zeros(self.shapeIn, dtype=numpy.float32),
+                                        self.nbpt_rad),
+                                 kwargs=dict(method="lut", unit=self.unit)
+                                 ).start()
diff --git a/pyFAI-src/spline.py b/pyFAI-src/spline.py
index 6fc5106..88db6ec 100644
--- a/pyFAI-src/spline.py
+++ b/pyFAI-src/spline.py
@@ -42,10 +42,11 @@ import logging
 import scipy.optimize
 import scipy.interpolate
 from scipy.interpolate import fitpack
+import traceback
 logger = logging.getLogger("pyFAI.spline")
 
 
-class Spline:
+class Spline(object):
     """
     This class is a python representation of the spline file
 
@@ -145,54 +146,58 @@ class Spline:
         @type filename: str
         """
         if not os.path.isfile(filename):
-            raise IOError("File does not exist %s" % filename)
+            raise IOError("Spline File does not exist %s" % filename)
         self.filename = filename
         stringSpline = [i.rstrip() for i in open(filename)]
-        indexLine = 0
-        for oneLine in stringSpline:
-            stripedLine = oneLine.strip().upper()
-            if stripedLine == "VALID REGION":
-                data = stringSpline[indexLine + 1]
-                self.xmin = float(data[self.lenStrFloat * 0:self.lenStrFloat * 1])
-                self.ymin = float(data[self.lenStrFloat * 1:self.lenStrFloat * 2])
-                self.xmax = float(data[self.lenStrFloat * 2:self.lenStrFloat * 3])
-                self.ymax = float(data[self.lenStrFloat * 3:self.lenStrFloat * 4])
-            elif stripedLine == "GRID SPACING, X-PIXEL SIZE, Y-PIXEL SIZE":
-                data = stringSpline[indexLine + 1]
-                self.grid = float(data[:self.lenStrFloat])
-                self.pixelSize = \
-                    (float(data[self.lenStrFloat:self.lenStrFloat * 2]),
-                     float(data[self.lenStrFloat * 2:self.lenStrFloat * 3]))
-            elif stripedLine == "X-DISTORTION":
-                data = stringSpline[indexLine + 1]
-                [splineKnotsXLen, splineKnotsYLen] = \
-                    [int(i) for i in data.split()]
-                databloc = []
-                for line in stringSpline[indexLine + 2:]:
-                    if len(line) > 0:
-                        for i in range(len(line) / self.lenStrFloat):
-                            databloc.append(float(line[i * self.lenStrFloat: (i + 1) * self.lenStrFloat]))
-                    else:
-                        break
-                self.xSplineKnotsX = databloc[:splineKnotsXLen]
-                self.xSplineKnotsY = databloc[splineKnotsXLen:splineKnotsXLen + splineKnotsYLen]
-                self.xSplineCoeff = databloc[splineKnotsXLen + splineKnotsYLen:]
-            elif stripedLine == "Y-DISTORTION":
-                data = stringSpline[indexLine + 1]
-                [splineKnotsXLen, splineKnotsYLen] = [int(i) for i in data.split()]
-                databloc = []
-                for line in stringSpline[indexLine + 2:]:
-                    if len(line) > 0:
-                        for i in range(len(line) / self.lenStrFloat):
-                            databloc.append(float(line[i * self.lenStrFloat:(i + 1) * self.lenStrFloat]))
-                    else:
-                        break
-                self.ySplineKnotsX = databloc[:splineKnotsXLen]
-                self.ySplineKnotsY = databloc[splineKnotsXLen:splineKnotsXLen + splineKnotsYLen]
-                self.ySplineCoeff = databloc[ splineKnotsXLen + splineKnotsYLen:]
-# Keep this at the end
-            indexLine += 1
-
+        try:
+            indexLine = 0
+            for oneLine in stringSpline:
+                stripedLine = oneLine.strip().upper()
+                if stripedLine == "VALID REGION":
+                    data = stringSpline[indexLine + 1]
+                    self.xmin = float(data[self.lenStrFloat * 0:self.lenStrFloat * 1])
+                    self.ymin = float(data[self.lenStrFloat * 1:self.lenStrFloat * 2])
+                    self.xmax = float(data[self.lenStrFloat * 2:self.lenStrFloat * 3])
+                    self.ymax = float(data[self.lenStrFloat * 3:self.lenStrFloat * 4])
+                elif stripedLine == "GRID SPACING, X-PIXEL SIZE, Y-PIXEL SIZE":
+                    data = stringSpline[indexLine + 1]
+                    self.grid = float(data[:self.lenStrFloat])
+                    self.pixelSize = \
+                        (float(data[self.lenStrFloat:self.lenStrFloat * 2]),
+                         float(data[self.lenStrFloat * 2:self.lenStrFloat * 3]))
+                elif stripedLine == "X-DISTORTION":
+                    data = stringSpline[indexLine + 1]
+                    [splineKnotsXLen, splineKnotsYLen] = \
+                        [int(i) for i in data.split()]
+                    databloc = []
+                    for line in stringSpline[indexLine + 2:]:
+                        if len(line) > 0:
+                            for i in range(len(line) / self.lenStrFloat):
+                                databloc.append(float(line[i * self.lenStrFloat: (i + 1) * self.lenStrFloat]))
+                        else:
+                            break
+                    self.xSplineKnotsX = databloc[:splineKnotsXLen]
+                    self.xSplineKnotsY = databloc[splineKnotsXLen:splineKnotsXLen + splineKnotsYLen]
+                    self.xSplineCoeff = databloc[splineKnotsXLen + splineKnotsYLen:]
+                elif stripedLine == "Y-DISTORTION":
+                    data = stringSpline[indexLine + 1]
+                    [splineKnotsXLen, splineKnotsYLen] = [int(i) for i in data.split()]
+                    databloc = []
+                    for line in stringSpline[indexLine + 2:]:
+                        if len(line) > 0:
+                            for i in range(len(line) / self.lenStrFloat):
+                                databloc.append(float(line[i * self.lenStrFloat:(i + 1) * self.lenStrFloat]))
+                        else:
+                            break
+                    self.ySplineKnotsX = databloc[:splineKnotsXLen]
+                    self.ySplineKnotsY = databloc[splineKnotsXLen:splineKnotsXLen + splineKnotsYLen]
+                    self.ySplineCoeff = databloc[ splineKnotsXLen + splineKnotsYLen:]
+    # Keep this at the end
+                indexLine += 1
+        except:        
+            traceback.print_exc()
+            raise IOError("Spline File parsing error: %s" % (filename))
+                
     def comparison(self, ref, verbose=False):
         """
         Compares the current spline distortion with a reference
diff --git a/pyFAI-src/units.py b/pyFAI-src/units.py
index 7310b05..75504c0 100644
--- a/pyFAI-src/units.py
+++ b/pyFAI-src/units.py
@@ -93,8 +93,8 @@ def to_unit(obj):
             if one_unit.REPR == obj:
                 rad_unit = one_unit
                 break
-    elif isinstance(obj, Enum):
+    elif obj.__class__.__name__.split(".")[-1] == "Enum":
         rad_unit = obj
     if rad_unit is None:
-        logger.error("Unable to recognize this type unit %s. Valid units are 2th_deg, 2th_rad, q_nm^-1, q_A^-1 and r_mm" % obj)
+        logger.error("Unable to recognize this type unit '%s' of type %s. Valid units are 2th_deg, 2th_rad, q_nm^-1, q_A^-1 and r_mm" % (obj, type(obj)))
     return rad_unit
diff --git a/pyFAI-src/utils.py b/pyFAI-src/utils.py
index bd84598..643e6fd 100644
--- a/pyFAI-src/utils.py
+++ b/pyFAI-src/utils.py
@@ -42,8 +42,12 @@ import numpy
 import fabio
 from scipy import ndimage
 from scipy.interpolate import interp1d
-from math import  ceil
-from . import relabel as relabelCython
+from math import  ceil, sin, cos, atan2, pi
+
+try:
+    from . import relabel as relabelCython
+except:
+    relabelCython = None
 from scipy.optimize.optimize import fmin, fminbound
 import scipy.ndimage.filters
 logger = logging.getLogger("pyFAI.utils")
@@ -380,17 +384,20 @@ def relabel(label, data, blured, max_size=None):
     @param max_size: the max number of label wanted
     @return array like label
     """
-    max_label = label.max()
-    a, b, c, d = relabelCython.countThem(label, data, blured)
-    count = d
-    sortCount = count.argsort()
-    invSortCount = sortCount[-1::-1]
-    invCutInvSortCount = numpy.zeros(max_label + 1, dtype=int)
-    for i, j in enumerate(list(invSortCount[:max_size])):
-        invCutInvSortCount[j] = i
-    f = lambda i:invCutInvSortCount[i]
-    return f(label)
-
+    if relabelCython:
+        max_label = label.max()
+        a, b, c, d = relabelCython.countThem(label, data, blured)
+        count = d
+        sortCount = count.argsort()
+        invSortCount = sortCount[-1::-1]
+        invCutInvSortCount = numpy.zeros(max_label + 1, dtype=int)
+        for i, j in enumerate(list(invSortCount[:max_size])):
+            invCutInvSortCount[j] = i
+        f = lambda i:invCutInvSortCount[i]
+        return f(label)
+    else:
+        logger.warning("relabel Cython module is not available...")
+        return label
 
 def averageDark(lstimg, center_method="mean", cutoff=None):
     """
@@ -452,6 +459,7 @@ def averageImages(listImages, output=None, threshold=0.1, minimum=None, maximum=
     @param filter_: can be maximum, mean or median (default=mean)
     @param correct_flat_from_dark: shall the flat be re-corrected ?
     @param cutoff: keep all data where (I-center)/std < cutoff
+    @return: filename with the data or the data ndarray in case format=None
     """
     if filter_ not in ["min", "max", "median", "mean"]:
         logger.warning("Filter %s not understood. switch to mean filter")
@@ -519,40 +527,58 @@ def averageImages(listImages, output=None, threshold=0.1, minimum=None, maximum=
             datared = numpy.ascontiguousarray(sumImg, dtype=numpy.float32)
         elif filter_ == "mean":
             datared = sumImg / numpy.float32(ld)
-
-    if output is None:
-        prefix = ""
-        for ch in zip(*listImages):
-            c = ch[0]
-            good = True
-            for i in ch:
-                if i != c:
+    logger.debug("Intensity range in merged dataset : %s --> %s", datared.min(), datared.max())
+    if format is not None:
+        if format.startswith("."):
+            format = format.lstrip(".")
+        if (output is None):
+            prefix = ""
+            for ch in zip(*listImages):
+                c = ch[0]
+                good = True
+                if c in ["*", "?", "[", "{", "("]:
                     good = False
                     break
-            if good:
-                prefix += c
+                for i in ch:
+                    if i != c:
+                        good = False
+                        break
+                if good:
+                    prefix += c
+                else:
+                    break
+            if filter_ == "max":
+                output = "maxfilt%02i-%s.%s" % (ld,prefix,format)
+            elif filter_ == "median":
+                output = "medfilt%02i-%s.%s" % (ld,prefix,format)
+            elif filter_ == "median":
+                output = "meanfilt%02i-%s.%s" % (ld, prefix, format)
             else:
-                break
-        if filter_ == "max":
-            output = ("maxfilt%02i-" % ld) + prefix + ".edf"
-        elif filter_ == "median":
-            output = ("medfilt%02i-" % ld) + prefix + ".edf"
-        elif filter_ == "median":
-            output = ("meanfilt%02i-" % ld) + prefix + ".edf"
-        else:
-            output = ("merged%02i-" % ld) + prefix + ".edf"
-    logger.debug("Intensity range in merged dataset : %s --> %s", datared.min(), datared.max())
-    if format:
-        fabiomod = fabio.__getattribute__(format + "image")
-        fabioclass = fabiomod.__getattribute__(format + "image")
-        fimg = fabioclass(data=datared,
-                          header={"method":filter_, "nframes":ld, "cutoff":str(cutoff),
-                                  "merged": ",".join(listImages)})
-        fimg.write(output)
-        logger.info("Wrote %s" % output)
-
-    return output
-
+                output = "merged%02i-%s.%s" % (ld, prefix, format)
+        if format and output:
+            if "." in format:  # in case "edf.gz"
+                format = format.split(".")[0]
+            fabiomod = fabio.__getattribute__(format + "image")
+            fabioclass = fabiomod.__getattribute__(format + "image")
+            header = {"method":filter_,
+                      "nframes":ld,
+                      "cutoff":str(cutoff)}
+            form = "merged_file_%%0%ii" % len(str(len(listImages)))
+            header_list = ["method", "nframes", "cutoff"]
+            for i, f in enumerate(listImages):
+                name = form % i
+                header[name] = f
+                header_list.append(name)
+            fimg = fabioclass(data=datared,
+                              header=header)
+#            if "header_keys" in dir(fimg):
+            fimg.header_keys = header_list
+                                      
+            fimg.write(output)
+            logger.info("Wrote %s" % output)
+        return output
+    else:
+        return datared
 
 def boundingBox(img):
     """
@@ -705,7 +731,7 @@ def shiftFFT(input_img, shift_val, method="fftw"):
         fftw3 = sys.modules.get("fftw3")
     else:
         fftw3 = None
-    print fftw3
+#    print fftw3
     d0, d1 = input_img.shape
     v0, v1 = shift_val
     f0 = numpy.fft.ifftshift(numpy.arange(-d0 // 2, d0 // 2))
@@ -851,3 +877,85 @@ def expand_args(args):
         else:
             new += glob.glob(afile)
     return new
+
+
+def _get_data_path(filename):
+    """
+    @param filename: the name of the requested data file.
+    @type filename: str
+
+    In the future ....
+    This method try to find the requested ui-name following the
+    xfreedesktop recommendations. First the source directory then
+    the system locations
+
+    For now, just perform a recursive search
+    """
+    # when using bootstrap the file is located under the build directory
+#    real_filename = os.path.abspath(os.path.join(os.path.dirname(__file__),
+#                                                 os.path.pardir,
+#                                                 os.path.pardir,
+#                                                 os.path.pardir,
+#                                                 'data',
+#                                                 filename))
+#    if not os.path.exists(real_filename):
+    resources = [os.path.dirname(__file__)]
+    try:
+        import xdg.BaseDirectory
+        resources += xdg.BaseDirectory.load_data_paths("pyFAI")
+    except ImportError:
+        pass
+
+    for resource in resources:
+        real_filename = os.path.join(resource, filename)
+        if os.path.exists(real_filename):
+            return real_filename
+    else:
+        raise Exception("Can not find the [%s] resource, "
+                        " something went wrong !!!" % (real_filename,))
+#    else:
+#        return real_filename
+
+
+def get_ui_file(filename):
+    return _get_data_path(os.path.join("gui", filename))
+#    return _get_data_path(filename)
+
+
+def get_cl_file(filename):
+#    return _get_data_path(os.path.join("openCL", filename))
+    return _get_data_path(filename)
+
+def deg2rad(dd):
+    """
+    Convert degrees to radian in the range -pi->pi
+
+    @param dd: angle in degrees
+
+    Nota: depending on the platform it could be 0<2pi
+    A branch is cheaper than a trigo operation
+    """
+    while dd > 180.0:
+        dd -= 360.0
+    while dd <= -180.0:
+        dd += 360.0
+    return dd * pi / 180.
+
+class lazy_property(object):
+    '''
+    meant to be used for lazy evaluation of an object attribute.
+    property should represent non-mutable data, as it replaces itself.
+    '''
+
+    def __init__(self,fget):
+        self.fget = fget
+        self.func_name = fget.__name__
+
+
+    def __get__(self,obj,cls):
+        if obj is None:
+            return None
+        value = self.fget(obj)
+        setattr(obj,self.func_name,value)
+        return value
+
diff --git a/pyFAI-src/worker.py b/pyFAI-src/worker.py
new file mode 100644
index 0000000..2716cc3
--- /dev/null
+++ b/pyFAI-src/worker.py
@@ -0,0 +1,427 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+#    Project: Fast Azimuthal integration
+#             https://github.com/kif/pyFAI
+#
+#    Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
+#
+#    Principal author:       Jérôme Kieffer (Jerome.Kieffer at ESRF.eu)
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+
+from __future__ import with_statement, print_function
+
+__author__ = "Jerome Kieffer"
+__contact__ = "Jerome.Kieffer at ESRF.eu"
+__license__ = "GPLv3+"
+__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
+__date__ = "15/10/2013"
+__status__ = "development"
+__doc__ = """
+
+This module contains the Worker class:
+
+A tool able to perform azimuthal integration with:
+additional saving capabilities like
+- save as 2/3D structure in a HDF5 File
+- read from HDF5 files
+
+Aims at being integrated into a plugin like LImA or as model for the GUI 
+
+The configuration of this class is mainly done via a dictionary transmitted as a JSON string:
+Here are the valid keys:  
+    "dist",
+    "poni1",
+    "poni2",
+    "rot1"
+    "rot3"
+    "rot2"
+    "pixel1"
+    "pixel2"
+
+    "splineFile"
+    "wavelength"
+
+    "poni" #path of the file
+
+    "chi_discontinuity_at_0"
+    "do_mask"
+    "do_dark"
+    "do_azimuthal_range"
+    "do_flat"
+    "do_2D"
+    "azimuth_range_min"
+    "azimuth_range_max"
+     
+    "polarization_factor"
+    "nbpt_rad"
+    "do_solid_angle"
+    "do_radial_range"
+    "do_poisson"
+    "delta_dummy"
+    "nbpt_azim"
+    "flat_field"
+    "radial_range_min"
+    "dark_current"
+    "do_polarization"
+    "mask_file"
+    "detector"
+    "unit"
+    "radial_range_max"
+    "val_dummy"
+    "do_dummy"
+    "method"
+}
+
+"""
+
+import threading, os
+import logging
+logger = logging.getLogger("pyFAI.worker")
+import numpy
+from .detectors import detector_factory
+from .azimuthalIntegrator import AzimuthalIntegrator
+from . import units
+import json
+#from .io import h5py, HDF5Writer
+
+class Worker(object):
+    def __init__(self, azimuthalIntgrator=None, shapeIn=(2048, 2048), shapeOut=(360, 500), unit="r_mm"):
+        """
+        @param azimuthalIntgrator: pyFAI.AzimuthalIntegrator instance
+        @param shapeIn: image size in input
+        @param shapeOut: Integrated size: can be (1,2000) for 1D integration
+        @param unit: can be "2th_deg, r_mm or q_nm^-1 ...
+        """
+        self._sem = threading.Semaphore()
+        if azimuthalIntgrator is None:
+            self.ai = AzimuthalIntegrator()
+        else:
+            self.ai = azimuthalIntgrator
+#        self.config = {}
+#        self.config_file = "azimInt.json"
+#        self.nbpt_azim = 0
+#        if type(config) == dict:
+#            self.config = config
+#        elif type(config) in types.StringTypes:
+#            if os.path.isfile(config):
+#                self.config = json.load(open(config, "r"))
+#                self.config_file(config)
+#            else:
+#                self.config = json.loads(config)
+#        if self.config:
+#            self.configure()
+        self._normalization_factor = None #Value of the monitor: divides the intensity by this value for normalization
+        self.nbpt_azim, self.nbpt_rad = shapeOut
+        self._unit = units.to_unit(unit)
+        self.polarization = None
+        self.dummy = None
+        self.delta_dummy = None
+        self.correct_solid_angle = True
+        self.dark_current_image = None
+        self.flat_field_image = None
+        self.mask_image = None
+        self.subdir = ""
+        self.extension = None
+        self.do_poisson = None
+        self.needs_reset = True
+        self.output = "numpy" #exports as numpy array by default
+        self.shape = shapeIn
+        self.method = "lut"
+        self.radial = None
+        self.azimuthal = None
+
+    def __repr__(self):
+        """
+        pretty print of myself
+        """
+        lstout = ["Azimuthal Integrator:", self.ai.__repr__(),
+                "Input image shape: %s" % list(self.shape),
+                "Number of points in radial direction: %s" % self.nbpt_rad,
+                "Number of points in azimuthal direction: %s" % self.nbpt_azim,
+                "Unit in radial dimension: %s" % self.unit.REPR,
+                "Correct for solid angle: %s" % self.correct_solid_angle,
+                "Polarization factor: %s" % self.polarization,
+                "Dark current image: %s" % self.dark_current_image,
+                "Flat field image: %s" % self.flat_field_image,
+                "Mask image: %s" % self.mask_image,
+                "Dummy: %s,\tDelta_Dummy: %s" % (self.dummy, self.delta_dummy),
+                "Directory: %s, \tExtension: %s" % (self.subdir, self.extension)]
+        return os.linesep.join(lstout)
+
+    def do_2D(self):
+        return self.nbpt_azim > 1
+
+    def reset(self):
+        """
+        this is just to force the integrator to initialize
+        """
+        if self.needs_reset:
+            with self._sem:
+                if self.needs_reset:
+                    self.ai.reset()
+                    self.needs_reset = False
+        # print self.__repr__()
+
+    def reconfig(self, shape=(2048, 2048), sync=False):
+        """
+        This is just to force the integrator to initialize with a given input image shape
+        
+        @param shape: shape of the input image
+        @param sync: return only when synchronized
+        """
+        self.shape = shape
+        self.ai.reset()
+        self.warmup(sync)
+
+    def process(self, data) :
+        """
+        Process a frame
+        """
+        with self._sem:
+            monitor = self._normalization_factor
+        kwarg = {"unit": self.unit,
+                 "dummy": self.dummy,
+                 "delta_dummy": self.delta_dummy,
+                 "method": self.method,
+                 "polarization_factor":self.polarization,
+                 # "filename": None,
+                 "safe": True,
+                 "data": data,
+                 "normalization_factor":monitor
+                 }
+
+
+        if self.do_2D():
+            kwarg["nbPt_rad"] = self.nbpt_rad
+            kwarg["nbPt_azim"] = self.nbpt_azim
+            if "filename" in kwarg:
+                if self.extension:
+                    kwarg["filename"] += self.extension
+                else:
+                    kwarg["filename"] += ".azim"
+        else:
+            kwarg["nbPt"] = self.nbpt_rad
+            if "filename" in kwarg:
+                if self.extension:
+                    kwarg["filename"] += self.extension
+                else:
+                    kwarg["filename"] += ".xy"
+        if self.do_poisson:
+            kwarg["error_model"] = "poisson"
+        else:
+            kwarg["error_model"] = None
+
+#        try:
+        if 1:
+            if self.do_2D():
+                rData, self.radial, self.azimuthal = self.ai.integrate2d(**kwarg)
+            else:
+
+                rData = self.ai.integrate1d(**kwarg)
+                self.radial = rData[0]
+                rData = numpy.vstack(rData).T
+
+#        except:
+#            print(data.shape, data.size)
+#            print(self.ai)
+#            print(self.ai._lut_integrator)
+#            print(self.ai._lut_integrator.size)
+#            raise
+        if self.output == "numpy":
+            return rData
+
+    def setSubdir(self, path):
+        """
+        Set the relative or absolute path for processed data
+        """
+        self.subdir = path
+
+    def setExtension(self, ext):
+        """
+        enforce the extension of the processed data file written
+        """
+        if ext:
+            self.extension = ext
+        else:
+            self.extension = None
+
+    def setDarkcurrentFile(self, imagefile):
+        self.ai.set_darkfiles(imagefile)
+        self.dark_current_image = imagefile
+
+    def setFlatfieldFile(self, imagefile):
+        self.ai.set_flatfiles(imagefile)
+        self.flat_field_image = imagefile
+
+    def setJsonConfig(self, jsonconfig):
+        print("start config ...")
+        if os.path.isfile(jsonconfig):
+            config = json.load(open(jsonconfig, "r"))
+        else:
+            config = json.loads(jsonconfig)
+        if "poni" in config:
+            poni = config["poni"]
+            if poni and os.path.isfile(poni):
+                self.ai = pyFAI.load(poni)
+
+        detector = config.get("detector", "detector")
+        self.ai.detector = detector_factory(detector)
+
+        if "wavelength" in config:
+            wavelength = config["wavelength"]
+            try:
+                fwavelength = float(wavelength)
+            except ValueError:
+                logger.error("Unable to convert wavelength to float: %s" % wavelength)
+            else:
+                if fwavelength <= 0 or fwavelength > 1e-6:
+                    logger.warning("Wavelength is in meter ... unlikely value %s" % fwavelength)
+                self.ai.wavelength = fwavelength
+
+        splineFile = config.get("splineFile")
+        if splineFile and os.path.isfile(splineFile):
+            self.ai.detector.splineFile = splineFile
+        self.ai.pixel1 = float(config.get("pixel1", 1))
+        self.ai.pixel2 = float(config.get("pixel2", 1))
+        self.ai.dist = config.get("dist", 1)
+        self.ai.poni1 = config.get("poni1", 0)
+        self.ai.poni2 = config.get("poni2", 0)
+        self.ai.rot1 = config.get("rot1", 0)
+        self.ai.rot2 = config.get("rot2", 0)
+        self.ai.rot3 = config.get("rot3", 0)
+
+
+        if config.get("chi_discontinuity_at_0"):
+            self.ai.setChiDiscAtZero()
+        else:
+            self.ai.setChiDiscAtPi()
+
+
+        mask_file = config.get("mask_file")
+        do_mask = config.get("do_mask")
+        if mask_file and os.path.exists(mask_file) and do_mask:
+            try:
+                mask = fabio.open(mask_file).data
+            except Exception as error:
+                logger.error("Unable to load mask file %s, error %s" % (mask_file, error))
+            else:
+                self.ai.mask = mask
+                self.mask_image = os.path.abspath(mask_file)
+
+        self.ai.set_darkfiles([i.strip() for i in config.get("dark_current", "").split(",")
+                               if os.path.isfile(i.strip())])
+        self.ai.set_flatfiles([i.strip() for i in config.get("flat_field", "").split(",")
+                               if os.path.isfile(i.strip())])
+        self.dark_current_image = self.ai.darkfiles
+        self.flat_field_image = self.ai.flatfiles
+        if config.get("do_2D"):
+            self.nbpt_azim = int(config.get("nbpt_azim"))
+        else:
+            self.nbpt_azim = 1
+        if config.get("nbpt_rad"):
+            self.nbpt_rad = int(config["nbpt_rad"])
+        self.unit = units.to_unit(config.get("unit", units.TTH_DEG))
+        self.do_poisson = config.get("do_poisson")
+        if config.get("do_polarization"):
+            self.polarization = config.get("polarization")
+        else:
+            self.polarization = None
+        logger.info(self.ai.__repr__())
+        self.reset()
+        # For now we do not calculate the LUT as the size of the input image is unknown
+
+    def set_unit(self, value):
+        self._unit = units.to_unit(value)
+    def get_unit(self):
+        return self._unit
+    unit = property(get_unit, set_unit)
+
+    def get_config(self):
+        """return configuration as a dictionary"""
+        config = {"unit":str(self.unit)}
+        for key in ["dist",    "poni1",    "poni2",    "rot1",    "rot3",    "rot2",    "pixel1",    "pixel2",    "splineFile",    "wavelength"]:
+            try:
+                config[key] = self.ai.__getattribute__(key)
+            except:
+                pass
+        for key in ["nbpt_azim", "nbpt_rad", "polarization", "dummy", "delta_dummy", "correct_solid_angle", "dark_current_image", "flat_field_image", "mask_image",
+                  "do_poisson","shape","method"
+                  ]:
+            try:
+                config[key] = self.__getattribute__(key)
+            except:
+                pass
+            
+        return config
+#
+#    "poni" #path of the file
+#
+#    "chi_discontinuity_at_0"
+#    "do_mask"
+#    "do_dark"
+#    "do_azimuthal_range"
+#    "do_flat"
+#    "do_2D"
+#    "azimuth_range_min"
+#    "azimuth_range_max"
+#
+#    "polarization_factor"
+#    "nbpt_rad"
+#    "do_solid_angle"
+#    "do_radial_range"
+#    "do_poisson"
+#    "delta_dummy"
+#    "nbpt_azim"
+#    "flat_field"
+#    "radial_range_min"
+#    "dark_current"
+#    "do_polarization"
+#    "mask_file"
+#    "detector"
+#    "unit"
+#    "radial_range_max"
+#    "val_dummy"
+#    "do_dummy"
+#    "method"
+#}
+
+    def get_json_config(self):
+        """return configuration as a JSON string"""
+        pass #TODO
+
+    def save_config(self, filename=None):
+        if not filename:
+            filename = self.config_file
+
+
+    def warmup(self, sync=False):
+        """
+        Process a dummy image to ensure everything is initialized
+
+        @param sync: wait for processing to be finished
+
+        """
+        t = threading.Thread(target=self.process,
+                             name="init2d",
+                             args=(numpy.zeros(self.shape, dtype=numpy.float32),))
+        t.start()
+        if sync:
+            t.join()
+
+    def set_normalization_factor(self, value):
+        with self._sem:
+            self._normalization_factor = value
diff --git a/scripts/MX-calibrate b/scripts/MX-calibrate
index aea9205..e1ee51a 100644
--- a/scripts/MX-calibrate
+++ b/scripts/MX-calibrate
@@ -253,17 +253,8 @@ class MultiCalib(object):
         (options, args) = parser.parse_args()
 
         # Analyse aruments and options
-        if options.version:
-            print("pyFAI-calib version %s" % pyFAI.version)
-            sys.exit(0)
         if options.debug:
             logger.setLevel(logging.DEBUG)
-#        self.outfile = options.outfile
-#        self.gaussianWidth = options.gaussian
-#        if options.square:
-#            self.labelPattern = [[1] * 3] * 3
-#        else:
-#            self.labelPattern = [[0, 1, 0], [1, 1, 1], [0, 1, 0]]
         if options.background is not None:
             try:
                 self.cutBackground = float(options.background)
@@ -304,7 +295,7 @@ class MultiCalib(object):
         self.max_rings = options.max_rings
         self.fixed = []
         if not options.tilt:
-            self.fixed+=["rot1", "rot2", "rot3"]
+            self.fixed += ["rot1", "rot2", "rot3"]
         if options.fix_dist:
             self.fixed.append("dist")
         if options.fix_poni1:
diff --git a/scripts/diff_tomo b/scripts/diff_tomo
index 8c83c93..dabf0ce 100755
--- a/scripts/diff_tomo
+++ b/scripts/diff_tomo
@@ -35,7 +35,7 @@ __author__ = "Jerome Kieffer"
 __contact__ = "Jerome.Kieffer at ESRF.eu"
 __license__ = "GPLv3+"
 __copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
-__date__ = "27/11/2012"
+__date__ = "04/11/2013"
 __satus__ = "development"
 
 import logging
@@ -79,6 +79,7 @@ class DiffTomo(object):
         self.inputfiles = []
         self.timing = []
         self.use_gpu = False
+        self.unit = "2th_deg"
 
     def __repr__(self):
         return "Diffraction Tomography with r=%s t: %s, d:%s" % \
@@ -174,17 +175,19 @@ If the number of files is too large, use double quotes like "*.edf" """
         self.inputfiles.sort()
         if not self.inputfiles:
             raise RuntimeError("No input files to process, try --help")
+        if options.mask:
+            if os.path.isfile(options.mask):
+                logger.info("Reading Mask file from: %s" % options.mask)
+                self.mask = (fabio.open(options.mask).data != 0)
+            else:
+                logger.warning("No such mask file %s" % options.mask)
         if options.poni:
             if os.path.isfile(options.poni):
+                logger.info("Reading PONI file from: %s" % options.poni)
                 self.poni = options.poni
                 self.setup_ai()
             else:
                 logger.warning("No such poni file %s" % options.poni)
-        if options.mask:
-            if os.path.isfile(options.poni):
-                self.mask = (fabio.open(options.mask).data != 0)
-            else:
-                logger.warning("No such mask file %s" % options.poni)
         if options.nTrans is not None:
             self.nTrans = int(options.nTrans)
         if options.nRot is not None:
@@ -263,11 +266,14 @@ If the number of files is too large, use double quotes like "*.edf" """
         elif pos["index"] < 0 or pos["rot"] < 0 or pos["trans"] < 0:
             return
         data = fabio.open(filename).data.astype(numpy.float32)
+
         if self.use_gpu:
-            tth, I = self.ai.xrpd_LUT_OCL(data, self.nDiff, safe=False,
-                                          devicetype="gpu")
+            meth = "lut_ocl_gpu"
         else:
-            tth, I = self.ai.xrpd_LUT(data, self.nDiff, safe=False)
+            meth = "lut"
+        tth, I = self.ai.integrate1d(data, self.nDiff, safe=False,
+                                     method=meth, unit=self.unit)
+
         self.dataset[pos["rot"], pos["trans"], :] = I
         if "2theta" not in self.group:
             self.group["2theta"] = tth
diff --git a/scripts/pyFAI-integrate b/scripts/pyFAI-integrate
index b915b3a..4072b9b 100644
--- a/scripts/pyFAI-integrate
+++ b/scripts/pyFAI-integrate
@@ -42,13 +42,10 @@ import os.path as op
 import numpy
 logging.basicConfig(level=logging.INFO)
 logger = logging.getLogger("pyFAI")
-from PyQt4 import QtCore, QtGui, uic
-from PyQt4.QtCore import SIGNAL
 import pyFAI, fabio
 from pyFAI.opencl import ocl
 import pyFAI.utils
 from pyFAI.integrate_widget import AIWidget
-UIC = op.join(op.dirname(pyFAI.__file__), "integration.ui")
 
 try:
     from rfoo.utils import rconsole
@@ -90,6 +87,10 @@ http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=697348"""
     parser.add_option("-r", "--fast-motor",
                       dest="rapid", default=None,
                       help="Dimension of the scan on the fast direction (makes sense only with HDF5)")
+    parser.add_option("--no-gui",
+                      dest="gui", default=True, action="store_false",
+                      help="Process the dataset without showing the user interface.")
+
     (options, args) = parser.parse_args()
     # Analyse aruments and options
     args = pyFAI.utils.expand_args(args)
@@ -98,8 +99,14 @@ http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=697348"""
     if options.verbose:
         logger.info("setLevel: debug")
         logger.setLevel(logging.DEBUG)
-    app = QtGui.QApplication([])
-    window = AIWidget()
-    window.set_input_data(args)
-    window.show()
-    sys.exit(app.exec_())
+    if options.gui:
+        from PyQt4 import QtCore, QtGui, uic
+        from PyQt4.QtCore import SIGNAL
+        app = QtGui.QApplication([])
+        window = AIWidget()
+        window.set_input_data(args)
+        window.show()
+        sys.exit(app.exec_())
+    else:
+        # TODO
+        pass
diff --git a/scripts/pyFAI-saxs b/scripts/pyFAI-saxs
index d367ac2..5f00980 100755
--- a/scripts/pyFAI-saxs
+++ b/scripts/pyFAI-saxs
@@ -100,7 +100,7 @@ def main():
                       help="extension of the regrouped filename (.dat)")
 
     (options, args) = parser.parse_args()
-    if len(args) != 1:
+    if len(args) < 1:
         parser.error("incorrect number of arguments")
 
     processFile = pyFAI.utils.expand_args(args)
diff --git a/scripts/pyFAI-waxs b/scripts/pyFAI-waxs
index c183fc5..221ed6b 100755
--- a/scripts/pyFAI-waxs
+++ b/scripts/pyFAI-waxs
@@ -102,7 +102,7 @@ def main():
                       help="extension of the regrouped filename (.xy) ")
 
     (options, args) = parser.parse_args()
-    if len(args) != 1:
+    if len(args) < 1:
         parser.error("incorrect number of arguments")
 
     processFile = pyFAI.utils.expand_args(args)
diff --git a/setup.py b/setup.py
index 97904a9..b7561f7 100644
--- a/setup.py
+++ b/setup.py
@@ -23,6 +23,7 @@
 #    You should have received a copy of the GNU General Public License
 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
+from __future__ import with_statement, print_function
 """
 Setup script for python Fast Azimuthal Integration
 """
@@ -31,18 +32,24 @@ __author__ = "Jerome Kieffer"
 __contact__ = "Jerome.Kieffer at ESRF.eu"
 __license__ = "GPLv3+"
 __copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
-__date__ = "27/11/2012"
+__date__ = "05/11/2013"
 __status__ = "stable"
 
 
-import os, sys, glob, shutil, ConfigParser, platform
+import os
+import sys
+import glob
+import shutil
+import platform
+from os.path import join
 from distutils.core import setup, Extension, Command
 from numpy.distutils.misc_util import get_numpy_include_dirs
 from distutils.sysconfig import get_python_lib
+from distutils.command.install_data import install_data
 
-# ###############################################################################
+################################################################################
 # Check for Cython
-# ###############################################################################
+################################################################################
 try:
     from Cython.Distutils import build_ext
     CYTHON = True
@@ -56,6 +63,10 @@ if CYTHON:
     else:
         if Cython.Compiler.Version.version < "0.17":
             CYTHON = False
+if ("--no-cython" in sys.argv):
+    CYTHON = False
+    sys.argv.remove("--no-cython")
+        
 
 if CYTHON:
     cython_c_ext = ".pyx"
@@ -71,7 +82,7 @@ def rewriteManifest(with_testimages=False):
     @param with_testimages: include
     """
     base = os.path.dirname(os.path.abspath(__file__))
-    manifest_file = os.path.join(base, "MANIFEST.in")
+    manifest_file = join(base, "MANIFEST.in")
     if not os.path.isfile(manifest_file):
         print("MANIFEST file is missing !!!")
         return
@@ -79,7 +90,7 @@ def rewriteManifest(with_testimages=False):
     changed = False
 
     if with_testimages:
-        testimages = ["test/testimages/" + i for i in os.listdir(os.path.join(base, "test", "testimages"))]
+        testimages = ["test/testimages/" + i for i in os.listdir(join(base, "test", "testimages"))]
         for image in testimages:
             if image not in manifest:
                 manifest.append("include " + image)
@@ -109,7 +120,7 @@ cython_modules = ["histogram", "splitPixel", "splitBBox", "splitBBoxLUT",
                   "relabel", "bilinear", "_geometry", "reconstruct", "fastcrc", "_distortion"]
 src = {}
 for ext in cython_modules:
-    src[ext] = os.path.join("src", ext + cython_c_ext)
+    src[ext] = join("src", ext + cython_c_ext)
 
 _geometry_dic = dict(name="_geometry",
                      include_dirs=get_numpy_include_dirs(),
@@ -163,7 +174,7 @@ bilinear_dic = dict(name="bilinear",
 
 fastcrc_dic = dict(name="fastcrc",
                         include_dirs=get_numpy_include_dirs(),
-                        sources=[src['fastcrc'] , os.path.join("src", "crc32.c")],
+                        sources=[src['fastcrc'] , join("src", "crc32.c")],
 #                        extra_compile_args=['-msse4.2'],
                         )
 _distortion_dic = dict(name="_distortion",
@@ -187,40 +198,36 @@ if (os.name != "posix") or ("x86" not in platform.machine()):
 # ###############################################################################
 # scripts and data installation
 # ###############################################################################
+global installDir
+installDir = "pyFAI"
 
-installDir = os.path.join(get_python_lib(), "pyFAI")
-
-data_files = [(installDir, [os.path.join('openCL', o) for o in [
-      "ocl_azim_kernel_2.cl", "ocl_azim_kernel2d_2.cl", "ocl_azim_LUT.cl"]] +
-                [os.path.join('gui', o) for o in ("integration.ui",)])]
+data_files = [(installDir, glob.glob("openCL/*.cl")),
+              (join(installDir, "gui"), glob.glob("gui/*.ui")),
+              (join(installDir, "calibration"), glob.glob("calibration/*.D"))]
 
 if sys.platform == "win32":
-    # This is for mingw32/gomp?
-    data_files[0][1].append(os.path.join("dll", "pthreadGC2.dll"))
+    # This is for mingw32/gomp
+    if tuple.__itemsize__ == 4:
+        data_files[0][1].append(join("dll", "pthreadGC2.dll"))
     root = os.path.dirname(os.path.abspath(__file__))
     tocopy_files = []
     script_files = []
-    for i in os.listdir(os.path.join(root, "scripts")):
-        if os.path.isfile(os.path.join(root, "scripts", i)):
+    for i in os.listdir(join(root, "scripts")):
+        if os.path.isfile(join(root, "scripts", i)):
             if i.endswith(".py"):
-                script_files.append(os.path.join("scripts", i))
+                script_files.append(join("scripts", i))
             else:
-                tocopy_files.append(os.path.join("scripts", i))
+                tocopy_files.append(join("scripts", i))
     for i in tocopy_files:
-        filein = os.path.join(root, i)
+        filein = join(root, i)
         if (filein + ".py") not in script_files:
             shutil.copyfile(filein, filein + ".py")
             script_files.append(filein + ".py")
 
 else:
     script_files = glob.glob("scripts/*")
-print(data_files)
-
-data_files += [(installDir, [os.path.join('openCL', o) for o in [
-      "ocl_azim_kernel_2.cl", "ocl_azim_kernel2d_2.cl", "ocl_azim_LUT.cl"]] +
-                [os.path.join('gui', o) for o in ("integration.ui",)])]
 
-version = [eval(l.split("=")[1]) for l in open(os.path.join(os.path.dirname(
+version = [eval(l.split("=")[1]) for l in open(join(os.path.dirname(
     os.path.abspath(__file__)), "pyFAI-src", "__init__.py"))
     if l.strip().startswith("version")][0]
 
@@ -271,8 +278,8 @@ class build_ext_pyFAI(build_ext):
             # print e.extra_compile_args
             # print e.extra_link_args
         build_ext.build_extensions(self)
-
 cmdclass['build_ext'] = build_ext_pyFAI
+
 class PyTest(Command):
     user_options = []
     def initialize_options(self):
@@ -315,13 +322,25 @@ if sphinx:
             # Build the Users Guide in HTML and TeX format
             for builder in ('html', 'latex'):
                 self.builder = builder
-                self.builder_target_dir = os.path.join(self.build_dir, builder)
+                self.builder_target_dir = join(self.build_dir, builder)
                 self.mkpath(self.builder_target_dir)
                 builder_index = 'index_{0}.txt'.format(builder)
                 BuildDoc.run(self)
             sys.path.pop(0)
     cmdclass['build_doc'] = build_doc
 
+class smart_install_data(install_data):
+    def run(self):
+        install_cmd = self.get_finalized_command('install')
+#        self.install_dir = join(getattr(install_cmd,'install_lib'), "data")
+        self.install_dir = getattr(install_cmd, 'install_lib')
+        print("DATA to be installed in %s" % self.install_dir)
+        global installDir
+        installDir = join(self.install_dir, installDir)
+        return install_data.run(self)
+cmdclass['install_data'] = smart_install_data
+
+
 setup(name='pyFAI',
       version=version,
       author="Jérôme Kieffer (python), \
@@ -364,7 +383,8 @@ http://pypi.python.org/pypi/pyopencl
 # check if OpenMP modules, freshly installed can import
 # ###############################################################################
 pyFAI = None
-sys.path.insert(0, installDir)
+sys.path.insert(0, os.path.dirname(installDir))
+#print installDir
 for loc in ["", ".", os.getcwd()]:
     if loc in sys.path:
         sys.path.pop(sys.path.index(loc))
@@ -373,14 +393,12 @@ for mod in sys.modules.copy():
         sys.modules.pop(mod)
 try:
     import pyFAI
-    print pyFAI.__file__
 except ImportError as E:
     print("Unable to import pyFAI: %s" % E)
 else:
     print("PyFAI is installed in %s" % pyFAI.__file__)
     try:
         import pyFAI.histogram
-        print  pyFAI.histogram.__file__
     except ImportError as E:
         print("PyFAI.histogram failed to import. It is likely there is an OpenMP error: %s" % E)
     else:
diff --git a/src/_distortion.c b/src/_distortion.c
index 6da50c9..2087915 100644
--- a/src/_distortion.c
+++ b/src/_distortion.c
@@ -1,6 +1,18 @@
-/* Generated by Cython 0.17 on Mon Mar 18 21:36:34 2013 */
+/* Generated by Cython 0.19.2 on Mon Jan  6 15:25:40 2014 */
 
 #define PY_SSIZE_T_CLEAN
+#ifndef CYTHON_USE_PYLONG_INTERNALS
+#ifdef PYLONG_BITS_IN_DIGIT
+#define CYTHON_USE_PYLONG_INTERNALS 0
+#else
+#include "pyconfig.h"
+#ifdef PYLONG_BITS_IN_DIGIT
+#define CYTHON_USE_PYLONG_INTERNALS 1
+#else
+#define CYTHON_USE_PYLONG_INTERNALS 0
+#endif
+#endif
+#endif
 #include "Python.h"
 #ifndef Py_PYTHON_H
     #error Python headers needed to compile C extensions, please install development version of Python.
@@ -53,12 +65,15 @@
                                 (PyErr_Format(PyExc_TypeError, \
                                               "expected index value, got %.200s", Py_TYPE(o)->tp_name), \
                                  (PyObject*)0))
-  #define PyIndex_Check(o)     (PyNumber_Check(o) && !PyFloat_Check(o) && !PyComplex_Check(o))
+  #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \
+                                  !PyComplex_Check(o))
+  #define PyIndex_Check __Pyx_PyIndex_Check
   #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
   #define __PYX_BUILD_PY_SSIZE_T "i"
 #else
   #define __PYX_BUILD_PY_SSIZE_T "n"
   #define CYTHON_FORMAT_SSIZE_T "z"
+  #define __Pyx_PyIndex_Check PyIndex_Check
 #endif
 #if PY_VERSION_HEX < 0x02060000
   #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
@@ -113,6 +128,9 @@
 #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
   #define Py_TPFLAGS_HAVE_NEWBUFFER 0
 #endif
+#if PY_VERSION_HEX < 0x02060000
+  #define Py_TPFLAGS_HAVE_VERSION_TAG 0
+#endif
 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
   #define CYTHON_PEP393_ENABLED 1
   #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ? \
@@ -152,6 +170,14 @@
   #define PyBytes_Concat               PyString_Concat
   #define PyBytes_ConcatAndDel         PyString_ConcatAndDel
 #endif
+#if PY_MAJOR_VERSION >= 3
+  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
+  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
+#else
+  #define __Pyx_PyBaseString_Check(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj) || \
+                                         PyString_Check(obj) || PyUnicode_Check(obj))
+  #define __Pyx_PyBaseString_CheckExact(obj) (Py_TYPE(obj) == &PyBaseString_Type)
+#endif
 #if PY_VERSION_HEX < 0x02060000
   #define PySet_Check(obj)             PyObject_TypeCheck(obj, &PySet_Type)
   #define PyFrozenSet_Check(obj)       PyObject_TypeCheck(obj, &PyFrozenSet_Type)
@@ -224,6 +250,40 @@
   #define __Pyx_NAMESTR(n) (n)
   #define __Pyx_DOCSTR(n)  (n)
 #endif
+#ifndef CYTHON_INLINE
+  #if defined(__GNUC__)
+    #define CYTHON_INLINE __inline__
+  #elif defined(_MSC_VER)
+    #define CYTHON_INLINE __inline
+  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+    #define CYTHON_INLINE inline
+  #else
+    #define CYTHON_INLINE
+  #endif
+#endif
+#ifndef CYTHON_RESTRICT
+  #if defined(__GNUC__)
+    #define CYTHON_RESTRICT __restrict__
+  #elif defined(_MSC_VER) && _MSC_VER >= 1400
+    #define CYTHON_RESTRICT __restrict
+  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+    #define CYTHON_RESTRICT restrict
+  #else
+    #define CYTHON_RESTRICT
+  #endif
+#endif
+#ifdef NAN
+#define __PYX_NAN() ((float) NAN)
+#else
+static CYTHON_INLINE float __PYX_NAN() {
+  /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and
+   a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is
+   a quiet NaN. */
+  float value;
+  memset(&value, 0xFF, sizeof(value));
+  return value;
+}
+#endif
 
 
 #if PY_MAJOR_VERSION >= 3
@@ -248,12 +308,12 @@
 #include <math.h>
 #define __PYX_HAVE___distortion
 #define __PYX_HAVE_API___distortion
+#include "string.h"
 #include "stdio.h"
 #include "stdlib.h"
 #include "numpy/arrayobject.h"
 #include "numpy/ufuncobject.h"
 #include "math.h"
-#include "string.h"
 #include "pythread.h"
 #include "pystate.h"
 #ifdef _OPENMP
@@ -264,21 +324,6 @@
 #define CYTHON_WITHOUT_ASSERTIONS
 #endif
 
-
-/* inline attribute */
-#ifndef CYTHON_INLINE
-  #if defined(__GNUC__)
-    #define CYTHON_INLINE __inline__
-  #elif defined(_MSC_VER)
-    #define CYTHON_INLINE __inline
-  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
-    #define CYTHON_INLINE inline
-  #else
-    #define CYTHON_INLINE
-  #endif
-#endif
-
-/* unused attribute */
 #ifndef CYTHON_UNUSED
 # if defined(__GNUC__)
 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
@@ -292,30 +337,130 @@
 #   define CYTHON_UNUSED
 # endif
 #endif
-
-typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/
-
-
-/* Type Conversion Predeclarations */
-
-#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
-#define __Pyx_PyBytes_AsUString(s)   ((unsigned char*) PyBytes_AsString(s))
-
+typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding;
+                const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/
+
+#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
+#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
+#define __PYX_DEFAULT_STRING_ENCODING ""
+#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
+#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
+static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
+static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
+#define __Pyx_PyBytes_FromString        PyBytes_FromString
+#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char*);
+#if PY_MAJOR_VERSION < 3
+    #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
+    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
+#else
+    #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
+    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
+#endif
+#define __Pyx_PyObject_AsUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
+#define __Pyx_PyObject_FromUString(s)  __Pyx_PyObject_FromString((char*)s)
+#define __Pyx_PyBytes_FromUString(s)   __Pyx_PyBytes_FromString((char*)s)
+#define __Pyx_PyStr_FromUString(s)     __Pyx_PyStr_FromString((char*)s)
+#define __Pyx_PyUnicode_FromUString(s) __Pyx_PyUnicode_FromString((char*)s)
+#if PY_MAJOR_VERSION < 3
+static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
+{
+    const Py_UNICODE *u_end = u;
+    while (*u_end++) ;
+    return u_end - u - 1;
+}
+#else
+#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
+#endif
+#define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
+#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
+#define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
 #define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
 #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
 static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
-
 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
 static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
-
 #if CYTHON_COMPILING_IN_CPYTHON
 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
 #else
 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
 #endif
 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
+#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+static int __Pyx_sys_getdefaultencoding_not_ascii;
+static int __Pyx_init_sys_getdefaultencoding_params() {
+    PyObject* sys = NULL;
+    PyObject* default_encoding = NULL;
+    PyObject* ascii_chars_u = NULL;
+    PyObject* ascii_chars_b = NULL;
+    sys = PyImport_ImportModule("sys");
+    if (sys == NULL) goto bad;
+    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
+    if (default_encoding == NULL) goto bad;
+    if (strcmp(PyBytes_AsString(default_encoding), "ascii") == 0) {
+        __Pyx_sys_getdefaultencoding_not_ascii = 0;
+    } else {
+        const char* default_encoding_c = PyBytes_AS_STRING(default_encoding);
+        char ascii_chars[128];
+        int c;
+        for (c = 0; c < 128; c++) {
+            ascii_chars[c] = c;
+        }
+        __Pyx_sys_getdefaultencoding_not_ascii = 1;
+        ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
+        if (ascii_chars_u == NULL) goto bad;
+        ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
+        if (ascii_chars_b == NULL || strncmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
+            PyErr_Format(
+                PyExc_ValueError,
+                "This module compiled with c_string_encoding=ascii, but default encoding '%s' is not a superset of ascii.",
+                default_encoding_c);
+            goto bad;
+        }
+    }
+    Py_XDECREF(sys);
+    Py_XDECREF(default_encoding);
+    Py_XDECREF(ascii_chars_u);
+    Py_XDECREF(ascii_chars_b);
+    return 0;
+bad:
+    Py_XDECREF(sys);
+    Py_XDECREF(default_encoding);
+    Py_XDECREF(ascii_chars_u);
+    Py_XDECREF(ascii_chars_b);
+    return -1;
+}
+#endif
+#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
+#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
+#else
+#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
+#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
+static char* __PYX_DEFAULT_STRING_ENCODING;
+static int __Pyx_init_sys_getdefaultencoding_params() {
+    PyObject* sys = NULL;
+    PyObject* default_encoding = NULL;
+    char* default_encoding_c;
+    sys = PyImport_ImportModule("sys");
+    if (sys == NULL) goto bad;
+    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
+    if (default_encoding == NULL) goto bad;
+    default_encoding_c = PyBytes_AS_STRING(default_encoding);
+    __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
+    strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
+    Py_DECREF(sys);
+    Py_DECREF(default_encoding);
+    return 0;
+bad:
+    Py_XDECREF(sys);
+    Py_XDECREF(default_encoding);
+    return -1;
+}
+#endif
+#endif
+
 
 #ifdef __GNUC__
   /* Test for GCC > 2.95 */
@@ -330,8 +475,9 @@ static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
   #define likely(x)   (x)
   #define unlikely(x) (x)
 #endif /* __GNUC__ */
-    
+
 static PyObject *__pyx_m;
+static PyObject *__pyx_d;
 static PyObject *__pyx_b;
 static PyObject *__pyx_empty_tuple;
 static PyObject *__pyx_empty_bytes;
@@ -417,10 +563,9 @@ typedef struct {
     #define CYTHON_ATOMICS 1
 #endif
 #define __pyx_atomic_int_type int
-/* todo: Portland pgcc, maybe OS X's OSAtomicIncrement32,
-   libatomic + autotools-like distutils support? Such a pain... */
-#if CYTHON_ATOMICS && __GNUC__ >= 4 && (__GNUC_MINOR__ > 1 || \
-                    (__GNUC_MINOR__ == 1 && __GNUC_PATHLEVEL >= 2))
+#if CYTHON_ATOMICS && __GNUC__ >= 4 && (__GNUC_MINOR__ > 1 ||           \
+                    (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL >= 2)) && \
+                    !defined(__i386__)
     #define __pyx_atomic_incr_aligned(value, lock) __sync_fetch_and_add(value, 1)
     #define __pyx_atomic_decr_aligned(value, lock) __sync_fetch_and_sub(value, 1)
     #ifdef __PYX_DEBUG_ATOMICS
@@ -948,10 +1093,33 @@ static struct __pyx_vtabstruct_11_distortion_Quad *__pyx_vtabptr_11_distortion_Q
   #define __Pyx_XGOTREF(r)
   #define __Pyx_XGIVEREF(r)
 #endif /* CYTHON_REFNANNY */
+#define __Pyx_XDECREF_SET(r, v) do {                            \
+        PyObject *tmp = (PyObject *) r;                         \
+        r = v; __Pyx_XDECREF(tmp);                              \
+    } while (0)
+#define __Pyx_DECREF_SET(r, v) do {                             \
+        PyObject *tmp = (PyObject *) r;                         \
+        r = v; __Pyx_DECREF(tmp);                               \
+    } while (0)
 #define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
 #define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
 
-static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
+    PyTypeObject* tp = Py_TYPE(obj);
+    if (likely(tp->tp_getattro))
+        return tp->tp_getattro(obj, attr_name);
+#if PY_MAJOR_VERSION < 3
+    if (likely(tp->tp_getattr))
+        return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
+#endif
+    return PyObject_GetAttr(obj, attr_name);
+}
+#else
+#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
+#endif
+
+static PyObject *__Pyx_GetBuiltinName(PyObject *name); /*proto*/
 
 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
     Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/
@@ -966,8 +1134,6 @@ static CYTHON_INLINE int  __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* o
     __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack);
 static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);
 
-static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
-
 #define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d
 #define __Pyx_MEMVIEW_DIRECT   1
 #define __Pyx_MEMVIEW_PTR      2
@@ -977,24 +1143,15 @@ static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
 #define __Pyx_MEMVIEW_FOLLOW   32
 #define __Pyx_IS_C_CONTIG 1
 #define __Pyx_IS_F_CONTIG 2
-static int __Pyx_ValidateAndInit_memviewslice(
-                int *axes_specs,
-                int c_or_f_flag,
-                int buf_flags,
-                int ndim,
-                __Pyx_TypeInfo *dtype,
-                __Pyx_BufFmt_StackElem stack[],
-                __Pyx_memviewslice *memviewslice,
-                PyObject *original_obj);
 static int __Pyx_init_memviewslice(
                 struct __pyx_memoryview_obj *memview,
                 int ndim,
                 __Pyx_memviewslice *memviewslice,
                 int memview_is_new_reference);
-static CYTHON_INLINE int __pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
-                                                            PyThread_type_lock lock);
-static CYTHON_INLINE int __pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
-                                                            PyThread_type_lock lock);
+static CYTHON_INLINE int __pyx_add_acquisition_count_locked(
+    __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
+static CYTHON_INLINE int __pyx_sub_acquisition_count_locked(
+    __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
 #define __pyx_get_slice_count_pointer(memview) (memview->acquisition_count_aligned_p)
 #define __pyx_get_slice_count(memview) (*__pyx_get_slice_count_pointer(memview))
 #define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__)
@@ -1004,21 +1161,11 @@ static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *, int, int);
 
 static void __Pyx_RaiseBufferIndexError(int axis); /*proto*/
 
-static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
-static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
-
-static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/
-
-static CYTHON_INLINE int __Pyx_PySequence_Contains(PyObject* item, PyObject* seq, int eq) {
-    int result = PySequence_Contains(seq, item);
-    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
-}
-
 #if CYTHON_COMPILING_IN_CPYTHON
 static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
     PyListObject* L = (PyListObject*) list;
     Py_ssize_t len = Py_SIZE(list);
-    if (likely(L->allocated > len)) {
+    if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
         Py_INCREF(x);
         PyList_SET_ITEM(list, len, x);
         Py_SIZE(list) = len+1;
@@ -1030,91 +1177,77 @@ static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
 #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
 #endif
 
-static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
-    PyObject *r;
-    if (!j) return NULL;
-    r = PyObject_GetItem(o, j);
-    Py_DECREF(j);
-    return r;
+static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); /*proto*/
+
+static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
+static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
+
+static void __Pyx_WriteUnraisable(const char *name, int clineno,
+                                  int lineno, const char *filename); /*proto*/
+
+#ifndef __PYX_FORCE_INIT_THREADS
+  #define __PYX_FORCE_INIT_THREADS 0
+#endif
+
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/
+
+static CYTHON_INLINE int __Pyx_PySequence_Contains(PyObject* item, PyObject* seq, int eq) {
+    int result = PySequence_Contains(seq, item);
+    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
 }
-#define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
-                                                    __Pyx_GetItemInt_List_Fast(o, i) : \
-                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
-static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) {
+
 #if CYTHON_COMPILING_IN_CPYTHON
-    if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
-        PyObject *r = PyList_GET_ITEM(o, i);
-        Py_INCREF(r);
-        return r;
-    }
-    else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
-        PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
-        Py_INCREF(r);
-        return r;
-    }
-    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
-#else
-    return PySequence_GetItem(o, i);
+#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o,n,NULL)
+static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
+    PyTypeObject* tp = Py_TYPE(obj);
+    if (likely(tp->tp_setattro))
+        return tp->tp_setattro(obj, attr_name, value);
+#if PY_MAJOR_VERSION < 3
+    if (likely(tp->tp_setattr))
+        return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
 #endif
+    return PyObject_SetAttr(obj, attr_name, value);
 }
-#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
-                                                    __Pyx_GetItemInt_Tuple_Fast(o, i) : \
-                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
-static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) {
-#if CYTHON_COMPILING_IN_CPYTHON
-    if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
-        PyObject *r = PyTuple_GET_ITEM(o, i);
-        Py_INCREF(r);
-        return r;
-    }
-    else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
-        PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
-        Py_INCREF(r);
-        return r;
-    }
-    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
 #else
-    return PySequence_GetItem(o, i);
+#define __Pyx_PyObject_DelAttrStr(o,n)   PyObject_DelAttr(o,n)
+#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
 #endif
-}
-#define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
-                                                    __Pyx_GetItemInt_Fast(o, i) : \
-                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
-static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) {
+
 #if CYTHON_COMPILING_IN_CPYTHON
-    if (PyList_CheckExact(o)) {
-        Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
-        if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) {
-            PyObject *r = PyList_GET_ITEM(o, n);
-            Py_INCREF(r);
-            return r;
-        }
-    }
-    else if (PyTuple_CheckExact(o)) {
-        Py_ssize_t n = (likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
-        if (likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
-            PyObject *r = PyTuple_GET_ITEM(o, n);
-            Py_INCREF(r);
-            return r;
-        }
-    } else {  /* inlined PySequence_GetItem() */
-        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
-        if (likely(m && m->sq_item)) {
-            if (unlikely(i < 0) && likely(m->sq_length)) {
-                Py_ssize_t l = m->sq_length(o);
-                if (unlikely(l < 0)) return NULL;
-                i += l;
-            }
-            return m->sq_item(o, i);
-        }
+static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
+    PyListObject* L = (PyListObject*) list;
+    Py_ssize_t len = Py_SIZE(list);
+    if (likely(L->allocated > len)) {
+        Py_INCREF(x);
+        PyList_SET_ITEM(list, len, x);
+        Py_SIZE(list) = len+1;
+        return 0;
     }
+    return PyList_Append(list, x);
+}
 #else
-    if (PySequence_Check(o)) {
-        return PySequence_GetItem(o, i);
-    }
+#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
 #endif
-    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
-}
+
+#define __Pyx_GetItemInt(o, i, size, to_py_func, is_list, wraparound, boundscheck) \
+    (((size) <= sizeof(Py_ssize_t)) ? \
+    __Pyx_GetItemInt_Fast(o, i, is_list, wraparound, boundscheck) : \
+    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
+#define __Pyx_GetItemInt_List(o, i, size, to_py_func, is_list, wraparound, boundscheck) \
+    (((size) <= sizeof(Py_ssize_t)) ? \
+    __Pyx_GetItemInt_List_Fast(o, i, wraparound, boundscheck) : \
+    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
+                                                              int wraparound, int boundscheck);
+#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func, is_list, wraparound, boundscheck) \
+    (((size) <= sizeof(Py_ssize_t)) ? \
+    __Pyx_GetItemInt_Tuple_Fast(o, i, wraparound, boundscheck) : \
+    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
+                                                              int wraparound, int boundscheck);
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
+                                                     int is_list, int wraparound, int boundscheck);
 
 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
 
@@ -1132,26 +1265,20 @@ static void __Pyx_RaiseBufferFallbackError(void); /*proto*/
 
 #define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1)
 #define __Pyx_BufPtrStrided3d(type, buf, i0, s0, i1, s1, i2, s2) (type)((char*)buf + i0 * s0 + i1 * s1 + i2 * s2)
-#include <string.h>
-void __pyx_init_nan(void);
-static float __PYX_NAN;
-
-#ifndef __PYX_FORCE_INIT_THREADS
-  #define __PYX_FORCE_INIT_THREADS 0
-#endif
-
 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
 
 static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
     const char *name, int exact); /*proto*/
 
+static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); /*proto*/
+
 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); /*proto*/
 
 static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t); /* proto */
 
 #define UNARY_NEG_WOULD_OVERFLOW(x)            (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))
 
-static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
+static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/
 
 static PyObject *get_memview(PyObject *__pyx_v_self); /*proto*/
@@ -1162,7 +1289,7 @@ static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
 
 #include <string.h>
 
-static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
+static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
 static PyObject *__pyx_memoryview_transpose(PyObject *__pyx_v_self); /*proto*/
 static PyObject *__pyx_memoryview__get__base(PyObject *__pyx_v_self); /*proto*/
 static PyObject *__pyx_memoryview_get_shape(PyObject *__pyx_v_self); /*proto*/
@@ -1177,44 +1304,9 @@ static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
 static CYTHON_INLINE long __Pyx_div_long(long, long); /* proto */
 
 static PyObject *__pyx_memoryviewslice__get__base(PyObject *__pyx_v_self); /*proto*/
-static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
-static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
-
-typedef struct {
-  Py_ssize_t shape, strides, suboffsets;
-} __Pyx_Buf_DimInfo;
-typedef struct {
-  size_t refcount;
-  Py_buffer pybuffer;
-} __Pyx_Buffer;
-typedef struct {
-  __Pyx_Buffer *rcbuffer;
-  char *data;
-  __Pyx_Buf_DimInfo diminfo[8];
-} __Pyx_LocalBuf_ND;
-
-#if PY_MAJOR_VERSION < 3
-    static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
-    static void __Pyx_ReleaseBuffer(Py_buffer *view);
-#else
-    #define __Pyx_GetBuffer PyObject_GetBuffer
-    #define __Pyx_ReleaseBuffer PyBuffer_Release
-#endif
-
-
-static Py_ssize_t __Pyx_zeros[] = {0, 0, 0, 0, 0, 0, 0, 0};
-static Py_ssize_t __Pyx_minusones[] = {-1, -1, -1, -1, -1, -1, -1, -1};
-
-static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/
-
-static CYTHON_INLINE void __Pyx_RaiseImportError(PyObject *name);
-
-static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_float(PyObject *);
-
-static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases); /*proto*/
+static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
 
-static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name,
-                                   PyObject *modname); /*proto*/
+static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); /*proto*/
 
 #define __Pyx_CyFunction_USED 1
 #include <structmember.h>
@@ -1235,20 +1327,23 @@ typedef struct {
     PyObject *func_dict;
     PyObject *func_weakreflist;
     PyObject *func_name;
+    PyObject *func_qualname;
     PyObject *func_doc;
     PyObject *func_code;
     PyObject *func_closure;
     PyObject *func_classobj; /* No-args super() class cell */
     void *defaults;
     int defaults_pyobjects;
-    PyObject *defaults_tuple; /* Const defaults tuple */
+    PyObject *defaults_tuple;   /* Const defaults tuple */
+    PyObject *defaults_kwdict;  /* Const kwonly defaults dict */
     PyObject *(*defaults_getter)(PyObject *);
+    PyObject *func_annotations; /* function annotations dict */
 } __pyx_CyFunctionObject;
 static PyTypeObject *__pyx_CyFunctionType = 0;
-#define __Pyx_CyFunction_NewEx(ml, flags, self, module, code) \
-    __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, self, module, code)
-static PyObject *__Pyx_CyFunction_New(PyTypeObject *,
-                                      PyMethodDef *ml, int flags,
+#define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, code) \
+    __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, code)
+static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml,
+                                      int flags, PyObject* qualname,
                                       PyObject *self, PyObject *module,
                                       PyObject* code);
 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
@@ -1256,20 +1351,73 @@ static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
                                                          int pyobjects);
 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
                                                             PyObject *tuple);
+static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
+                                                             PyObject *dict);
+static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
+                                                              PyObject *dict);
 static int __Pyx_CyFunction_init(void);
 
-PyObject *__pyx_memview_get_float(const char *itemp); /* proto */
-int __pyx_memview_set_float(const char *itemp, PyObject *obj); /* proto */
+static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
+static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
 
-static int __Pyx_Print(PyObject*, PyObject *, int); /*proto*/
-#if CYTHON_COMPILING_IN_PYPY || PY_MAJOR_VERSION >= 3
-static PyObject* __pyx_print = 0;
-static PyObject* __pyx_print_kwargs = 0;
-#endif
+typedef struct {
+  Py_ssize_t shape, strides, suboffsets;
+} __Pyx_Buf_DimInfo;
+typedef struct {
+  size_t refcount;
+  Py_buffer pybuffer;
+} __Pyx_Buffer;
+typedef struct {
+  __Pyx_Buffer *rcbuffer;
+  char *data;
+  __Pyx_Buf_DimInfo diminfo[8];
+} __Pyx_LocalBuf_ND;
 
-static int __Pyx_PrintOne(PyObject* stream, PyObject *o); /*proto*/
+#if PY_MAJOR_VERSION < 3
+    static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
+    static void __Pyx_ReleaseBuffer(Py_buffer *view);
+#else
+    #define __Pyx_GetBuffer PyObject_GetBuffer
+    #define __Pyx_ReleaseBuffer PyBuffer_Release
+#endif
 
-static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_Py_intptr_t(Py_intptr_t);
+
+static Py_ssize_t __Pyx_zeros[] = {0, 0, 0, 0, 0, 0, 0, 0};
+static Py_ssize_t __Pyx_minusones[] = {-1, -1, -1, -1, -1, -1, -1, -1};
+
+static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /*proto*/
+
+static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
+
+static int __Pyx_ValidateAndInit_memviewslice(
+                int *axes_specs,
+                int c_or_f_flag,
+                int buf_flags,
+                int ndim,
+                __Pyx_TypeInfo *dtype,
+                __Pyx_BufFmt_StackElem stack[],
+                __Pyx_memviewslice *memviewslice,
+                PyObject *original_obj);
+
+static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_float(PyObject *);
+
+static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases); /*proto*/
+
+static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name,
+                                   PyObject *qualname, PyObject *modname); /*proto*/
+
+static PyObject *__pyx_memview_get_float(const char *itemp); /* proto */
+static int __pyx_memview_set_float(const char *itemp, PyObject *obj); /* proto */
+
+static int __Pyx_Print(PyObject*, PyObject *, int); /*proto*/
+#if CYTHON_COMPILING_IN_PYPY || PY_MAJOR_VERSION >= 3
+static PyObject* __pyx_print = 0;
+static PyObject* __pyx_print_kwargs = 0;
+#endif
+
+static int __Pyx_PrintOne(PyObject* stream, PyObject *o); /*proto*/
+
+static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_Py_intptr_t(Py_intptr_t);
 
 #if CYTHON_CCOMPLEX
   #ifdef __cplusplus
@@ -1416,9 +1564,6 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);
 
 static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);
 
-static void __Pyx_WriteUnraisable(const char *name, int clineno,
-                                  int lineno, const char *filename); /*proto*/
-
 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_int(PyObject *);
 
 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_float(PyObject *);
@@ -1429,8 +1574,6 @@ static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_flo
 
 static int __Pyx_check_binary_version(void);
 
-static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
-
 #if !defined(__Pyx_PyIdentifier_FromString)
 #if PY_MAJOR_VERSION < 3
   #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
@@ -1471,6 +1614,8 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
 
 /* Module declarations from 'cpython.ref' */
 
+/* Module declarations from 'libc.string' */
+
 /* Module declarations from 'libc.stdio' */
 
 /* Module declarations from 'cpython.object' */
@@ -1494,13 +1639,11 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, cha
 
 /* Module declarations from 'libc.math' */
 
-/* Module declarations from 'libc.string' */
-
 /* Module declarations from '_distortion' */
-static PyTypeObject *__pyx_ptype_11_distortion_Quad = 0;
-static PyTypeObject *__pyx_array_type = 0;
-static PyTypeObject *__pyx_MemviewEnum_type = 0;
 static PyTypeObject *__pyx_memoryview_type = 0;
+static PyTypeObject *__pyx_MemviewEnum_type = 0;
+static PyTypeObject *__pyx_array_type = 0;
+static PyTypeObject *__pyx_ptype_11_distortion_Quad = 0;
 static PyTypeObject *__pyx_memoryviewslice_type = 0;
 static PyObject *generic = 0;
 static PyObject *strided = 0;
@@ -1514,12 +1657,12 @@ static CYTHON_INLINE void __pyx_f_11_distortion_integrate(__Pyx_memviewslice, fl
 static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/
 static void *__pyx_align_pointer(void *, size_t); /*proto*/
 static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo *); /*proto*/
-static int __pyx_memoryview_check(PyObject *); /*proto*/
+static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/
 static PyObject *_unellipsify(PyObject *, int); /*proto*/
 static PyObject *assert_direct_dimensions(Py_ssize_t *, int); /*proto*/
 static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/
 static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int, int); /*proto*/
-static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, int); /*proto*/
+static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/
 static int __pyx_memslice_transpose(__Pyx_memviewslice *); /*proto*/
 static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice, int, PyObject *(*)(char *), int (*)(char *, PyObject *), int); /*proto*/
 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
@@ -1626,6 +1769,11 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_20copy(struct __pyx_me
 static PyObject *__pyx_memoryview_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
 static void __pyx_memoryviewslice_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
 static PyObject *__pyx_memoryviewslice__get__base_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
+static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_11_distortion_Quad(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
 static char __pyx_k_1[] = "offset %i,%i size %i, %i";
 static char __pyx_k_2[] = "box:";
 static char __pyx_k_3[] = "";
@@ -1681,14 +1829,21 @@ static char __pyx_k_125[] = "Cannot transpose memoryview with indirect dimension
 static char __pyx_k_126[] = "got differing extents in dimension %d (got %d and %d)";
 static char __pyx_k_127[] = "Dimension %d is not direct";
 static char __pyx_k_128[] = "pyFAI._distortion";
-static char __pyx_k_132[] = "/home/jerome/workspace/pyFAI/src/_distortion.pyx";
-static char __pyx_k_146[] = "\n\n    This class applies a distortion correction on an image.\n\n    It is also able to apply an inversion of the correction.\n\n    ";
-static char __pyx_k_147[] = "getbuffer(obj, view, flags)";
-static char __pyx_k_148[] = "<strided and direct or indirect>";
-static char __pyx_k_150[] = "<strided and direct>";
-static char __pyx_k_152[] = "<strided and indirect>";
-static char __pyx_k_154[] = "<contiguous and direct>";
-static char __pyx_k_156[] = "<contiguous and indirect>";
+static char __pyx_k_132[] = "/users/kieffer/workspace-ssd/pyFAI/src/_distortion.pyx";
+static char __pyx_k_134[] = "Distortion.__init__";
+static char __pyx_k_137[] = "Distortion.__repr__";
+static char __pyx_k_140[] = "Distortion.calc_pos";
+static char __pyx_k_143[] = "Distortion.calc_LUT_size";
+static char __pyx_k_146[] = "Distortion.calc_LUT";
+static char __pyx_k_149[] = "Distortion.correct";
+static char __pyx_k_152[] = "Distortion.uncorrect";
+static char __pyx_k_153[] = "\n\n    This class applies a distortion correction on an image.\n\n    It is also able to apply an inversion of the correction.\n\n    ";
+static char __pyx_k_154[] = "getbuffer(obj, view, flags)";
+static char __pyx_k_155[] = "<strided and direct or indirect>";
+static char __pyx_k_157[] = "<strided and direct>";
+static char __pyx_k_159[] = "<strided and indirect>";
+static char __pyx_k_161[] = "<contiguous and direct>";
+static char __pyx_k_163[] = "<contiguous and indirect>";
 static char __pyx_k__A0[] = "A0";
 static char __pyx_k__A1[] = "A1";
 static char __pyx_k__AB[] = "AB";
@@ -1727,6 +1882,7 @@ static char __pyx_k__cAB[] = "cAB";
 static char __pyx_k__cBC[] = "cBC";
 static char __pyx_k__cCD[] = "cCD";
 static char __pyx_k__cDA[] = "cDA";
+static char __pyx_k__end[] = "end";
 static char __pyx_k__idx[] = "idx";
 static char __pyx_k__lin[] = "lin";
 static char __pyx_k__lut[] = "lut";
@@ -1750,6 +1906,7 @@ static char __pyx_k__base[] = "base";
 static char __pyx_k__ceil[] = "ceil";
 static char __pyx_k__clip[] = "clip";
 static char __pyx_k__coef[] = "coef";
+static char __pyx_k__file[] = "file";
 static char __pyx_k__info[] = "info";
 static char __pyx_k__int8[] = "int8";
 static char __pyx_k__join[] = "join";
@@ -1777,6 +1934,7 @@ static char __pyx_k__int32[] = "int32";
 static char __pyx_k__lmask[] = "lmask";
 static char __pyx_k__numpy[] = "numpy";
 static char __pyx_k__outer[] = "outer";
+static char __pyx_k__print[] = "print";
 static char __pyx_k__range[] = "range";
 static char __pyx_k__ravel[] = "ravel";
 static char __pyx_k__shape[] = "shape";
@@ -1857,6 +2015,8 @@ static char __pyx_k__uncorrect[] = "uncorrect";
 static char __pyx_k__Distortion[] = "Distortion";
 static char __pyx_k__IndexError[] = "IndexError";
 static char __pyx_k__ValueError[] = "ValueError";
+static char __pyx_k____import__[] = "__import__";
+static char __pyx_k____module__[] = "__module__";
 static char __pyx_k__init_slope[] = "init_slope";
 static char __pyx_k__MemoryError[] = "MemoryError";
 static char __pyx_k__StringTypes[] = "StringTypes";
@@ -1866,18 +2026,22 @@ static char __pyx_k__get_offset0[] = "get_offset0";
 static char __pyx_k__get_offset1[] = "get_offset1";
 static char __pyx_k__pos_corners[] = "pos_corners";
 static char __pyx_k__RuntimeError[] = "RuntimeError";
+static char __pyx_k____qualname__[] = "__qualname__";
 static char __pyx_k__calc_area_AB[] = "calc_area_AB";
 static char __pyx_k__calc_area_BC[] = "calc_area_BC";
 static char __pyx_k__calc_area_CD[] = "calc_area_CD";
 static char __pyx_k__calc_area_DA[] = "calc_area_DA";
+static char __pyx_k____metaclass__[] = "__metaclass__";
 static char __pyx_k__calc_LUT_size[] = "calc_LUT_size";
 static char __pyx_k__get_box_size0[] = "get_box_size0";
 static char __pyx_k__get_box_size1[] = "get_box_size1";
+static char __pyx_k____pyx_vtable__[] = "__pyx_vtable__";
 static char __pyx_k____pyx_getbuffer[] = "__pyx_getbuffer";
 static char __pyx_k__allocate_buffer[] = "allocate_buffer";
 static char __pyx_k__dtype_is_object[] = "dtype_is_object";
 static char __pyx_k__detector_factory[] = "detector_factory";
 static char __pyx_k__ascontiguousarray[] = "ascontiguousarray";
+static char __pyx_k____pyx_releasebuffer[] = "__pyx_releasebuffer";
 static PyObject *__pyx_kp_s_1;
 static PyObject *__pyx_kp_s_100;
 static PyObject *__pyx_kp_s_102;
@@ -1894,12 +2058,19 @@ static PyObject *__pyx_kp_s_124;
 static PyObject *__pyx_kp_s_126;
 static PyObject *__pyx_kp_s_128;
 static PyObject *__pyx_kp_s_132;
-static PyObject *__pyx_kp_s_146;
-static PyObject *__pyx_kp_s_148;
-static PyObject *__pyx_kp_s_150;
-static PyObject *__pyx_kp_s_152;
-static PyObject *__pyx_kp_s_154;
-static PyObject *__pyx_kp_s_156;
+static PyObject *__pyx_n_s_134;
+static PyObject *__pyx_n_s_137;
+static PyObject *__pyx_n_s_140;
+static PyObject *__pyx_n_s_143;
+static PyObject *__pyx_n_s_146;
+static PyObject *__pyx_n_s_149;
+static PyObject *__pyx_n_s_152;
+static PyObject *__pyx_kp_s_153;
+static PyObject *__pyx_kp_s_155;
+static PyObject *__pyx_kp_s_157;
+static PyObject *__pyx_kp_s_159;
+static PyObject *__pyx_kp_s_161;
+static PyObject *__pyx_kp_s_163;
 static PyObject *__pyx_kp_s_2;
 static PyObject *__pyx_kp_s_3;
 static PyObject *__pyx_kp_s_4;
@@ -1952,10 +2123,16 @@ static PyObject *__pyx_n_s__ValueError;
 static PyObject *__pyx_n_s____class__;
 static PyObject *__pyx_n_s____enter__;
 static PyObject *__pyx_n_s____exit__;
+static PyObject *__pyx_n_s____import__;
 static PyObject *__pyx_n_s____init__;
 static PyObject *__pyx_n_s____main__;
+static PyObject *__pyx_n_s____metaclass__;
+static PyObject *__pyx_n_s____module__;
 static PyObject *__pyx_n_s____name__;
 static PyObject *__pyx_n_s____pyx_getbuffer;
+static PyObject *__pyx_n_s____pyx_releasebuffer;
+static PyObject *__pyx_n_s____pyx_vtable__;
+static PyObject *__pyx_n_s____qualname__;
 static PyObject *__pyx_n_s____repr__;
 static PyObject *__pyx_n_s____test__;
 static PyObject *__pyx_n_s___distortion;
@@ -2002,10 +2179,12 @@ static PyObject *__pyx_n_s__dtype;
 static PyObject *__pyx_n_s__dtype_is_object;
 static PyObject *__pyx_n_s__empty;
 static PyObject *__pyx_n_s__encode;
+static PyObject *__pyx_n_s__end;
 static PyObject *__pyx_n_s__enumerate;
 static PyObject *__pyx_n_s__error;
 static PyObject *__pyx_n_s__extend;
 static PyObject *__pyx_n_s__fabio;
+static PyObject *__pyx_n_s__file;
 static PyObject *__pyx_n_s__flags;
 static PyObject *__pyx_n_s__float32;
 static PyObject *__pyx_n_s__float64;
@@ -2083,6 +2262,7 @@ static PyObject *__pyx_n_s__pos0min;
 static PyObject *__pyx_n_s__pos1max;
 static PyObject *__pyx_n_s__pos1min;
 static PyObject *__pyx_n_s__pos_corners;
+static PyObject *__pyx_n_s__print;
 static PyObject *__pyx_n_s__range;
 static PyObject *__pyx_n_s__ravel;
 static PyObject *__pyx_n_s__recarray;
@@ -2214,24 +2394,24 @@ static PyObject *__pyx_k_tuple_120;
 static PyObject *__pyx_k_tuple_129;
 static PyObject *__pyx_k_tuple_130;
 static PyObject *__pyx_k_tuple_133;
-static PyObject *__pyx_k_tuple_134;
-static PyObject *__pyx_k_tuple_136;
+static PyObject *__pyx_k_tuple_135;
 static PyObject *__pyx_k_tuple_138;
-static PyObject *__pyx_k_tuple_140;
-static PyObject *__pyx_k_tuple_142;
+static PyObject *__pyx_k_tuple_141;
 static PyObject *__pyx_k_tuple_144;
-static PyObject *__pyx_k_tuple_149;
-static PyObject *__pyx_k_tuple_151;
-static PyObject *__pyx_k_tuple_153;
-static PyObject *__pyx_k_tuple_155;
-static PyObject *__pyx_k_tuple_157;
+static PyObject *__pyx_k_tuple_147;
+static PyObject *__pyx_k_tuple_150;
+static PyObject *__pyx_k_tuple_156;
+static PyObject *__pyx_k_tuple_158;
+static PyObject *__pyx_k_tuple_160;
+static PyObject *__pyx_k_tuple_162;
+static PyObject *__pyx_k_tuple_164;
 static PyObject *__pyx_k_codeobj_131;
-static PyObject *__pyx_k_codeobj_135;
-static PyObject *__pyx_k_codeobj_137;
+static PyObject *__pyx_k_codeobj_136;
 static PyObject *__pyx_k_codeobj_139;
-static PyObject *__pyx_k_codeobj_141;
-static PyObject *__pyx_k_codeobj_143;
+static PyObject *__pyx_k_codeobj_142;
 static PyObject *__pyx_k_codeobj_145;
+static PyObject *__pyx_k_codeobj_148;
+static PyObject *__pyx_k_codeobj_151;
 
 /* "_distortion.pyx":43
  *     numpy.float32_t coef
@@ -2255,11 +2435,11 @@ static CYTHON_INLINE float __pyx_f_11_distortion_min4f(float __pyx_v_a, float __
  *         return a
  *     if (b <= a) and (b <= c) and (b <= d):
  */
-  __pyx_t_1 = (__pyx_v_a <= __pyx_v_b);
+  __pyx_t_1 = ((__pyx_v_a <= __pyx_v_b) != 0);
   if (__pyx_t_1) {
-    __pyx_t_2 = (__pyx_v_a <= __pyx_v_c);
+    __pyx_t_2 = ((__pyx_v_a <= __pyx_v_c) != 0);
     if (__pyx_t_2) {
-      __pyx_t_3 = (__pyx_v_a <= __pyx_v_d);
+      __pyx_t_3 = ((__pyx_v_a <= __pyx_v_d) != 0);
       __pyx_t_4 = __pyx_t_3;
     } else {
       __pyx_t_4 = __pyx_t_2;
@@ -2290,11 +2470,11 @@ static CYTHON_INLINE float __pyx_f_11_distortion_min4f(float __pyx_v_a, float __
  *         return b
  *     if (c <= a) and (c <= b) and (c <= d):
  */
-  __pyx_t_2 = (__pyx_v_b <= __pyx_v_a);
+  __pyx_t_2 = ((__pyx_v_b <= __pyx_v_a) != 0);
   if (__pyx_t_2) {
-    __pyx_t_1 = (__pyx_v_b <= __pyx_v_c);
+    __pyx_t_1 = ((__pyx_v_b <= __pyx_v_c) != 0);
     if (__pyx_t_1) {
-      __pyx_t_4 = (__pyx_v_b <= __pyx_v_d);
+      __pyx_t_4 = ((__pyx_v_b <= __pyx_v_d) != 0);
       __pyx_t_3 = __pyx_t_4;
     } else {
       __pyx_t_3 = __pyx_t_1;
@@ -2325,11 +2505,11 @@ static CYTHON_INLINE float __pyx_f_11_distortion_min4f(float __pyx_v_a, float __
  *         return c
  *     else:
  */
-  __pyx_t_1 = (__pyx_v_c <= __pyx_v_a);
+  __pyx_t_1 = ((__pyx_v_c <= __pyx_v_a) != 0);
   if (__pyx_t_1) {
-    __pyx_t_2 = (__pyx_v_c <= __pyx_v_b);
+    __pyx_t_2 = ((__pyx_v_c <= __pyx_v_b) != 0);
     if (__pyx_t_2) {
-      __pyx_t_3 = (__pyx_v_c <= __pyx_v_d);
+      __pyx_t_3 = ((__pyx_v_c <= __pyx_v_d) != 0);
       __pyx_t_4 = __pyx_t_3;
     } else {
       __pyx_t_4 = __pyx_t_2;
@@ -2392,11 +2572,11 @@ static CYTHON_INLINE float __pyx_f_11_distortion_max4f(float __pyx_v_a, float __
  *         return a
  *     if (b >= a) and (b >= c) and (b >= d):
  */
-  __pyx_t_1 = (__pyx_v_a >= __pyx_v_b);
+  __pyx_t_1 = ((__pyx_v_a >= __pyx_v_b) != 0);
   if (__pyx_t_1) {
-    __pyx_t_2 = (__pyx_v_a >= __pyx_v_c);
+    __pyx_t_2 = ((__pyx_v_a >= __pyx_v_c) != 0);
     if (__pyx_t_2) {
-      __pyx_t_3 = (__pyx_v_a >= __pyx_v_d);
+      __pyx_t_3 = ((__pyx_v_a >= __pyx_v_d) != 0);
       __pyx_t_4 = __pyx_t_3;
     } else {
       __pyx_t_4 = __pyx_t_2;
@@ -2427,11 +2607,11 @@ static CYTHON_INLINE float __pyx_f_11_distortion_max4f(float __pyx_v_a, float __
  *         return b
  *     if (c >= a) and (c >= b) and (c >= d):
  */
-  __pyx_t_2 = (__pyx_v_b >= __pyx_v_a);
+  __pyx_t_2 = ((__pyx_v_b >= __pyx_v_a) != 0);
   if (__pyx_t_2) {
-    __pyx_t_1 = (__pyx_v_b >= __pyx_v_c);
+    __pyx_t_1 = ((__pyx_v_b >= __pyx_v_c) != 0);
     if (__pyx_t_1) {
-      __pyx_t_4 = (__pyx_v_b >= __pyx_v_d);
+      __pyx_t_4 = ((__pyx_v_b >= __pyx_v_d) != 0);
       __pyx_t_3 = __pyx_t_4;
     } else {
       __pyx_t_3 = __pyx_t_1;
@@ -2462,11 +2642,11 @@ static CYTHON_INLINE float __pyx_f_11_distortion_max4f(float __pyx_v_a, float __
  *         return c
  *     else:
  */
-  __pyx_t_1 = (__pyx_v_c >= __pyx_v_a);
+  __pyx_t_1 = ((__pyx_v_c >= __pyx_v_a) != 0);
   if (__pyx_t_1) {
-    __pyx_t_2 = (__pyx_v_c >= __pyx_v_b);
+    __pyx_t_2 = ((__pyx_v_c >= __pyx_v_b) != 0);
     if (__pyx_t_2) {
-      __pyx_t_3 = (__pyx_v_c >= __pyx_v_d);
+      __pyx_t_3 = ((__pyx_v_c >= __pyx_v_d) != 0);
       __pyx_t_4 = __pyx_t_3;
     } else {
       __pyx_t_4 = __pyx_t_2;
@@ -2542,6 +2722,9 @@ static PyObject *__pyx_pw_11_distortion_1calc_area(PyObject *__pyx_self, PyObjec
   float __pyx_v_I2;
   float __pyx_v_slope;
   float __pyx_v_intercept;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("calc_area (wrapper)", 0);
@@ -2695,7 +2878,7 @@ static CYTHON_INLINE void __pyx_f_11_distortion_integrate(__Pyx_memviewslice __p
  *         P = ceil(start)
  *         dP = P - start
  */
-  __pyx_t_1 = (__pyx_v_start < __pyx_v_stop);
+  __pyx_t_1 = ((__pyx_v_start < __pyx_v_stop) != 0);
   if (__pyx_t_1) {
 
     /* "_distortion.pyx":78
@@ -2723,7 +2906,7 @@ static CYTHON_INLINE void __pyx_f_11_distortion_integrate(__Pyx_memviewslice __p
  *             A = calc_area(start, stop, slope, intercept)
  *             if A != 0:
  */
-    __pyx_t_1 = (__pyx_v_P > __pyx_v_stop);
+    __pyx_t_1 = ((__pyx_v_P > __pyx_v_stop) != 0);
     if (__pyx_t_1) {
 
       /* "_distortion.pyx":81
@@ -2742,7 +2925,7 @@ static CYTHON_INLINE void __pyx_f_11_distortion_integrate(__Pyx_memviewslice __p
  *                 AA = fabs(A)
  *                 sign = A / AA
  */
-      __pyx_t_1 = (__pyx_v_A != 0.0);
+      __pyx_t_1 = ((__pyx_v_A != 0.0) != 0);
       if (__pyx_t_1) {
 
         /* "_distortion.pyx":83
@@ -2789,7 +2972,7 @@ static CYTHON_INLINE void __pyx_f_11_distortion_integrate(__Pyx_memviewslice __p
  *                         dA = AA
  */
         while (1) {
-          __pyx_t_1 = (__pyx_v_AA > 0.0);
+          __pyx_t_1 = ((__pyx_v_AA > 0.0) != 0);
           if (!__pyx_t_1) break;
 
           /* "_distortion.pyx":88
@@ -2799,7 +2982,7 @@ static CYTHON_INLINE void __pyx_f_11_distortion_integrate(__Pyx_memviewslice __p
  *                         dA = AA
  *                         AA = -1
  */
-          __pyx_t_1 = (__pyx_v_dA > __pyx_v_AA);
+          __pyx_t_1 = ((__pyx_v_dA > __pyx_v_AA) != 0);
           if (__pyx_t_1) {
 
             /* "_distortion.pyx":89
@@ -2866,7 +3049,7 @@ static CYTHON_INLINE void __pyx_f_11_distortion_integrate(__Pyx_memviewslice __p
  *                 A = calc_area(start, P, slope, intercept)
  *                 if A != 0:
  */
-      __pyx_t_1 = (__pyx_v_dP > 0.0);
+      __pyx_t_1 = ((__pyx_v_dP > 0.0) != 0);
       if (__pyx_t_1) {
 
         /* "_distortion.pyx":96
@@ -2885,7 +3068,7 @@ static CYTHON_INLINE void __pyx_f_11_distortion_integrate(__Pyx_memviewslice __p
  *                     AA = fabs(A)
  *                     sign = A / AA
  */
-        __pyx_t_1 = (__pyx_v_A != 0.0);
+        __pyx_t_1 = ((__pyx_v_A != 0.0) != 0);
         if (__pyx_t_1) {
 
           /* "_distortion.pyx":98
@@ -2932,7 +3115,7 @@ static CYTHON_INLINE void __pyx_f_11_distortion_integrate(__Pyx_memviewslice __p
  *                             dA = AA
  */
           while (1) {
-            __pyx_t_1 = (__pyx_v_AA > 0.0);
+            __pyx_t_1 = ((__pyx_v_AA > 0.0) != 0);
             if (!__pyx_t_1) break;
 
             /* "_distortion.pyx":103
@@ -2942,7 +3125,7 @@ static CYTHON_INLINE void __pyx_f_11_distortion_integrate(__Pyx_memviewslice __p
  *                             dA = AA
  *                             AA = -1
  */
-            __pyx_t_1 = (__pyx_v_dA > __pyx_v_AA);
+            __pyx_t_1 = ((__pyx_v_dA > __pyx_v_AA) != 0);
             if (__pyx_t_1) {
 
               /* "_distortion.pyx":104
@@ -3029,7 +3212,7 @@ static CYTHON_INLINE void __pyx_f_11_distortion_integrate(__Pyx_memviewslice __p
  *                     AA = fabs(A)
  *                     sign = A / AA
  */
-        __pyx_t_1 = (__pyx_v_A != 0.0);
+        __pyx_t_1 = ((__pyx_v_A != 0.0) != 0);
         if (__pyx_t_1) {
 
           /* "_distortion.pyx":113
@@ -3076,7 +3259,7 @@ static CYTHON_INLINE void __pyx_f_11_distortion_integrate(__Pyx_memviewslice __p
  *                             dA = AA
  */
           while (1) {
-            __pyx_t_1 = (__pyx_v_AA > 0.0);
+            __pyx_t_1 = ((__pyx_v_AA > 0.0) != 0);
             if (!__pyx_t_1) break;
 
             /* "_distortion.pyx":119
@@ -3086,7 +3269,7 @@ static CYTHON_INLINE void __pyx_f_11_distortion_integrate(__Pyx_memviewslice __p
  *                             dA = AA
  *                             AA = -1
  */
-            __pyx_t_1 = (__pyx_v_dA > __pyx_v_AA);
+            __pyx_t_1 = ((__pyx_v_dA > __pyx_v_AA) != 0);
             if (__pyx_t_1) {
 
               /* "_distortion.pyx":120
@@ -3169,7 +3352,7 @@ static CYTHON_INLINE void __pyx_f_11_distortion_integrate(__Pyx_memviewslice __p
  *                 A = calc_area(P, stop, slope, intercept)
  *                 if A != 0:
  */
-      __pyx_t_1 = (__pyx_v_dP > 0.0);
+      __pyx_t_1 = ((__pyx_v_dP > 0.0) != 0);
       if (__pyx_t_1) {
 
         /* "_distortion.pyx":129
@@ -3188,7 +3371,7 @@ static CYTHON_INLINE void __pyx_f_11_distortion_integrate(__Pyx_memviewslice __p
  *                     AA = fabs(A)
  *                     sign = A / AA
  */
-        __pyx_t_1 = (__pyx_v_A != 0.0);
+        __pyx_t_1 = ((__pyx_v_A != 0.0) != 0);
         if (__pyx_t_1) {
 
           /* "_distortion.pyx":131
@@ -3235,7 +3418,7 @@ static CYTHON_INLINE void __pyx_f_11_distortion_integrate(__Pyx_memviewslice __p
  *                             dA = AA
  */
           while (1) {
-            __pyx_t_1 = (__pyx_v_AA > 0.0);
+            __pyx_t_1 = ((__pyx_v_AA > 0.0) != 0);
             if (!__pyx_t_1) break;
 
             /* "_distortion.pyx":136
@@ -3245,7 +3428,7 @@ static CYTHON_INLINE void __pyx_f_11_distortion_integrate(__Pyx_memviewslice __p
  *                             dA = AA
  *                             AA = -1
  */
-            __pyx_t_1 = (__pyx_v_dA > __pyx_v_AA);
+            __pyx_t_1 = ((__pyx_v_dA > __pyx_v_AA) != 0);
             if (__pyx_t_1) {
 
               /* "_distortion.pyx":137
@@ -3316,7 +3499,7 @@ static CYTHON_INLINE void __pyx_f_11_distortion_integrate(__Pyx_memviewslice __p
  *         P = floor(start)
  *         if stop > P:  # start and stop are in the same unit
  */
-  __pyx_t_1 = (__pyx_v_start > __pyx_v_stop);
+  __pyx_t_1 = ((__pyx_v_start > __pyx_v_stop) != 0);
   if (__pyx_t_1) {
 
     /* "_distortion.pyx":143
@@ -3335,7 +3518,7 @@ static CYTHON_INLINE void __pyx_f_11_distortion_integrate(__Pyx_memviewslice __p
  *             A = calc_area(start, stop, slope, intercept)
  *             if A != 0:
  */
-    __pyx_t_1 = (__pyx_v_stop > __pyx_v_P);
+    __pyx_t_1 = ((__pyx_v_stop > __pyx_v_P) != 0);
     if (__pyx_t_1) {
 
       /* "_distortion.pyx":145
@@ -3354,7 +3537,7 @@ static CYTHON_INLINE void __pyx_f_11_distortion_integrate(__Pyx_memviewslice __p
  *                 AA = fabs(A)
  *                 sign = A / AA
  */
-      __pyx_t_1 = (__pyx_v_A != 0.0);
+      __pyx_t_1 = ((__pyx_v_A != 0.0) != 0);
       if (__pyx_t_1) {
 
         /* "_distortion.pyx":147
@@ -3401,7 +3584,7 @@ static CYTHON_INLINE void __pyx_f_11_distortion_integrate(__Pyx_memviewslice __p
  *                         dA = AA
  */
         while (1) {
-          __pyx_t_1 = (__pyx_v_AA > 0.0);
+          __pyx_t_1 = ((__pyx_v_AA > 0.0) != 0);
           if (!__pyx_t_1) break;
 
           /* "_distortion.pyx":152
@@ -3411,7 +3594,7 @@ static CYTHON_INLINE void __pyx_f_11_distortion_integrate(__Pyx_memviewslice __p
  *                         dA = AA
  *                         AA = -1
  */
-          __pyx_t_1 = (__pyx_v_dA > __pyx_v_AA);
+          __pyx_t_1 = ((__pyx_v_dA > __pyx_v_AA) != 0);
           if (__pyx_t_1) {
 
             /* "_distortion.pyx":153
@@ -3487,7 +3670,7 @@ static CYTHON_INLINE void __pyx_f_11_distortion_integrate(__Pyx_memviewslice __p
  *                 A = calc_area(start, P, slope, intercept)
  *                 if A != 0:
  */
-      __pyx_t_1 = (__pyx_v_dP < 0.0);
+      __pyx_t_1 = ((__pyx_v_dP < 0.0) != 0);
       if (__pyx_t_1) {
 
         /* "_distortion.pyx":161
@@ -3506,7 +3689,7 @@ static CYTHON_INLINE void __pyx_f_11_distortion_integrate(__Pyx_memviewslice __p
  *                     AA = fabs(A)
  *                     sign = A / AA
  */
-        __pyx_t_1 = (__pyx_v_A != 0.0);
+        __pyx_t_1 = ((__pyx_v_A != 0.0) != 0);
         if (__pyx_t_1) {
 
           /* "_distortion.pyx":163
@@ -3553,7 +3736,7 @@ static CYTHON_INLINE void __pyx_f_11_distortion_integrate(__Pyx_memviewslice __p
  *                             dA = AA
  */
           while (1) {
-            __pyx_t_1 = (__pyx_v_AA > 0.0);
+            __pyx_t_1 = ((__pyx_v_AA > 0.0) != 0);
             if (!__pyx_t_1) break;
 
             /* "_distortion.pyx":168
@@ -3563,7 +3746,7 @@ static CYTHON_INLINE void __pyx_f_11_distortion_integrate(__Pyx_memviewslice __p
  *                             dA = AA
  *                             AA = -1
  */
-            __pyx_t_1 = (__pyx_v_dA > __pyx_v_AA);
+            __pyx_t_1 = ((__pyx_v_dA > __pyx_v_AA) != 0);
             if (__pyx_t_1) {
 
               /* "_distortion.pyx":169
@@ -3650,7 +3833,7 @@ static CYTHON_INLINE void __pyx_f_11_distortion_integrate(__Pyx_memviewslice __p
  *                     AA = fabs(A)
  *                     sign = A / AA
  */
-        __pyx_t_1 = (__pyx_v_A != 0.0);
+        __pyx_t_1 = ((__pyx_v_A != 0.0) != 0);
         if (__pyx_t_1) {
 
           /* "_distortion.pyx":178
@@ -3697,7 +3880,7 @@ static CYTHON_INLINE void __pyx_f_11_distortion_integrate(__Pyx_memviewslice __p
  *                             dA = AA
  */
           while (1) {
-            __pyx_t_1 = (__pyx_v_AA > 0.0);
+            __pyx_t_1 = ((__pyx_v_AA > 0.0) != 0);
             if (!__pyx_t_1) break;
 
             /* "_distortion.pyx":183
@@ -3707,7 +3890,7 @@ static CYTHON_INLINE void __pyx_f_11_distortion_integrate(__Pyx_memviewslice __p
  *                             dA = AA
  *                             AA = -1
  */
-            __pyx_t_1 = (__pyx_v_dA > __pyx_v_AA);
+            __pyx_t_1 = ((__pyx_v_dA > __pyx_v_AA) != 0);
             if (__pyx_t_1) {
 
               /* "_distortion.pyx":184
@@ -3790,7 +3973,7 @@ static CYTHON_INLINE void __pyx_f_11_distortion_integrate(__Pyx_memviewslice __p
  *                 A = calc_area(P, stop, slope, intercept)
  *                 if A != 0:
  */
-      __pyx_t_1 = (__pyx_v_dP < 0.0);
+      __pyx_t_1 = ((__pyx_v_dP < 0.0) != 0);
       if (__pyx_t_1) {
 
         /* "_distortion.pyx":193
@@ -3809,7 +3992,7 @@ static CYTHON_INLINE void __pyx_f_11_distortion_integrate(__Pyx_memviewslice __p
  *                     AA = fabs(A)
  *                     sign = A / AA
  */
-        __pyx_t_1 = (__pyx_v_A != 0.0);
+        __pyx_t_1 = ((__pyx_v_A != 0.0) != 0);
         if (__pyx_t_1) {
 
           /* "_distortion.pyx":195
@@ -3856,7 +4039,7 @@ static CYTHON_INLINE void __pyx_f_11_distortion_integrate(__Pyx_memviewslice __p
  *                             dA = AA; AA = -1
  */
           while (1) {
-            __pyx_t_1 = (__pyx_v_AA > 0.0);
+            __pyx_t_1 = ((__pyx_v_AA > 0.0) != 0);
             if (!__pyx_t_1) break;
 
             /* "_distortion.pyx":200
@@ -3866,7 +4049,7 @@ static CYTHON_INLINE void __pyx_f_11_distortion_integrate(__Pyx_memviewslice __p
  *                             dA = AA; AA = -1
  *                         box[(<int> floor(stop)), h] += sign * dA
  */
-            __pyx_t_1 = (__pyx_v_dA > __pyx_v_AA);
+            __pyx_t_1 = ((__pyx_v_dA > __pyx_v_AA) != 0);
             if (__pyx_t_1) {
 
               /* "_distortion.pyx":201
@@ -3929,6 +4112,9 @@ static CYTHON_INLINE void __pyx_f_11_distortion_integrate(__Pyx_memviewslice __p
 static int __pyx_pw_11_distortion_4Quad_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static int __pyx_pw_11_distortion_4Quad_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   __Pyx_memviewslice __pyx_v_buffer = { 0, 0, { 0 }, { 0 }, { 0 } };
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
@@ -4124,6 +4310,9 @@ static PyObject *__pyx_pw_11_distortion_4Quad_3reinit(PyObject *__pyx_v_self, Py
   PyObject *__pyx_v_C1 = 0;
   PyObject *__pyx_v_D0 = 0;
   PyObject *__pyx_v_D1 = 0;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("reinit (wrapper)", 0);
@@ -4385,19 +4574,19 @@ __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
   __pyx_t_5 = __pyx_v_self->C0;
   __pyx_t_6 = __pyx_v_self->D0;
   __pyx_t_7 = __pyx_v_self->A0;
-  if ((__pyx_t_4 < __pyx_t_7)) {
+  if (((__pyx_t_4 < __pyx_t_7) != 0)) {
     __pyx_t_8 = __pyx_t_4;
   } else {
     __pyx_t_8 = __pyx_t_7;
   }
   __pyx_t_7 = __pyx_t_8;
-  if ((__pyx_t_5 < __pyx_t_7)) {
+  if (((__pyx_t_5 < __pyx_t_7) != 0)) {
     __pyx_t_8 = __pyx_t_5;
   } else {
     __pyx_t_8 = __pyx_t_7;
   }
   __pyx_t_7 = __pyx_t_8;
-  if ((__pyx_t_6 < __pyx_t_7)) {
+  if (((__pyx_t_6 < __pyx_t_7) != 0)) {
     __pyx_t_8 = __pyx_t_6;
   } else {
     __pyx_t_8 = __pyx_t_7;
@@ -4415,19 +4604,19 @@ __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
   __pyx_t_4 = __pyx_v_self->C1;
   __pyx_t_5 = __pyx_v_self->D1;
   __pyx_t_6 = __pyx_v_self->A1;
-  if ((__pyx_t_8 < __pyx_t_6)) {
+  if (((__pyx_t_8 < __pyx_t_6) != 0)) {
     __pyx_t_7 = __pyx_t_8;
   } else {
     __pyx_t_7 = __pyx_t_6;
   }
   __pyx_t_6 = __pyx_t_7;
-  if ((__pyx_t_4 < __pyx_t_6)) {
+  if (((__pyx_t_4 < __pyx_t_6) != 0)) {
     __pyx_t_7 = __pyx_t_4;
   } else {
     __pyx_t_7 = __pyx_t_6;
   }
   __pyx_t_6 = __pyx_t_7;
-  if ((__pyx_t_5 < __pyx_t_6)) {
+  if (((__pyx_t_5 < __pyx_t_6) != 0)) {
     __pyx_t_7 = __pyx_t_5;
   } else {
     __pyx_t_7 = __pyx_t_6;
@@ -4445,19 +4634,19 @@ __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
   __pyx_t_8 = __pyx_v_self->C0;
   __pyx_t_4 = __pyx_v_self->D0;
   __pyx_t_5 = __pyx_v_self->A0;
-  if ((__pyx_t_7 > __pyx_t_5)) {
+  if (((__pyx_t_7 > __pyx_t_5) != 0)) {
     __pyx_t_6 = __pyx_t_7;
   } else {
     __pyx_t_6 = __pyx_t_5;
   }
   __pyx_t_5 = __pyx_t_6;
-  if ((__pyx_t_8 > __pyx_t_5)) {
+  if (((__pyx_t_8 > __pyx_t_5) != 0)) {
     __pyx_t_6 = __pyx_t_8;
   } else {
     __pyx_t_6 = __pyx_t_5;
   }
   __pyx_t_5 = __pyx_t_6;
-  if ((__pyx_t_4 > __pyx_t_5)) {
+  if (((__pyx_t_4 > __pyx_t_5) != 0)) {
     __pyx_t_6 = __pyx_t_4;
   } else {
     __pyx_t_6 = __pyx_t_5;
@@ -4475,19 +4664,19 @@ __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
   __pyx_t_7 = __pyx_v_self->C1;
   __pyx_t_8 = __pyx_v_self->D1;
   __pyx_t_4 = __pyx_v_self->A1;
-  if ((__pyx_t_6 > __pyx_t_4)) {
+  if (((__pyx_t_6 > __pyx_t_4) != 0)) {
     __pyx_t_5 = __pyx_t_6;
   } else {
     __pyx_t_5 = __pyx_t_4;
   }
   __pyx_t_4 = __pyx_t_5;
-  if ((__pyx_t_7 > __pyx_t_4)) {
+  if (((__pyx_t_7 > __pyx_t_4) != 0)) {
     __pyx_t_5 = __pyx_t_7;
   } else {
     __pyx_t_5 = __pyx_t_4;
   }
   __pyx_t_4 = __pyx_t_5;
-  if ((__pyx_t_8 > __pyx_t_4)) {
+  if (((__pyx_t_8 > __pyx_t_4) != 0)) {
     __pyx_t_5 = __pyx_t_8;
   } else {
     __pyx_t_5 = __pyx_t_4;
@@ -4714,7 +4903,7 @@ static PyObject *__pyx_pf_11_distortion_4Quad_4__repr__(struct __pyx_obj_11_dist
   PyList_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_kp_s_2));
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2));
   __pyx_t_4 = 0;
-  __pyx_v_res = __pyx_t_5;
+  __pyx_v_res = ((PyObject*)__pyx_t_5);
   __pyx_t_5 = 0;
 
   /* "_distortion.pyx":288
@@ -4736,8 +4925,7 @@ static PyObject *__pyx_pf_11_distortion_4Quad_4__repr__(struct __pyx_obj_11_dist
  *                 line+="\t%.3f"%self.box[i,j]
  */
     __Pyx_INCREF(((PyObject *)__pyx_kp_s_3));
-    __Pyx_XDECREF(__pyx_v_line);
-    __pyx_v_line = ((PyObject *)__pyx_kp_s_3);
+    __Pyx_XDECREF_SET(__pyx_v_line, ((PyObject *)__pyx_kp_s_3));
 
     /* "_distortion.pyx":290
  *         for i in range(self.box_size0):
@@ -4781,8 +4969,7 @@ static PyObject *__pyx_pf_11_distortion_4Quad_4__repr__(struct __pyx_obj_11_dist
       __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_line, ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
       __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-      __Pyx_DECREF(__pyx_v_line);
-      __pyx_v_line = __pyx_t_5;
+      __Pyx_DECREF_SET(__pyx_v_line, __pyx_t_5);
       __pyx_t_5 = 0;
     }
 
@@ -4793,7 +4980,7 @@ static PyObject *__pyx_pf_11_distortion_4Quad_4__repr__(struct __pyx_obj_11_dist
  *         return os.linesep.join(res)
  * 
  */
-    __pyx_t_13 = PyList_Append(__pyx_v_res, __pyx_v_line); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_13 = __Pyx_PyList_Append(__pyx_v_res, __pyx_v_line); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
 
   /* "_distortion.pyx":293
@@ -4804,12 +4991,12 @@ static PyObject *__pyx_pf_11_distortion_4Quad_4__repr__(struct __pyx_obj_11_dist
  *     cpdef float get_box(self, int i, int j):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__os); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__linesep); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__linesep); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__join); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__join); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -4869,9 +5056,9 @@ static float __pyx_f_11_distortion_4Quad_get_box(struct __pyx_obj_11_distortion_
   __Pyx_RefNannySetupContext("get_box", 0);
   /* Check if called by wrapper */
   if (unlikely(__pyx_skip_dispatch)) ;
-  /* Check if overriden in Python */
+  /* Check if overridden in Python */
   else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
-    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__get_box); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_box); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_11_distortion_4Quad_7get_box)) {
       __pyx_t_2 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -4943,6 +5130,9 @@ static PyObject *__pyx_pw_11_distortion_4Quad_7get_box(PyObject *__pyx_v_self, P
 static PyObject *__pyx_pw_11_distortion_4Quad_7get_box(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   int __pyx_v_i;
   int __pyx_v_j;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("get_box (wrapper)", 0);
@@ -5050,9 +5240,9 @@ static int __pyx_f_11_distortion_4Quad_get_offset0(struct __pyx_obj_11_distortio
   __Pyx_RefNannySetupContext("get_offset0", 0);
   /* Check if called by wrapper */
   if (unlikely(__pyx_skip_dispatch)) ;
-  /* Check if overriden in Python */
+  /* Check if overridden in Python */
   else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
-    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__get_offset0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_offset0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_11_distortion_4Quad_9get_offset0)) {
       __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -5155,9 +5345,9 @@ static int __pyx_f_11_distortion_4Quad_get_offset1(struct __pyx_obj_11_distortio
   __Pyx_RefNannySetupContext("get_offset1", 0);
   /* Check if called by wrapper */
   if (unlikely(__pyx_skip_dispatch)) ;
-  /* Check if overriden in Python */
+  /* Check if overridden in Python */
   else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
-    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__get_offset1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_offset1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_11_distortion_4Quad_11get_offset1)) {
       __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -5260,9 +5450,9 @@ static int __pyx_f_11_distortion_4Quad_get_box_size0(struct __pyx_obj_11_distort
   __Pyx_RefNannySetupContext("get_box_size0", 0);
   /* Check if called by wrapper */
   if (unlikely(__pyx_skip_dispatch)) ;
-  /* Check if overriden in Python */
+  /* Check if overridden in Python */
   else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
-    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__get_box_size0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_box_size0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_11_distortion_4Quad_13get_box_size0)) {
       __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -5365,9 +5555,9 @@ static int __pyx_f_11_distortion_4Quad_get_box_size1(struct __pyx_obj_11_distort
   __Pyx_RefNannySetupContext("get_box_size1", 0);
   /* Check if called by wrapper */
   if (unlikely(__pyx_skip_dispatch)) ;
-  /* Check if overriden in Python */
+  /* Check if overridden in Python */
   else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
-    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__get_box_size1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_box_size1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_11_distortion_4Quad_15get_box_size1)) {
       __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -5472,9 +5662,9 @@ static PyObject *__pyx_f_11_distortion_4Quad_init_slope(struct __pyx_obj_11_dist
   __Pyx_RefNannySetupContext("init_slope", 0);
   /* Check if called by wrapper */
   if (unlikely(__pyx_skip_dispatch)) ;
-  /* Check if overriden in Python */
+  /* Check if overridden in Python */
   else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
-    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__init_slope); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__init_slope); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_11_distortion_4Quad_17init_slope)) {
       __Pyx_XDECREF(__pyx_r);
@@ -5495,7 +5685,7 @@ static PyObject *__pyx_f_11_distortion_4Quad_init_slope(struct __pyx_obj_11_dist
  *             if self.B0 != self.A0:
  *                 self.pAB = (self.B1 - self.A1) / (self.B0 - self.A0)
  */
-  __pyx_t_3 = (!__pyx_v_self->has_slope);
+  __pyx_t_3 = ((!(__pyx_v_self->has_slope != 0)) != 0);
   if (__pyx_t_3) {
 
     /* "_distortion.pyx":308
@@ -5505,7 +5695,7 @@ static PyObject *__pyx_f_11_distortion_4Quad_init_slope(struct __pyx_obj_11_dist
  *                 self.pAB = (self.B1 - self.A1) / (self.B0 - self.A0)
  *                 self.cAB = self.A1 - self.pAB * self.A0
  */
-    __pyx_t_3 = (__pyx_v_self->B0 != __pyx_v_self->A0);
+    __pyx_t_3 = ((__pyx_v_self->B0 != __pyx_v_self->A0) != 0);
     if (__pyx_t_3) {
 
       /* "_distortion.pyx":309
@@ -5518,7 +5708,13 @@ static PyObject *__pyx_f_11_distortion_4Quad_init_slope(struct __pyx_obj_11_dist
       __pyx_t_4 = (__pyx_v_self->B1 - __pyx_v_self->A1);
       __pyx_t_5 = (__pyx_v_self->B0 - __pyx_v_self->A0);
       if (unlikely(__pyx_t_5 == 0)) {
+        #ifdef WITH_THREAD
+        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+        #endif
         PyErr_Format(PyExc_ZeroDivisionError, "float division");
+        #ifdef WITH_THREAD
+        PyGILState_Release(__pyx_gilstate_save);
+        #endif
         {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       }
       __pyx_v_self->pAB = (__pyx_t_4 / __pyx_t_5);
@@ -5542,7 +5738,7 @@ static PyObject *__pyx_f_11_distortion_4Quad_init_slope(struct __pyx_obj_11_dist
  *                 self.pBC = (self.C1 - self.B1) / (self.C0 - self.B0)
  *                 self.cBC = self.B1 - self.pBC * self.B0
  */
-    __pyx_t_3 = (__pyx_v_self->C0 != __pyx_v_self->B0);
+    __pyx_t_3 = ((__pyx_v_self->C0 != __pyx_v_self->B0) != 0);
     if (__pyx_t_3) {
 
       /* "_distortion.pyx":312
@@ -5555,7 +5751,13 @@ static PyObject *__pyx_f_11_distortion_4Quad_init_slope(struct __pyx_obj_11_dist
       __pyx_t_5 = (__pyx_v_self->C1 - __pyx_v_self->B1);
       __pyx_t_4 = (__pyx_v_self->C0 - __pyx_v_self->B0);
       if (unlikely(__pyx_t_4 == 0)) {
+        #ifdef WITH_THREAD
+        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+        #endif
         PyErr_Format(PyExc_ZeroDivisionError, "float division");
+        #ifdef WITH_THREAD
+        PyGILState_Release(__pyx_gilstate_save);
+        #endif
         {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       }
       __pyx_v_self->pBC = (__pyx_t_5 / __pyx_t_4);
@@ -5579,7 +5781,7 @@ static PyObject *__pyx_f_11_distortion_4Quad_init_slope(struct __pyx_obj_11_dist
  *                 self.pCD = (self.D1 - self.C1) / (self.D0 - self.C0)
  *                 self.cCD = self.C1 - self.pCD * self.C0
  */
-    __pyx_t_3 = (__pyx_v_self->D0 != __pyx_v_self->C0);
+    __pyx_t_3 = ((__pyx_v_self->D0 != __pyx_v_self->C0) != 0);
     if (__pyx_t_3) {
 
       /* "_distortion.pyx":315
@@ -5592,7 +5794,13 @@ static PyObject *__pyx_f_11_distortion_4Quad_init_slope(struct __pyx_obj_11_dist
       __pyx_t_4 = (__pyx_v_self->D1 - __pyx_v_self->C1);
       __pyx_t_5 = (__pyx_v_self->D0 - __pyx_v_self->C0);
       if (unlikely(__pyx_t_5 == 0)) {
+        #ifdef WITH_THREAD
+        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+        #endif
         PyErr_Format(PyExc_ZeroDivisionError, "float division");
+        #ifdef WITH_THREAD
+        PyGILState_Release(__pyx_gilstate_save);
+        #endif
         {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       }
       __pyx_v_self->pCD = (__pyx_t_4 / __pyx_t_5);
@@ -5616,7 +5824,7 @@ static PyObject *__pyx_f_11_distortion_4Quad_init_slope(struct __pyx_obj_11_dist
  *                 self.pDA = (self.A1 - self.D1) / (self.A0 - self.D0)
  *                 self.cDA = self.D1 - self.pDA * self.D0
  */
-    __pyx_t_3 = (__pyx_v_self->A0 != __pyx_v_self->D0);
+    __pyx_t_3 = ((__pyx_v_self->A0 != __pyx_v_self->D0) != 0);
     if (__pyx_t_3) {
 
       /* "_distortion.pyx":318
@@ -5629,7 +5837,13 @@ static PyObject *__pyx_f_11_distortion_4Quad_init_slope(struct __pyx_obj_11_dist
       __pyx_t_5 = (__pyx_v_self->A1 - __pyx_v_self->D1);
       __pyx_t_4 = (__pyx_v_self->A0 - __pyx_v_self->D0);
       if (unlikely(__pyx_t_4 == 0)) {
+        #ifdef WITH_THREAD
+        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+        #endif
         PyErr_Format(PyExc_ZeroDivisionError, "float division");
+        #ifdef WITH_THREAD
+        PyGILState_Release(__pyx_gilstate_save);
+        #endif
         {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       }
       __pyx_v_self->pDA = (__pyx_t_5 / __pyx_t_4);
@@ -5741,9 +5955,9 @@ static float __pyx_f_11_distortion_4Quad_calc_area_AB(struct __pyx_obj_11_distor
   __Pyx_RefNannySetupContext("calc_area_AB", 0);
   /* Check if called by wrapper */
   if (unlikely(__pyx_skip_dispatch)) ;
-  /* Check if overriden in Python */
+  /* Check if overridden in Python */
   else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
-    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__calc_area_AB); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__calc_area_AB); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_11_distortion_4Quad_19calc_area_AB)) {
       __pyx_t_2 = PyFloat_FromDouble(__pyx_v_I1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -5777,7 +5991,7 @@ static float __pyx_f_11_distortion_4Quad_calc_area_AB(struct __pyx_obj_11_distor
  *             return 0.5 * (I2 - I1) * (self.pAB * (I2 + I1) + 2 * self.cAB)
  *         else:
  */
-  __pyx_t_6 = (__pyx_v_self->B0 != __pyx_v_self->A0);
+  __pyx_t_6 = ((__pyx_v_self->B0 != __pyx_v_self->A0) != 0);
   if (__pyx_t_6) {
 
     /* "_distortion.pyx":324
@@ -5824,6 +6038,9 @@ static PyObject *__pyx_pw_11_distortion_4Quad_19calc_area_AB(PyObject *__pyx_v_s
 static PyObject *__pyx_pw_11_distortion_4Quad_19calc_area_AB(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   float __pyx_v_I1;
   float __pyx_v_I2;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("calc_area_AB (wrapper)", 0);
@@ -5934,9 +6151,9 @@ static float __pyx_f_11_distortion_4Quad_calc_area_BC(struct __pyx_obj_11_distor
   __Pyx_RefNannySetupContext("calc_area_BC", 0);
   /* Check if called by wrapper */
   if (unlikely(__pyx_skip_dispatch)) ;
-  /* Check if overriden in Python */
+  /* Check if overridden in Python */
   else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
-    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__calc_area_BC); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__calc_area_BC); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_11_distortion_4Quad_21calc_area_BC)) {
       __pyx_t_2 = PyFloat_FromDouble(__pyx_v_J1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -5970,7 +6187,7 @@ static float __pyx_f_11_distortion_4Quad_calc_area_BC(struct __pyx_obj_11_distor
  *             return 0.5 * (J2 - J1) * (self.pBC * (J1 + J2) + 2 * self.cBC)
  *         else:
  */
-  __pyx_t_6 = (__pyx_v_self->B0 != __pyx_v_self->C0);
+  __pyx_t_6 = ((__pyx_v_self->B0 != __pyx_v_self->C0) != 0);
   if (__pyx_t_6) {
 
     /* "_distortion.pyx":330
@@ -6017,6 +6234,9 @@ static PyObject *__pyx_pw_11_distortion_4Quad_21calc_area_BC(PyObject *__pyx_v_s
 static PyObject *__pyx_pw_11_distortion_4Quad_21calc_area_BC(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   float __pyx_v_J1;
   float __pyx_v_J2;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("calc_area_BC (wrapper)", 0);
@@ -6127,9 +6347,9 @@ static float __pyx_f_11_distortion_4Quad_calc_area_CD(struct __pyx_obj_11_distor
   __Pyx_RefNannySetupContext("calc_area_CD", 0);
   /* Check if called by wrapper */
   if (unlikely(__pyx_skip_dispatch)) ;
-  /* Check if overriden in Python */
+  /* Check if overridden in Python */
   else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
-    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__calc_area_CD); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__calc_area_CD); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_11_distortion_4Quad_23calc_area_CD)) {
       __pyx_t_2 = PyFloat_FromDouble(__pyx_v_K1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -6163,7 +6383,7 @@ static float __pyx_f_11_distortion_4Quad_calc_area_CD(struct __pyx_obj_11_distor
  *             return 0.5 * (K2 - K1) * (self.pCD * (K2 + K1) + 2 * self.cCD)
  *         else:
  */
-  __pyx_t_6 = (__pyx_v_self->C0 != __pyx_v_self->D0);
+  __pyx_t_6 = ((__pyx_v_self->C0 != __pyx_v_self->D0) != 0);
   if (__pyx_t_6) {
 
     /* "_distortion.pyx":336
@@ -6210,6 +6430,9 @@ static PyObject *__pyx_pw_11_distortion_4Quad_23calc_area_CD(PyObject *__pyx_v_s
 static PyObject *__pyx_pw_11_distortion_4Quad_23calc_area_CD(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   float __pyx_v_K1;
   float __pyx_v_K2;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("calc_area_CD (wrapper)", 0);
@@ -6320,9 +6543,9 @@ static float __pyx_f_11_distortion_4Quad_calc_area_DA(struct __pyx_obj_11_distor
   __Pyx_RefNannySetupContext("calc_area_DA", 0);
   /* Check if called by wrapper */
   if (unlikely(__pyx_skip_dispatch)) ;
-  /* Check if overriden in Python */
+  /* Check if overridden in Python */
   else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
-    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__calc_area_DA); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__calc_area_DA); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_11_distortion_4Quad_25calc_area_DA)) {
       __pyx_t_2 = PyFloat_FromDouble(__pyx_v_L1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -6356,7 +6579,7 @@ static float __pyx_f_11_distortion_4Quad_calc_area_DA(struct __pyx_obj_11_distor
  *             return 0.5 * (L2 - L1) * (self.pDA * (L1 + L2) + 2 * self.cDA)
  *         else:
  */
-  __pyx_t_6 = (__pyx_v_self->D0 != __pyx_v_self->A0);
+  __pyx_t_6 = ((__pyx_v_self->D0 != __pyx_v_self->A0) != 0);
   if (__pyx_t_6) {
 
     /* "_distortion.pyx":342
@@ -6403,6 +6626,9 @@ static PyObject *__pyx_pw_11_distortion_4Quad_25calc_area_DA(PyObject *__pyx_v_s
 static PyObject *__pyx_pw_11_distortion_4Quad_25calc_area_DA(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   float __pyx_v_L1;
   float __pyx_v_L2;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("calc_area_DA (wrapper)", 0);
@@ -6511,9 +6737,9 @@ static float __pyx_f_11_distortion_4Quad_calc_area(struct __pyx_obj_11_distortio
   __Pyx_RefNannySetupContext("calc_area", 0);
   /* Check if called by wrapper */
   if (unlikely(__pyx_skip_dispatch)) ;
-  /* Check if overriden in Python */
+  /* Check if overridden in Python */
   else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
-    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__calc_area); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__calc_area); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_11_distortion_4Quad_27calc_area)) {
       __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -6534,7 +6760,7 @@ static float __pyx_f_11_distortion_4Quad_calc_area(struct __pyx_obj_11_distortio
  *             self.area = 0.5*((self.C0 - self.A0)*(self.D1 - self.B1)-(self.C1 - self.A1)*(self.D0 - self.B0))
  *             self.has_area = 1
  */
-  __pyx_t_4 = (!__pyx_v_self->has_area);
+  __pyx_t_4 = ((!(__pyx_v_self->has_area != 0)) != 0);
   if (__pyx_t_4) {
 
     /* "_distortion.pyx":350
@@ -6686,7 +6912,7 @@ static PyObject *__pyx_pf_11_distortion_4Quad_28populate_box(struct __pyx_obj_11
  *             self.init_slope()
  *         integrate(self.box, self.B0, self.A0, self.pAB, self.cAB)
  */
-  __pyx_t_1 = (!__pyx_v_self->has_slope);
+  __pyx_t_1 = ((!(__pyx_v_self->has_slope != 0)) != 0);
   if (__pyx_t_1) {
 
     /* "_distortion.pyx":358
@@ -6799,7 +7025,13 @@ static PyObject *__pyx_pf_11_distortion_4Quad_28populate_box(struct __pyx_obj_11
       }
       __pyx_t_10 = (*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_self->box.data + __pyx_t_7 * __pyx_v_self->box.strides[0]) ) + __pyx_t_8 * __pyx_v_self->box.strides[1]) )));
       if (unlikely(__pyx_v_area == 0)) {
+        #ifdef WITH_THREAD
+        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+        #endif
         PyErr_Format(PyExc_ZeroDivisionError, "float division");
+        #ifdef WITH_THREAD
+        PyGILState_Release(__pyx_gilstate_save);
+        #endif
         {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       }
       __pyx_v_value = (__pyx_t_10 / __pyx_v_area);
@@ -6836,7 +7068,7 @@ static PyObject *__pyx_pf_11_distortion_4Quad_28populate_box(struct __pyx_obj_11
  *                     print self.box
  *                     self.box[:, :] = 0
  */
-      __pyx_t_1 = (__pyx_v_value < 0.0);
+      __pyx_t_1 = ((__pyx_v_value < 0.0) != 0);
       if (__pyx_t_1) {
 
         /* "_distortion.pyx":369
@@ -6915,7 +7147,7 @@ __PYX_XDEC_MEMVIEW(&__pyx_t_13, 1);
  *                     print self.box
  *                     self.box[:, :] = 0
  */
-        __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__integrate); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__integrate); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_2);
         __pyx_t_15 = PyFloat_FromDouble(__pyx_v_self->B0); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_15);
@@ -7021,7 +7253,7 @@ __PYX_XDEC_MEMVIEW(&__pyx_t_13, 1);
  *                     print self.box
  *                     self.box[:, :] = 0
  */
-        __pyx_t_18 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__integrate); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_18 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__integrate); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_18);
         __pyx_t_19 = PyFloat_FromDouble(__pyx_v_self->A0); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_19);
@@ -7127,7 +7359,7 @@ __PYX_XDEC_MEMVIEW(&__pyx_t_13, 1);
  *                     print self.box
  *                     self.box[:, :] = 0
  */
-        __pyx_t_16 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__integrate); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_16 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__integrate); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_16);
         __pyx_t_15 = PyFloat_FromDouble(__pyx_v_self->D0); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_15);
@@ -7233,7 +7465,7 @@ __PYX_XDEC_MEMVIEW(&__pyx_t_13, 1);
  *                     print self.box
  *                     print self
  */
-        __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__integrate); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__integrate); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_2);
         __pyx_t_19 = PyFloat_FromDouble(__pyx_v_self->C0); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_19);
@@ -7332,6 +7564,9 @@ static PyObject *__pyx_pw_11_distortion_4Quad_31integrate(PyObject *__pyx_v_self
   float __pyx_v_stop;
   float __pyx_v_slope;
   float __pyx_v_intercept;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("integrate (wrapper)", 0);
@@ -7457,7 +7692,7 @@ static PyObject *__pyx_pf_11_distortion_4Quad_30integrate(struct __pyx_obj_11_di
  *             P = ceil(start)
  *             dP = P - start
  */
-  __pyx_t_1 = (__pyx_v_start < __pyx_v_stop);
+  __pyx_t_1 = ((__pyx_v_start < __pyx_v_stop) != 0);
   if (__pyx_t_1) {
 
     /* "_distortion.pyx":394
@@ -7485,7 +7720,7 @@ static PyObject *__pyx_pf_11_distortion_4Quad_30integrate(struct __pyx_obj_11_di
  *                 A = calc_area(start, stop, slope, intercept)
  *                 if A != 0:
  */
-    __pyx_t_1 = (__pyx_v_P > __pyx_v_stop);
+    __pyx_t_1 = ((__pyx_v_P > __pyx_v_stop) != 0);
     if (__pyx_t_1) {
 
       /* "_distortion.pyx":398
@@ -7504,7 +7739,7 @@ static PyObject *__pyx_pf_11_distortion_4Quad_30integrate(struct __pyx_obj_11_di
  *                     AA = fabs(A)
  *                     sign = A / AA
  */
-      __pyx_t_1 = (__pyx_v_A != 0.0);
+      __pyx_t_1 = ((__pyx_v_A != 0.0) != 0);
       if (__pyx_t_1) {
 
         /* "_distortion.pyx":400
@@ -7524,7 +7759,13 @@ static PyObject *__pyx_pf_11_distortion_4Quad_30integrate(struct __pyx_obj_11_di
  * #                    print AA, sign, dA
  */
         if (unlikely(__pyx_v_AA == 0)) {
+          #ifdef WITH_THREAD
+          PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+          #endif
           PyErr_Format(PyExc_ZeroDivisionError, "float division");
+          #ifdef WITH_THREAD
+          PyGILState_Release(__pyx_gilstate_save);
+          #endif
           {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         }
         __pyx_v_sign = (__pyx_v_A / __pyx_v_AA);
@@ -7555,7 +7796,7 @@ static PyObject *__pyx_pf_11_distortion_4Quad_30integrate(struct __pyx_obj_11_di
  *                             dA = AA
  */
         while (1) {
-          __pyx_t_1 = (__pyx_v_AA > 0.0);
+          __pyx_t_1 = ((__pyx_v_AA > 0.0) != 0);
           if (!__pyx_t_1) break;
 
           /* "_distortion.pyx":406
@@ -7565,7 +7806,7 @@ static PyObject *__pyx_pf_11_distortion_4Quad_30integrate(struct __pyx_obj_11_di
  *                             dA = AA
  *                             AA = -1
  */
-          __pyx_t_1 = (__pyx_v_dA > __pyx_v_AA);
+          __pyx_t_1 = ((__pyx_v_dA > __pyx_v_AA) != 0);
           if (__pyx_t_1) {
 
             /* "_distortion.pyx":407
@@ -7646,7 +7887,7 @@ static PyObject *__pyx_pf_11_distortion_4Quad_30integrate(struct __pyx_obj_11_di
  *                     A = calc_area(start, P, slope, intercept)
  *                     if A != 0:
  */
-      __pyx_t_1 = (__pyx_v_dP > 0.0);
+      __pyx_t_1 = ((__pyx_v_dP > 0.0) != 0);
       if (__pyx_t_1) {
 
         /* "_distortion.pyx":414
@@ -7665,7 +7906,7 @@ static PyObject *__pyx_pf_11_distortion_4Quad_30integrate(struct __pyx_obj_11_di
  *                         AA = fabs(A)
  *                         sign = A / AA
  */
-        __pyx_t_1 = (__pyx_v_A != 0.0);
+        __pyx_t_1 = ((__pyx_v_A != 0.0) != 0);
         if (__pyx_t_1) {
 
           /* "_distortion.pyx":416
@@ -7685,7 +7926,13 @@ static PyObject *__pyx_pf_11_distortion_4Quad_30integrate(struct __pyx_obj_11_di
  *                         dA = dP
  */
           if (unlikely(__pyx_v_AA == 0)) {
+            #ifdef WITH_THREAD
+            PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+            #endif
             PyErr_Format(PyExc_ZeroDivisionError, "float division");
+            #ifdef WITH_THREAD
+            PyGILState_Release(__pyx_gilstate_save);
+            #endif
             {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           }
           __pyx_v_sign = (__pyx_v_A / __pyx_v_AA);
@@ -7716,7 +7963,7 @@ static PyObject *__pyx_pf_11_distortion_4Quad_30integrate(struct __pyx_obj_11_di
  *                                 dA = AA
  */
           while (1) {
-            __pyx_t_1 = (__pyx_v_AA > 0.0);
+            __pyx_t_1 = ((__pyx_v_AA > 0.0) != 0);
             if (!__pyx_t_1) break;
 
             /* "_distortion.pyx":421
@@ -7726,7 +7973,7 @@ static PyObject *__pyx_pf_11_distortion_4Quad_30integrate(struct __pyx_obj_11_di
  *                                 dA = AA
  *                                 AA = -1
  */
-            __pyx_t_1 = (__pyx_v_dA > __pyx_v_AA);
+            __pyx_t_1 = ((__pyx_v_dA > __pyx_v_AA) != 0);
             if (__pyx_t_1) {
 
               /* "_distortion.pyx":422
@@ -7827,7 +8074,7 @@ static PyObject *__pyx_pf_11_distortion_4Quad_30integrate(struct __pyx_obj_11_di
  *                         AA = fabs(A)
  *                         sign = A / AA
  */
-        __pyx_t_1 = (__pyx_v_A != 0.0);
+        __pyx_t_1 = ((__pyx_v_A != 0.0) != 0);
         if (__pyx_t_1) {
 
           /* "_distortion.pyx":431
@@ -7847,7 +8094,13 @@ static PyObject *__pyx_pf_11_distortion_4Quad_30integrate(struct __pyx_obj_11_di
  *                         h = 0
  */
           if (unlikely(__pyx_v_AA == 0)) {
+            #ifdef WITH_THREAD
+            PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+            #endif
             PyErr_Format(PyExc_ZeroDivisionError, "float division");
+            #ifdef WITH_THREAD
+            PyGILState_Release(__pyx_gilstate_save);
+            #endif
             {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           }
           __pyx_v_sign = (__pyx_v_A / __pyx_v_AA);
@@ -7878,7 +8131,7 @@ static PyObject *__pyx_pf_11_distortion_4Quad_30integrate(struct __pyx_obj_11_di
  *                                 dA = AA
  */
           while (1) {
-            __pyx_t_1 = (__pyx_v_AA > 0.0);
+            __pyx_t_1 = ((__pyx_v_AA > 0.0) != 0);
             if (!__pyx_t_1) break;
 
             /* "_distortion.pyx":437
@@ -7888,7 +8141,7 @@ static PyObject *__pyx_pf_11_distortion_4Quad_30integrate(struct __pyx_obj_11_di
  *                                 dA = AA
  *                                 AA = -1
  */
-            __pyx_t_1 = (__pyx_v_dA > __pyx_v_AA);
+            __pyx_t_1 = ((__pyx_v_dA > __pyx_v_AA) != 0);
             if (__pyx_t_1) {
 
               /* "_distortion.pyx":438
@@ -7985,7 +8238,7 @@ static PyObject *__pyx_pf_11_distortion_4Quad_30integrate(struct __pyx_obj_11_di
  *                     A = calc_area(P, stop, slope, intercept)
  *                     if A != 0:
  */
-      __pyx_t_1 = (__pyx_v_dP > 0.0);
+      __pyx_t_1 = ((__pyx_v_dP > 0.0) != 0);
       if (__pyx_t_1) {
 
         /* "_distortion.pyx":447
@@ -8004,7 +8257,7 @@ static PyObject *__pyx_pf_11_distortion_4Quad_30integrate(struct __pyx_obj_11_di
  *                         AA = fabs(A)
  *                         sign = A / AA
  */
-        __pyx_t_1 = (__pyx_v_A != 0.0);
+        __pyx_t_1 = ((__pyx_v_A != 0.0) != 0);
         if (__pyx_t_1) {
 
           /* "_distortion.pyx":449
@@ -8024,7 +8277,13 @@ static PyObject *__pyx_pf_11_distortion_4Quad_30integrate(struct __pyx_obj_11_di
  *                         dA = fabs(dP)
  */
           if (unlikely(__pyx_v_AA == 0)) {
+            #ifdef WITH_THREAD
+            PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+            #endif
             PyErr_Format(PyExc_ZeroDivisionError, "float division");
+            #ifdef WITH_THREAD
+            PyGILState_Release(__pyx_gilstate_save);
+            #endif
             {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           }
           __pyx_v_sign = (__pyx_v_A / __pyx_v_AA);
@@ -8055,7 +8314,7 @@ static PyObject *__pyx_pf_11_distortion_4Quad_30integrate(struct __pyx_obj_11_di
  *                                 dA = AA
  */
           while (1) {
-            __pyx_t_1 = (__pyx_v_AA > 0.0);
+            __pyx_t_1 = ((__pyx_v_AA > 0.0) != 0);
             if (!__pyx_t_1) break;
 
             /* "_distortion.pyx":454
@@ -8065,7 +8324,7 @@ static PyObject *__pyx_pf_11_distortion_4Quad_30integrate(struct __pyx_obj_11_di
  *                                 dA = AA
  *                                 AA = -1
  */
-            __pyx_t_1 = (__pyx_v_dA > __pyx_v_AA);
+            __pyx_t_1 = ((__pyx_v_dA > __pyx_v_AA) != 0);
             if (__pyx_t_1) {
 
               /* "_distortion.pyx":455
@@ -8150,7 +8409,7 @@ static PyObject *__pyx_pf_11_distortion_4Quad_30integrate(struct __pyx_obj_11_di
  *             P = floor(start)
  *             if stop > P:  # start and stop are in the same unit
  */
-  __pyx_t_1 = (__pyx_v_start > __pyx_v_stop);
+  __pyx_t_1 = ((__pyx_v_start > __pyx_v_stop) != 0);
   if (__pyx_t_1) {
 
     /* "_distortion.pyx":461
@@ -8169,7 +8428,7 @@ static PyObject *__pyx_pf_11_distortion_4Quad_30integrate(struct __pyx_obj_11_di
  *                 A = calc_area(start, stop, slope, intercept)
  *                 if A != 0:
  */
-    __pyx_t_1 = (__pyx_v_stop > __pyx_v_P);
+    __pyx_t_1 = ((__pyx_v_stop > __pyx_v_P) != 0);
     if (__pyx_t_1) {
 
       /* "_distortion.pyx":463
@@ -8188,7 +8447,7 @@ static PyObject *__pyx_pf_11_distortion_4Quad_30integrate(struct __pyx_obj_11_di
  *                     AA = fabs(A)
  *                     sign = A / AA
  */
-      __pyx_t_1 = (__pyx_v_A != 0.0);
+      __pyx_t_1 = ((__pyx_v_A != 0.0) != 0);
       if (__pyx_t_1) {
 
         /* "_distortion.pyx":465
@@ -8208,7 +8467,13 @@ static PyObject *__pyx_pf_11_distortion_4Quad_30integrate(struct __pyx_obj_11_di
  *                     h = 0
  */
         if (unlikely(__pyx_v_AA == 0)) {
+          #ifdef WITH_THREAD
+          PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+          #endif
           PyErr_Format(PyExc_ZeroDivisionError, "float division");
+          #ifdef WITH_THREAD
+          PyGILState_Release(__pyx_gilstate_save);
+          #endif
           {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         }
         __pyx_v_sign = (__pyx_v_A / __pyx_v_AA);
@@ -8239,7 +8504,7 @@ static PyObject *__pyx_pf_11_distortion_4Quad_30integrate(struct __pyx_obj_11_di
  *                             dA = AA
  */
         while (1) {
-          __pyx_t_1 = (__pyx_v_AA > 0.0);
+          __pyx_t_1 = ((__pyx_v_AA > 0.0) != 0);
           if (!__pyx_t_1) break;
 
           /* "_distortion.pyx":470
@@ -8249,7 +8514,7 @@ static PyObject *__pyx_pf_11_distortion_4Quad_30integrate(struct __pyx_obj_11_di
  *                             dA = AA
  *                             AA = -1
  */
-          __pyx_t_1 = (__pyx_v_dA > __pyx_v_AA);
+          __pyx_t_1 = ((__pyx_v_dA > __pyx_v_AA) != 0);
           if (__pyx_t_1) {
 
             /* "_distortion.pyx":471
@@ -8339,7 +8604,7 @@ static PyObject *__pyx_pf_11_distortion_4Quad_30integrate(struct __pyx_obj_11_di
  *                     A = calc_area(start, P, slope, intercept)
  *                     if A != 0:
  */
-      __pyx_t_1 = (__pyx_v_dP < 0.0);
+      __pyx_t_1 = ((__pyx_v_dP < 0.0) != 0);
       if (__pyx_t_1) {
 
         /* "_distortion.pyx":479
@@ -8358,7 +8623,7 @@ static PyObject *__pyx_pf_11_distortion_4Quad_30integrate(struct __pyx_obj_11_di
  *                         AA = fabs(A)
  *                         sign = A / AA
  */
-        __pyx_t_1 = (__pyx_v_A != 0.0);
+        __pyx_t_1 = ((__pyx_v_A != 0.0) != 0);
         if (__pyx_t_1) {
 
           /* "_distortion.pyx":481
@@ -8378,7 +8643,13 @@ static PyObject *__pyx_pf_11_distortion_4Quad_30integrate(struct __pyx_obj_11_di
  *                         dA = fabs(dP)
  */
           if (unlikely(__pyx_v_AA == 0)) {
+            #ifdef WITH_THREAD
+            PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+            #endif
             PyErr_Format(PyExc_ZeroDivisionError, "float division");
+            #ifdef WITH_THREAD
+            PyGILState_Release(__pyx_gilstate_save);
+            #endif
             {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           }
           __pyx_v_sign = (__pyx_v_A / __pyx_v_AA);
@@ -8409,7 +8680,7 @@ static PyObject *__pyx_pf_11_distortion_4Quad_30integrate(struct __pyx_obj_11_di
  *                                 dA = AA
  */
           while (1) {
-            __pyx_t_1 = (__pyx_v_AA > 0.0);
+            __pyx_t_1 = ((__pyx_v_AA > 0.0) != 0);
             if (!__pyx_t_1) break;
 
             /* "_distortion.pyx":486
@@ -8419,7 +8690,7 @@ static PyObject *__pyx_pf_11_distortion_4Quad_30integrate(struct __pyx_obj_11_di
  *                                 dA = AA
  *                                 AA = -1
  */
-            __pyx_t_1 = (__pyx_v_dA > __pyx_v_AA);
+            __pyx_t_1 = ((__pyx_v_dA > __pyx_v_AA) != 0);
             if (__pyx_t_1) {
 
               /* "_distortion.pyx":487
@@ -8520,7 +8791,7 @@ static PyObject *__pyx_pf_11_distortion_4Quad_30integrate(struct __pyx_obj_11_di
  *                         AA = fabs(A)
  *                         sign = A / AA
  */
-        __pyx_t_1 = (__pyx_v_A != 0.0);
+        __pyx_t_1 = ((__pyx_v_A != 0.0) != 0);
         if (__pyx_t_1) {
 
           /* "_distortion.pyx":496
@@ -8540,7 +8811,13 @@ static PyObject *__pyx_pf_11_distortion_4Quad_30integrate(struct __pyx_obj_11_di
  *                         dA = 1
  */
           if (unlikely(__pyx_v_AA == 0)) {
+            #ifdef WITH_THREAD
+            PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+            #endif
             PyErr_Format(PyExc_ZeroDivisionError, "float division");
+            #ifdef WITH_THREAD
+            PyGILState_Release(__pyx_gilstate_save);
+            #endif
             {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           }
           __pyx_v_sign = (__pyx_v_A / __pyx_v_AA);
@@ -8571,7 +8848,7 @@ static PyObject *__pyx_pf_11_distortion_4Quad_30integrate(struct __pyx_obj_11_di
  *                                 dA = AA
  */
           while (1) {
-            __pyx_t_1 = (__pyx_v_AA > 0.0);
+            __pyx_t_1 = ((__pyx_v_AA > 0.0) != 0);
             if (!__pyx_t_1) break;
 
             /* "_distortion.pyx":501
@@ -8581,7 +8858,7 @@ static PyObject *__pyx_pf_11_distortion_4Quad_30integrate(struct __pyx_obj_11_di
  *                                 dA = AA
  *                                 AA = -1
  */
-            __pyx_t_1 = (__pyx_v_dA > __pyx_v_AA);
+            __pyx_t_1 = ((__pyx_v_dA > __pyx_v_AA) != 0);
             if (__pyx_t_1) {
 
               /* "_distortion.pyx":502
@@ -8678,7 +8955,7 @@ static PyObject *__pyx_pf_11_distortion_4Quad_30integrate(struct __pyx_obj_11_di
  *                     A = calc_area(P, stop, slope, intercept)
  *                     if A != 0:
  */
-      __pyx_t_1 = (__pyx_v_dP < 0.0);
+      __pyx_t_1 = ((__pyx_v_dP < 0.0) != 0);
       if (__pyx_t_1) {
 
         /* "_distortion.pyx":511
@@ -8697,7 +8974,7 @@ static PyObject *__pyx_pf_11_distortion_4Quad_30integrate(struct __pyx_obj_11_di
  *                         AA = fabs(A)
  *                         sign = A / AA
  */
-        __pyx_t_1 = (__pyx_v_A != 0.0);
+        __pyx_t_1 = ((__pyx_v_A != 0.0) != 0);
         if (__pyx_t_1) {
 
           /* "_distortion.pyx":513
@@ -8717,7 +8994,13 @@ static PyObject *__pyx_pf_11_distortion_4Quad_30integrate(struct __pyx_obj_11_di
  *                         dA = fabs(dP)
  */
           if (unlikely(__pyx_v_AA == 0)) {
+            #ifdef WITH_THREAD
+            PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+            #endif
             PyErr_Format(PyExc_ZeroDivisionError, "float division");
+            #ifdef WITH_THREAD
+            PyGILState_Release(__pyx_gilstate_save);
+            #endif
             {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           }
           __pyx_v_sign = (__pyx_v_A / __pyx_v_AA);
@@ -8748,7 +9031,7 @@ static PyObject *__pyx_pf_11_distortion_4Quad_30integrate(struct __pyx_obj_11_di
  *                                 dA = AA; AA = -1
  */
           while (1) {
-            __pyx_t_1 = (__pyx_v_AA > 0.0);
+            __pyx_t_1 = ((__pyx_v_AA > 0.0) != 0);
             if (!__pyx_t_1) break;
 
             /* "_distortion.pyx":518
@@ -8758,7 +9041,7 @@ static PyObject *__pyx_pf_11_distortion_4Quad_30integrate(struct __pyx_obj_11_di
  *                                 dA = AA; AA = -1
  *                             self.box[(<int> floor(stop)), h] += sign * dA
  */
-            __pyx_t_1 = (__pyx_v_dA > __pyx_v_AA);
+            __pyx_t_1 = ((__pyx_v_dA > __pyx_v_AA) != 0);
             if (__pyx_t_1) {
 
               /* "_distortion.pyx":519
@@ -8848,6 +9131,9 @@ static PyObject *__pyx_pw_11_distortion_10Distortion_1__init__(PyObject *__pyx_s
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_detector = 0;
   PyObject *__pyx_v_shape = 0;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
@@ -8926,10 +9212,11 @@ static PyObject *__pyx_pf_11_distortion_10Distortion___init__(CYTHON_UNUSED PyOb
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
   int __pyx_t_3;
-  PyObject *__pyx_t_4 = NULL;
-  Py_ssize_t __pyx_t_5;
-  PyObject *(*__pyx_t_6)(PyObject *);
-  PyObject *__pyx_t_7 = NULL;
+  int __pyx_t_4;
+  PyObject *__pyx_t_5 = NULL;
+  Py_ssize_t __pyx_t_6;
+  PyObject *(*__pyx_t_7)(PyObject *);
+  PyObject *__pyx_t_8 = NULL;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -8942,14 +9229,15 @@ static PyObject *__pyx_pf_11_distortion_10Distortion___init__(CYTHON_UNUSED PyOb
  *             self.detector = detector_factory(detector)
  *         else:  # we assume it is a Detector instance
  */
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__types); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__types); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__StringTypes); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__StringTypes); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __pyx_t_3 = (__Pyx_PySequence_Contains(((PyObject *)Py_TYPE(__pyx_v_detector)), __pyx_t_2, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (__pyx_t_3) {
+  __pyx_t_4 = (__pyx_t_3 != 0);
+  if (__pyx_t_4) {
 
     /* "_distortion.pyx":537
  *         """
@@ -8958,19 +9246,19 @@ static PyObject *__pyx_pf_11_distortion_10Distortion___init__(CYTHON_UNUSED PyOb
  *         else:  # we assume it is a Detector instance
  *             self.detector = detector
  */
-    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__detector_factory); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__detector_factory); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_INCREF(__pyx_v_detector);
     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_detector);
     __Pyx_GIVEREF(__pyx_v_detector);
-    __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-    if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__detector, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__detector, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     goto __pyx_L3;
   }
   /*else*/ {
@@ -8982,7 +9270,7 @@ static PyObject *__pyx_pf_11_distortion_10Distortion___init__(CYTHON_UNUSED PyOb
  *         if "max_shape" in dir(self.detector):
  *             self.shape = self.detector.max_shape
  */
-    if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__detector, __pyx_v_detector) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__detector, __pyx_v_detector) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   __pyx_L3:;
 
@@ -8993,13 +9281,14 @@ static PyObject *__pyx_pf_11_distortion_10Distortion___init__(CYTHON_UNUSED PyOb
  *             self.shape = self.detector.max_shape
  *         else:
  */
-  __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__detector); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_1 = PyObject_Dir(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__detector); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
+  __pyx_t_1 = PyObject_Dir(__pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_t_3 = (__Pyx_PySequence_Contains(((PyObject *)__pyx_n_s__max_shape), __pyx_t_1, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+  __pyx_t_4 = (__Pyx_PySequence_Contains(((PyObject *)__pyx_n_s__max_shape), __pyx_t_1, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_3 = (__pyx_t_4 != 0);
   if (__pyx_t_3) {
 
     /* "_distortion.pyx":541
@@ -9009,13 +9298,13 @@ static PyObject *__pyx_pf_11_distortion_10Distortion___init__(CYTHON_UNUSED PyOb
  *         else:
  *             self.shape = shape
  */
-    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__detector); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__detector); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__max_shape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__max_shape); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__shape, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__shape, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     goto __pyx_L4;
   }
   /*else*/ {
@@ -9027,7 +9316,7 @@ static PyObject *__pyx_pf_11_distortion_10Distortion___init__(CYTHON_UNUSED PyOb
  *         self.shape = tuple([int(i) for i in self.shape])
  *         self._sem = threading.Semaphore()
  */
-    if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__shape, __pyx_v_shape) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__shape, __pyx_v_shape) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   __pyx_L4:;
 
@@ -9038,36 +9327,36 @@ static PyObject *__pyx_pf_11_distortion_10Distortion___init__(CYTHON_UNUSED PyOb
  *         self._sem = threading.Semaphore()
  *         self.lut_size = None
  */
-  __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) {
-    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_5 = 0;
-    __pyx_t_6 = NULL;
+    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_6 = 0;
+    __pyx_t_7 = NULL;
   } else {
-    __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_6 = Py_TYPE(__pyx_t_2)->tp_iternext;
+    __pyx_t_7 = Py_TYPE(__pyx_t_2)->tp_iternext;
   }
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   for (;;) {
-    if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_2)) {
-      if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_2)) break;
+    if (!__pyx_t_7 && PyList_CheckExact(__pyx_t_2)) {
+      if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_2)) break;
       #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       #else
-      __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       #endif
-    } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_2)) {
-      if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
+    } else if (!__pyx_t_7 && PyTuple_CheckExact(__pyx_t_2)) {
+      if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
       #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       #else
-      __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       #endif
     } else {
-      __pyx_t_1 = __pyx_t_6(__pyx_t_2);
+      __pyx_t_1 = __pyx_t_7(__pyx_t_2);
       if (unlikely(!__pyx_t_1)) {
         if (PyErr_Occurred()) {
           if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
@@ -9077,25 +9366,24 @@ static PyObject *__pyx_pf_11_distortion_10Distortion___init__(CYTHON_UNUSED PyOb
       }
       __Pyx_GOTREF(__pyx_t_1);
     }
-    __Pyx_XDECREF(__pyx_v_i);
-    __pyx_v_i = __pyx_t_1;
+    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1);
     __pyx_t_1 = 0;
     __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_INCREF(__pyx_v_i);
     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_i);
     __Pyx_GIVEREF(__pyx_v_i);
-    __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_7);
+    __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_8);
     __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-    if (unlikely(__Pyx_PyList_Append(__pyx_t_4, (PyObject*)__pyx_t_7))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+    if (unlikely(__Pyx_ListComp_Append(__pyx_t_5, (PyObject*)__pyx_t_8))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
   }
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = ((PyObject *)PyList_AsTuple(__pyx_t_4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = ((PyObject *)PyList_AsTuple(((PyObject*)__pyx_t_5))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__shape, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__shape, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
 
   /* "_distortion.pyx":545
@@ -9105,15 +9393,15 @@ static PyObject *__pyx_pf_11_distortion_10Distortion___init__(CYTHON_UNUSED PyOb
  *         self.lut_size = None
  *         self.pos = None
  */
-  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__threading); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__threading); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__Semaphore); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
+  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__Semaphore); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___sem, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s___sem, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
   /* "_distortion.pyx":546
@@ -9123,7 +9411,7 @@ static PyObject *__pyx_pf_11_distortion_10Distortion___init__(CYTHON_UNUSED PyOb
  *         self.pos = None
  *         self.LUT = None
  */
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__lut_size, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__lut_size, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   /* "_distortion.pyx":547
  *         self._sem = threading.Semaphore()
@@ -9132,7 +9420,7 @@ static PyObject *__pyx_pf_11_distortion_10Distortion___init__(CYTHON_UNUSED PyOb
  *         self.LUT = None
  *         self.delta0 = self.delta1 = None  # max size of an pixel on a regular grid ...
  */
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__pos, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__pos, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   /* "_distortion.pyx":548
  *         self.lut_size = None
@@ -9141,7 +9429,7 @@ static PyObject *__pyx_pf_11_distortion_10Distortion___init__(CYTHON_UNUSED PyOb
  *         self.delta0 = self.delta1 = None  # max size of an pixel on a regular grid ...
  * 
  */
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__LUT, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__LUT, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   /* "_distortion.pyx":549
  *         self.pos = None
@@ -9150,16 +9438,16 @@ static PyObject *__pyx_pf_11_distortion_10Distortion___init__(CYTHON_UNUSED PyOb
  * 
  * 
  */
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__delta0, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__delta1, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__delta0, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__delta1, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_XDECREF(__pyx_t_4);
-  __Pyx_XDECREF(__pyx_t_7);
+  __Pyx_XDECREF(__pyx_t_5);
+  __Pyx_XDECREF(__pyx_t_8);
   __Pyx_AddTraceback("_distortion.Distortion.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
@@ -9208,12 +9496,12 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_2__repr__(CYTHON_UNUSED PyO
  *     def calc_pos(self):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__linesep); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__linesep); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
@@ -9224,9 +9512,9 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_2__repr__(CYTHON_UNUSED PyO
  *     def calc_pos(self):
  *         if self.pos is None:
  */
-  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__detector); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__detector); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____repr__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s____repr__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -9296,7 +9584,7 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_4calc_pos(CYTHON_UNUSED PyO
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
   int __pyx_t_2;
-  PyObject *__pyx_t_3 = NULL;
+  int __pyx_t_3;
   PyObject *__pyx_t_4 = NULL;
   PyObject *__pyx_t_5 = NULL;
   PyObject *__pyx_t_6 = NULL;
@@ -9306,10 +9594,10 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_4calc_pos(CYTHON_UNUSED PyO
   PyObject *__pyx_t_10 = NULL;
   PyObject *__pyx_t_11 = NULL;
   PyObject *__pyx_t_12 = NULL;
-  PyObject *(*__pyx_t_13)(PyObject *);
-  PyObject *__pyx_t_14 = NULL;
+  PyObject *__pyx_t_13 = NULL;
+  PyObject *(*__pyx_t_14)(PyObject *);
   PyObject *__pyx_t_15 = NULL;
-  int __pyx_t_16;
+  PyObject *__pyx_t_16 = NULL;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -9322,11 +9610,12 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_4calc_pos(CYTHON_UNUSED PyO
  *             with self._sem:
  *                 if self.pos is None:
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = (__pyx_t_1 == Py_None);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (__pyx_t_2) {
+  __pyx_t_3 = (__pyx_t_2 != 0);
+  if (__pyx_t_3) {
 
     /* "_distortion.pyx":557
  *     def calc_pos(self):
@@ -9336,23 +9625,23 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_4calc_pos(CYTHON_UNUSED PyO
  *                     pos_corners = numpy.empty((self.shape[0] + 1, self.shape[1] + 1, 2), dtype=numpy.float64)
  */
     /*with:*/ {
-      __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___sem); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s___sem); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____exit__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____enter__); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s____exit__); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s____enter__); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
       __Pyx_GOTREF(__pyx_t_5);
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+      __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+      __Pyx_GOTREF(__pyx_t_6);
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       /*try:*/ {
         {
-          __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
-          __Pyx_XGOTREF(__pyx_t_6);
+          __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
           __Pyx_XGOTREF(__pyx_t_7);
           __Pyx_XGOTREF(__pyx_t_8);
+          __Pyx_XGOTREF(__pyx_t_9);
           /*try:*/ {
 
             /* "_distortion.pyx":558
@@ -9362,10 +9651,11 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_4calc_pos(CYTHON_UNUSED PyO
  *                     pos_corners = numpy.empty((self.shape[0] + 1, self.shape[1] + 1, 2), dtype=numpy.float64)
  *                     d1 = numpy.outer(numpy.arange(self.shape[0] + 1, dtype=numpy.float64), numpy.ones(self.shape[1] + 1, dtype=numpy.float64)) - 0.5
  */
-            __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+            __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
             __Pyx_GOTREF(__pyx_t_1);
-            __pyx_t_2 = (__pyx_t_1 == Py_None);
+            __pyx_t_3 = (__pyx_t_1 == Py_None);
             __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+            __pyx_t_2 = (__pyx_t_3 != 0);
             if (__pyx_t_2) {
 
               /* "_distortion.pyx":559
@@ -9375,59 +9665,59 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_4calc_pos(CYTHON_UNUSED PyO
  *                     d1 = numpy.outer(numpy.arange(self.shape[0] + 1, dtype=numpy.float64), numpy.ones(self.shape[1] + 1, dtype=numpy.float64)) - 0.5
  *                     d2 = numpy.outer(numpy.ones(self.shape[0] + 1, dtype=numpy.float64), numpy.arange(self.shape[1] + 1, dtype=numpy.float64)) - 0.5
  */
-              __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
               __Pyx_GOTREF(__pyx_t_1);
-              __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_5);
+              __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_6);
               __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-              __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
               __Pyx_GOTREF(__pyx_t_1);
-              __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_4);
+              __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_5);
               __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-              __pyx_t_1 = PyNumber_Add(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __pyx_t_1 = PyNumber_Add(__pyx_t_5, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
               __Pyx_GOTREF(__pyx_t_1);
-              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-              __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_4);
-              __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_4, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_9);
-              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-              __pyx_t_4 = PyNumber_Add(__pyx_t_9, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_4);
-              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-              __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_9);
-              PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_1);
+              __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+              __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_5);
+              __pyx_t_10 = __Pyx_GetItemInt(__pyx_t_5, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_10);
+              __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+              __pyx_t_5 = PyNumber_Add(__pyx_t_10, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_5);
+              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+              __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_10);
+              PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1);
               __Pyx_GIVEREF(__pyx_t_1);
-              PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_4);
-              __Pyx_GIVEREF(__pyx_t_4);
+              PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_5);
+              __Pyx_GIVEREF(__pyx_t_5);
               __Pyx_INCREF(__pyx_int_2);
-              PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_int_2);
+              PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_int_2);
               __Pyx_GIVEREF(__pyx_int_2);
               __pyx_t_1 = 0;
-              __pyx_t_4 = 0;
-              __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_4);
-              PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_9));
-              __Pyx_GIVEREF(((PyObject *)__pyx_t_9));
-              __pyx_t_9 = 0;
-              __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(((PyObject *)__pyx_t_9));
-              __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __pyx_t_5 = 0;
+              __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_5);
+              PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_10));
+              __Pyx_GIVEREF(((PyObject *)__pyx_t_10));
+              __pyx_t_10 = 0;
+              __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(((PyObject *)__pyx_t_10));
+              __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
               __Pyx_GOTREF(__pyx_t_1);
-              __pyx_t_10 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float64); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_10);
+              __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__float64); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_11);
               __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-              if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__dtype), __pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-              __pyx_t_10 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_10);
-              __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-              __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-              __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
-              __pyx_v_pos_corners = __pyx_t_10;
-              __pyx_t_10 = 0;
+              if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__dtype), __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+              __pyx_t_11 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_11);
+              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+              __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+              __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
+              __pyx_v_pos_corners = __pyx_t_11;
+              __pyx_t_11 = 0;
 
               /* "_distortion.pyx":560
  *                 if self.pos is None:
@@ -9436,95 +9726,95 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_4calc_pos(CYTHON_UNUSED PyO
  *                     d2 = numpy.outer(numpy.ones(self.shape[0] + 1, dtype=numpy.float64), numpy.arange(self.shape[1] + 1, dtype=numpy.float64)) - 0.5
  *                     pos_corners[:, :, 0], pos_corners[:, :, 1] = self.detector.calc_cartesian_positions(d1, d2)
  */
-              __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_10);
-              __pyx_t_9 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__outer); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_9);
-              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-              __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_10);
-              __pyx_t_4 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__arange); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_4);
-              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-              __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_10);
-              __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_10, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_5);
-              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-              __pyx_t_10 = PyNumber_Add(__pyx_t_5, __pyx_int_1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_11);
+              __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s__outer); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
               __Pyx_GOTREF(__pyx_t_10);
-              __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-              __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+              __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_11);
+              __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s__arange); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
               __Pyx_GOTREF(__pyx_t_5);
-              PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_10);
-              __Pyx_GIVEREF(__pyx_t_10);
-              __pyx_t_10 = 0;
-              __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(((PyObject *)__pyx_t_10));
-              __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_1);
-              __pyx_t_11 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float64); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+              __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
               __Pyx_GOTREF(__pyx_t_11);
-              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-              if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__dtype), __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_11, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_6);
               __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-              __pyx_t_11 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __pyx_t_11 = PyNumber_Add(__pyx_t_6, __pyx_int_1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
               __Pyx_GOTREF(__pyx_t_11);
-              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-              __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
-              __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
-              __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_10);
-              __pyx_t_5 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__ones); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_5);
-              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-              __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_10);
-              __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_10, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_4);
-              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-              __pyx_t_10 = PyNumber_Add(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_10);
-              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-              __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_4);
-              PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_10);
-              __Pyx_GIVEREF(__pyx_t_10);
-              __pyx_t_10 = 0;
-              __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(((PyObject *)__pyx_t_10));
-              __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+              __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_6);
+              PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_11);
+              __Pyx_GIVEREF(__pyx_t_11);
+              __pyx_t_11 = 0;
+              __pyx_t_11 = PyDict_New(); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(((PyObject *)__pyx_t_11));
+              __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
               __Pyx_GOTREF(__pyx_t_1);
-              __pyx_t_12 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float64); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__float64); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
               __Pyx_GOTREF(__pyx_t_12);
               __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-              if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__dtype), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              if (PyDict_SetItem(__pyx_t_11, ((PyObject *)__pyx_n_s__dtype), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
               __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-              __pyx_t_12 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __pyx_t_12 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_11)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
               __Pyx_GOTREF(__pyx_t_12);
               __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-              __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-              __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
-              __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_10);
-              PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_11);
+              __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+              __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
+              __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_11);
+              __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s__ones); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_6);
+              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+              __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_11);
+              __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_11, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_5);
+              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+              __pyx_t_11 = PyNumber_Add(__pyx_t_5, __pyx_int_1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_11);
+              __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+              __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_5);
+              PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_11);
               __Pyx_GIVEREF(__pyx_t_11);
-              PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_12);
-              __Pyx_GIVEREF(__pyx_t_12);
               __pyx_t_11 = 0;
+              __pyx_t_11 = PyDict_New(); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(((PyObject *)__pyx_t_11));
+              __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_1);
+              __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__float64); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_13);
+              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+              if (PyDict_SetItem(__pyx_t_11, ((PyObject *)__pyx_n_s__dtype), __pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+              __pyx_t_13 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_11)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_13);
+              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+              __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+              __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
+              __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_11);
+              PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_12);
+              __Pyx_GIVEREF(__pyx_t_12);
+              PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_13);
+              __Pyx_GIVEREF(__pyx_t_13);
               __pyx_t_12 = 0;
-              __pyx_t_12 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_12);
-              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-              __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
-              __pyx_t_10 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_10);
-              __pyx_t_9 = PyNumber_Subtract(__pyx_t_12, __pyx_t_10); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_9);
-              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+              __pyx_t_13 = 0;
+              __pyx_t_13 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_13);
               __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-              __pyx_v_d1 = __pyx_t_9;
-              __pyx_t_9 = 0;
+              __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
+              __pyx_t_11 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_11);
+              __pyx_t_10 = PyNumber_Subtract(__pyx_t_13, __pyx_t_11); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_10);
+              __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+              __pyx_v_d1 = __pyx_t_10;
+              __pyx_t_10 = 0;
 
               /* "_distortion.pyx":561
  *                     pos_corners = numpy.empty((self.shape[0] + 1, self.shape[1] + 1, 2), dtype=numpy.float64)
@@ -9533,95 +9823,95 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_4calc_pos(CYTHON_UNUSED PyO
  *                     pos_corners[:, :, 0], pos_corners[:, :, 1] = self.detector.calc_cartesian_positions(d1, d2)
  *                     pos_corners[:, :, 0] /= self.detector.pixel1
  */
-              __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_9);
-              __pyx_t_10 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__outer); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
               __Pyx_GOTREF(__pyx_t_10);
-              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-              __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_9);
-              __pyx_t_12 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__ones); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_12);
-              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-              __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_9);
-              __pyx_t_11 = __Pyx_GetItemInt(__pyx_t_9, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_11) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_11);
-              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-              __pyx_t_9 = PyNumber_Add(__pyx_t_11, __pyx_int_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_9);
-              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-              __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_11);
-              PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9);
-              __Pyx_GIVEREF(__pyx_t_9);
-              __pyx_t_9 = 0;
-              __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(((PyObject *)__pyx_t_9));
-              __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_4);
-              __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__float64); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_5);
-              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-              if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-              __pyx_t_5 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_t_11), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_5);
-              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-              __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
-              __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
-              __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_9);
-              __pyx_t_11 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__arange); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s__outer); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
               __Pyx_GOTREF(__pyx_t_11);
-              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-              __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_9);
-              __pyx_t_12 = __Pyx_GetItemInt(__pyx_t_9, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+              __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_10);
+              __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s__ones); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_13);
+              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+              __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_10);
+              __pyx_t_12 = __Pyx_GetItemInt(__pyx_t_10, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
               __Pyx_GOTREF(__pyx_t_12);
-              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-              __pyx_t_9 = PyNumber_Add(__pyx_t_12, __pyx_int_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_9);
+              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+              __pyx_t_10 = PyNumber_Add(__pyx_t_12, __pyx_int_1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_10);
               __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
               __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
               __Pyx_GOTREF(__pyx_t_12);
-              PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_9);
-              __Pyx_GIVEREF(__pyx_t_9);
-              __pyx_t_9 = 0;
-              __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(((PyObject *)__pyx_t_9));
-              __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_4);
-              __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__float64); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_10);
+              __Pyx_GIVEREF(__pyx_t_10);
+              __pyx_t_10 = 0;
+              __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(((PyObject *)__pyx_t_10));
+              __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_5);
+              __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__float64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_6);
+              __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+              if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+              __pyx_t_6 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_t_12), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_6);
+              __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+              __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
+              __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
+              __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_10);
+              __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s__arange); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_12);
+              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+              __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_10);
+              __pyx_t_13 = __Pyx_GetItemInt(__pyx_t_10, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_13) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_13);
+              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+              __pyx_t_10 = PyNumber_Add(__pyx_t_13, __pyx_int_1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_10);
+              __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+              __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_13);
+              PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_10);
+              __Pyx_GIVEREF(__pyx_t_10);
+              __pyx_t_10 = 0;
+              __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(((PyObject *)__pyx_t_10));
+              __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_5);
+              __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__float64); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
               __Pyx_GOTREF(__pyx_t_1);
-              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-              if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+              if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
               __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-              __pyx_t_1 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_12), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __pyx_t_1 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_t_13), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
               __Pyx_GOTREF(__pyx_t_1);
-              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-              __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
-              __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
-              __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_9);
-              PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_5);
-              __Pyx_GIVEREF(__pyx_t_5);
-              PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_1);
+              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+              __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
+              __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
+              __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_10);
+              PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_6);
+              __Pyx_GIVEREF(__pyx_t_6);
+              PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_1);
               __Pyx_GIVEREF(__pyx_t_1);
-              __pyx_t_5 = 0;
+              __pyx_t_6 = 0;
               __pyx_t_1 = 0;
-              __pyx_t_1 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __pyx_t_1 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
               __Pyx_GOTREF(__pyx_t_1);
-              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-              __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
-              __pyx_t_9 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_9);
-              __pyx_t_10 = PyNumber_Subtract(__pyx_t_1, __pyx_t_9); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+              __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
+              __pyx_t_10 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
               __Pyx_GOTREF(__pyx_t_10);
+              __pyx_t_11 = PyNumber_Subtract(__pyx_t_1, __pyx_t_10); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_11);
               __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-              __pyx_v_d2 = __pyx_t_10;
-              __pyx_t_10 = 0;
+              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+              __pyx_v_d2 = __pyx_t_11;
+              __pyx_t_11 = 0;
 
               /* "_distortion.pyx":562
  *                     d1 = numpy.outer(numpy.arange(self.shape[0] + 1, dtype=numpy.float64), numpy.ones(self.shape[1] + 1, dtype=numpy.float64)) - 0.5
@@ -9630,23 +9920,23 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_4calc_pos(CYTHON_UNUSED PyO
  *                     pos_corners[:, :, 0] /= self.detector.pixel1
  *                     pos_corners[:, :, 1] /= self.detector.pixel2
  */
-              __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__detector); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_10);
-              __pyx_t_9 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s_6); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_9);
-              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-              __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__detector); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_11);
+              __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_6); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
               __Pyx_GOTREF(__pyx_t_10);
+              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+              __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_11);
               __Pyx_INCREF(__pyx_v_d1);
-              PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_d1);
+              PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_d1);
               __Pyx_GIVEREF(__pyx_v_d1);
               __Pyx_INCREF(__pyx_v_d2);
-              PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_d2);
+              PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_v_d2);
               __Pyx_GIVEREF(__pyx_v_d2);
-              __pyx_t_1 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __pyx_t_1 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
               __Pyx_GOTREF(__pyx_t_1);
-              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-              __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
+              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+              __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
               if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
                 PyObject* sequence = __pyx_t_1;
                 #if CYTHON_COMPILING_IN_CPYTHON
@@ -9661,45 +9951,47 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_4calc_pos(CYTHON_UNUSED PyO
                 }
                 #if CYTHON_COMPILING_IN_CPYTHON
                 if (likely(PyTuple_CheckExact(sequence))) {
-                  __pyx_t_10 = PyTuple_GET_ITEM(sequence, 0); 
-                  __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); 
+                  __pyx_t_11 = PyTuple_GET_ITEM(sequence, 0); 
+                  __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1); 
                 } else {
-                  __pyx_t_10 = PyList_GET_ITEM(sequence, 0); 
-                  __pyx_t_9 = PyList_GET_ITEM(sequence, 1); 
+                  __pyx_t_11 = PyList_GET_ITEM(sequence, 0); 
+                  __pyx_t_10 = PyList_GET_ITEM(sequence, 1); 
                 }
+                __Pyx_INCREF(__pyx_t_11);
                 __Pyx_INCREF(__pyx_t_10);
-                __Pyx_INCREF(__pyx_t_9);
                 #else
-                __pyx_t_10 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-                __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+                __pyx_t_11 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+                __Pyx_GOTREF(__pyx_t_11);
+                __pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+                __Pyx_GOTREF(__pyx_t_10);
                 #endif
                 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
               } else
               {
                 Py_ssize_t index = -1;
-                __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-                __Pyx_GOTREF(__pyx_t_5);
+                __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+                __Pyx_GOTREF(__pyx_t_6);
                 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-                __pyx_t_13 = Py_TYPE(__pyx_t_5)->tp_iternext;
-                index = 0; __pyx_t_10 = __pyx_t_13(__pyx_t_5); if (unlikely(!__pyx_t_10)) goto __pyx_L17_unpacking_failed;
+                __pyx_t_14 = Py_TYPE(__pyx_t_6)->tp_iternext;
+                index = 0; __pyx_t_11 = __pyx_t_14(__pyx_t_6); if (unlikely(!__pyx_t_11)) goto __pyx_L17_unpacking_failed;
+                __Pyx_GOTREF(__pyx_t_11);
+                index = 1; __pyx_t_10 = __pyx_t_14(__pyx_t_6); if (unlikely(!__pyx_t_10)) goto __pyx_L17_unpacking_failed;
                 __Pyx_GOTREF(__pyx_t_10);
-                index = 1; __pyx_t_9 = __pyx_t_13(__pyx_t_5); if (unlikely(!__pyx_t_9)) goto __pyx_L17_unpacking_failed;
-                __Pyx_GOTREF(__pyx_t_9);
-                if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-                __pyx_t_13 = NULL;
-                __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+                if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_6), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+                __pyx_t_14 = NULL;
+                __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
                 goto __pyx_L18_unpacking_done;
                 __pyx_L17_unpacking_failed:;
-                __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-                __pyx_t_13 = NULL;
+                __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+                __pyx_t_14 = NULL;
                 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
                 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
                 __pyx_L18_unpacking_done:;
               }
-              if (PyObject_SetItem(__pyx_v_pos_corners, ((PyObject *)__pyx_k_tuple_9), __pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              if (PyObject_SetItem(__pyx_v_pos_corners, ((PyObject *)__pyx_k_tuple_9), __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+              if (PyObject_SetItem(__pyx_v_pos_corners, ((PyObject *)__pyx_k_tuple_12), __pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
               __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-              if (PyObject_SetItem(__pyx_v_pos_corners, ((PyObject *)__pyx_k_tuple_12), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
 
               /* "_distortion.pyx":563
  *                     d2 = numpy.outer(numpy.ones(self.shape[0] + 1, dtype=numpy.float64), numpy.arange(self.shape[1] + 1, dtype=numpy.float64)) - 0.5
@@ -9709,21 +10001,21 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_4calc_pos(CYTHON_UNUSED PyO
  *                     pos = numpy.empty((self.shape[0], self.shape[1], 4, 2), dtype=numpy.float32)
  */
               __Pyx_INCREF(((PyObject *)__pyx_k_tuple_15));
-              __pyx_t_14 = __pyx_k_tuple_15;
-              __pyx_t_1 = PyObject_GetItem(__pyx_v_pos_corners, ((PyObject *)__pyx_t_14)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __pyx_t_15 = __pyx_k_tuple_15;
+              __pyx_t_1 = PyObject_GetItem(__pyx_v_pos_corners, ((PyObject *)__pyx_t_15)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
               __Pyx_GOTREF(__pyx_t_1);
-              __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__detector); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_9);
-              __pyx_t_10 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__pixel1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__detector); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_10);
+              __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s__pixel1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_11);
+              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+              __pyx_t_10 = __Pyx_PyNumber_InPlaceDivide(__pyx_t_1, __pyx_t_11); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
               __Pyx_GOTREF(__pyx_t_10);
-              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-              __pyx_t_9 = __Pyx_PyNumber_InPlaceDivide(__pyx_t_1, __pyx_t_10); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_9);
               __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+              if (PyObject_SetItem(__pyx_v_pos_corners, ((PyObject *)__pyx_t_15), __pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
               __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-              if (PyObject_SetItem(__pyx_v_pos_corners, ((PyObject *)__pyx_t_14), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-              __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0;
+              __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0;
 
               /* "_distortion.pyx":564
  *                     pos_corners[:, :, 0], pos_corners[:, :, 1] = self.detector.calc_cartesian_positions(d1, d2)
@@ -9733,21 +10025,21 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_4calc_pos(CYTHON_UNUSED PyO
  *                     pos[:, :, 0, :] = pos_corners[:-1, :-1]
  */
               __Pyx_INCREF(((PyObject *)__pyx_k_tuple_18));
-              __pyx_t_14 = __pyx_k_tuple_18;
-              __pyx_t_9 = PyObject_GetItem(__pyx_v_pos_corners, ((PyObject *)__pyx_t_14)); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_9);
-              __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__detector); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __pyx_t_15 = __pyx_k_tuple_18;
+              __pyx_t_10 = PyObject_GetItem(__pyx_v_pos_corners, ((PyObject *)__pyx_t_15)); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
               __Pyx_GOTREF(__pyx_t_10);
-              __pyx_t_1 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__pixel2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__detector); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_11);
+              __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s__pixel2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
               __Pyx_GOTREF(__pyx_t_1);
+              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+              __pyx_t_11 = __Pyx_PyNumber_InPlaceDivide(__pyx_t_10, __pyx_t_1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_11);
               __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-              __pyx_t_10 = __Pyx_PyNumber_InPlaceDivide(__pyx_t_9, __pyx_t_1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_10);
-              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
               __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-              if (PyObject_SetItem(__pyx_v_pos_corners, ((PyObject *)__pyx_t_14), __pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-              __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0;
+              if (PyObject_SetItem(__pyx_v_pos_corners, ((PyObject *)__pyx_t_15), __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+              __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0;
 
               /* "_distortion.pyx":565
  *                     pos_corners[:, :, 0] /= self.detector.pixel1
@@ -9756,56 +10048,56 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_4calc_pos(CYTHON_UNUSED PyO
  *                     pos[:, :, 0, :] = pos_corners[:-1, :-1]
  *                     pos[:, :, 1, :] = pos_corners[:-1, 1: ]
  */
-              __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_10);
-              __pyx_t_1 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_11);
+              __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
               __Pyx_GOTREF(__pyx_t_1);
-              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-              __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_10);
-              __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_10, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_9);
-              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-              __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_10);
-              __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_10, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_5);
-              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-              __pyx_t_10 = PyTuple_New(4); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+              __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_11);
+              __pyx_t_10 = __Pyx_GetItemInt(__pyx_t_11, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
               __Pyx_GOTREF(__pyx_t_10);
-              PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9);
-              __Pyx_GIVEREF(__pyx_t_9);
-              PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_5);
-              __Pyx_GIVEREF(__pyx_t_5);
+              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+              __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_11);
+              __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_11, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_6);
+              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+              __pyx_t_11 = PyTuple_New(4); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_11);
+              PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_10);
+              __Pyx_GIVEREF(__pyx_t_10);
+              PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_6);
+              __Pyx_GIVEREF(__pyx_t_6);
               __Pyx_INCREF(__pyx_int_4);
-              PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_int_4);
+              PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_int_4);
               __Pyx_GIVEREF(__pyx_int_4);
               __Pyx_INCREF(__pyx_int_2);
-              PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_int_2);
+              PyTuple_SET_ITEM(__pyx_t_11, 3, __pyx_int_2);
               __Pyx_GIVEREF(__pyx_int_2);
-              __pyx_t_9 = 0;
-              __pyx_t_5 = 0;
-              __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_5);
-              PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_10));
-              __Pyx_GIVEREF(((PyObject *)__pyx_t_10));
               __pyx_t_10 = 0;
-              __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(((PyObject *)__pyx_t_10));
-              __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_9);
-              __pyx_t_12 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__float32); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_12);
-              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-              if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__dtype), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-              __pyx_t_12 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_12);
+              __pyx_t_6 = 0;
+              __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_6);
+              PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_11));
+              __Pyx_GIVEREF(((PyObject *)__pyx_t_11));
+              __pyx_t_11 = 0;
+              __pyx_t_11 = PyDict_New(); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(((PyObject *)__pyx_t_11));
+              __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_10);
+              __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s__float32); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_13);
+              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+              if (PyDict_SetItem(__pyx_t_11, ((PyObject *)__pyx_n_s__dtype), __pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+              __pyx_t_13 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_11)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_13);
               __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-              __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
-              __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
-              __pyx_v_pos = __pyx_t_12;
-              __pyx_t_12 = 0;
+              __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+              __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
+              __pyx_v_pos = __pyx_t_13;
+              __pyx_t_13 = 0;
 
               /* "_distortion.pyx":566
  *                     pos_corners[:, :, 1] /= self.detector.pixel2
@@ -9814,10 +10106,10 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_4calc_pos(CYTHON_UNUSED PyO
  *                     pos[:, :, 1, :] = pos_corners[:-1, 1: ]
  *                     pos[:, :, 2, :] = pos_corners[1: , 1: ]
  */
-              __pyx_t_12 = PyObject_GetItem(__pyx_v_pos_corners, ((PyObject *)__pyx_k_tuple_21)); if (!__pyx_t_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_12);
-              if (PyObject_SetItem(__pyx_v_pos, ((PyObject *)__pyx_k_tuple_25), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+              __pyx_t_13 = PyObject_GetItem(__pyx_v_pos_corners, ((PyObject *)__pyx_k_tuple_21)); if (!__pyx_t_13) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_13);
+              if (PyObject_SetItem(__pyx_v_pos, ((PyObject *)__pyx_k_tuple_25), __pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
 
               /* "_distortion.pyx":567
  *                     pos = numpy.empty((self.shape[0], self.shape[1], 4, 2), dtype=numpy.float32)
@@ -9826,10 +10118,10 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_4calc_pos(CYTHON_UNUSED PyO
  *                     pos[:, :, 2, :] = pos_corners[1: , 1: ]
  *                     pos[:, :, 3, :] = pos_corners[1: , :-1]
  */
-              __pyx_t_12 = PyObject_GetItem(__pyx_v_pos_corners, ((PyObject *)__pyx_k_tuple_28)); if (!__pyx_t_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_12);
-              if (PyObject_SetItem(__pyx_v_pos, ((PyObject *)__pyx_k_tuple_32), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+              __pyx_t_13 = PyObject_GetItem(__pyx_v_pos_corners, ((PyObject *)__pyx_k_tuple_28)); if (!__pyx_t_13) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_13);
+              if (PyObject_SetItem(__pyx_v_pos, ((PyObject *)__pyx_k_tuple_32), __pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
 
               /* "_distortion.pyx":568
  *                     pos[:, :, 0, :] = pos_corners[:-1, :-1]
@@ -9838,10 +10130,10 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_4calc_pos(CYTHON_UNUSED PyO
  *                     pos[:, :, 3, :] = pos_corners[1: , :-1]
  *                     self.pos = pos
  */
-              __pyx_t_12 = PyObject_GetItem(__pyx_v_pos_corners, ((PyObject *)__pyx_k_tuple_35)); if (!__pyx_t_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_12);
-              if (PyObject_SetItem(__pyx_v_pos, ((PyObject *)__pyx_k_tuple_39), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+              __pyx_t_13 = PyObject_GetItem(__pyx_v_pos_corners, ((PyObject *)__pyx_k_tuple_35)); if (!__pyx_t_13) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_13);
+              if (PyObject_SetItem(__pyx_v_pos, ((PyObject *)__pyx_k_tuple_39), __pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
 
               /* "_distortion.pyx":569
  *                     pos[:, :, 1, :] = pos_corners[:-1, 1: ]
@@ -9850,10 +10142,10 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_4calc_pos(CYTHON_UNUSED PyO
  *                     self.pos = pos
  *                     self.delta0 = int((numpy.ceil(pos_corners[1:, :, 0]) - numpy.floor(pos_corners[:-1, :, 0])).max())
  */
-              __pyx_t_12 = PyObject_GetItem(__pyx_v_pos_corners, ((PyObject *)__pyx_k_tuple_42)); if (!__pyx_t_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_12);
-              if (PyObject_SetItem(__pyx_v_pos, ((PyObject *)__pyx_k_tuple_46), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+              __pyx_t_13 = PyObject_GetItem(__pyx_v_pos_corners, ((PyObject *)__pyx_k_tuple_42)); if (!__pyx_t_13) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_13);
+              if (PyObject_SetItem(__pyx_v_pos, ((PyObject *)__pyx_k_tuple_46), __pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
 
               /* "_distortion.pyx":570
  *                     pos[:, :, 2, :] = pos_corners[1: , 1: ]
@@ -9862,7 +10154,7 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_4calc_pos(CYTHON_UNUSED PyO
  *                     self.delta0 = int((numpy.ceil(pos_corners[1:, :, 0]) - numpy.floor(pos_corners[:-1, :, 0])).max())
  *                     self.delta1 = int((numpy.ceil(pos_corners[:, 1:, 1]) - numpy.floor(pos_corners[:, :-1, 1])).max())
  */
-              if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__pos, __pyx_v_pos) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__pos, __pyx_v_pos) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
 
               /* "_distortion.pyx":571
  *                     pos[:, :, 3, :] = pos_corners[1: , :-1]
@@ -9871,57 +10163,57 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_4calc_pos(CYTHON_UNUSED PyO
  *                     self.delta1 = int((numpy.ceil(pos_corners[:, 1:, 1]) - numpy.floor(pos_corners[:, :-1, 1])).max())
  *         return self.pos
  */
-              __pyx_t_12 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_12);
-              __pyx_t_10 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__ceil); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_10);
-              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-              __pyx_t_12 = PyObject_GetItem(__pyx_v_pos_corners, ((PyObject *)__pyx_k_tuple_49)); if (!__pyx_t_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_12);
-              __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_5);
-              PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_12);
-              __Pyx_GIVEREF(__pyx_t_12);
-              __pyx_t_12 = 0;
-              __pyx_t_12 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_12);
-              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-              __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
-              __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_5);
-              __pyx_t_10 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__floor); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_10);
-              __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-              __pyx_t_5 = PyObject_GetItem(__pyx_v_pos_corners, ((PyObject *)__pyx_k_tuple_52)); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_5);
+              __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_13);
+              __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s__ceil); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_11);
+              __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+              __pyx_t_13 = PyObject_GetItem(__pyx_v_pos_corners, ((PyObject *)__pyx_k_tuple_49)); if (!__pyx_t_13) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_13);
+              __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_6);
+              PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_13);
+              __Pyx_GIVEREF(__pyx_t_13);
+              __pyx_t_13 = 0;
+              __pyx_t_13 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_13);
+              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+              __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+              __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_6);
+              __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s__floor); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_11);
+              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+              __pyx_t_6 = PyObject_GetItem(__pyx_v_pos_corners, ((PyObject *)__pyx_k_tuple_52)); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_6);
               __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
               __Pyx_GOTREF(__pyx_t_1);
-              PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5);
-              __Pyx_GIVEREF(__pyx_t_5);
-              __pyx_t_5 = 0;
-              __pyx_t_5 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_5);
-              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+              PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6);
+              __Pyx_GIVEREF(__pyx_t_6);
+              __pyx_t_6 = 0;
+              __pyx_t_6 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_6);
+              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
               __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-              __pyx_t_1 = PyNumber_Subtract(__pyx_t_12, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __pyx_t_1 = PyNumber_Subtract(__pyx_t_13, __pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
               __Pyx_GOTREF(__pyx_t_1);
-              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-              __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-              __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__max); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_5);
+              __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+              __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__max); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_6);
               __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-              __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __pyx_t_1 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
               __Pyx_GOTREF(__pyx_t_1);
-              __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-              __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_5);
-              PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
+              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+              __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L8_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(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
               __Pyx_GOTREF(__pyx_t_1);
-              __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
-              if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__delta0, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+              if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__delta0, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
               __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
               /* "_distortion.pyx":572
@@ -9931,75 +10223,75 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_4calc_pos(CYTHON_UNUSED PyO
  *         return self.pos
  * 
  */
-              __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
               __Pyx_GOTREF(__pyx_t_1);
-              __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__ceil); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_5);
+              __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__ceil); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_6);
               __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
               __pyx_t_1 = PyObject_GetItem(__pyx_v_pos_corners, ((PyObject *)__pyx_k_tuple_55)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
               __Pyx_GOTREF(__pyx_t_1);
-              __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_12);
-              PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_1);
+              __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L8_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 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __pyx_t_1 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
               __Pyx_GOTREF(__pyx_t_1);
-              __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-              __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
-              __pyx_t_12 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_12);
-              __pyx_t_5 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__floor); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_5);
-              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-              __pyx_t_12 = PyObject_GetItem(__pyx_v_pos_corners, ((PyObject *)__pyx_k_tuple_58)); if (!__pyx_t_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_12);
-              __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_10);
-              PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_12);
-              __Pyx_GIVEREF(__pyx_t_12);
-              __pyx_t_12 = 0;
-              __pyx_t_12 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_12);
-              __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-              __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
-              __pyx_t_10 = PyNumber_Subtract(__pyx_t_1, __pyx_t_12); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_10);
+              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+              __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
+              __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_13);
+              __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s__floor); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_6);
+              __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+              __pyx_t_13 = PyObject_GetItem(__pyx_v_pos_corners, ((PyObject *)__pyx_k_tuple_58)); if (!__pyx_t_13) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_13);
+              __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_11);
+              PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_13);
+              __Pyx_GIVEREF(__pyx_t_13);
+              __pyx_t_13 = 0;
+              __pyx_t_13 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_13);
+              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+              __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
+              __pyx_t_11 = PyNumber_Subtract(__pyx_t_1, __pyx_t_13); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_11);
               __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-              __pyx_t_12 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__max); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_12);
-              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-              __pyx_t_10 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_10);
-              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-              __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_12);
-              PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_10);
-              __Pyx_GIVEREF(__pyx_t_10);
-              __pyx_t_10 = 0;
-              __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_10);
-              __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
-              if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__delta1, __pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+              __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+              __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s__max); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_13);
+              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+              __pyx_t_11 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_11);
+              __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 = 572; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_13);
+              PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_11);
+              __Pyx_GIVEREF(__pyx_t_11);
+              __pyx_t_11 = 0;
+              __pyx_t_11 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_11);
+              __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
+              if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__delta1, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
               goto __pyx_L16;
             }
             __pyx_L16:;
           }
-          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
           __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
           __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
           goto __pyx_L15_try_end;
           __pyx_L8_error:;
-          __Pyx_XDECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0;
-          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
-          __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
-          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
           __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
-          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
           __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
           __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
+          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+          __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
+          __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
+          __Pyx_XDECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0;
 
           /* "_distortion.pyx":557
  *     def calc_pos(self):
@@ -10010,73 +10302,73 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_4calc_pos(CYTHON_UNUSED PyO
  */
           /*except:*/ {
             __Pyx_AddTraceback("_distortion.Distortion.calc_pos", __pyx_clineno, __pyx_lineno, __pyx_filename);
-            if (__Pyx_GetException(&__pyx_t_10, &__pyx_t_12, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
-            __Pyx_GOTREF(__pyx_t_10);
-            __Pyx_GOTREF(__pyx_t_12);
+            if (__Pyx_GetException(&__pyx_t_11, &__pyx_t_13, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
+            __Pyx_GOTREF(__pyx_t_11);
+            __Pyx_GOTREF(__pyx_t_13);
             __Pyx_GOTREF(__pyx_t_1);
-            __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
-            __Pyx_GOTREF(__pyx_t_5);
-            __Pyx_INCREF(__pyx_t_10);
-            PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_10);
-            __Pyx_GIVEREF(__pyx_t_10);
-            __Pyx_INCREF(__pyx_t_12);
-            PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_12);
-            __Pyx_GIVEREF(__pyx_t_12);
+            __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
+            __Pyx_GOTREF(__pyx_t_6);
+            __Pyx_INCREF(__pyx_t_11);
+            PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_11);
+            __Pyx_GIVEREF(__pyx_t_11);
+            __Pyx_INCREF(__pyx_t_13);
+            PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_13);
+            __Pyx_GIVEREF(__pyx_t_13);
             __Pyx_INCREF(__pyx_t_1);
-            PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_1);
+            PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_1);
             __Pyx_GIVEREF(__pyx_t_1);
-            __pyx_t_15 = PyObject_Call(__pyx_t_3, __pyx_t_5, NULL);
-            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-            if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
-            __Pyx_GOTREF(__pyx_t_15);
-            __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_15);
-            __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
-            if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
-            __pyx_t_16 = (!__pyx_t_2);
-            if (__pyx_t_16) {
-              __Pyx_GIVEREF(__pyx_t_10);
-              __Pyx_GIVEREF(__pyx_t_12);
+            __pyx_t_16 = PyObject_Call(__pyx_t_4, __pyx_t_6, NULL);
+            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+            if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
+            __Pyx_GOTREF(__pyx_t_16);
+            __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_16);
+            __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+            if (__pyx_t_2 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
+            __pyx_t_3 = ((!(__pyx_t_2 != 0)) != 0);
+            if (__pyx_t_3) {
+              __Pyx_GIVEREF(__pyx_t_11);
+              __Pyx_GIVEREF(__pyx_t_13);
               __Pyx_GIVEREF(__pyx_t_1);
-              __Pyx_ErrRestore(__pyx_t_10, __pyx_t_12, __pyx_t_1);
-              __pyx_t_10 = 0; __pyx_t_12 = 0; __pyx_t_1 = 0; 
+              __Pyx_ErrRestore(__pyx_t_11, __pyx_t_13, __pyx_t_1);
+              __pyx_t_11 = 0; __pyx_t_13 = 0; __pyx_t_1 = 0; 
               {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
               goto __pyx_L21;
             }
             __pyx_L21:;
-            __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
-            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+            __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
             __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
             goto __pyx_L9_exception_handled;
           }
           __pyx_L10_except_error:;
-          __Pyx_XGIVEREF(__pyx_t_6);
           __Pyx_XGIVEREF(__pyx_t_7);
           __Pyx_XGIVEREF(__pyx_t_8);
-          __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
+          __Pyx_XGIVEREF(__pyx_t_9);
+          __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
           goto __pyx_L1_error;
           __pyx_L9_exception_handled:;
-          __Pyx_XGIVEREF(__pyx_t_6);
           __Pyx_XGIVEREF(__pyx_t_7);
           __Pyx_XGIVEREF(__pyx_t_8);
-          __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
+          __Pyx_XGIVEREF(__pyx_t_9);
+          __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
           __pyx_L15_try_end:;
         }
       }
       /*finally:*/ {
-        if (__pyx_t_3) {
-          __pyx_t_8 = PyObject_Call(__pyx_t_3, __pyx_k_tuple_59, NULL);
-          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-          if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_8);
-          __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_8);
-          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-          if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        if (__pyx_t_4) {
+          __pyx_t_9 = PyObject_Call(__pyx_t_4, __pyx_k_tuple_59, NULL);
+          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+          if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_9);
+          __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_9);
+          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+          if (__pyx_t_3 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         }
       }
       goto __pyx_L22;
       __pyx_L4_error:;
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
       goto __pyx_L1_error;
       __pyx_L22:;
     }
@@ -10092,7 +10384,7 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_4calc_pos(CYTHON_UNUSED PyO
  *     @cython.wraparound(False)
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -10102,13 +10394,13 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_4calc_pos(CYTHON_UNUSED PyO
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_5);
-  __Pyx_XDECREF(__pyx_t_9);
+  __Pyx_XDECREF(__pyx_t_6);
   __Pyx_XDECREF(__pyx_t_10);
   __Pyx_XDECREF(__pyx_t_11);
   __Pyx_XDECREF(__pyx_t_12);
-  __Pyx_XDECREF(((PyObject *)__pyx_t_14));
+  __Pyx_XDECREF(__pyx_t_13);
+  __Pyx_XDECREF(((PyObject *)__pyx_t_15));
   __Pyx_AddTraceback("_distortion.Distortion.calc_pos", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
@@ -10163,24 +10455,24 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_6calc_LUT_size(CYTHON_UNUSE
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
   int __pyx_t_2;
-  PyObject *__pyx_t_3 = NULL;
-  PyArrayObject *__pyx_t_4 = NULL;
-  int __pyx_t_5;
-  PyObject *__pyx_t_6 = NULL;
+  int __pyx_t_3;
+  PyObject *__pyx_t_4 = NULL;
+  PyArrayObject *__pyx_t_5 = NULL;
+  int __pyx_t_6;
   PyObject *__pyx_t_7 = NULL;
   PyObject *__pyx_t_8 = NULL;
   PyObject *__pyx_t_9 = NULL;
   PyObject *__pyx_t_10 = NULL;
   PyObject *__pyx_t_11 = NULL;
-  PyObject *(*__pyx_t_12)(PyObject *);
-  int __pyx_t_13;
-  __Pyx_memviewslice __pyx_t_14 = { 0, 0, { 0 }, { 0 }, { 0 } };
-  PyObject *__pyx_t_15 = NULL;
-  PyArrayObject *__pyx_t_16 = NULL;
-  PyObject *__pyx_t_17 = NULL;
+  PyObject *__pyx_t_12 = NULL;
+  PyObject *(*__pyx_t_13)(PyObject *);
+  int __pyx_t_14;
+  __Pyx_memviewslice __pyx_t_15 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  PyObject *__pyx_t_16 = NULL;
+  PyArrayObject *__pyx_t_17 = NULL;
   PyObject *__pyx_t_18 = NULL;
   PyObject *__pyx_t_19 = NULL;
-  int __pyx_t_20;
+  PyObject *__pyx_t_20 = NULL;
   int __pyx_t_21;
   int __pyx_t_22;
   int __pyx_t_23;
@@ -10217,11 +10509,12 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_6calc_LUT_size(CYTHON_UNUSE
  *             pos = self.calc_pos()
  *         else:
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = (__pyx_t_1 == Py_None);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (__pyx_t_2) {
+  __pyx_t_3 = (__pyx_t_2 != 0);
+  if (__pyx_t_3) {
 
     /* "_distortion.pyx":592
  *         cdef numpy.ndarray[numpy.int32_t, ndim = 2] lut_size
@@ -10230,32 +10523,32 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_6calc_LUT_size(CYTHON_UNUSE
  *         else:
  *             pos = self.pos
  */
-    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__calc_pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__calc_pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_4 = ((PyArrayObject *)__pyx_t_3);
+    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = ((PyArrayObject *)__pyx_t_4);
     {
       __Pyx_BufFmt_StackElem __pyx_stack[1];
       __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos.rcbuffer->pybuffer);
-      __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pos.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack);
-      if (unlikely(__pyx_t_5 < 0)) {
-        PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
+      __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pos.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack);
+      if (unlikely(__pyx_t_6 < 0)) {
+        PyErr_Fetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
         if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pos.rcbuffer->pybuffer, (PyObject*)__pyx_v_pos, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) {
-          Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
+          Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9);
           __Pyx_RaiseBufferFallbackError();
         } else {
-          PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
+          PyErr_Restore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
         }
       }
       __pyx_pybuffernd_pos.diminfo[0].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pos.diminfo[0].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pos.diminfo[1].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pos.diminfo[1].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_pos.diminfo[2].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_pos.dim [...]
-      if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
+    __pyx_t_5 = 0;
+    __pyx_v_pos = ((PyArrayObject *)__pyx_t_4);
     __pyx_t_4 = 0;
-    __pyx_v_pos = ((PyArrayObject *)__pyx_t_3);
-    __pyx_t_3 = 0;
     goto __pyx_L3;
   }
   /*else*/ {
@@ -10267,29 +10560,29 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_6calc_LUT_size(CYTHON_UNUSE
  *         if self.lut_size is None:
  *             with self._sem:
  */
-    __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pos); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_4 = ((PyArrayObject *)__pyx_t_3);
+    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__pos); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = ((PyArrayObject *)__pyx_t_4);
     {
       __Pyx_BufFmt_StackElem __pyx_stack[1];
       __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos.rcbuffer->pybuffer);
-      __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pos.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack);
-      if (unlikely(__pyx_t_5 < 0)) {
-        PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
+      __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pos.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack);
+      if (unlikely(__pyx_t_6 < 0)) {
+        PyErr_Fetch(&__pyx_t_9, &__pyx_t_8, &__pyx_t_7);
         if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pos.rcbuffer->pybuffer, (PyObject*)__pyx_v_pos, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) {
-          Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6);
+          Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7);
           __Pyx_RaiseBufferFallbackError();
         } else {
-          PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6);
+          PyErr_Restore(__pyx_t_9, __pyx_t_8, __pyx_t_7);
         }
       }
       __pyx_pybuffernd_pos.diminfo[0].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pos.diminfo[0].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pos.diminfo[1].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pos.diminfo[1].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_pos.diminfo[2].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_pos.dim [...]
-      if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
+    __pyx_t_5 = 0;
+    __pyx_v_pos = ((PyArrayObject *)__pyx_t_4);
     __pyx_t_4 = 0;
-    __pyx_v_pos = ((PyArrayObject *)__pyx_t_3);
-    __pyx_t_3 = 0;
   }
   __pyx_L3:;
 
@@ -10300,10 +10593,11 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_6calc_LUT_size(CYTHON_UNUSE
  *             with self._sem:
  *                 if self.lut_size is None:
  */
-  __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__lut_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_2 = (__pyx_t_3 == Py_None);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__lut_size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
+  __pyx_t_3 = (__pyx_t_4 == Py_None);
+  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __pyx_t_2 = (__pyx_t_3 != 0);
   if (__pyx_t_2) {
 
     /* "_distortion.pyx":596
@@ -10314,23 +10608,23 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_6calc_LUT_size(CYTHON_UNUSE
  *                     shape0, shape1 = self.shape
  */
     /*with:*/ {
-      __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___sem); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_6 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s____exit__); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_6);
-      __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s____enter__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
+      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s___sem); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_4);
+      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s____exit__); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_7);
+      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s____enter__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
       __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_9 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
-      __Pyx_GOTREF(__pyx_t_9);
+      __pyx_t_10 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
+      __Pyx_GOTREF(__pyx_t_10);
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
       /*try:*/ {
         {
-          __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_10);
-          __Pyx_XGOTREF(__pyx_t_7);
+          __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_9, &__pyx_t_11);
           __Pyx_XGOTREF(__pyx_t_8);
-          __Pyx_XGOTREF(__pyx_t_10);
+          __Pyx_XGOTREF(__pyx_t_9);
+          __Pyx_XGOTREF(__pyx_t_11);
           /*try:*/ {
 
             /* "_distortion.pyx":597
@@ -10340,11 +10634,12 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_6calc_LUT_size(CYTHON_UNUSE
  *                     shape0, shape1 = self.shape
  *                     pos0min = numpy.floor(pos[:, :, :, 0].min(axis= -1)).astype(numpy.int32).clip(0, self.shape[0])
  */
-            __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__lut_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-            __Pyx_GOTREF(__pyx_t_3);
-            __pyx_t_2 = (__pyx_t_3 == Py_None);
-            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-            if (__pyx_t_2) {
+            __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__lut_size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+            __Pyx_GOTREF(__pyx_t_4);
+            __pyx_t_2 = (__pyx_t_4 == Py_None);
+            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+            __pyx_t_3 = (__pyx_t_2 != 0);
+            if (__pyx_t_3) {
 
               /* "_distortion.pyx":598
  *             with self._sem:
@@ -10353,10 +10648,10 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_6calc_LUT_size(CYTHON_UNUSE
  *                     pos0min = numpy.floor(pos[:, :, :, 0].min(axis= -1)).astype(numpy.int32).clip(0, self.shape[0])
  *                     pos1min = numpy.floor(pos[:, :, :, 1].min(axis= -1)).astype(numpy.int32).clip(0, self.shape[1])
  */
-              __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_3);
-              if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
-                PyObject* sequence = __pyx_t_3;
+              __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_4);
+              if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
+                PyObject* sequence = __pyx_t_4;
                 #if CYTHON_COMPILING_IN_CPYTHON
                 Py_ssize_t size = Py_SIZE(sequence);
                 #else
@@ -10369,47 +10664,49 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_6calc_LUT_size(CYTHON_UNUSE
                 }
                 #if CYTHON_COMPILING_IN_CPYTHON
                 if (likely(PyTuple_CheckExact(sequence))) {
-                  __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); 
+                  __pyx_t_10 = PyTuple_GET_ITEM(sequence, 0); 
                   __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
                 } else {
-                  __pyx_t_9 = PyList_GET_ITEM(sequence, 0); 
+                  __pyx_t_10 = PyList_GET_ITEM(sequence, 0); 
                   __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
                 }
-                __Pyx_INCREF(__pyx_t_9);
+                __Pyx_INCREF(__pyx_t_10);
                 __Pyx_INCREF(__pyx_t_1);
                 #else
-                __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+                __pyx_t_10 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+                __Pyx_GOTREF(__pyx_t_10);
                 __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+                __Pyx_GOTREF(__pyx_t_1);
                 #endif
-                __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+                __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
               } else
               {
                 Py_ssize_t index = -1;
-                __pyx_t_11 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-                __Pyx_GOTREF(__pyx_t_11);
-                __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-                __pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext;
-                index = 0; __pyx_t_9 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_9)) goto __pyx_L18_unpacking_failed;
-                __Pyx_GOTREF(__pyx_t_9);
-                index = 1; __pyx_t_1 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_1)) goto __pyx_L18_unpacking_failed;
+                __pyx_t_12 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+                __Pyx_GOTREF(__pyx_t_12);
+                __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+                __pyx_t_13 = Py_TYPE(__pyx_t_12)->tp_iternext;
+                index = 0; __pyx_t_10 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_10)) goto __pyx_L18_unpacking_failed;
+                __Pyx_GOTREF(__pyx_t_10);
+                index = 1; __pyx_t_1 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_1)) goto __pyx_L18_unpacking_failed;
                 __Pyx_GOTREF(__pyx_t_1);
-                if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-                __pyx_t_12 = NULL;
-                __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+                if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_12), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+                __pyx_t_13 = NULL;
+                __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
                 goto __pyx_L19_unpacking_done;
                 __pyx_L18_unpacking_failed:;
-                __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-                __pyx_t_12 = NULL;
+                __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+                __pyx_t_13 = NULL;
                 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
                 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
                 __pyx_L19_unpacking_done:;
               }
-              __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_9); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-              __pyx_t_13 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_10); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+              __pyx_t_14 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
               __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-              __pyx_v_shape0 = __pyx_t_5;
-              __pyx_v_shape1 = __pyx_t_13;
+              __pyx_v_shape0 = __pyx_t_6;
+              __pyx_v_shape1 = __pyx_t_14;
 
               /* "_distortion.pyx":599
  *                 if self.lut_size is None:
@@ -10418,75 +10715,75 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_6calc_LUT_size(CYTHON_UNUSE
  *                     pos1min = numpy.floor(pos[:, :, :, 1].min(axis= -1)).astype(numpy.int32).clip(0, self.shape[1])
  *                     pos0max = (numpy.ceil(pos[:, :, :, 0].max(axis= -1)).astype(numpy.int32) + 1).clip(0, self.shape[0])
  */
-              __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_3);
-              __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__floor); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_4);
+              __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__floor); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
               __Pyx_GOTREF(__pyx_t_1);
-              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-              __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_pos), ((PyObject *)__pyx_k_tuple_63)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_3);
-              __pyx_t_9 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__min); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_9);
-              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-              __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-              if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__axis), __pyx_int_neg_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __pyx_t_11 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_11);
-              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-              __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-              __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_3);
-              PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_11);
-              __Pyx_GIVEREF(__pyx_t_11);
-              __pyx_t_11 = 0;
-              __pyx_t_11 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_11);
+              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+              __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_pos), ((PyObject *)__pyx_k_tuple_63)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_4);
+              __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__min); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_10);
+              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+              __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+              if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__axis), __pyx_int_neg_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __pyx_t_12 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_12);
+              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+              __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+              __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_4);
+              PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_12);
+              __Pyx_GIVEREF(__pyx_t_12);
+              __pyx_t_12 = 0;
+              __pyx_t_12 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_12);
               __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-              __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-              __pyx_t_3 = PyObject_GetAttr(__pyx_t_11, __pyx_n_s__astype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_3);
-              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-              __pyx_t_11 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_11);
-              __pyx_t_1 = PyObject_GetAttr(__pyx_t_11, __pyx_n_s__int32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+              __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s__astype); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_4);
+              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+              __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_12);
+              __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s__int32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
               __Pyx_GOTREF(__pyx_t_1);
-              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-              __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_11);
-              PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_1);
+              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+              __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_12);
+              PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_1);
               __Pyx_GIVEREF(__pyx_t_1);
               __pyx_t_1 = 0;
-              __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
               __Pyx_GOTREF(__pyx_t_1);
-              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-              __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
-              __pyx_t_11 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__clip); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_11);
+              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+              __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
+              __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__clip); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_12);
               __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-              __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
               __Pyx_GOTREF(__pyx_t_1);
-              __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_3);
+              __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_4);
               __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
               __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
               __Pyx_GOTREF(__pyx_t_1);
               __Pyx_INCREF(__pyx_int_0);
               PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_int_0);
               __Pyx_GIVEREF(__pyx_int_0);
-              PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
-              __Pyx_GIVEREF(__pyx_t_3);
-              __pyx_t_3 = 0;
-              __pyx_t_3 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_3);
-              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+              PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4);
+              __Pyx_GIVEREF(__pyx_t_4);
+              __pyx_t_4 = 0;
+              __pyx_t_4 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_4);
+              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
               __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-              __pyx_t_14 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(__pyx_t_3);
-              if (unlikely(!__pyx_t_14.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-              __pyx_v_pos0min = __pyx_t_14;
-              __pyx_t_14.memview = NULL;
-              __pyx_t_14.data = NULL;
+              __pyx_t_15 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(__pyx_t_4);
+              if (unlikely(!__pyx_t_15.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+              __pyx_v_pos0min = __pyx_t_15;
+              __pyx_t_15.memview = NULL;
+              __pyx_t_15.data = NULL;
 
               /* "_distortion.pyx":600
  *                     shape0, shape1 = self.shape
@@ -10495,75 +10792,75 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_6calc_LUT_size(CYTHON_UNUSE
  *                     pos0max = (numpy.ceil(pos[:, :, :, 0].max(axis= -1)).astype(numpy.int32) + 1).clip(0, self.shape[0])
  *                     pos1max = (numpy.ceil(pos[:, :, :, 1].max(axis= -1)).astype(numpy.int32) + 1).clip(0, self.shape[1])
  */
-              __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_3);
-              __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__floor); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_4);
+              __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__floor); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
               __Pyx_GOTREF(__pyx_t_1);
-              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-              __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_pos), ((PyObject *)__pyx_k_tuple_67)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_3);
-              __pyx_t_11 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__min); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_11);
-              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-              __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-              if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__axis), __pyx_int_neg_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __pyx_t_9 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_9);
-              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-              __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-              __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_3);
-              PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_9);
-              __Pyx_GIVEREF(__pyx_t_9);
-              __pyx_t_9 = 0;
-              __pyx_t_9 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_9);
+              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+              __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_pos), ((PyObject *)__pyx_k_tuple_67)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_4);
+              __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__min); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_12);
+              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+              __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+              if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__axis), __pyx_int_neg_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __pyx_t_10 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_10);
+              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+              __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+              __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_4);
+              PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_10);
+              __Pyx_GIVEREF(__pyx_t_10);
+              __pyx_t_10 = 0;
+              __pyx_t_10 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_10);
               __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-              __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-              __pyx_t_3 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__astype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_3);
-              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-              __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_9);
-              __pyx_t_1 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__int32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+              __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s__astype); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_4);
+              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+              __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_10);
+              __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s__int32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
               __Pyx_GOTREF(__pyx_t_1);
-              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-              __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_9);
-              PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_1);
+              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+              __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_10);
+              PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1);
               __Pyx_GIVEREF(__pyx_t_1);
               __pyx_t_1 = 0;
-              __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
               __Pyx_GOTREF(__pyx_t_1);
-              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-              __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
-              __pyx_t_9 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__clip); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_9);
+              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+              __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
+              __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__clip); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_10);
               __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-              __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
               __Pyx_GOTREF(__pyx_t_1);
-              __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_3);
+              __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, 1, sizeof(long), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_4);
               __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
               __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
               __Pyx_GOTREF(__pyx_t_1);
               __Pyx_INCREF(__pyx_int_0);
               PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_int_0);
               __Pyx_GIVEREF(__pyx_int_0);
-              PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
-              __Pyx_GIVEREF(__pyx_t_3);
-              __pyx_t_3 = 0;
-              __pyx_t_3 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_3);
-              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+              PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4);
+              __Pyx_GIVEREF(__pyx_t_4);
+              __pyx_t_4 = 0;
+              __pyx_t_4 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_4);
+              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
               __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-              __pyx_t_14 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(__pyx_t_3);
-              if (unlikely(!__pyx_t_14.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-              __pyx_v_pos1min = __pyx_t_14;
-              __pyx_t_14.memview = NULL;
-              __pyx_t_14.data = NULL;
+              __pyx_t_15 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(__pyx_t_4);
+              if (unlikely(!__pyx_t_15.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+              __pyx_v_pos1min = __pyx_t_15;
+              __pyx_t_15.memview = NULL;
+              __pyx_t_15.data = NULL;
 
               /* "_distortion.pyx":601
  *                     pos0min = numpy.floor(pos[:, :, :, 0].min(axis= -1)).astype(numpy.int32).clip(0, self.shape[0])
@@ -10572,78 +10869,78 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_6calc_LUT_size(CYTHON_UNUSE
  *                     pos1max = (numpy.ceil(pos[:, :, :, 1].max(axis= -1)).astype(numpy.int32) + 1).clip(0, self.shape[1])
  *                     lut_size = numpy.zeros(self.shape, dtype=numpy.int32)
  */
-              __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_3);
-              __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__ceil); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_4);
+              __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__ceil); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
               __Pyx_GOTREF(__pyx_t_1);
-              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-              __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_pos), ((PyObject *)__pyx_k_tuple_71)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_3);
-              __pyx_t_9 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__max); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_9);
-              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-              __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-              if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__axis), __pyx_int_neg_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __pyx_t_11 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_11);
-              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-              __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-              __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_3);
-              PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_11);
-              __Pyx_GIVEREF(__pyx_t_11);
-              __pyx_t_11 = 0;
-              __pyx_t_11 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_11);
+              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+              __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_pos), ((PyObject *)__pyx_k_tuple_71)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_4);
+              __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__max); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_10);
+              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+              __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+              if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__axis), __pyx_int_neg_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __pyx_t_12 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_12);
+              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+              __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+              __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_4);
+              PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_12);
+              __Pyx_GIVEREF(__pyx_t_12);
+              __pyx_t_12 = 0;
+              __pyx_t_12 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_12);
               __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-              __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-              __pyx_t_3 = PyObject_GetAttr(__pyx_t_11, __pyx_n_s__astype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_3);
-              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-              __pyx_t_11 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_11);
-              __pyx_t_1 = PyObject_GetAttr(__pyx_t_11, __pyx_n_s__int32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+              __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s__astype); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_4);
+              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+              __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_12);
+              __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s__int32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
               __Pyx_GOTREF(__pyx_t_1);
-              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-              __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_11);
-              PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_1);
+              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+              __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_12);
+              PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_1);
               __Pyx_GIVEREF(__pyx_t_1);
               __pyx_t_1 = 0;
-              __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
               __Pyx_GOTREF(__pyx_t_1);
-              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-              __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
-              __pyx_t_11 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_11);
+              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+              __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
+              __pyx_t_12 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_12);
               __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-              __pyx_t_1 = PyObject_GetAttr(__pyx_t_11, __pyx_n_s__clip); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s__clip); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
               __Pyx_GOTREF(__pyx_t_1);
-              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-              __pyx_t_11 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_11);
-              __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_11, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_3);
-              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-              __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_11);
+              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+              __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_12);
+              __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_12, 0, sizeof(long), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_4);
+              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+              __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_12);
               __Pyx_INCREF(__pyx_int_0);
-              PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_int_0);
+              PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_int_0);
               __Pyx_GIVEREF(__pyx_int_0);
-              PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_3);
-              __Pyx_GIVEREF(__pyx_t_3);
-              __pyx_t_3 = 0;
-              __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_3);
+              PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_4);
+              __Pyx_GIVEREF(__pyx_t_4);
+              __pyx_t_4 = 0;
+              __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_4);
               __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-              __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
-              __pyx_t_14 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(__pyx_t_3);
-              if (unlikely(!__pyx_t_14.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-              __pyx_v_pos0max = __pyx_t_14;
-              __pyx_t_14.memview = NULL;
-              __pyx_t_14.data = NULL;
+              __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
+              __pyx_t_15 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(__pyx_t_4);
+              if (unlikely(!__pyx_t_15.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+              __pyx_v_pos0max = __pyx_t_15;
+              __pyx_t_15.memview = NULL;
+              __pyx_t_15.data = NULL;
 
               /* "_distortion.pyx":602
  *                     pos1min = numpy.floor(pos[:, :, :, 1].min(axis= -1)).astype(numpy.int32).clip(0, self.shape[1])
@@ -10652,133 +10949,133 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_6calc_LUT_size(CYTHON_UNUSE
  *                     lut_size = numpy.zeros(self.shape, dtype=numpy.int32)
  *                     with nogil:
  */
-              __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_3);
-              __pyx_t_11 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__ceil); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_11);
-              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-              __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_pos), ((PyObject *)__pyx_k_tuple_75)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_3);
-              __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__max); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_4);
+              __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__ceil); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_12);
+              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+              __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_pos), ((PyObject *)__pyx_k_tuple_75)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_4);
+              __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__max); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
               __Pyx_GOTREF(__pyx_t_1);
-              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-              __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-              if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__axis), __pyx_int_neg_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __pyx_t_9 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_9);
+              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+              __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+              if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__axis), __pyx_int_neg_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __pyx_t_10 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_10);
               __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-              __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-              __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_3);
-              PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_9);
-              __Pyx_GIVEREF(__pyx_t_9);
-              __pyx_t_9 = 0;
-              __pyx_t_9 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_9);
-              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-              __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-              __pyx_t_3 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__astype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_3);
-              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-              __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_9);
-              __pyx_t_11 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__int32); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_11);
-              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-              __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_9);
-              PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_11);
-              __Pyx_GIVEREF(__pyx_t_11);
-              __pyx_t_11 = 0;
-              __pyx_t_11 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_11);
-              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-              __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
-              __pyx_t_9 = PyNumber_Add(__pyx_t_11, __pyx_int_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_9);
-              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-              __pyx_t_11 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__clip); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_11);
-              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-              __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_9);
-              __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_9, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_3);
-              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-              __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_9);
+              __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+              __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_4);
+              PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_10);
+              __Pyx_GIVEREF(__pyx_t_10);
+              __pyx_t_10 = 0;
+              __pyx_t_10 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_10);
+              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+              __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+              __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s__astype); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_4);
+              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+              __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_10);
+              __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s__int32); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_12);
+              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+              __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_10);
+              PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_12);
+              __Pyx_GIVEREF(__pyx_t_12);
+              __pyx_t_12 = 0;
+              __pyx_t_12 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_12);
+              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+              __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
+              __pyx_t_10 = PyNumber_Add(__pyx_t_12, __pyx_int_1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_10);
+              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+              __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s__clip); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_12);
+              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+              __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_10);
+              __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_10, 1, sizeof(long), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_4);
+              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+              __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_10);
               __Pyx_INCREF(__pyx_int_0);
-              PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_int_0);
+              PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_int_0);
               __Pyx_GIVEREF(__pyx_int_0);
-              PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_3);
-              __Pyx_GIVEREF(__pyx_t_3);
-              __pyx_t_3 = 0;
-              __pyx_t_3 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_3);
-              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-              __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
-              __pyx_t_14 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(__pyx_t_3);
-              if (unlikely(!__pyx_t_14.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-              __pyx_v_pos1max = __pyx_t_14;
-              __pyx_t_14.memview = NULL;
-              __pyx_t_14.data = NULL;
-
-              /* "_distortion.pyx":603
- *                     pos0max = (numpy.ceil(pos[:, :, :, 0].max(axis= -1)).astype(numpy.int32) + 1).clip(0, self.shape[0])
+              PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_4);
+              __Pyx_GIVEREF(__pyx_t_4);
+              __pyx_t_4 = 0;
+              __pyx_t_4 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_4);
+              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+              __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
+              __pyx_t_15 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(__pyx_t_4);
+              if (unlikely(!__pyx_t_15.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+              __pyx_v_pos1max = __pyx_t_15;
+              __pyx_t_15.memview = NULL;
+              __pyx_t_15.data = NULL;
+
+              /* "_distortion.pyx":603
+ *                     pos0max = (numpy.ceil(pos[:, :, :, 0].max(axis= -1)).astype(numpy.int32) + 1).clip(0, self.shape[0])
  *                     pos1max = (numpy.ceil(pos[:, :, :, 1].max(axis= -1)).astype(numpy.int32) + 1).clip(0, self.shape[1])
  *                     lut_size = numpy.zeros(self.shape, dtype=numpy.int32)             # <<<<<<<<<<<<<<
  *                     with nogil:
  *                         for i in range(shape0):
  */
-              __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_3);
-              __pyx_t_9 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__zeros); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_9);
-              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-              __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_3);
-              __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_11);
-              PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3);
-              __Pyx_GIVEREF(__pyx_t_3);
-              __pyx_t_3 = 0;
-              __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-              __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_4);
+              __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__zeros); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_10);
+              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+              __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_4);
+              __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_12);
+              PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_4);
+              __Pyx_GIVEREF(__pyx_t_4);
+              __pyx_t_4 = 0;
+              __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+              __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
               __Pyx_GOTREF(__pyx_t_1);
-              __pyx_t_15 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__int32); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_15);
+              __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__int32); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_16);
               __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-              if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_15) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
-              __pyx_t_15 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_11), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_15);
-              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-              __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
-              __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-              if (!(likely(((__pyx_t_15) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_15, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __pyx_t_16 = ((PyArrayObject *)__pyx_t_15);
+              if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_16) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+              __pyx_t_16 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_12), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_16);
+              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+              __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
+              __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+              if (!(likely(((__pyx_t_16) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_16, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __pyx_t_17 = ((PyArrayObject *)__pyx_t_16);
               {
                 __Pyx_BufFmt_StackElem __pyx_stack[1];
                 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lut_size.rcbuffer->pybuffer);
-                __pyx_t_13 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lut_size.rcbuffer->pybuffer, (PyObject*)__pyx_t_16, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
-                if (unlikely(__pyx_t_13 < 0)) {
-                  PyErr_Fetch(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19);
+                __pyx_t_14 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lut_size.rcbuffer->pybuffer, (PyObject*)__pyx_t_17, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
+                if (unlikely(__pyx_t_14 < 0)) {
+                  PyErr_Fetch(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20);
                   if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lut_size.rcbuffer->pybuffer, (PyObject*)__pyx_v_lut_size, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
-                    Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_18); Py_XDECREF(__pyx_t_19);
+                    Py_XDECREF(__pyx_t_18); Py_XDECREF(__pyx_t_19); Py_XDECREF(__pyx_t_20);
                     __Pyx_RaiseBufferFallbackError();
                   } else {
-                    PyErr_Restore(__pyx_t_17, __pyx_t_18, __pyx_t_19);
+                    PyErr_Restore(__pyx_t_18, __pyx_t_19, __pyx_t_20);
                   }
                 }
                 __pyx_pybuffernd_lut_size.diminfo[0].strides = __pyx_pybuffernd_lut_size.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lut_size.diminfo[0].shape = __pyx_pybuffernd_lut_size.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_lut_size.diminfo[1].strides = __pyx_pybuffernd_lut_size.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_lut_size.diminfo[1].shape = __pyx_pybuffernd_lut_size.rcbuffer->pybuffer.shape[1];
-                if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+                if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
               }
+              __pyx_t_17 = 0;
+              __pyx_v_lut_size = ((PyArrayObject *)__pyx_t_16);
               __pyx_t_16 = 0;
-              __pyx_v_lut_size = ((PyArrayObject *)__pyx_t_15);
-              __pyx_t_15 = 0;
 
               /* "_distortion.pyx":604
  *                     pos1max = (numpy.ceil(pos[:, :, :, 1].max(axis= -1)).astype(numpy.int32) + 1).clip(0, self.shape[1])
@@ -10789,9 +11086,9 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_6calc_LUT_size(CYTHON_UNUSE
  */
               {
                   #ifdef WITH_THREAD
-                  PyThreadState *_save = NULL;
-                  #endif
+                  PyThreadState *_save;
                   Py_UNBLOCK_THREADS
+                  #endif
                   /*try:*/ {
 
                     /* "_distortion.pyx":605
@@ -10801,9 +11098,9 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_6calc_LUT_size(CYTHON_UNUSE
  *                             for j in range(shape1):
  *                                 for k in range(pos0min[i, j],pos0max[i, j]):
  */
-                    __pyx_t_13 = __pyx_v_shape0;
-                    for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_13; __pyx_t_5+=1) {
-                      __pyx_v_i = __pyx_t_5;
+                    __pyx_t_14 = __pyx_v_shape0;
+                    for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_14; __pyx_t_6+=1) {
+                      __pyx_v_i = __pyx_t_6;
 
                       /* "_distortion.pyx":606
  *                     with nogil:
@@ -10812,9 +11109,9 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_6calc_LUT_size(CYTHON_UNUSE
  *                                 for k in range(pos0min[i, j],pos0max[i, j]):
  *                                     for l in range(pos1min[i, j],pos1max[i, j]):
  */
-                      __pyx_t_20 = __pyx_v_shape1;
-                      for (__pyx_t_21 = 0; __pyx_t_21 < __pyx_t_20; __pyx_t_21+=1) {
-                        __pyx_v_j = __pyx_t_21;
+                      __pyx_t_21 = __pyx_v_shape1;
+                      for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) {
+                        __pyx_v_j = __pyx_t_22;
 
                         /* "_distortion.pyx":607
  *                         for i in range(shape0):
@@ -10823,13 +11120,13 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_6calc_LUT_size(CYTHON_UNUSE
  *                                     for l in range(pos1min[i, j],pos1max[i, j]):
  *                                         lut_size[k,l] += 1
  */
-                        __pyx_t_22 = __pyx_v_i;
-                        __pyx_t_23 = __pyx_v_j;
-                        __pyx_t_24 = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pos0max.data + __pyx_t_22 * __pyx_v_pos0max.strides[0]) ) + __pyx_t_23 * __pyx_v_pos0max.strides[1]) )));
-                        __pyx_t_25 = __pyx_v_i;
-                        __pyx_t_26 = __pyx_v_j;
-                        for (__pyx_t_27 = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pos0min.data + __pyx_t_25 * __pyx_v_pos0min.strides[0]) ) + __pyx_t_26 * __pyx_v_pos0min.strides[1]) ))); __pyx_t_27 < __pyx_t_24; __pyx_t_27+=1) {
-                          __pyx_v_k = __pyx_t_27;
+                        __pyx_t_23 = __pyx_v_i;
+                        __pyx_t_24 = __pyx_v_j;
+                        __pyx_t_25 = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pos0max.data + __pyx_t_23 * __pyx_v_pos0max.strides[0]) ) + __pyx_t_24 * __pyx_v_pos0max.strides[1]) )));
+                        __pyx_t_26 = __pyx_v_i;
+                        __pyx_t_27 = __pyx_v_j;
+                        for (__pyx_t_28 = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pos0min.data + __pyx_t_26 * __pyx_v_pos0min.strides[0]) ) + __pyx_t_27 * __pyx_v_pos0min.strides[1]) ))); __pyx_t_28 < __pyx_t_25; __pyx_t_28+=1) {
+                          __pyx_v_k = __pyx_t_28;
 
                           /* "_distortion.pyx":608
  *                             for j in range(shape1):
@@ -10838,13 +11135,13 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_6calc_LUT_size(CYTHON_UNUSE
  *                                         lut_size[k,l] += 1
  *                     self.lut_size = lut_size.max()
  */
-                          __pyx_t_28 = __pyx_v_i;
-                          __pyx_t_29 = __pyx_v_j;
-                          __pyx_t_30 = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pos1max.data + __pyx_t_28 * __pyx_v_pos1max.strides[0]) ) + __pyx_t_29 * __pyx_v_pos1max.strides[1]) )));
-                          __pyx_t_31 = __pyx_v_i;
-                          __pyx_t_32 = __pyx_v_j;
-                          for (__pyx_t_33 = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pos1min.data + __pyx_t_31 * __pyx_v_pos1min.strides[0]) ) + __pyx_t_32 * __pyx_v_pos1min.strides[1]) ))); __pyx_t_33 < __pyx_t_30; __pyx_t_33+=1) {
-                            __pyx_v_l = __pyx_t_33;
+                          __pyx_t_29 = __pyx_v_i;
+                          __pyx_t_30 = __pyx_v_j;
+                          __pyx_t_31 = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pos1max.data + __pyx_t_29 * __pyx_v_pos1max.strides[0]) ) + __pyx_t_30 * __pyx_v_pos1max.strides[1]) )));
+                          __pyx_t_32 = __pyx_v_i;
+                          __pyx_t_33 = __pyx_v_j;
+                          for (__pyx_t_34 = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pos1min.data + __pyx_t_32 * __pyx_v_pos1min.strides[0]) ) + __pyx_t_33 * __pyx_v_pos1min.strides[1]) ))); __pyx_t_34 < __pyx_t_31; __pyx_t_34+=1) {
+                            __pyx_v_l = __pyx_t_34;
 
                             /* "_distortion.pyx":609
  *                                 for k in range(pos0min[i, j],pos0max[i, j]):
@@ -10853,9 +11150,9 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_6calc_LUT_size(CYTHON_UNUSE
  *                     self.lut_size = lut_size.max()
  *                     return lut_size
  */
-                            __pyx_t_34 = __pyx_v_k;
-                            __pyx_t_35 = __pyx_v_l;
-                            *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_lut_size.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_lut_size.diminfo[0].strides, __pyx_t_35, __pyx_pybuffernd_lut_size.diminfo[1].strides) += 1;
+                            __pyx_t_35 = __pyx_v_k;
+                            __pyx_t_36 = __pyx_v_l;
+                            *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_lut_size.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_lut_size.diminfo[0].strides, __pyx_t_36, __pyx_pybuffernd_lut_size.diminfo[1].strides) += 1;
                           }
                         }
                       }
@@ -10870,7 +11167,9 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_6calc_LUT_size(CYTHON_UNUSE
  *                             for j in range(shape1):
  */
                   /*finally:*/ {
+                    #ifdef WITH_THREAD
                     Py_BLOCK_THREADS
+                    #endif
                   }
               }
 
@@ -10881,13 +11180,13 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_6calc_LUT_size(CYTHON_UNUSE
  *                     return lut_size
  * 
  */
-              __pyx_t_15 = PyObject_GetAttr(((PyObject *)__pyx_v_lut_size), __pyx_n_s__max); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_15);
-              __pyx_t_3 = PyObject_Call(__pyx_t_15, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_GOTREF(__pyx_t_3);
-              __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
-              if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__lut_size, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
-              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+              __pyx_t_16 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_lut_size), __pyx_n_s__max); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_16);
+              __pyx_t_4 = PyObject_Call(__pyx_t_16, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_GOTREF(__pyx_t_4);
+              __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+              if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__lut_size, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
+              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
               /* "_distortion.pyx":611
  *                                         lut_size[k,l] += 1
@@ -10904,23 +11203,23 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_6calc_LUT_size(CYTHON_UNUSE
             }
             __pyx_L17:;
           }
-          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
           __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
-          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
+          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
+          __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
           goto __pyx_L16_try_end;
           __pyx_L13_try_return:;
-          __Pyx_XGIVEREF(__pyx_t_7);
           __Pyx_XGIVEREF(__pyx_t_8);
-          __Pyx_XGIVEREF(__pyx_t_10);
-          __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_10);
+          __Pyx_XGIVEREF(__pyx_t_9);
+          __Pyx_XGIVEREF(__pyx_t_11);
+          __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_11);
           goto __pyx_L6;
           __pyx_L9_error:;
           __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
-          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
-          __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
-          __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
-          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
-          __PYX_XDEC_MEMVIEW(&__pyx_t_14, 1);
+          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
+          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
+          __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
+          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+          __PYX_XDEC_MEMVIEW(&__pyx_t_15, 1);
 
           /* "_distortion.pyx":596
  *             pos = self.pos
@@ -10931,56 +11230,56 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_6calc_LUT_size(CYTHON_UNUSE
  */
           /*except:*/ {
             __Pyx_AddTraceback("_distortion.Distortion.calc_LUT_size", __pyx_clineno, __pyx_lineno, __pyx_filename);
-            if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_15, &__pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;}
-            __Pyx_GOTREF(__pyx_t_3);
-            __Pyx_GOTREF(__pyx_t_15);
-            __Pyx_GOTREF(__pyx_t_11);
-            __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;}
-            __Pyx_GOTREF(__pyx_t_9);
-            __Pyx_INCREF(__pyx_t_3);
-            PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_3);
-            __Pyx_GIVEREF(__pyx_t_3);
-            __Pyx_INCREF(__pyx_t_15);
-            PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_15);
-            __Pyx_GIVEREF(__pyx_t_15);
-            __Pyx_INCREF(__pyx_t_11);
-            PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_11);
-            __Pyx_GIVEREF(__pyx_t_11);
-            __pyx_t_19 = PyObject_Call(__pyx_t_6, __pyx_t_9, NULL);
-            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-            if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;}
-            __Pyx_GOTREF(__pyx_t_19);
-            __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_19);
-            __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
-            if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;}
-            __pyx_t_36 = (!__pyx_t_2);
-            if (__pyx_t_36) {
-              __Pyx_GIVEREF(__pyx_t_3);
-              __Pyx_GIVEREF(__pyx_t_15);
-              __Pyx_GIVEREF(__pyx_t_11);
-              __Pyx_ErrRestore(__pyx_t_3, __pyx_t_15, __pyx_t_11);
-              __pyx_t_3 = 0; __pyx_t_15 = 0; __pyx_t_11 = 0; 
+            if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_16, &__pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;}
+            __Pyx_GOTREF(__pyx_t_4);
+            __Pyx_GOTREF(__pyx_t_16);
+            __Pyx_GOTREF(__pyx_t_12);
+            __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;}
+            __Pyx_GOTREF(__pyx_t_10);
+            __Pyx_INCREF(__pyx_t_4);
+            PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_4);
+            __Pyx_GIVEREF(__pyx_t_4);
+            __Pyx_INCREF(__pyx_t_16);
+            PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_16);
+            __Pyx_GIVEREF(__pyx_t_16);
+            __Pyx_INCREF(__pyx_t_12);
+            PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_12);
+            __Pyx_GIVEREF(__pyx_t_12);
+            __pyx_t_20 = PyObject_Call(__pyx_t_7, __pyx_t_10, NULL);
+            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+            if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;}
+            __Pyx_GOTREF(__pyx_t_20);
+            __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_20);
+            __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
+            if (__pyx_t_3 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;}
+            __pyx_t_2 = ((!(__pyx_t_3 != 0)) != 0);
+            if (__pyx_t_2) {
+              __Pyx_GIVEREF(__pyx_t_4);
+              __Pyx_GIVEREF(__pyx_t_16);
+              __Pyx_GIVEREF(__pyx_t_12);
+              __Pyx_ErrRestore(__pyx_t_4, __pyx_t_16, __pyx_t_12);
+              __pyx_t_4 = 0; __pyx_t_16 = 0; __pyx_t_12 = 0; 
               {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;}
               goto __pyx_L35;
             }
             __pyx_L35:;
-            __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
-            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-            __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
-            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+            __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
+            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+            __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
             goto __pyx_L10_exception_handled;
           }
           __pyx_L11_except_error:;
-          __Pyx_XGIVEREF(__pyx_t_7);
           __Pyx_XGIVEREF(__pyx_t_8);
-          __Pyx_XGIVEREF(__pyx_t_10);
-          __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_10);
+          __Pyx_XGIVEREF(__pyx_t_9);
+          __Pyx_XGIVEREF(__pyx_t_11);
+          __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_11);
           goto __pyx_L1_error;
           __pyx_L10_exception_handled:;
-          __Pyx_XGIVEREF(__pyx_t_7);
           __Pyx_XGIVEREF(__pyx_t_8);
-          __Pyx_XGIVEREF(__pyx_t_10);
-          __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_10);
+          __Pyx_XGIVEREF(__pyx_t_9);
+          __Pyx_XGIVEREF(__pyx_t_11);
+          __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_11);
           __pyx_L16_try_end:;
         }
       }
@@ -10989,14 +11288,14 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_6calc_LUT_size(CYTHON_UNUSE
         __pyx_why = 0; goto __pyx_L8;
         __pyx_L6: __pyx_why = 3; goto __pyx_L8;
         __pyx_L8:;
-        if (__pyx_t_6) {
-          __pyx_t_10 = PyObject_Call(__pyx_t_6, __pyx_k_tuple_76, NULL);
-          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-          if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_10);
-          __pyx_t_36 = __Pyx_PyObject_IsTrue(__pyx_t_10);
-          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-          if (unlikely(__pyx_t_36 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        if (__pyx_t_7) {
+          __pyx_t_11 = PyObject_Call(__pyx_t_7, __pyx_k_tuple_76, NULL);
+          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+          if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_11);
+          __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_11);
+          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+          if (__pyx_t_2 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         }
         switch (__pyx_why) {
           case 3: goto __pyx_L0;
@@ -11004,7 +11303,7 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_6calc_LUT_size(CYTHON_UNUSE
       }
       goto __pyx_L36;
       __pyx_L5_error:;
-      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       goto __pyx_L1_error;
       __pyx_L36:;
     }
@@ -11016,11 +11315,11 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_6calc_LUT_size(CYTHON_UNUSE
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_XDECREF(__pyx_t_9);
-  __Pyx_XDECREF(__pyx_t_11);
-  __PYX_XDEC_MEMVIEW(&__pyx_t_14, 1);
-  __Pyx_XDECREF(__pyx_t_15);
+  __Pyx_XDECREF(__pyx_t_4);
+  __Pyx_XDECREF(__pyx_t_10);
+  __Pyx_XDECREF(__pyx_t_12);
+  __PYX_XDEC_MEMVIEW(&__pyx_t_15, 1);
+  __Pyx_XDECREF(__pyx_t_16);
   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lut_size.rcbuffer->pybuffer);
@@ -11119,57 +11418,57 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_8calc_LUT(CYTHON_UNUSED PyO
   int __pyx_t_8;
   int __pyx_t_9;
   int __pyx_t_10;
-  PyObject *__pyx_t_11 = NULL;
+  int __pyx_t_11;
   PyObject *__pyx_t_12 = NULL;
   PyObject *__pyx_t_13 = NULL;
   PyObject *__pyx_t_14 = NULL;
-  __Pyx_memviewslice __pyx_t_15 = { 0, 0, { 0 }, { 0 }, { 0 } };
-  PyObject *__pyx_t_16 = NULL;
-  PyArrayObject *__pyx_t_17 = NULL;
-  PyObject *__pyx_t_18 = NULL;
+  PyObject *__pyx_t_15 = NULL;
+  __Pyx_memviewslice __pyx_t_16 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  PyObject *__pyx_t_17 = NULL;
+  PyArrayObject *__pyx_t_18 = NULL;
   PyObject *__pyx_t_19 = NULL;
   PyObject *__pyx_t_20 = NULL;
-  long __pyx_t_21;
+  PyObject *__pyx_t_21 = NULL;
   long __pyx_t_22;
   long __pyx_t_23;
-  __Pyx_memviewslice __pyx_t_24 = { 0, 0, { 0 }, { 0 }, { 0 } };
-  int __pyx_t_25;
+  long __pyx_t_24;
+  __Pyx_memviewslice __pyx_t_25 = { 0, 0, { 0 }, { 0 }, { 0 } };
   int __pyx_t_26;
-  Py_ssize_t __pyx_t_27;
+  int __pyx_t_27;
   Py_ssize_t __pyx_t_28;
-  int __pyx_t_29;
+  Py_ssize_t __pyx_t_29;
   int __pyx_t_30;
-  Py_ssize_t __pyx_t_31;
+  int __pyx_t_31;
   Py_ssize_t __pyx_t_32;
-  int __pyx_t_33;
+  Py_ssize_t __pyx_t_33;
   int __pyx_t_34;
-  Py_ssize_t __pyx_t_35;
+  int __pyx_t_35;
   Py_ssize_t __pyx_t_36;
-  int __pyx_t_37;
+  Py_ssize_t __pyx_t_37;
   int __pyx_t_38;
-  Py_ssize_t __pyx_t_39;
+  int __pyx_t_39;
   Py_ssize_t __pyx_t_40;
-  int __pyx_t_41;
+  Py_ssize_t __pyx_t_41;
   int __pyx_t_42;
-  Py_ssize_t __pyx_t_43;
+  int __pyx_t_43;
   Py_ssize_t __pyx_t_44;
-  int __pyx_t_45;
+  Py_ssize_t __pyx_t_45;
   int __pyx_t_46;
-  Py_ssize_t __pyx_t_47;
+  int __pyx_t_47;
   Py_ssize_t __pyx_t_48;
-  int __pyx_t_49;
+  Py_ssize_t __pyx_t_49;
   int __pyx_t_50;
-  Py_ssize_t __pyx_t_51;
+  int __pyx_t_51;
   Py_ssize_t __pyx_t_52;
-  int __pyx_t_53;
+  Py_ssize_t __pyx_t_53;
   int __pyx_t_54;
-  Py_ssize_t __pyx_t_55;
+  int __pyx_t_55;
   Py_ssize_t __pyx_t_56;
-  int __pyx_t_57;
+  Py_ssize_t __pyx_t_57;
   int __pyx_t_58;
-  Py_ssize_t __pyx_t_59;
+  int __pyx_t_59;
   Py_ssize_t __pyx_t_60;
-  int __pyx_t_61;
+  Py_ssize_t __pyx_t_61;
   int __pyx_t_62;
   int __pyx_t_63;
   int __pyx_t_64;
@@ -11216,12 +11515,12 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_8calc_LUT(CYTHON_UNUSED PyO
  *         cdef  float[:,:] buffer
  *         #cdef float[:,:,:] pos
  */
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
@@ -11230,9 +11529,9 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_8calc_LUT(CYTHON_UNUSED PyO
   __pyx_t_1 = 0;
   __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__int32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -11263,7 +11562,7 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_8calc_LUT(CYTHON_UNUSED PyO
  * 
  *         if self.lut_size is None:
  */
-  __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
   if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
     PyObject* sequence = __pyx_t_5;
@@ -11289,7 +11588,9 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_8calc_LUT(CYTHON_UNUSED PyO
     __Pyx_INCREF(__pyx_t_3);
     #else
     __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
     __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
     #endif
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
   } else
@@ -11328,11 +11629,12 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_8calc_LUT(CYTHON_UNUSED PyO
  *             self.calc_LUT_size()
  *         if self.LUT is None:
  */
-  __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__lut_size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__lut_size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
   __pyx_t_10 = (__pyx_t_5 == Py_None);
   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  if (__pyx_t_10) {
+  __pyx_t_11 = (__pyx_t_10 != 0);
+  if (__pyx_t_11) {
 
     /* "_distortion.pyx":630
  * 
@@ -11341,7 +11643,7 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_8calc_LUT(CYTHON_UNUSED PyO
  *         if self.LUT is None:
  *             with self._sem:
  */
-    __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__calc_LUT_size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__calc_LUT_size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __pyx_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
@@ -11358,10 +11660,11 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_8calc_LUT(CYTHON_UNUSED PyO
  *             with self._sem:
  *                 if self.LUT is None:
  */
-  __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__LUT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__LUT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_10 = (__pyx_t_3 == Py_None);
+  __pyx_t_11 = (__pyx_t_3 == Py_None);
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_10 = (__pyx_t_11 != 0);
   if (__pyx_t_10) {
 
     /* "_distortion.pyx":632
@@ -11372,11 +11675,11 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_8calc_LUT(CYTHON_UNUSED PyO
  *                     pos = self.pos#.reshape(shape0,shape1,4*sizeof(float))
  */
     /*with:*/ {
-      __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___sem); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s___sem); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_11 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s____exit__); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_11);
-      __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s____enter__); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s____exit__); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_12);
+      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s____enter__); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
       __Pyx_GOTREF(__pyx_t_5);
       __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
       __Pyx_GOTREF(__pyx_t_1);
@@ -11385,10 +11688,10 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_8calc_LUT(CYTHON_UNUSED PyO
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
       /*try:*/ {
         {
-          __Pyx_ExceptionSave(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
-          __Pyx_XGOTREF(__pyx_t_12);
+          __Pyx_ExceptionSave(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
           __Pyx_XGOTREF(__pyx_t_13);
           __Pyx_XGOTREF(__pyx_t_14);
+          __Pyx_XGOTREF(__pyx_t_15);
           /*try:*/ {
 
             /* "_distortion.pyx":633
@@ -11398,11 +11701,12 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_8calc_LUT(CYTHON_UNUSED PyO
  *                     pos = self.pos#.reshape(shape0,shape1,4*sizeof(float))
  *                     lut = numpy.recarray(shape=(self.shape[0] , self.shape[1], self.lut_size), dtype=[("idx", numpy.int32), ("coef", numpy.float32)])
  */
-            __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__LUT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+            __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__LUT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
             __Pyx_GOTREF(__pyx_t_3);
             __pyx_t_10 = (__pyx_t_3 == Py_None);
             __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-            if (__pyx_t_10) {
+            __pyx_t_11 = (__pyx_t_10 != 0);
+            if (__pyx_t_11) {
 
               /* "_distortion.pyx":634
  *             with self._sem:
@@ -11411,14 +11715,14 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_8calc_LUT(CYTHON_UNUSED PyO
  *                     lut = numpy.recarray(shape=(self.shape[0] , self.shape[1], self.lut_size), dtype=[("idx", numpy.int32), ("coef", numpy.float32)])
  *                     size = self.shape[0]*self.shape[1]*self.lut_size*sizeof(lut_point)
  */
-              __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pos); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+              __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__pos); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
               __Pyx_GOTREF(__pyx_t_3);
-              __pyx_t_15 = __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_float(__pyx_t_3);
-              if (unlikely(!__pyx_t_15.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+              __pyx_t_16 = __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_float(__pyx_t_3);
+              if (unlikely(!__pyx_t_16.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
               __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-              __pyx_v_pos = __pyx_t_15;
-              __pyx_t_15.memview = NULL;
-              __pyx_t_15.data = NULL;
+              __pyx_v_pos = __pyx_t_16;
+              __pyx_t_16.memview = NULL;
+              __pyx_t_16.data = NULL;
 
               /* "_distortion.pyx":635
  *                 if self.LUT is None:
@@ -11427,54 +11731,54 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_8calc_LUT(CYTHON_UNUSED PyO
  *                     size = self.shape[0]*self.shape[1]*self.lut_size*sizeof(lut_point)
  *                     memset(&lut[0,0,0], 0, size)
  */
-              __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+              __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
               __Pyx_GOTREF(__pyx_t_3);
-              __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__recarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+              __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__recarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
               __Pyx_GOTREF(__pyx_t_1);
               __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
               __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
               __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-              __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+              __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
               __Pyx_GOTREF(__pyx_t_5);
-              __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_5, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+              __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_5, 0, sizeof(long), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
               __Pyx_GOTREF(__pyx_t_2);
               __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-              __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+              __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
               __Pyx_GOTREF(__pyx_t_5);
-              __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_5, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+              __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_5, 1, sizeof(long), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
               __Pyx_GOTREF(__pyx_t_4);
               __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-              __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__lut_size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+              __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__lut_size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
               __Pyx_GOTREF(__pyx_t_5);
-              __pyx_t_16 = PyTuple_New(3); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
-              __Pyx_GOTREF(__pyx_t_16);
-              PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_2);
+              __pyx_t_17 = PyTuple_New(3); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+              __Pyx_GOTREF(__pyx_t_17);
+              PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_2);
               __Pyx_GIVEREF(__pyx_t_2);
-              PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_4);
+              PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_4);
               __Pyx_GIVEREF(__pyx_t_4);
-              PyTuple_SET_ITEM(__pyx_t_16, 2, __pyx_t_5);
+              PyTuple_SET_ITEM(__pyx_t_17, 2, __pyx_t_5);
               __Pyx_GIVEREF(__pyx_t_5);
               __pyx_t_2 = 0;
               __pyx_t_4 = 0;
               __pyx_t_5 = 0;
-              if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__shape), ((PyObject *)__pyx_t_16)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
-              __Pyx_DECREF(((PyObject *)__pyx_t_16)); __pyx_t_16 = 0;
-              __pyx_t_16 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
-              __Pyx_GOTREF(__pyx_t_16);
-              __pyx_t_5 = PyObject_GetAttr(__pyx_t_16, __pyx_n_s__int32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+              if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__shape), ((PyObject *)__pyx_t_17)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+              __Pyx_DECREF(((PyObject *)__pyx_t_17)); __pyx_t_17 = 0;
+              __pyx_t_17 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+              __Pyx_GOTREF(__pyx_t_17);
+              __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_17, __pyx_n_s__int32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
               __Pyx_GOTREF(__pyx_t_5);
-              __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
-              __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
-              __Pyx_GOTREF(__pyx_t_16);
+              __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
+              __pyx_t_17 = PyTuple_New(2); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+              __Pyx_GOTREF(__pyx_t_17);
               __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
-              PyTuple_SET_ITEM(__pyx_t_16, 0, ((PyObject *)__pyx_n_s__idx));
+              PyTuple_SET_ITEM(__pyx_t_17, 0, ((PyObject *)__pyx_n_s__idx));
               __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx));
-              PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_5);
+              PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_5);
               __Pyx_GIVEREF(__pyx_t_5);
               __pyx_t_5 = 0;
-              __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+              __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
               __Pyx_GOTREF(__pyx_t_5);
-              __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__float32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+              __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__float32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
               __Pyx_GOTREF(__pyx_t_4);
               __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
               __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
@@ -11487,11 +11791,11 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_8calc_LUT(CYTHON_UNUSED PyO
               __pyx_t_4 = 0;
               __pyx_t_4 = PyList_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
               __Pyx_GOTREF(__pyx_t_4);
-              PyList_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_16));
-              __Pyx_GIVEREF(((PyObject *)__pyx_t_16));
+              PyList_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_17));
+              __Pyx_GIVEREF(((PyObject *)__pyx_t_17));
               PyList_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_t_5));
               __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
-              __pyx_t_16 = 0;
+              __pyx_t_17 = 0;
               __pyx_t_5 = 0;
               if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_t_4)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
               __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
@@ -11500,24 +11804,24 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_8calc_LUT(CYTHON_UNUSED PyO
               __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
               __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
               if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
-              __pyx_t_17 = ((PyArrayObject *)__pyx_t_4);
+              __pyx_t_18 = ((PyArrayObject *)__pyx_t_4);
               {
                 __Pyx_BufFmt_StackElem __pyx_stack[2];
                 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lut.rcbuffer->pybuffer);
-                __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lut.rcbuffer->pybuffer, (PyObject*)__pyx_t_17, &__Pyx_TypeInfo_nn_struct___pyx_t_11_distortion_lut_point, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack);
+                __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lut.rcbuffer->pybuffer, (PyObject*)__pyx_t_18, &__Pyx_TypeInfo_nn_struct___pyx_t_11_distortion_lut_point, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack);
                 if (unlikely(__pyx_t_9 < 0)) {
-                  PyErr_Fetch(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20);
+                  PyErr_Fetch(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21);
                   if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lut.rcbuffer->pybuffer, (PyObject*)__pyx_v_lut, &__Pyx_TypeInfo_nn_struct___pyx_t_11_distortion_lut_point, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {
-                    Py_XDECREF(__pyx_t_18); Py_XDECREF(__pyx_t_19); Py_XDECREF(__pyx_t_20);
+                    Py_XDECREF(__pyx_t_19); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21);
                     __Pyx_RaiseBufferFallbackError();
                   } else {
-                    PyErr_Restore(__pyx_t_18, __pyx_t_19, __pyx_t_20);
+                    PyErr_Restore(__pyx_t_19, __pyx_t_20, __pyx_t_21);
                   }
                 }
                 __pyx_pybuffernd_lut.diminfo[0].strides = __pyx_pybuffernd_lut.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lut.diminfo[0].shape = __pyx_pybuffernd_lut.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_lut.diminfo[1].strides = __pyx_pybuffernd_lut.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_lut.diminfo[1].shape = __pyx_pybuffernd_lut.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_lut.diminfo[2].strides = __pyx_pybuffernd_lut.rcbuffer->pybuffer.strides[2]; __pyx_pybuffer [...]
                 if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
               }
-              __pyx_t_17 = 0;
+              __pyx_t_18 = 0;
               __pyx_v_lut = ((PyArrayObject *)__pyx_t_4);
               __pyx_t_4 = 0;
 
@@ -11528,21 +11832,21 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_8calc_LUT(CYTHON_UNUSED PyO
  *                     memset(&lut[0,0,0], 0, size)
  *                     logger.info("LUT shape: (%i,%i,%i) %.3f MByte"%(lut.shape[0], lut.shape[1],lut.shape[2],size/1.0e6))
  */
-              __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+              __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
               __Pyx_GOTREF(__pyx_t_4);
-              __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_4, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+              __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_4, 0, sizeof(long), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
               __Pyx_GOTREF(__pyx_t_3);
               __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-              __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+              __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
               __Pyx_GOTREF(__pyx_t_4);
-              __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_4, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+              __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_4, 1, sizeof(long), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
               __Pyx_GOTREF(__pyx_t_1);
               __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
               __pyx_t_4 = PyNumber_Multiply(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
               __Pyx_GOTREF(__pyx_t_4);
               __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
               __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-              __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__lut_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+              __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__lut_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
               __Pyx_GOTREF(__pyx_t_1);
               __pyx_t_3 = PyNumber_Multiply(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
               __Pyx_GOTREF(__pyx_t_3);
@@ -11565,10 +11869,10 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_8calc_LUT(CYTHON_UNUSED PyO
  *                     logger.info("LUT shape: (%i,%i,%i) %.3f MByte"%(lut.shape[0], lut.shape[1],lut.shape[2],size/1.0e6))
  *                     buffer = numpy.empty((self.delta0, self.delta1),dtype=numpy.float32)
  */
-              __pyx_t_21 = 0;
               __pyx_t_22 = 0;
               __pyx_t_23 = 0;
-              memset((&(*__Pyx_BufPtrStrided3d(struct __pyx_t_11_distortion_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_23, __pyx_pybuffernd_lut.diminfo[2].strides))), 0, __pyx_v_size);
+              __pyx_t_24 = 0;
+              memset((&(*__Pyx_BufPtrStrided3d(struct __pyx_t_11_distortion_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_24, __pyx_pybuffernd_lut.diminfo[2].strides))), 0, __pyx_v_size);
 
               /* "_distortion.pyx":638
  *                     size = self.shape[0]*self.shape[1]*self.lut_size*sizeof(lut_point)
@@ -11577,9 +11881,9 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_8calc_LUT(CYTHON_UNUSED PyO
  *                     buffer = numpy.empty((self.delta0, self.delta1),dtype=numpy.float32)
  *                     buffer_size = self.delta0 * self.delta1 * sizeof(float)
  */
-              __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+              __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
               __Pyx_GOTREF(__pyx_t_4);
-              __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__info); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+              __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__info); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
               __Pyx_GOTREF(__pyx_t_1);
               __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
               __pyx_t_4 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_lut->dimensions[0])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
@@ -11588,8 +11892,8 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_8calc_LUT(CYTHON_UNUSED PyO
               __Pyx_GOTREF(__pyx_t_3);
               __pyx_t_5 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_lut->dimensions[2])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
               __Pyx_GOTREF(__pyx_t_5);
-              __pyx_t_16 = PyFloat_FromDouble((__pyx_v_size / 1.0e6)); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
-              __Pyx_GOTREF(__pyx_t_16);
+              __pyx_t_17 = PyFloat_FromDouble((__pyx_v_size / 1.0e6)); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+              __Pyx_GOTREF(__pyx_t_17);
               __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
               __Pyx_GOTREF(__pyx_t_2);
               PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
@@ -11598,25 +11902,25 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_8calc_LUT(CYTHON_UNUSED PyO
               __Pyx_GIVEREF(__pyx_t_3);
               PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5);
               __Pyx_GIVEREF(__pyx_t_5);
-              PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_16);
-              __Pyx_GIVEREF(__pyx_t_16);
+              PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_17);
+              __Pyx_GIVEREF(__pyx_t_17);
               __pyx_t_4 = 0;
               __pyx_t_3 = 0;
               __pyx_t_5 = 0;
-              __pyx_t_16 = 0;
-              __pyx_t_16 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_77), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
-              __Pyx_GOTREF(((PyObject *)__pyx_t_16));
+              __pyx_t_17 = 0;
+              __pyx_t_17 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_77), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+              __Pyx_GOTREF(((PyObject *)__pyx_t_17));
               __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
               __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
               __Pyx_GOTREF(__pyx_t_2);
-              PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_16));
-              __Pyx_GIVEREF(((PyObject *)__pyx_t_16));
-              __pyx_t_16 = 0;
-              __pyx_t_16 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
-              __Pyx_GOTREF(__pyx_t_16);
+              PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_17));
+              __Pyx_GIVEREF(((PyObject *)__pyx_t_17));
+              __pyx_t_17 = 0;
+              __pyx_t_17 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+              __Pyx_GOTREF(__pyx_t_17);
               __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
               __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-              __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+              __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
 
               /* "_distortion.pyx":639
  *                     memset(&lut[0,0,0], 0, size)
@@ -11625,22 +11929,22 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_8calc_LUT(CYTHON_UNUSED PyO
  *                     buffer_size = self.delta0 * self.delta1 * sizeof(float)
  *                     logger.info("Max pixel size: %ix%i; Max source pixel in target: %i"%(buffer.shape[1],buffer.shape[0], self.lut_size))
  */
-              __pyx_t_16 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
-              __Pyx_GOTREF(__pyx_t_16);
-              __pyx_t_2 = PyObject_GetAttr(__pyx_t_16, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+              __pyx_t_17 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+              __Pyx_GOTREF(__pyx_t_17);
+              __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_17, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
               __Pyx_GOTREF(__pyx_t_2);
-              __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
-              __pyx_t_16 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__delta0); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
-              __Pyx_GOTREF(__pyx_t_16);
-              __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__delta1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+              __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
+              __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__delta0); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+              __Pyx_GOTREF(__pyx_t_17);
+              __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__delta1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
               __Pyx_GOTREF(__pyx_t_1);
               __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
               __Pyx_GOTREF(__pyx_t_5);
-              PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_16);
-              __Pyx_GIVEREF(__pyx_t_16);
+              PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_17);
+              __Pyx_GIVEREF(__pyx_t_17);
               PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
               __Pyx_GIVEREF(__pyx_t_1);
-              __pyx_t_16 = 0;
+              __pyx_t_17 = 0;
               __pyx_t_1 = 0;
               __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
               __Pyx_GOTREF(__pyx_t_1);
@@ -11649,11 +11953,11 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_8calc_LUT(CYTHON_UNUSED PyO
               __pyx_t_5 = 0;
               __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
               __Pyx_GOTREF(((PyObject *)__pyx_t_5));
-              __pyx_t_16 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
-              __Pyx_GOTREF(__pyx_t_16);
-              __pyx_t_3 = PyObject_GetAttr(__pyx_t_16, __pyx_n_s__float32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+              __pyx_t_17 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+              __Pyx_GOTREF(__pyx_t_17);
+              __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_17, __pyx_n_s__float32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
               __Pyx_GOTREF(__pyx_t_3);
-              __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+              __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
               if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
               __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
               __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
@@ -11661,12 +11965,12 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_8calc_LUT(CYTHON_UNUSED PyO
               __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
               __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
               __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
-              __pyx_t_24 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(__pyx_t_3);
-              if (unlikely(!__pyx_t_24.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+              __pyx_t_25 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(__pyx_t_3);
+              if (unlikely(!__pyx_t_25.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
               __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-              __pyx_v_buffer = __pyx_t_24;
-              __pyx_t_24.memview = NULL;
-              __pyx_t_24.data = NULL;
+              __pyx_v_buffer = __pyx_t_25;
+              __pyx_t_25.memview = NULL;
+              __pyx_t_25.data = NULL;
 
               /* "_distortion.pyx":640
  *                     logger.info("LUT shape: (%i,%i,%i) %.3f MByte"%(lut.shape[0], lut.shape[1],lut.shape[2],size/1.0e6))
@@ -11675,9 +11979,9 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_8calc_LUT(CYTHON_UNUSED PyO
  *                     logger.info("Max pixel size: %ix%i; Max source pixel in target: %i"%(buffer.shape[1],buffer.shape[0], self.lut_size))
  *                     with nogil:
  */
-              __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__delta0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+              __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__delta0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
               __Pyx_GOTREF(__pyx_t_3);
-              __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__delta1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+              __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__delta1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
               __Pyx_GOTREF(__pyx_t_5);
               __pyx_t_1 = PyNumber_Multiply(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
               __Pyx_GOTREF(__pyx_t_1);
@@ -11700,40 +12004,40 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_8calc_LUT(CYTHON_UNUSED PyO
  *                     with nogil:
  *                         # i,j, idx are indexes of the raw image uncorrected
  */
-              __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+              __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
               __Pyx_GOTREF(__pyx_t_3);
-              __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__info); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+              __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__info); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
               __Pyx_GOTREF(__pyx_t_5);
               __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
               __pyx_t_3 = PyInt_FromSsize_t((__pyx_v_buffer.shape[1])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
               __Pyx_GOTREF(__pyx_t_3);
               __pyx_t_1 = PyInt_FromSsize_t((__pyx_v_buffer.shape[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
               __Pyx_GOTREF(__pyx_t_1);
-              __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__lut_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+              __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__lut_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
               __Pyx_GOTREF(__pyx_t_2);
-              __pyx_t_16 = PyTuple_New(3); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
-              __Pyx_GOTREF(__pyx_t_16);
-              PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_3);
+              __pyx_t_17 = PyTuple_New(3); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+              __Pyx_GOTREF(__pyx_t_17);
+              PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_3);
               __Pyx_GIVEREF(__pyx_t_3);
-              PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_1);
+              PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_1);
               __Pyx_GIVEREF(__pyx_t_1);
-              PyTuple_SET_ITEM(__pyx_t_16, 2, __pyx_t_2);
+              PyTuple_SET_ITEM(__pyx_t_17, 2, __pyx_t_2);
               __Pyx_GIVEREF(__pyx_t_2);
               __pyx_t_3 = 0;
               __pyx_t_1 = 0;
               __pyx_t_2 = 0;
-              __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_78), ((PyObject *)__pyx_t_16)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+              __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_78), ((PyObject *)__pyx_t_17)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
               __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-              __Pyx_DECREF(((PyObject *)__pyx_t_16)); __pyx_t_16 = 0;
-              __pyx_t_16 = PyTuple_New(1); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
-              __Pyx_GOTREF(__pyx_t_16);
-              PyTuple_SET_ITEM(__pyx_t_16, 0, ((PyObject *)__pyx_t_2));
+              __Pyx_DECREF(((PyObject *)__pyx_t_17)); __pyx_t_17 = 0;
+              __pyx_t_17 = PyTuple_New(1); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+              __Pyx_GOTREF(__pyx_t_17);
+              PyTuple_SET_ITEM(__pyx_t_17, 0, ((PyObject *)__pyx_t_2));
               __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
               __pyx_t_2 = 0;
-              __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_16), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+              __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_17), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
               __Pyx_GOTREF(__pyx_t_2);
               __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-              __Pyx_DECREF(((PyObject *)__pyx_t_16)); __pyx_t_16 = 0;
+              __Pyx_DECREF(((PyObject *)__pyx_t_17)); __pyx_t_17 = 0;
               __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
               /* "_distortion.pyx":642
@@ -11745,9 +12049,9 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_8calc_LUT(CYTHON_UNUSED PyO
  */
               {
                   #ifdef WITH_THREAD
-                  PyThreadState *_save = NULL;
-                  #endif
+                  PyThreadState *_save;
                   Py_UNBLOCK_THREADS
+                  #endif
                   /*try:*/ {
 
                     /* "_distortion.pyx":644
@@ -11768,9 +12072,9 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_8calc_LUT(CYTHON_UNUSED PyO
  *                                 #reinit of buffer
  *                                 memset(&buffer[0,0], 0, buffer_size)
  */
-                      __pyx_t_25 = __pyx_v_shape1;
-                      for (__pyx_t_26 = 0; __pyx_t_26 < __pyx_t_25; __pyx_t_26+=1) {
-                        __pyx_v_j = __pyx_t_26;
+                      __pyx_t_26 = __pyx_v_shape1;
+                      for (__pyx_t_27 = 0; __pyx_t_27 < __pyx_t_26; __pyx_t_27+=1) {
+                        __pyx_v_j = __pyx_t_27;
 
                         /* "_distortion.pyx":647
  *                             for j in range(shape1):
@@ -11779,9 +12083,9 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_8calc_LUT(CYTHON_UNUSED PyO
  *                                 A0 = pos[i, j, 0, 0]
  *                                 A1 = pos[i, j, 0, 1]
  */
-                        __pyx_t_27 = 0;
                         __pyx_t_28 = 0;
-                        memset((&(*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_buffer.data + __pyx_t_27 * __pyx_v_buffer.strides[0]) ) + __pyx_t_28 * __pyx_v_buffer.strides[1]) )))), 0, __pyx_v_buffer_size);
+                        __pyx_t_29 = 0;
+                        memset((&(*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_buffer.data + __pyx_t_28 * __pyx_v_buffer.strides[0]) ) + __pyx_t_29 * __pyx_v_buffer.strides[1]) )))), 0, __pyx_v_buffer_size);
 
                         /* "_distortion.pyx":648
  *                                 #reinit of buffer
@@ -11790,11 +12094,11 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_8calc_LUT(CYTHON_UNUSED PyO
  *                                 A1 = pos[i, j, 0, 1]
  *                                 B0 = pos[i, j, 1, 0]
  */
-                        __pyx_t_29 = __pyx_v_i;
-                        __pyx_t_30 = __pyx_v_j;
-                        __pyx_t_31 = 0;
+                        __pyx_t_30 = __pyx_v_i;
+                        __pyx_t_31 = __pyx_v_j;
                         __pyx_t_32 = 0;
-                        __pyx_v_A0 = (*((float *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pos.data + __pyx_t_29 * __pyx_v_pos.strides[0]) ) + __pyx_t_30 * __pyx_v_pos.strides[1]) ) + __pyx_t_31 * __pyx_v_pos.strides[2]) ) + __pyx_t_32 * __pyx_v_pos.strides[3]) )));
+                        __pyx_t_33 = 0;
+                        __pyx_v_A0 = (*((float *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pos.data + __pyx_t_30 * __pyx_v_pos.strides[0]) ) + __pyx_t_31 * __pyx_v_pos.strides[1]) ) + __pyx_t_32 * __pyx_v_pos.strides[2]) ) + __pyx_t_33 * __pyx_v_pos.strides[3]) )));
 
                         /* "_distortion.pyx":649
  *                                 memset(&buffer[0,0], 0, buffer_size)
@@ -11803,11 +12107,11 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_8calc_LUT(CYTHON_UNUSED PyO
  *                                 B0 = pos[i, j, 1, 0]
  *                                 B1 = pos[i, j, 1, 1]
  */
-                        __pyx_t_33 = __pyx_v_i;
-                        __pyx_t_34 = __pyx_v_j;
-                        __pyx_t_35 = 0;
-                        __pyx_t_36 = 1;
-                        __pyx_v_A1 = (*((float *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pos.data + __pyx_t_33 * __pyx_v_pos.strides[0]) ) + __pyx_t_34 * __pyx_v_pos.strides[1]) ) + __pyx_t_35 * __pyx_v_pos.strides[2]) ) + __pyx_t_36 * __pyx_v_pos.strides[3]) )));
+                        __pyx_t_34 = __pyx_v_i;
+                        __pyx_t_35 = __pyx_v_j;
+                        __pyx_t_36 = 0;
+                        __pyx_t_37 = 1;
+                        __pyx_v_A1 = (*((float *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pos.data + __pyx_t_34 * __pyx_v_pos.strides[0]) ) + __pyx_t_35 * __pyx_v_pos.strides[1]) ) + __pyx_t_36 * __pyx_v_pos.strides[2]) ) + __pyx_t_37 * __pyx_v_pos.strides[3]) )));
 
                         /* "_distortion.pyx":650
  *                                 A0 = pos[i, j, 0, 0]
@@ -11816,11 +12120,11 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_8calc_LUT(CYTHON_UNUSED PyO
  *                                 B1 = pos[i, j, 1, 1]
  *                                 C0 = pos[i, j, 2, 0]
  */
-                        __pyx_t_37 = __pyx_v_i;
-                        __pyx_t_38 = __pyx_v_j;
-                        __pyx_t_39 = 1;
-                        __pyx_t_40 = 0;
-                        __pyx_v_B0 = (*((float *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pos.data + __pyx_t_37 * __pyx_v_pos.strides[0]) ) + __pyx_t_38 * __pyx_v_pos.strides[1]) ) + __pyx_t_39 * __pyx_v_pos.strides[2]) ) + __pyx_t_40 * __pyx_v_pos.strides[3]) )));
+                        __pyx_t_38 = __pyx_v_i;
+                        __pyx_t_39 = __pyx_v_j;
+                        __pyx_t_40 = 1;
+                        __pyx_t_41 = 0;
+                        __pyx_v_B0 = (*((float *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pos.data + __pyx_t_38 * __pyx_v_pos.strides[0]) ) + __pyx_t_39 * __pyx_v_pos.strides[1]) ) + __pyx_t_40 * __pyx_v_pos.strides[2]) ) + __pyx_t_41 * __pyx_v_pos.strides[3]) )));
 
                         /* "_distortion.pyx":651
  *                                 A1 = pos[i, j, 0, 1]
@@ -11829,11 +12133,11 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_8calc_LUT(CYTHON_UNUSED PyO
  *                                 C0 = pos[i, j, 2, 0]
  *                                 C1 = pos[i, j, 2, 1]
  */
-                        __pyx_t_41 = __pyx_v_i;
-                        __pyx_t_42 = __pyx_v_j;
-                        __pyx_t_43 = 1;
+                        __pyx_t_42 = __pyx_v_i;
+                        __pyx_t_43 = __pyx_v_j;
                         __pyx_t_44 = 1;
-                        __pyx_v_B1 = (*((float *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pos.data + __pyx_t_41 * __pyx_v_pos.strides[0]) ) + __pyx_t_42 * __pyx_v_pos.strides[1]) ) + __pyx_t_43 * __pyx_v_pos.strides[2]) ) + __pyx_t_44 * __pyx_v_pos.strides[3]) )));
+                        __pyx_t_45 = 1;
+                        __pyx_v_B1 = (*((float *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pos.data + __pyx_t_42 * __pyx_v_pos.strides[0]) ) + __pyx_t_43 * __pyx_v_pos.strides[1]) ) + __pyx_t_44 * __pyx_v_pos.strides[2]) ) + __pyx_t_45 * __pyx_v_pos.strides[3]) )));
 
                         /* "_distortion.pyx":652
  *                                 B0 = pos[i, j, 1, 0]
@@ -11842,11 +12146,11 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_8calc_LUT(CYTHON_UNUSED PyO
  *                                 C1 = pos[i, j, 2, 1]
  *                                 D0 = pos[i, j, 3, 0]
  */
-                        __pyx_t_45 = __pyx_v_i;
-                        __pyx_t_46 = __pyx_v_j;
-                        __pyx_t_47 = 2;
-                        __pyx_t_48 = 0;
-                        __pyx_v_C0 = (*((float *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pos.data + __pyx_t_45 * __pyx_v_pos.strides[0]) ) + __pyx_t_46 * __pyx_v_pos.strides[1]) ) + __pyx_t_47 * __pyx_v_pos.strides[2]) ) + __pyx_t_48 * __pyx_v_pos.strides[3]) )));
+                        __pyx_t_46 = __pyx_v_i;
+                        __pyx_t_47 = __pyx_v_j;
+                        __pyx_t_48 = 2;
+                        __pyx_t_49 = 0;
+                        __pyx_v_C0 = (*((float *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pos.data + __pyx_t_46 * __pyx_v_pos.strides[0]) ) + __pyx_t_47 * __pyx_v_pos.strides[1]) ) + __pyx_t_48 * __pyx_v_pos.strides[2]) ) + __pyx_t_49 * __pyx_v_pos.strides[3]) )));
 
                         /* "_distortion.pyx":653
  *                                 B1 = pos[i, j, 1, 1]
@@ -11855,11 +12159,11 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_8calc_LUT(CYTHON_UNUSED PyO
  *                                 D0 = pos[i, j, 3, 0]
  *                                 D1 = pos[i, j, 3, 1]
  */
-                        __pyx_t_49 = __pyx_v_i;
-                        __pyx_t_50 = __pyx_v_j;
-                        __pyx_t_51 = 2;
-                        __pyx_t_52 = 1;
-                        __pyx_v_C1 = (*((float *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pos.data + __pyx_t_49 * __pyx_v_pos.strides[0]) ) + __pyx_t_50 * __pyx_v_pos.strides[1]) ) + __pyx_t_51 * __pyx_v_pos.strides[2]) ) + __pyx_t_52 * __pyx_v_pos.strides[3]) )));
+                        __pyx_t_50 = __pyx_v_i;
+                        __pyx_t_51 = __pyx_v_j;
+                        __pyx_t_52 = 2;
+                        __pyx_t_53 = 1;
+                        __pyx_v_C1 = (*((float *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pos.data + __pyx_t_50 * __pyx_v_pos.strides[0]) ) + __pyx_t_51 * __pyx_v_pos.strides[1]) ) + __pyx_t_52 * __pyx_v_pos.strides[2]) ) + __pyx_t_53 * __pyx_v_pos.strides[3]) )));
 
                         /* "_distortion.pyx":654
  *                                 C0 = pos[i, j, 2, 0]
@@ -11868,11 +12172,11 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_8calc_LUT(CYTHON_UNUSED PyO
  *                                 D1 = pos[i, j, 3, 1]
  *                                 offset0 = (<int> floor(min4f(A0, B0, C0, D0)))
  */
-                        __pyx_t_53 = __pyx_v_i;
-                        __pyx_t_54 = __pyx_v_j;
-                        __pyx_t_55 = 3;
-                        __pyx_t_56 = 0;
-                        __pyx_v_D0 = (*((float *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pos.data + __pyx_t_53 * __pyx_v_pos.strides[0]) ) + __pyx_t_54 * __pyx_v_pos.strides[1]) ) + __pyx_t_55 * __pyx_v_pos.strides[2]) ) + __pyx_t_56 * __pyx_v_pos.strides[3]) )));
+                        __pyx_t_54 = __pyx_v_i;
+                        __pyx_t_55 = __pyx_v_j;
+                        __pyx_t_56 = 3;
+                        __pyx_t_57 = 0;
+                        __pyx_v_D0 = (*((float *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pos.data + __pyx_t_54 * __pyx_v_pos.strides[0]) ) + __pyx_t_55 * __pyx_v_pos.strides[1]) ) + __pyx_t_56 * __pyx_v_pos.strides[2]) ) + __pyx_t_57 * __pyx_v_pos.strides[3]) )));
 
                         /* "_distortion.pyx":655
  *                                 C1 = pos[i, j, 2, 1]
@@ -11881,11 +12185,11 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_8calc_LUT(CYTHON_UNUSED PyO
  *                                 offset0 = (<int> floor(min4f(A0, B0, C0, D0)))
  *                                 offset1 = (<int> floor(min4f(A1, B1, C1, D1)))
  */
-                        __pyx_t_57 = __pyx_v_i;
-                        __pyx_t_58 = __pyx_v_j;
-                        __pyx_t_59 = 3;
-                        __pyx_t_60 = 1;
-                        __pyx_v_D1 = (*((float *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pos.data + __pyx_t_57 * __pyx_v_pos.strides[0]) ) + __pyx_t_58 * __pyx_v_pos.strides[1]) ) + __pyx_t_59 * __pyx_v_pos.strides[2]) ) + __pyx_t_60 * __pyx_v_pos.strides[3]) )));
+                        __pyx_t_58 = __pyx_v_i;
+                        __pyx_t_59 = __pyx_v_j;
+                        __pyx_t_60 = 3;
+                        __pyx_t_61 = 1;
+                        __pyx_v_D1 = (*((float *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pos.data + __pyx_t_58 * __pyx_v_pos.strides[0]) ) + __pyx_t_59 * __pyx_v_pos.strides[1]) ) + __pyx_t_60 * __pyx_v_pos.strides[2]) ) + __pyx_t_61 * __pyx_v_pos.strides[3]) )));
 
                         /* "_distortion.pyx":656
  *                                 D0 = pos[i, j, 3, 0]
@@ -12002,8 +12306,8 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_8calc_LUT(CYTHON_UNUSED PyO
  *                                     pAB = (B1 - A1) / (B0 - A0)
  *                                     cAB = A1 - pAB * A0
  */
-                        __pyx_t_10 = (__pyx_v_B0 != __pyx_v_A0);
-                        if (__pyx_t_10) {
+                        __pyx_t_11 = ((__pyx_v_B0 != __pyx_v_A0) != 0);
+                        if (__pyx_t_11) {
 
                           /* "_distortion.pyx":669
  *                                 D1 -= <float> offset1
@@ -12045,8 +12349,8 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_8calc_LUT(CYTHON_UNUSED PyO
  *                                     pBC = (C1 - B1) / (C0 - B0)
  *                                     cBC = B1 - pBC * B0
  */
-                        __pyx_t_10 = (__pyx_v_C0 != __pyx_v_B0);
-                        if (__pyx_t_10) {
+                        __pyx_t_11 = ((__pyx_v_C0 != __pyx_v_B0) != 0);
+                        if (__pyx_t_11) {
 
                           /* "_distortion.pyx":674
  *                                     pAB = cAB = 0.0
@@ -12088,8 +12392,8 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_8calc_LUT(CYTHON_UNUSED PyO
  *                                     pCD = (D1 - C1) / (D0 - C0)
  *                                     cCD = C1 - pCD * C0
  */
-                        __pyx_t_10 = (__pyx_v_D0 != __pyx_v_C0);
-                        if (__pyx_t_10) {
+                        __pyx_t_11 = ((__pyx_v_D0 != __pyx_v_C0) != 0);
+                        if (__pyx_t_11) {
 
                           /* "_distortion.pyx":679
  *                                     pBC = cBC = 0.0
@@ -12131,8 +12435,8 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_8calc_LUT(CYTHON_UNUSED PyO
  *                                     pDA = (A1 - D1) / (A0 - D0)
  *                                     cDA = D1 - pDA * D0
  */
-                        __pyx_t_10 = (__pyx_v_A0 != __pyx_v_D0);
-                        if (__pyx_t_10) {
+                        __pyx_t_11 = ((__pyx_v_A0 != __pyx_v_D0) != 0);
+                        if (__pyx_t_11) {
 
                           /* "_distortion.pyx":684
  *                                     pCD = cCD = 0.0
@@ -12219,9 +12523,9 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_8calc_LUT(CYTHON_UNUSED PyO
  *                                     ml = ms + offset0
  *                                     if ml < 0 or ml >= shape0:
  */
-                        __pyx_t_61 = __pyx_v_box_size0;
-                        for (__pyx_t_62 = 0; __pyx_t_62 < __pyx_t_61; __pyx_t_62+=1) {
-                          __pyx_v_ms = __pyx_t_62;
+                        __pyx_t_62 = __pyx_v_box_size0;
+                        for (__pyx_t_63 = 0; __pyx_t_63 < __pyx_t_62; __pyx_t_63+=1) {
+                          __pyx_v_ms = __pyx_t_63;
 
                           /* "_distortion.pyx":694
  *                                 area = 0.5*((C0 - A0)*(D1 - B1)-(C1 - A1)*(D0 - B0))
@@ -12239,12 +12543,12 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_8calc_LUT(CYTHON_UNUSED PyO
  *                                         continue
  *                                     for ns in range(box_size1):
  */
-                          __pyx_t_10 = (__pyx_v_ml < 0);
-                          if (!__pyx_t_10) {
-                            __pyx_t_63 = (__pyx_v_ml >= __pyx_v_shape0);
-                            __pyx_t_64 = __pyx_t_63;
-                          } else {
+                          __pyx_t_11 = ((__pyx_v_ml < 0) != 0);
+                          if (!__pyx_t_11) {
+                            __pyx_t_10 = ((__pyx_v_ml >= __pyx_v_shape0) != 0);
                             __pyx_t_64 = __pyx_t_10;
+                          } else {
+                            __pyx_t_64 = __pyx_t_11;
                           }
                           if (__pyx_t_64) {
 
@@ -12287,14 +12591,14 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_8calc_LUT(CYTHON_UNUSED PyO
  *                                             continue
  *                                         value = buffer[ms, ns] / area
  */
-                            __pyx_t_64 = (__pyx_v_nl < 0);
+                            __pyx_t_64 = ((__pyx_v_nl < 0) != 0);
                             if (!__pyx_t_64) {
-                              __pyx_t_10 = (__pyx_v_nl >= __pyx_v_shape1);
-                              __pyx_t_63 = __pyx_t_10;
+                              __pyx_t_11 = ((__pyx_v_nl >= __pyx_v_shape1) != 0);
+                              __pyx_t_10 = __pyx_t_11;
                             } else {
-                              __pyx_t_63 = __pyx_t_64;
+                              __pyx_t_10 = __pyx_t_64;
                             }
-                            if (__pyx_t_63) {
+                            if (__pyx_t_10) {
 
                               /* "_distortion.pyx":701
  *                                         nl = ns + offset1
@@ -12326,8 +12630,8 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_8calc_LUT(CYTHON_UNUSED PyO
  *                                             continue
  *                                         k = outMax[ml, nl]
  */
-                            __pyx_t_63 = (__pyx_v_value <= 0.0);
-                            if (__pyx_t_63) {
+                            __pyx_t_10 = ((__pyx_v_value <= 0.0) != 0);
+                            if (__pyx_t_10) {
 
                               /* "_distortion.pyx":704
  *                                         value = buffer[ms, ns] / area
@@ -12411,7 +12715,9 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_8calc_LUT(CYTHON_UNUSED PyO
  *                         for i in range(shape0):
  */
                   /*finally:*/ {
+                    #ifdef WITH_THREAD
                     Py_BLOCK_THREADS
+                    #endif
                   }
               }
 
@@ -12422,55 +12728,55 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_8calc_LUT(CYTHON_UNUSED PyO
  * 
  *     @cython.wraparound(False)
  */
-              __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_lut), __pyx_n_s__reshape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+              __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_lut), __pyx_n_s__reshape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
               __Pyx_GOTREF(__pyx_t_2);
-              __pyx_t_16 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
-              __Pyx_GOTREF(__pyx_t_16);
-              __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_16, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+              __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+              __Pyx_GOTREF(__pyx_t_17);
+              __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_17, 0, sizeof(long), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
               __Pyx_GOTREF(__pyx_t_5);
-              __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
-              __pyx_t_16 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
-              __Pyx_GOTREF(__pyx_t_16);
-              __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_16, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+              __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
+              __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+              __Pyx_GOTREF(__pyx_t_17);
+              __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_17, 1, sizeof(long), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
               __Pyx_GOTREF(__pyx_t_1);
-              __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
-              __pyx_t_16 = PyNumber_Multiply(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
-              __Pyx_GOTREF(__pyx_t_16);
+              __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
+              __pyx_t_17 = PyNumber_Multiply(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+              __Pyx_GOTREF(__pyx_t_17);
               __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
               __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-              __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__lut_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+              __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__lut_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
               __Pyx_GOTREF(__pyx_t_1);
               __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
               __Pyx_GOTREF(__pyx_t_5);
-              PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_16);
-              __Pyx_GIVEREF(__pyx_t_16);
+              PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_17);
+              __Pyx_GIVEREF(__pyx_t_17);
               PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
               __Pyx_GIVEREF(__pyx_t_1);
-              __pyx_t_16 = 0;
+              __pyx_t_17 = 0;
               __pyx_t_1 = 0;
               __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
               __Pyx_GOTREF(__pyx_t_1);
               __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
               __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
-              if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__LUT, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
+              if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__LUT, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
               __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
               goto __pyx_L19;
             }
             __pyx_L19:;
           }
-          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
           __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
           __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
+          __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
           goto __pyx_L18_try_end;
           __pyx_L11_error:;
           __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
           __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
-          __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
+          __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
           __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
           __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
           __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
-          __PYX_XDEC_MEMVIEW(&__pyx_t_24, 1);
-          __PYX_XDEC_MEMVIEW(&__pyx_t_15, 1);
+          __PYX_XDEC_MEMVIEW(&__pyx_t_25, 1);
+          __PYX_XDEC_MEMVIEW(&__pyx_t_16, 1);
 
           /* "_distortion.pyx":632
  *             self.calc_LUT_size()
@@ -12485,25 +12791,25 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_8calc_LUT(CYTHON_UNUSED PyO
             __Pyx_GOTREF(__pyx_t_1);
             __Pyx_GOTREF(__pyx_t_5);
             __Pyx_GOTREF(__pyx_t_2);
-            __pyx_t_16 = PyTuple_New(3); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L13_except_error;}
-            __Pyx_GOTREF(__pyx_t_16);
+            __pyx_t_17 = PyTuple_New(3); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L13_except_error;}
+            __Pyx_GOTREF(__pyx_t_17);
             __Pyx_INCREF(__pyx_t_1);
-            PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_1);
+            PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_1);
             __Pyx_GIVEREF(__pyx_t_1);
             __Pyx_INCREF(__pyx_t_5);
-            PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_5);
+            PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_5);
             __Pyx_GIVEREF(__pyx_t_5);
             __Pyx_INCREF(__pyx_t_2);
-            PyTuple_SET_ITEM(__pyx_t_16, 2, __pyx_t_2);
+            PyTuple_SET_ITEM(__pyx_t_17, 2, __pyx_t_2);
             __Pyx_GIVEREF(__pyx_t_2);
-            __pyx_t_20 = PyObject_Call(__pyx_t_11, __pyx_t_16, NULL);
-            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-            if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L13_except_error;}
-            __Pyx_GOTREF(__pyx_t_20);
-            __pyx_t_63 = __Pyx_PyObject_IsTrue(__pyx_t_20);
-            __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
-            if (unlikely(__pyx_t_63 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L13_except_error;}
-            __pyx_t_64 = (!__pyx_t_63);
+            __pyx_t_21 = PyObject_Call(__pyx_t_12, __pyx_t_17, NULL);
+            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+            if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L13_except_error;}
+            __Pyx_GOTREF(__pyx_t_21);
+            __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_21);
+            __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
+            if (__pyx_t_10 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L13_except_error;}
+            __pyx_t_64 = ((!(__pyx_t_10 != 0)) != 0);
             if (__pyx_t_64) {
               __Pyx_GIVEREF(__pyx_t_1);
               __Pyx_GIVEREF(__pyx_t_5);
@@ -12514,40 +12820,40 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_8calc_LUT(CYTHON_UNUSED PyO
               goto __pyx_L42;
             }
             __pyx_L42:;
-            __Pyx_DECREF(((PyObject *)__pyx_t_16)); __pyx_t_16 = 0;
+            __Pyx_DECREF(((PyObject *)__pyx_t_17)); __pyx_t_17 = 0;
             __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
             __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
             __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
             goto __pyx_L12_exception_handled;
           }
           __pyx_L13_except_error:;
-          __Pyx_XGIVEREF(__pyx_t_12);
           __Pyx_XGIVEREF(__pyx_t_13);
           __Pyx_XGIVEREF(__pyx_t_14);
-          __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
+          __Pyx_XGIVEREF(__pyx_t_15);
+          __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
           goto __pyx_L1_error;
           __pyx_L12_exception_handled:;
-          __Pyx_XGIVEREF(__pyx_t_12);
           __Pyx_XGIVEREF(__pyx_t_13);
           __Pyx_XGIVEREF(__pyx_t_14);
-          __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
+          __Pyx_XGIVEREF(__pyx_t_15);
+          __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
           __pyx_L18_try_end:;
         }
       }
       /*finally:*/ {
-        if (__pyx_t_11) {
-          __pyx_t_14 = PyObject_Call(__pyx_t_11, __pyx_k_tuple_79, NULL);
-          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-          if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_14);
-          __pyx_t_64 = __Pyx_PyObject_IsTrue(__pyx_t_14);
-          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
-          if (unlikely(__pyx_t_64 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        if (__pyx_t_12) {
+          __pyx_t_15 = PyObject_Call(__pyx_t_12, __pyx_k_tuple_79, NULL);
+          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+          if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_15);
+          __pyx_t_64 = __Pyx_PyObject_IsTrue(__pyx_t_15);
+          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+          if (__pyx_t_64 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         }
       }
       goto __pyx_L43;
       __pyx_L7_error:;
-      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
       goto __pyx_L1_error;
       __pyx_L43:;
     }
@@ -12563,9 +12869,9 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_8calc_LUT(CYTHON_UNUSED PyO
   __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_5);
-  __PYX_XDEC_MEMVIEW(&__pyx_t_15, 1);
-  __Pyx_XDECREF(__pyx_t_16);
-  __PYX_XDEC_MEMVIEW(&__pyx_t_24, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_t_16, 1);
+  __Pyx_XDECREF(__pyx_t_17);
+  __PYX_XDEC_MEMVIEW(&__pyx_t_25, 1);
   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lut.rcbuffer->pybuffer);
@@ -12594,6 +12900,9 @@ static PyMethodDef __pyx_mdef_11_distortion_10Distortion_11correct = {__Pyx_NAME
 static PyObject *__pyx_pw_11_distortion_10Distortion_11correct(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_image = 0;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("correct (wrapper)", 0);
@@ -12671,10 +12980,10 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_10correct(CYTHON_UNUSED PyO
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
   int __pyx_t_2;
-  PyObject *__pyx_t_3 = NULL;
-  __Pyx_memviewslice __pyx_t_4 = { 0, 0, { 0 }, { 0 }, { 0 } };
-  PyObject *__pyx_t_5 = NULL;
-  int __pyx_t_6;
+  int __pyx_t_3;
+  PyObject *__pyx_t_4 = NULL;
+  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  PyObject *__pyx_t_6 = NULL;
   int __pyx_t_7;
   PyObject *__pyx_t_8 = NULL;
   PyObject *__pyx_t_9 = NULL;
@@ -12687,10 +12996,12 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_10correct(CYTHON_UNUSED PyO
   int __pyx_t_16;
   int __pyx_t_17;
   int __pyx_t_18;
-  int __pyx_t_19;
+  __pyx_t_5numpy_int32_t __pyx_t_19;
   int __pyx_t_20;
   int __pyx_t_21;
-  int __pyx_t_22;
+  __pyx_t_5numpy_float32_t __pyx_t_22;
+  int __pyx_t_23;
+  int __pyx_t_24;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -12704,11 +13015,12 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_10correct(CYTHON_UNUSED PyO
  *             self.calc_LUT()
  *         LUT = self.LUT
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__LUT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__LUT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = (__pyx_t_1 == Py_None);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (__pyx_t_2) {
+  __pyx_t_3 = (__pyx_t_2 != 0);
+  if (__pyx_t_3) {
 
     /* "_distortion.pyx":726
  *         cdef float[:] lout, lin
@@ -12717,12 +13029,12 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_10correct(CYTHON_UNUSED PyO
  *         LUT = self.LUT
  *         lshape0 = LUT.shape[0]
  */
-    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__calc_LUT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__calc_LUT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     goto __pyx_L3;
   }
   __pyx_L3:;
@@ -12734,14 +13046,14 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_10correct(CYTHON_UNUSED PyO
  *         lshape0 = LUT.shape[0]
  *         lshape1 = LUT.shape[1]
  */
-  __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__LUT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_dsds_nn_struct___pyx_t_11_distortion_lut_point(__pyx_t_3);
-  if (unlikely(!__pyx_t_4.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_v_LUT = __pyx_t_4;
-  __pyx_t_4.memview = NULL;
-  __pyx_t_4.data = NULL;
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__LUT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
+  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_nn_struct___pyx_t_11_distortion_lut_point(__pyx_t_4);
+  if (unlikely(!__pyx_t_5.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __pyx_v_LUT = __pyx_t_5;
+  __pyx_t_5.memview = NULL;
+  __pyx_t_5.data = NULL;
 
   /* "_distortion.pyx":728
  *             self.calc_LUT()
@@ -12768,10 +13080,10 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_10correct(CYTHON_UNUSED PyO
  *         if (img_shape[0]<self.shape[0]) or (img_shape[1]<self.shape[1]):
  *             new_image = numpy.zeros(self.shape, dtype=numpy.float32)
  */
-  __pyx_t_3 = PyObject_GetAttr(__pyx_v_image, __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_v_img_shape = __pyx_t_3;
-  __pyx_t_3 = 0;
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_image, __pyx_n_s__shape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
+  __pyx_v_img_shape = __pyx_t_4;
+  __pyx_t_4 = 0;
 
   /* "_distortion.pyx":731
  *         lshape1 = LUT.shape[1]
@@ -12780,34 +13092,34 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_10correct(CYTHON_UNUSED PyO
  *             new_image = numpy.zeros(self.shape, dtype=numpy.float32)
  *             new_image[:img_shape[0],:img_shape[1]] = image
  */
-  __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_img_shape, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_img_shape, 0, sizeof(long), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
+  __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __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_3, __pyx_t_5, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_6, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (!__pyx_t_2) {
-    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_img_shape, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (!__pyx_t_3) {
+    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_img_shape, 1, sizeof(long), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_5, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_5 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_6, 1, sizeof(long), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __pyx_t_6 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_7 = __pyx_t_6;
-  } else {
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
     __pyx_t_7 = __pyx_t_2;
+  } else {
+    __pyx_t_7 = __pyx_t_3;
   }
   if (__pyx_t_7) {
 
@@ -12818,32 +13130,32 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_10correct(CYTHON_UNUSED PyO
  *             new_image[:img_shape[0],:img_shape[1]] = image
  *             image = new_image
  */
-    __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
+    __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s__zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
     __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5);
-    __Pyx_GIVEREF(__pyx_t_5);
-    __pyx_t_5 = 0;
-    __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
-    __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    PyTuple_SET_ITEM(__pyx_t_1, 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 = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
+    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_8);
-    __pyx_t_9 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__float32); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__float32); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_9);
     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-    if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-    __pyx_t_9 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_9 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_9);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
     __pyx_v_new_image = __pyx_t_9;
     __pyx_t_9 = 0;
 
@@ -12854,23 +13166,23 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_10correct(CYTHON_UNUSED PyO
  *             image = new_image
  *             logger.warning("Patching image as image is %ix%i and spline is %ix%i"%(img_shape[1],img_shape[0],self.shape[1],self.shape[0]))
  */
-    __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_img_shape, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_img_shape, 0, sizeof(long), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_9);
-    __pyx_t_5 = PySlice_New(Py_None, __pyx_t_9, Py_None); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
+    __pyx_t_6 = PySlice_New(Py_None, __pyx_t_9, Py_None); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-    __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_img_shape, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_img_shape, 1, sizeof(long), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_9);
     __pyx_t_1 = PySlice_New(Py_None, __pyx_t_9, Py_None); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
     __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_9);
-    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_5);
-    __Pyx_GIVEREF(__pyx_t_5);
+    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6);
+    __Pyx_GIVEREF(__pyx_t_6);
     PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_1);
     __Pyx_GIVEREF(__pyx_t_1);
-    __pyx_t_5 = 0;
+    __pyx_t_6 = 0;
     __pyx_t_1 = 0;
     if (PyObject_SetItem(__pyx_v_new_image, ((PyObject *)__pyx_t_9), __pyx_v_image) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
@@ -12883,8 +13195,7 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_10correct(CYTHON_UNUSED PyO
  * 
  */
     __Pyx_INCREF(__pyx_v_new_image);
-    __Pyx_DECREF(__pyx_v_image);
-    __pyx_v_image = __pyx_v_new_image;
+    __Pyx_DECREF_SET(__pyx_v_image, __pyx_v_new_image);
 
     /* "_distortion.pyx":735
  *             new_image[:img_shape[0],:img_shape[1]] = image
@@ -12893,51 +13204,51 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_10correct(CYTHON_UNUSED PyO
  * 
  *         out = numpy.zeros(self.shape, dtype=numpy.float32)
  */
-    __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_9);
-    __pyx_t_1 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__warning); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s__warning); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-    __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_img_shape, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_img_shape, 1, sizeof(long), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_9);
-    __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_img_shape, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_3, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_img_shape, 0, sizeof(long), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_4, 1, sizeof(long), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_8);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_10 = __Pyx_GetItemInt(__pyx_t_3, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_10 = __Pyx_GetItemInt(__pyx_t_4, 0, sizeof(long), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_10);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_9);
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_9);
     __Pyx_GIVEREF(__pyx_t_9);
-    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5);
-    __Pyx_GIVEREF(__pyx_t_5);
-    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_8);
+    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_6);
+    __Pyx_GIVEREF(__pyx_t_6);
+    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_8);
     __Pyx_GIVEREF(__pyx_t_8);
-    PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_10);
+    PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_10);
     __Pyx_GIVEREF(__pyx_t_10);
     __pyx_t_9 = 0;
-    __pyx_t_5 = 0;
+    __pyx_t_6 = 0;
     __pyx_t_8 = 0;
     __pyx_t_10 = 0;
-    __pyx_t_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_80), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_80), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_10));
-    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_10));
+    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_10));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_10));
     __pyx_t_10 = 0;
-    __pyx_t_10 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_10 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_10);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
     goto __pyx_L4;
   }
@@ -12950,12 +13261,12 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_10correct(CYTHON_UNUSED PyO
  *         lout = out.ravel()
  *         lin = numpy.ascontiguousarray(image.ravel(),dtype=numpy.float32)
  */
-  __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_10);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s__zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-  __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_10);
   __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
@@ -12964,20 +13275,20 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_10correct(CYTHON_UNUSED PyO
   __pyx_t_10 = 0;
   __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_10));
-  __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_8);
-  __pyx_t_5 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__float32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
+  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__float32); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_6);
   __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-  if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+  __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_6);
+  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
-  __pyx_v_out = __pyx_t_5;
-  __pyx_t_5 = 0;
+  __pyx_v_out = __pyx_t_6;
+  __pyx_t_6 = 0;
 
   /* "_distortion.pyx":738
  * 
@@ -12986,11 +13297,11 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_10correct(CYTHON_UNUSED PyO
  *         lin = numpy.ascontiguousarray(image.ravel(),dtype=numpy.float32)
  *         size = lin.size
  */
-  __pyx_t_5 = PyObject_GetAttr(__pyx_v_out, __pyx_n_s__ravel); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_10 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_out, __pyx_n_s__ravel); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_6);
+  __pyx_t_10 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_10);
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
   __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_10);
   if (unlikely(!__pyx_t_11.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
@@ -13005,12 +13316,12 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_10correct(CYTHON_UNUSED PyO
  *         size = lin.size
  *         for i in prange(lshape0, nogil=True, schedule="static"):
  */
-  __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_10);
-  __pyx_t_5 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
+  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_6);
   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-  __pyx_t_10 = PyObject_GetAttr(__pyx_v_image, __pyx_n_s__ravel); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_image, __pyx_n_s__ravel); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_10);
   __pyx_t_1 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
@@ -13022,16 +13333,16 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_10correct(CYTHON_UNUSED PyO
   __pyx_t_1 = 0;
   __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_8 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__float32); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
+  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__float32); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_8);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-  __pyx_t_8 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_10), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_8 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_10), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_8);
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_8);
@@ -13050,7 +13361,7 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_10correct(CYTHON_UNUSED PyO
  */
   __pyx_t_8 = __pyx_memoryview_fromslice(__pyx_v_lin, 1, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_8);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
   __pyx_t_12 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -13066,16 +13377,16 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_10correct(CYTHON_UNUSED PyO
  */
   {
       #ifdef WITH_THREAD
-      PyThreadState *_save = NULL;
-      #endif
+      PyThreadState *_save;
       Py_UNBLOCK_THREADS
+      #endif
       /*try:*/ {
         __pyx_t_12 = __pyx_v_lshape0;
         if (1 == 0) abort();
         {
-            float __pyx_parallel_temp0 = __PYX_NAN;
+            int __pyx_parallel_temp0 = 0xbad0bad0;
             int __pyx_parallel_temp1 = 0xbad0bad0;
-            int __pyx_parallel_temp2 = 0xbad0bad0;
+            float __pyx_parallel_temp2 = __PYX_NAN();
             int __pyx_parallel_temp3 = 0xbad0bad0;
             const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0;
             PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL;
@@ -13091,7 +13402,7 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_10correct(CYTHON_UNUSED PyO
             if (__pyx_t_14 > 0)
             {
                 #ifdef _OPENMP
-                #pragma omp parallel private(__pyx_t_17, __pyx_t_7, __pyx_t_16, __pyx_t_21, __pyx_t_19, __pyx_t_22, __pyx_t_15, __pyx_t_18, __pyx_t_20) firstprivate(__pyx_t_10, __pyx_t_1, __pyx_t_8, __pyx_t_5) private(__pyx_filename, __pyx_lineno, __pyx_clineno) shared(__pyx_parallel_why, __pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb)
+                #pragma omp parallel private(__pyx_t_24, __pyx_t_18, __pyx_t_23, __pyx_t_17, __pyx_t_20, __pyx_t_7, __pyx_t_16, __pyx_t_21, __pyx_t_15, __pyx_t_19, __pyx_t_22) firstprivate(__pyx_t_6, __pyx_t_8, __pyx_t_10, __pyx_t_1) private(__pyx_filename, __pyx_lineno, __pyx_clineno) shared(__pyx_parallel_why, __pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb)
                 #endif /* _OPENMP */
                 {
                     #ifdef _OPENMP
@@ -13101,16 +13412,16 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_10correct(CYTHON_UNUSED PyO
                     Py_BEGIN_ALLOW_THREADS
                     #endif /* _OPENMP */
                     #ifdef _OPENMP
-                    #pragma omp for lastprivate(__pyx_v_coef) lastprivate(__pyx_v_idx) lastprivate(__pyx_v_j) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) schedule(static)
+                    #pragma omp for lastprivate(__pyx_v_j) lastprivate(__pyx_v_idx) lastprivate(__pyx_v_coef) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) schedule(static)
                     #endif /* _OPENMP */
                     for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_14; __pyx_t_13++){
                         if (__pyx_parallel_why < 2)
                         {
                             __pyx_v_i = 0 + 1 * __pyx_t_13;
                             /* Initialize private variables to invalid values */
-                            __pyx_v_coef = ((float)__PYX_NAN);
-                            __pyx_v_idx = ((int)0xbad0bad0);
                             __pyx_v_j = ((int)0xbad0bad0);
+                            __pyx_v_idx = ((int)0xbad0bad0);
+                            __pyx_v_coef = ((float)__PYX_NAN());
 
                             /* "_distortion.pyx":742
  *         size = lin.size
@@ -13132,7 +13443,8 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_10correct(CYTHON_UNUSED PyO
  */
                               __pyx_t_17 = __pyx_v_i;
                               __pyx_t_18 = __pyx_v_j;
-                              __pyx_v_idx = (*((struct __pyx_t_11_distortion_lut_point *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_LUT.data + __pyx_t_17 * __pyx_v_LUT.strides[0]) ) + __pyx_t_18 * __pyx_v_LUT.strides[1]) ))).idx;
+                              __pyx_t_19 = (*((struct __pyx_t_11_distortion_lut_point *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_LUT.data + __pyx_t_17 * __pyx_v_LUT.strides[0]) ) + __pyx_t_18 * __pyx_v_LUT.strides[1]) ))).idx;
+                              __pyx_v_idx = __pyx_t_19;
 
                               /* "_distortion.pyx":744
  *             for j in range(lshape1):
@@ -13141,9 +13453,10 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_10correct(CYTHON_UNUSED PyO
  *                 if coef<=0:
  *                     continue
  */
-                              __pyx_t_19 = __pyx_v_i;
-                              __pyx_t_20 = __pyx_v_j;
-                              __pyx_v_coef = (*((struct __pyx_t_11_distortion_lut_point *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_LUT.data + __pyx_t_19 * __pyx_v_LUT.strides[0]) ) + __pyx_t_20 * __pyx_v_LUT.strides[1]) ))).coef;
+                              __pyx_t_20 = __pyx_v_i;
+                              __pyx_t_21 = __pyx_v_j;
+                              __pyx_t_22 = (*((struct __pyx_t_11_distortion_lut_point *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_LUT.data + __pyx_t_20 * __pyx_v_LUT.strides[0]) ) + __pyx_t_21 * __pyx_v_LUT.strides[1]) ))).coef;
+                              __pyx_v_coef = __pyx_t_22;
 
                               /* "_distortion.pyx":745
  *                 idx = LUT[i,j].idx
@@ -13152,7 +13465,7 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_10correct(CYTHON_UNUSED PyO
  *                     continue
  *                 if idx>=size:
  */
-                              __pyx_t_7 = (__pyx_v_coef <= 0.0);
+                              __pyx_t_7 = ((__pyx_v_coef <= 0.0) != 0);
                               if (__pyx_t_7) {
 
                                 /* "_distortion.pyx":746
@@ -13174,7 +13487,7 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_10correct(CYTHON_UNUSED PyO
  *                     with gil:
  *                         logger.warning("Accessing %i >= %i !!!"%(idx,size))
  */
-                              __pyx_t_7 = (__pyx_v_idx >= __pyx_v_size);
+                              __pyx_t_7 = ((__pyx_v_idx >= __pyx_v_size) != 0);
                               if (__pyx_t_7) {
 
                                 /* "_distortion.pyx":748
@@ -13197,35 +13510,35 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_10correct(CYTHON_UNUSED PyO
  *                         continue
  *                 lout[i] += lin[idx] * coef
  */
-                                      __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L19;}
+                                      __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L19;}
                                       __Pyx_GOTREF(__pyx_t_1);
-                                      __pyx_t_8 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__warning); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L19;}
+                                      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__warning); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L19;}
                                       __Pyx_GOTREF(__pyx_t_8);
                                       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
                                       __pyx_t_1 = PyInt_FromLong(__pyx_v_idx); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L19;}
                                       __Pyx_GOTREF(__pyx_t_1);
                                       __pyx_t_10 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L19;}
                                       __Pyx_GOTREF(__pyx_t_10);
-                                      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L19;}
-                                      __Pyx_GOTREF(__pyx_t_5);
-                                      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
+                                      __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L19;}
+                                      __Pyx_GOTREF(__pyx_t_6);
+                                      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1);
                                       __Pyx_GIVEREF(__pyx_t_1);
-                                      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_10);
+                                      PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_10);
                                       __Pyx_GIVEREF(__pyx_t_10);
                                       __pyx_t_1 = 0;
                                       __pyx_t_10 = 0;
-                                      __pyx_t_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_81), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L19;}
+                                      __pyx_t_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_81), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L19;}
                                       __Pyx_GOTREF(((PyObject *)__pyx_t_10));
-                                      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
-                                      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L19;}
-                                      __Pyx_GOTREF(__pyx_t_5);
-                                      PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_10));
+                                      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+                                      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L19;}
+                                      __Pyx_GOTREF(__pyx_t_6);
+                                      PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_10));
                                       __Pyx_GIVEREF(((PyObject *)__pyx_t_10));
                                       __pyx_t_10 = 0;
-                                      __pyx_t_10 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L19;}
+                                      __pyx_t_10 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L19;}
                                       __Pyx_GOTREF(__pyx_t_10);
                                       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-                                      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+                                      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
                                       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
 
                                       /* "_distortion.pyx":750
@@ -13271,9 +13584,9 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_10correct(CYTHON_UNUSED PyO
  *         return out[:img_shape[0],:img_shape[1]]
  * 
  */
-                              __pyx_t_21 = __pyx_v_idx;
-                              __pyx_t_22 = __pyx_v_i;
-                              *((float *) ( /* dim=0 */ (__pyx_v_lout.data + __pyx_t_22 * __pyx_v_lout.strides[0]) )) += ((*((float *) ( /* dim=0 */ (__pyx_v_lin.data + __pyx_t_21 * __pyx_v_lin.strides[0]) ))) * __pyx_v_coef);
+                              __pyx_t_23 = __pyx_v_idx;
+                              __pyx_t_24 = __pyx_v_i;
+                              *((float *) ( /* dim=0 */ (__pyx_v_lout.data + __pyx_t_24 * __pyx_v_lout.strides[0]) )) += ((*((float *) ( /* dim=0 */ (__pyx_v_lin.data + __pyx_t_23 * __pyx_v_lin.strides[0]) ))) * __pyx_v_coef);
                               __pyx_L12_continue:;
                             }
                             goto __pyx_L23;
@@ -13298,12 +13611,12 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_10correct(CYTHON_UNUSED PyO
                             goto __pyx_L22;
                             __pyx_L22:;
                             #ifdef _OPENMP
-                            #pragma omp critical(__pyx_parallel_lastprivates0)
+                            #pragma omp critical(__pyx_parallel_lastprivates4)
                             #endif /* _OPENMP */
                             {
-                                __pyx_parallel_temp0 = __pyx_v_coef;
+                                __pyx_parallel_temp0 = __pyx_v_j;
                                 __pyx_parallel_temp1 = __pyx_v_idx;
-                                __pyx_parallel_temp2 = __pyx_v_j;
+                                __pyx_parallel_temp2 = __pyx_v_coef;
                                 __pyx_parallel_temp3 = __pyx_v_i;
                             }
                             __pyx_L23:;
@@ -13321,14 +13634,14 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_10correct(CYTHON_UNUSED PyO
                     #endif
                     #endif /* _OPENMP */
                     /* Clean up any temporaries */
+                    __Pyx_XDECREF(__pyx_t_6);
+                    __pyx_t_6 = NULL;
+                    __Pyx_XDECREF(__pyx_t_8);
+                    __pyx_t_8 = NULL;
                     __Pyx_XDECREF(__pyx_t_10);
                     __pyx_t_10 = NULL;
                     __Pyx_XDECREF(__pyx_t_1);
                     __pyx_t_1 = NULL;
-                    __Pyx_XDECREF(__pyx_t_8);
-                    __pyx_t_8 = NULL;
-                    __Pyx_XDECREF(__pyx_t_5);
-                    __pyx_t_5 = NULL;
                     #ifdef WITH_THREAD
                     PyGILState_Release(__pyx_gilstate_save);
                     #endif
@@ -13342,9 +13655,9 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_10correct(CYTHON_UNUSED PyO
               __pyx_parallel_why = 4;
             }
             if (__pyx_parallel_why) {
-              __pyx_v_coef = __pyx_parallel_temp0;
+              __pyx_v_j = __pyx_parallel_temp0;
               __pyx_v_idx = __pyx_parallel_temp1;
-              __pyx_v_j = __pyx_parallel_temp2;
+              __pyx_v_coef = __pyx_parallel_temp2;
               __pyx_v_i = __pyx_parallel_temp3;
               switch (__pyx_parallel_why) {
                     case 3: goto __pyx_L5;
@@ -13385,7 +13698,9 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_10correct(CYTHON_UNUSED PyO
         __pyx_L5: __pyx_why = 3; goto __pyx_L7;
         __pyx_L6: __pyx_why = 4; goto __pyx_L7;
         __pyx_L7:;
+        #ifdef WITH_THREAD
         Py_BLOCK_THREADS
+        #endif
         switch (__pyx_why) {
           case 3: goto __pyx_L0;
           case 4: goto __pyx_L1_error;
@@ -13401,23 +13716,23 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_10correct(CYTHON_UNUSED PyO
  *     @timeit
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_img_shape, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_img_shape, 0, sizeof(long), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_10);
-  __pyx_t_5 = PySlice_New(Py_None, __pyx_t_10, Py_None); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
+  __pyx_t_6 = PySlice_New(Py_None, __pyx_t_10, Py_None); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_6);
   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-  __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_img_shape, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_img_shape, 1, sizeof(long), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_10);
   __pyx_t_8 = PySlice_New(Py_None, __pyx_t_10, Py_None); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_8);
   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
   __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_10);
-  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5);
-  __Pyx_GIVEREF(__pyx_t_5);
+  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_6);
+  __Pyx_GIVEREF(__pyx_t_6);
   PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_8);
   __Pyx_GIVEREF(__pyx_t_8);
-  __pyx_t_5 = 0;
+  __pyx_t_6 = 0;
   __pyx_t_8 = 0;
   __pyx_t_8 = PyObject_GetItem(__pyx_v_out, ((PyObject *)__pyx_t_10)); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_8);
@@ -13430,9 +13745,9 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_10correct(CYTHON_UNUSED PyO
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_3);
-  __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1);
-  __Pyx_XDECREF(__pyx_t_5);
+  __Pyx_XDECREF(__pyx_t_4);
+  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
+  __Pyx_XDECREF(__pyx_t_6);
   __Pyx_XDECREF(__pyx_t_8);
   __Pyx_XDECREF(__pyx_t_9);
   __Pyx_XDECREF(__pyx_t_10);
@@ -13459,6 +13774,9 @@ static PyMethodDef __pyx_mdef_11_distortion_10Distortion_13uncorrect = {__Pyx_NA
 static PyObject *__pyx_pw_11_distortion_10Distortion_13uncorrect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_image = 0;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("uncorrect (wrapper)", 0);
@@ -13532,7 +13850,7 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_12uncorrect(CYTHON_UNUSED P
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
   int __pyx_t_2;
-  PyObject *__pyx_t_3 = NULL;
+  int __pyx_t_3;
   PyObject *__pyx_t_4 = NULL;
   PyObject *__pyx_t_5 = NULL;
   PyObject *__pyx_t_6 = NULL;
@@ -13540,7 +13858,7 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_12uncorrect(CYTHON_UNUSED P
   PyObject *__pyx_t_8 = NULL;
   PyObject *__pyx_t_9 = NULL;
   PyObject *__pyx_t_10 = NULL;
-  int __pyx_t_11;
+  PyObject *__pyx_t_11 = NULL;
   PyObject *__pyx_t_12 = NULL;
   Py_ssize_t __pyx_t_13;
   PyObject *(*__pyx_t_14)(PyObject *);
@@ -13556,11 +13874,12 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_12uncorrect(CYTHON_UNUSED P
  *             with self._sem:
  *                 if self.LUT is None:
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__LUT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__LUT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = (__pyx_t_1 == Py_None);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (__pyx_t_2) {
+  __pyx_t_3 = (__pyx_t_2 != 0);
+  if (__pyx_t_3) {
 
     /* "_distortion.pyx":763
  *         """
@@ -13570,23 +13889,23 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_12uncorrect(CYTHON_UNUSED P
  *                     self.calc_LUT()
  */
     /*with:*/ {
-      __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___sem); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s___sem); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____exit__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____enter__); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s____exit__); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s____enter__); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
       __Pyx_GOTREF(__pyx_t_5);
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+      __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+      __Pyx_GOTREF(__pyx_t_6);
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       /*try:*/ {
         {
-          __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
-          __Pyx_XGOTREF(__pyx_t_6);
+          __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
           __Pyx_XGOTREF(__pyx_t_7);
           __Pyx_XGOTREF(__pyx_t_8);
+          __Pyx_XGOTREF(__pyx_t_9);
           /*try:*/ {
 
             /* "_distortion.pyx":764
@@ -13596,10 +13915,11 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_12uncorrect(CYTHON_UNUSED P
  *                     self.calc_LUT()
  *         out = numpy.zeros(self.shape,dtype=numpy.float32)
  */
-            __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__LUT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+            __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__LUT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
             __Pyx_GOTREF(__pyx_t_1);
-            __pyx_t_2 = (__pyx_t_1 == Py_None);
+            __pyx_t_3 = (__pyx_t_1 == Py_None);
             __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+            __pyx_t_2 = (__pyx_t_3 != 0);
             if (__pyx_t_2) {
 
               /* "_distortion.pyx":765
@@ -13609,24 +13929,24 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_12uncorrect(CYTHON_UNUSED P
  *         out = numpy.zeros(self.shape,dtype=numpy.float32)
  *         mask = numpy.zeros(self.shape, dtype=numpy.int8)
  */
-              __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__calc_LUT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__calc_LUT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
               __Pyx_GOTREF(__pyx_t_1);
-              __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
-              __Pyx_GOTREF(__pyx_t_5);
+              __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
+              __Pyx_GOTREF(__pyx_t_6);
               __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-              __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
               goto __pyx_L16;
             }
             __pyx_L16:;
           }
-          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
           __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
           __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
           goto __pyx_L15_try_end;
           __pyx_L8_error:;
-          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
-          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
           __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
 
           /* "_distortion.pyx":763
  *         """
@@ -13637,73 +13957,73 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_12uncorrect(CYTHON_UNUSED P
  */
           /*except:*/ {
             __Pyx_AddTraceback("_distortion.Distortion.uncorrect", __pyx_clineno, __pyx_lineno, __pyx_filename);
-            if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_1, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
-            __Pyx_GOTREF(__pyx_t_5);
+            if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_1, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
+            __Pyx_GOTREF(__pyx_t_6);
             __Pyx_GOTREF(__pyx_t_1);
-            __Pyx_GOTREF(__pyx_t_4);
-            __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
-            __Pyx_GOTREF(__pyx_t_9);
-            __Pyx_INCREF(__pyx_t_5);
-            PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_5);
-            __Pyx_GIVEREF(__pyx_t_5);
+            __Pyx_GOTREF(__pyx_t_5);
+            __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
+            __Pyx_GOTREF(__pyx_t_10);
+            __Pyx_INCREF(__pyx_t_6);
+            PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_6);
+            __Pyx_GIVEREF(__pyx_t_6);
             __Pyx_INCREF(__pyx_t_1);
-            PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_1);
+            PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_1);
             __Pyx_GIVEREF(__pyx_t_1);
-            __Pyx_INCREF(__pyx_t_4);
-            PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_4);
-            __Pyx_GIVEREF(__pyx_t_4);
-            __pyx_t_10 = PyObject_Call(__pyx_t_3, __pyx_t_9, NULL);
-            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-            if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
-            __Pyx_GOTREF(__pyx_t_10);
-            __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_10);
-            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-            if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
-            __pyx_t_11 = (!__pyx_t_2);
-            if (__pyx_t_11) {
-              __Pyx_GIVEREF(__pyx_t_5);
+            __Pyx_INCREF(__pyx_t_5);
+            PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_5);
+            __Pyx_GIVEREF(__pyx_t_5);
+            __pyx_t_11 = PyObject_Call(__pyx_t_4, __pyx_t_10, NULL);
+            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+            if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
+            __Pyx_GOTREF(__pyx_t_11);
+            __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_11);
+            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+            if (__pyx_t_2 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
+            __pyx_t_3 = ((!(__pyx_t_2 != 0)) != 0);
+            if (__pyx_t_3) {
+              __Pyx_GIVEREF(__pyx_t_6);
               __Pyx_GIVEREF(__pyx_t_1);
-              __Pyx_GIVEREF(__pyx_t_4);
-              __Pyx_ErrRestore(__pyx_t_5, __pyx_t_1, __pyx_t_4);
-              __pyx_t_5 = 0; __pyx_t_1 = 0; __pyx_t_4 = 0; 
+              __Pyx_GIVEREF(__pyx_t_5);
+              __Pyx_ErrRestore(__pyx_t_6, __pyx_t_1, __pyx_t_5);
+              __pyx_t_6 = 0; __pyx_t_1 = 0; __pyx_t_5 = 0; 
               {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
               goto __pyx_L19;
             }
             __pyx_L19:;
-            __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
-            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+            __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
+            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
             __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
             goto __pyx_L9_exception_handled;
           }
           __pyx_L10_except_error:;
-          __Pyx_XGIVEREF(__pyx_t_6);
           __Pyx_XGIVEREF(__pyx_t_7);
           __Pyx_XGIVEREF(__pyx_t_8);
-          __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
+          __Pyx_XGIVEREF(__pyx_t_9);
+          __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
           goto __pyx_L1_error;
           __pyx_L9_exception_handled:;
-          __Pyx_XGIVEREF(__pyx_t_6);
           __Pyx_XGIVEREF(__pyx_t_7);
           __Pyx_XGIVEREF(__pyx_t_8);
-          __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
+          __Pyx_XGIVEREF(__pyx_t_9);
+          __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
           __pyx_L15_try_end:;
         }
       }
       /*finally:*/ {
-        if (__pyx_t_3) {
-          __pyx_t_8 = PyObject_Call(__pyx_t_3, __pyx_k_tuple_82, NULL);
-          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-          if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_8);
-          __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_8);
-          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-          if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        if (__pyx_t_4) {
+          __pyx_t_9 = PyObject_Call(__pyx_t_4, __pyx_k_tuple_82, NULL);
+          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+          if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_9);
+          __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_9);
+          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+          if (__pyx_t_3 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         }
       }
       goto __pyx_L20;
       __pyx_L4_error:;
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
       goto __pyx_L1_error;
       __pyx_L20:;
     }
@@ -13718,32 +14038,32 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_12uncorrect(CYTHON_UNUSED P
  *         mask = numpy.zeros(self.shape, dtype=numpy.int8)
  *         lmask = mask.ravel()
  */
-  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
-  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
-  __Pyx_GIVEREF(__pyx_t_4);
-  __pyx_t_4 = 0;
-  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-  __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
-  __pyx_t_12 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__float32); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_6);
+  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
+  __Pyx_GIVEREF(__pyx_t_5);
+  __pyx_t_5 = 0;
+  __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+  __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_10);
+  __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s__float32); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_12);
-  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+  if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-  __pyx_t_12 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_12 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_12);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
   __pyx_v_out = __pyx_t_12;
   __pyx_t_12 = 0;
 
@@ -13754,34 +14074,34 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_12uncorrect(CYTHON_UNUSED P
  *         lmask = mask.ravel()
  *         lout = out.ravel()
  */
-  __pyx_t_12 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_12);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
+  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s__zeros); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
   __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-  __pyx_t_12 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__shape); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_12);
-  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_12);
+  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_6);
+  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_12);
   __Pyx_GIVEREF(__pyx_t_12);
   __pyx_t_12 = 0;
   __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_12));
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_9 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__int8); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
+  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__int8); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_10);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__dtype), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-  __pyx_t_9 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+  if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__dtype), __pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+  __pyx_t_10 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_10);
+  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
-  __pyx_v_mask = __pyx_t_9;
-  __pyx_t_9 = 0;
+  __pyx_v_mask = __pyx_t_10;
+  __pyx_t_10 = 0;
 
   /* "_distortion.pyx":768
  *         out = numpy.zeros(self.shape,dtype=numpy.float32)
@@ -13790,11 +14110,11 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_12uncorrect(CYTHON_UNUSED P
  *         lout = out.ravel()
  *         lin = image.ravel()
  */
-  __pyx_t_9 = PyObject_GetAttr(__pyx_v_mask, __pyx_n_s__ravel); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
-  __pyx_t_12 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_mask, __pyx_n_s__ravel); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_10);
+  __pyx_t_12 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_12);
-  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
   __pyx_v_lmask = __pyx_t_12;
   __pyx_t_12 = 0;
 
@@ -13805,13 +14125,13 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_12uncorrect(CYTHON_UNUSED P
  *         lin = image.ravel()
  *         tot = self.LUT.coef.sum(axis= -1)
  */
-  __pyx_t_12 = PyObject_GetAttr(__pyx_v_out, __pyx_n_s__ravel); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_out, __pyx_n_s__ravel); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_12);
-  __pyx_t_9 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
+  __pyx_t_10 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_10);
   __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-  __pyx_v_lout = __pyx_t_9;
-  __pyx_t_9 = 0;
+  __pyx_v_lout = __pyx_t_10;
+  __pyx_t_10 = 0;
 
   /* "_distortion.pyx":770
  *         lmask = mask.ravel()
@@ -13820,11 +14140,11 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_12uncorrect(CYTHON_UNUSED P
  *         tot = self.LUT.coef.sum(axis= -1)
  *         for idx in range(self.LUT.shape[0]):
  */
-  __pyx_t_9 = PyObject_GetAttr(__pyx_v_image, __pyx_n_s__ravel); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
-  __pyx_t_12 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_image, __pyx_n_s__ravel); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_10);
+  __pyx_t_12 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_12);
-  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
   __pyx_v_lin = __pyx_t_12;
   __pyx_t_12 = 0;
 
@@ -13835,23 +14155,23 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_12uncorrect(CYTHON_UNUSED P
  *         for idx in range(self.LUT.shape[0]):
  *             t = tot[idx]
  */
-  __pyx_t_12 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__LUT); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__LUT); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_12);
-  __pyx_t_9 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__coef); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
+  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s__coef); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_10);
   __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-  __pyx_t_12 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__sum); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s__sum); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_12);
-  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-  __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_9));
-  if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__axis), __pyx_int_neg_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_5 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
+  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+  __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_10));
+  if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__axis), __pyx_int_neg_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_6);
   __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
-  __pyx_v_tot = __pyx_t_5;
-  __pyx_t_5 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
+  __pyx_v_tot = __pyx_t_6;
+  __pyx_t_6 = 0;
 
   /* "_distortion.pyx":772
  *         lin = image.ravel()
@@ -13860,60 +14180,59 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_12uncorrect(CYTHON_UNUSED P
  *             t = tot[idx]
  *             if t <= 0:
  */
-  __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__LUT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_9 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__shape); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_9, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-  __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
-  PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_5);
-  __Pyx_GIVEREF(__pyx_t_5);
-  __pyx_t_5 = 0;
-  __pyx_t_5 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
-  if (PyList_CheckExact(__pyx_t_5) || PyTuple_CheckExact(__pyx_t_5)) {
-    __pyx_t_9 = __pyx_t_5; __Pyx_INCREF(__pyx_t_9); __pyx_t_13 = 0;
+  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__LUT); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_6);
+  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s__shape); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_10);
+  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+  __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_10, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_6);
+  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+  __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_10);
+  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_6);
+  __Pyx_GIVEREF(__pyx_t_6);
+  __pyx_t_6 = 0;
+  __pyx_t_6 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_6);
+  __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
+  if (PyList_CheckExact(__pyx_t_6) || PyTuple_CheckExact(__pyx_t_6)) {
+    __pyx_t_10 = __pyx_t_6; __Pyx_INCREF(__pyx_t_10); __pyx_t_13 = 0;
     __pyx_t_14 = NULL;
   } else {
-    __pyx_t_13 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
-    __pyx_t_14 = Py_TYPE(__pyx_t_9)->tp_iternext;
+    __pyx_t_13 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_10);
+    __pyx_t_14 = Py_TYPE(__pyx_t_10)->tp_iternext;
   }
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
   for (;;) {
-    if (!__pyx_t_14 && PyList_CheckExact(__pyx_t_9)) {
-      if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_9)) break;
+    if (!__pyx_t_14 && PyList_CheckExact(__pyx_t_10)) {
+      if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_10)) break;
       #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_5 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_13); __Pyx_INCREF(__pyx_t_5); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_13); __Pyx_INCREF(__pyx_t_6); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       #else
-      __pyx_t_5 = PySequence_ITEM(__pyx_t_9, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = PySequence_ITEM(__pyx_t_10, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       #endif
-    } else if (!__pyx_t_14 && PyTuple_CheckExact(__pyx_t_9)) {
-      if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_9)) break;
+    } else if (!__pyx_t_14 && PyTuple_CheckExact(__pyx_t_10)) {
+      if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_10)) break;
       #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_13); __Pyx_INCREF(__pyx_t_5); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_13); __Pyx_INCREF(__pyx_t_6); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       #else
-      __pyx_t_5 = PySequence_ITEM(__pyx_t_9, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = PySequence_ITEM(__pyx_t_10, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       #endif
     } else {
-      __pyx_t_5 = __pyx_t_14(__pyx_t_9);
-      if (unlikely(!__pyx_t_5)) {
+      __pyx_t_6 = __pyx_t_14(__pyx_t_10);
+      if (unlikely(!__pyx_t_6)) {
         if (PyErr_Occurred()) {
           if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
           else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         }
         break;
       }
-      __Pyx_GOTREF(__pyx_t_5);
+      __Pyx_GOTREF(__pyx_t_6);
     }
-    __Pyx_XDECREF(__pyx_v_idx);
-    __pyx_v_idx = __pyx_t_5;
-    __pyx_t_5 = 0;
+    __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_6);
+    __pyx_t_6 = 0;
 
     /* "_distortion.pyx":773
  *         tot = self.LUT.coef.sum(axis= -1)
@@ -13922,11 +14241,10 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_12uncorrect(CYTHON_UNUSED P
  *             if t <= 0:
  *                 lmask[idx] = 1
  */
-    __pyx_t_5 = PyObject_GetItem(__pyx_v_tot, __pyx_v_idx); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_XDECREF(__pyx_v_t);
-    __pyx_v_t = __pyx_t_5;
-    __pyx_t_5 = 0;
+    __pyx_t_6 = PyObject_GetItem(__pyx_v_tot, __pyx_v_idx); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_6);
+    __pyx_t_6 = 0;
 
     /* "_distortion.pyx":774
  *         for idx in range(self.LUT.shape[0]):
@@ -13935,10 +14253,10 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_12uncorrect(CYTHON_UNUSED P
  *                 lmask[idx] = 1
  *                 continue
  */
-    __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    if (__pyx_t_11) {
+    __pyx_t_6 = PyObject_RichCompare(__pyx_v_t, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    if (__pyx_t_3) {
 
       /* "_distortion.pyx":775
  *             t = tot[idx]
@@ -13968,13 +14286,12 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_12uncorrect(CYTHON_UNUSED P
  *             lout[self.LUT[idx].idx] += val * self.LUT[idx].coef
  *         return out, mask
  */
-    __pyx_t_5 = PyObject_GetItem(__pyx_v_lin, __pyx_v_idx); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_12 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_v_t); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyObject_GetItem(__pyx_v_lin, __pyx_v_idx); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __pyx_t_12 = __Pyx_PyNumber_Divide(__pyx_t_6, __pyx_v_t); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_12);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __Pyx_XDECREF(__pyx_v_val);
-    __pyx_v_val = __pyx_t_12;
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __Pyx_XDECREF_SET(__pyx_v_val, __pyx_t_12);
     __pyx_t_12 = 0;
 
     /* "_distortion.pyx":778
@@ -13983,37 +14300,37 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_12uncorrect(CYTHON_UNUSED P
  *             lout[self.LUT[idx].idx] += val * self.LUT[idx].coef             # <<<<<<<<<<<<<<
  *         return out, mask
  */
-    __pyx_t_12 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__LUT); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__LUT); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_12);
-    __pyx_t_5 = PyObject_GetItem(__pyx_t_12, __pyx_v_idx); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
+    __pyx_t_6 = PyObject_GetItem(__pyx_t_12, __pyx_v_idx); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
     __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-    __pyx_t_12 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__idx); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s__idx); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_12);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_5 = PyObject_GetItem(__pyx_v_lout, __pyx_t_12); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __pyx_t_6 = PyObject_GetItem(__pyx_v_lout, __pyx_t_12); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__LUT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__LUT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_1 = PyObject_GetItem(__pyx_t_4, __pyx_v_idx); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_GetItem(__pyx_t_5, __pyx_v_idx); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__coef); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__coef); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_1 = PyNumber_Multiply(__pyx_v_val, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyNumber_Multiply(__pyx_v_val, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    if (PyObject_SetItem(__pyx_v_lout, __pyx_t_12, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    if (PyObject_SetItem(__pyx_v_lout, __pyx_t_12, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
     __pyx_L21_continue:;
   }
-  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
 
   /* "_distortion.pyx":779
  *             val = lin[idx]/t
@@ -14021,25 +14338,25 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_12uncorrect(CYTHON_UNUSED P
  *         return out, mask             # <<<<<<<<<<<<<<
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
+  __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_10);
   __Pyx_INCREF(__pyx_v_out);
-  PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_out);
+  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_out);
   __Pyx_GIVEREF(__pyx_v_out);
   __Pyx_INCREF(__pyx_v_mask);
-  PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_mask);
+  PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_mask);
   __Pyx_GIVEREF(__pyx_v_mask);
-  __pyx_r = ((PyObject *)__pyx_t_9);
-  __pyx_t_9 = 0;
+  __pyx_r = ((PyObject *)__pyx_t_10);
+  __pyx_t_10 = 0;
   goto __pyx_L0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_5);
-  __Pyx_XDECREF(__pyx_t_9);
+  __Pyx_XDECREF(__pyx_t_6);
+  __Pyx_XDECREF(__pyx_t_10);
   __Pyx_XDECREF(__pyx_t_12);
   __Pyx_AddTraceback("_distortion.Distortion.uncorrect", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
@@ -14059,8 +14376,8 @@ static PyObject *__pyx_pf_11_distortion_10Distortion_12uncorrect(CYTHON_UNUSED P
 }
 
 /* Python wrapper */
-static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
-static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
+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);
@@ -14115,7 +14432,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  * 
  *             cdef int copy_shape, i, ndim
  */
-  __pyx_t_1 = (__pyx_v_info == NULL);
+  __pyx_t_1 = ((__pyx_v_info == NULL) != 0);
   if (__pyx_t_1) {
     __pyx_r = 0;
     goto __pyx_L0;
@@ -14157,7 +14474,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 copy_shape = 1
  *             else:
  */
-  __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t)));
+  __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":209
@@ -14190,7 +14507,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
  *                 raise ValueError(u"ndarray is not C contiguous")
  */
-  __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS);
+  __pyx_t_1 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":214
@@ -14200,7 +14517,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 raise ValueError(u"ndarray is not C contiguous")
  * 
  */
-    __pyx_t_2 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS));
+    __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS) != 0)) != 0);
     __pyx_t_3 = __pyx_t_2;
   } else {
     __pyx_t_3 = __pyx_t_1;
@@ -14230,7 +14547,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
  *                 raise ValueError(u"ndarray is not Fortran contiguous")
  */
-  __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS);
+  __pyx_t_3 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0);
   if (__pyx_t_3) {
 
     /* "numpy.pxd":218
@@ -14240,7 +14557,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 raise ValueError(u"ndarray is not Fortran contiguous")
  * 
  */
-    __pyx_t_1 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS));
+    __pyx_t_1 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS) != 0)) != 0);
     __pyx_t_2 = __pyx_t_1;
   } else {
     __pyx_t_2 = __pyx_t_3;
@@ -14288,7 +14605,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 # Allocate new buffer for strides and shape info.
  *                 # This is allocated as one block, strides first.
  */
-  if (__pyx_v_copy_shape) {
+  __pyx_t_2 = (__pyx_v_copy_shape != 0);
+  if (__pyx_t_2) {
 
     /* "numpy.pxd":226
  *                 # Allocate new buffer for strides and shape info.
@@ -14386,7 +14704,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  * 
  *             cdef int t
  */
-  __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self));
+  __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0));
 
   /* "numpy.pxd":239
  * 
@@ -14404,8 +14722,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *             cdef list stack
  *             cdef int offset
  */
-  __Pyx_INCREF(((PyObject *)__pyx_v_self->descr));
-  __pyx_v_descr = __pyx_v_self->descr;
+  __pyx_t_4 = ((PyObject *)__pyx_v_self->descr);
+  __Pyx_INCREF(__pyx_t_4);
+  __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4);
+  __pyx_t_4 = 0;
 
   /* "numpy.pxd":244
  *             cdef int offset
@@ -14423,9 +14743,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 # do not call releasebuffer
  *                 info.obj = None
  */
-  __pyx_t_2 = (!__pyx_v_hasfields);
+  __pyx_t_2 = ((!(__pyx_v_hasfields != 0)) != 0);
   if (__pyx_t_2) {
-    __pyx_t_3 = (!__pyx_v_copy_shape);
+    __pyx_t_3 = ((!(__pyx_v_copy_shape != 0)) != 0);
     __pyx_t_1 = __pyx_t_3;
   } else {
     __pyx_t_1 = __pyx_t_2;
@@ -14470,7 +14790,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 t = descr.type_num
  *                 if ((descr.byteorder == c'>' and little_endian) or
  */
-  __pyx_t_1 = (!__pyx_v_hasfields);
+  __pyx_t_1 = ((!(__pyx_v_hasfields != 0)) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":254
@@ -14480,7 +14800,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 if ((descr.byteorder == c'>' and little_endian) or
  *                     (descr.byteorder == c'<' and not little_endian)):
  */
-    __pyx_v_t = __pyx_v_descr->type_num;
+    __pyx_t_5 = __pyx_v_descr->type_num;
+    __pyx_v_t = __pyx_t_5;
 
     /* "numpy.pxd":255
  *             if not hasfields:
@@ -14489,9 +14810,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                     (descr.byteorder == c'<' and not little_endian)):
  *                     raise ValueError(u"Non-native byte order not supported")
  */
-    __pyx_t_1 = (__pyx_v_descr->byteorder == '>');
+    __pyx_t_1 = ((__pyx_v_descr->byteorder == '>') != 0);
     if (__pyx_t_1) {
-      __pyx_t_2 = __pyx_v_little_endian;
+      __pyx_t_2 = (__pyx_v_little_endian != 0);
     } else {
       __pyx_t_2 = __pyx_t_1;
     }
@@ -14504,9 +14825,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                     raise ValueError(u"Non-native byte order not supported")
  *                 if   t == NPY_BYTE:        f = "b"
  */
-      __pyx_t_1 = (__pyx_v_descr->byteorder == '<');
+      __pyx_t_1 = ((__pyx_v_descr->byteorder == '<') != 0);
       if (__pyx_t_1) {
-        __pyx_t_3 = (!__pyx_v_little_endian);
+        __pyx_t_3 = ((!(__pyx_v_little_endian != 0)) != 0);
         __pyx_t_7 = __pyx_t_3;
       } else {
         __pyx_t_7 = __pyx_t_1;
@@ -14533,227 +14854,202 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
     }
     __pyx_L12:;
 
-    /* "numpy.pxd":258
+    /* "numpy.pxd":274
+ *                 elif t == NPY_CDOUBLE:     f = "Zd"
+ *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
+ *                 elif t == NPY_OBJECT:      f = "O"             # <<<<<<<<<<<<<<
+ *                 else:
+ *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
+ */
+    switch (__pyx_v_t) {
+
+      /* "numpy.pxd":258
  *                     (descr.byteorder == c'<' and not little_endian)):
  *                     raise ValueError(u"Non-native byte order not supported")
  *                 if   t == NPY_BYTE:        f = "b"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_UBYTE:       f = "B"
  *                 elif t == NPY_SHORT:       f = "h"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_BYTE);
-    if (__pyx_t_1) {
+      case NPY_BYTE:
       __pyx_v_f = __pyx_k__b;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":259
+      /* "numpy.pxd":259
  *                     raise ValueError(u"Non-native byte order not supported")
  *                 if   t == NPY_BYTE:        f = "b"
  *                 elif t == NPY_UBYTE:       f = "B"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_SHORT:       f = "h"
  *                 elif t == NPY_USHORT:      f = "H"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_UBYTE);
-    if (__pyx_t_1) {
+      case NPY_UBYTE:
       __pyx_v_f = __pyx_k__B;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":260
+      /* "numpy.pxd":260
  *                 if   t == NPY_BYTE:        f = "b"
  *                 elif t == NPY_UBYTE:       f = "B"
  *                 elif t == NPY_SHORT:       f = "h"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_USHORT:      f = "H"
  *                 elif t == NPY_INT:         f = "i"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_SHORT);
-    if (__pyx_t_1) {
+      case NPY_SHORT:
       __pyx_v_f = __pyx_k__h;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":261
+      /* "numpy.pxd":261
  *                 elif t == NPY_UBYTE:       f = "B"
  *                 elif t == NPY_SHORT:       f = "h"
  *                 elif t == NPY_USHORT:      f = "H"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_INT:         f = "i"
  *                 elif t == NPY_UINT:        f = "I"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_USHORT);
-    if (__pyx_t_1) {
+      case NPY_USHORT:
       __pyx_v_f = __pyx_k__H;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":262
+      /* "numpy.pxd":262
  *                 elif t == NPY_SHORT:       f = "h"
  *                 elif t == NPY_USHORT:      f = "H"
  *                 elif t == NPY_INT:         f = "i"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_UINT:        f = "I"
  *                 elif t == NPY_LONG:        f = "l"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_INT);
-    if (__pyx_t_1) {
+      case NPY_INT:
       __pyx_v_f = __pyx_k__i;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":263
+      /* "numpy.pxd":263
  *                 elif t == NPY_USHORT:      f = "H"
  *                 elif t == NPY_INT:         f = "i"
  *                 elif t == NPY_UINT:        f = "I"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_LONG:        f = "l"
  *                 elif t == NPY_ULONG:       f = "L"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_UINT);
-    if (__pyx_t_1) {
+      case NPY_UINT:
       __pyx_v_f = __pyx_k__I;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":264
+      /* "numpy.pxd":264
  *                 elif t == NPY_INT:         f = "i"
  *                 elif t == NPY_UINT:        f = "I"
  *                 elif t == NPY_LONG:        f = "l"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_ULONG:       f = "L"
  *                 elif t == NPY_LONGLONG:    f = "q"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_LONG);
-    if (__pyx_t_1) {
+      case NPY_LONG:
       __pyx_v_f = __pyx_k__l;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":265
+      /* "numpy.pxd":265
  *                 elif t == NPY_UINT:        f = "I"
  *                 elif t == NPY_LONG:        f = "l"
  *                 elif t == NPY_ULONG:       f = "L"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_LONGLONG:    f = "q"
  *                 elif t == NPY_ULONGLONG:   f = "Q"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_ULONG);
-    if (__pyx_t_1) {
+      case NPY_ULONG:
       __pyx_v_f = __pyx_k__L;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":266
+      /* "numpy.pxd":266
  *                 elif t == NPY_LONG:        f = "l"
  *                 elif t == NPY_ULONG:       f = "L"
  *                 elif t == NPY_LONGLONG:    f = "q"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_ULONGLONG:   f = "Q"
  *                 elif t == NPY_FLOAT:       f = "f"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG);
-    if (__pyx_t_1) {
+      case NPY_LONGLONG:
       __pyx_v_f = __pyx_k__q;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":267
+      /* "numpy.pxd":267
  *                 elif t == NPY_ULONG:       f = "L"
  *                 elif t == NPY_LONGLONG:    f = "q"
  *                 elif t == NPY_ULONGLONG:   f = "Q"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_FLOAT:       f = "f"
  *                 elif t == NPY_DOUBLE:      f = "d"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG);
-    if (__pyx_t_1) {
+      case NPY_ULONGLONG:
       __pyx_v_f = __pyx_k__Q;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":268
+      /* "numpy.pxd":268
  *                 elif t == NPY_LONGLONG:    f = "q"
  *                 elif t == NPY_ULONGLONG:   f = "Q"
  *                 elif t == NPY_FLOAT:       f = "f"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_DOUBLE:      f = "d"
  *                 elif t == NPY_LONGDOUBLE:  f = "g"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_FLOAT);
-    if (__pyx_t_1) {
+      case NPY_FLOAT:
       __pyx_v_f = __pyx_k__f;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":269
+      /* "numpy.pxd":269
  *                 elif t == NPY_ULONGLONG:   f = "Q"
  *                 elif t == NPY_FLOAT:       f = "f"
  *                 elif t == NPY_DOUBLE:      f = "d"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_LONGDOUBLE:  f = "g"
  *                 elif t == NPY_CFLOAT:      f = "Zf"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE);
-    if (__pyx_t_1) {
+      case NPY_DOUBLE:
       __pyx_v_f = __pyx_k__d;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":270
+      /* "numpy.pxd":270
  *                 elif t == NPY_FLOAT:       f = "f"
  *                 elif t == NPY_DOUBLE:      f = "d"
  *                 elif t == NPY_LONGDOUBLE:  f = "g"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_CFLOAT:      f = "Zf"
  *                 elif t == NPY_CDOUBLE:     f = "Zd"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE);
-    if (__pyx_t_1) {
+      case NPY_LONGDOUBLE:
       __pyx_v_f = __pyx_k__g;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":271
+      /* "numpy.pxd":271
  *                 elif t == NPY_DOUBLE:      f = "d"
  *                 elif t == NPY_LONGDOUBLE:  f = "g"
  *                 elif t == NPY_CFLOAT:      f = "Zf"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_CDOUBLE:     f = "Zd"
  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT);
-    if (__pyx_t_1) {
+      case NPY_CFLOAT:
       __pyx_v_f = __pyx_k__Zf;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":272
+      /* "numpy.pxd":272
  *                 elif t == NPY_LONGDOUBLE:  f = "g"
  *                 elif t == NPY_CFLOAT:      f = "Zf"
  *                 elif t == NPY_CDOUBLE:     f = "Zd"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
  *                 elif t == NPY_OBJECT:      f = "O"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE);
-    if (__pyx_t_1) {
+      case NPY_CDOUBLE:
       __pyx_v_f = __pyx_k__Zd;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":273
+      /* "numpy.pxd":273
  *                 elif t == NPY_CFLOAT:      f = "Zf"
  *                 elif t == NPY_CDOUBLE:     f = "Zd"
  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_OBJECT:      f = "O"
  *                 else:
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE);
-    if (__pyx_t_1) {
+      case NPY_CLONGDOUBLE:
       __pyx_v_f = __pyx_k__Zg;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":274
+      /* "numpy.pxd":274
  *                 elif t == NPY_CDOUBLE:     f = "Zd"
  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
  *                 elif t == NPY_OBJECT:      f = "O"             # <<<<<<<<<<<<<<
  *                 else:
  *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_OBJECT);
-    if (__pyx_t_1) {
+      case NPY_OBJECT:
       __pyx_v_f = __pyx_k__O;
-      goto __pyx_L13;
-    }
-    /*else*/ {
+      break;
+      default:
 
       /* "numpy.pxd":276
  *                 elif t == NPY_OBJECT:      f = "O"
@@ -14778,8 +15074,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
       {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      break;
     }
-    __pyx_L13:;
 
     /* "numpy.pxd":277
  *                 else:
@@ -14875,8 +15171,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
 }
 
 /* Python wrapper */
-static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
-static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
+static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
+static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
   __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));
@@ -14903,7 +15199,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s
  *                 stdlib.free(info.format)
  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
  */
-  __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self);
+  __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":290
@@ -14925,7 +15221,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s
  *                 stdlib.free(info.strides)
  *                 # info.shape was stored after info.strides in the same block
  */
-  __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t)));
+  __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":292
@@ -15230,8 +15526,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
     #else
     __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     #endif
-    __Pyx_XDECREF(__pyx_v_childname);
-    __pyx_v_childname = __pyx_t_3;
+    __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3);
     __pyx_t_3 = 0;
 
     /* "numpy.pxd":795
@@ -15244,8 +15539,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
     __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_XDECREF(((PyObject *)__pyx_v_fields));
-    __pyx_v_fields = ((PyObject*)__pyx_t_3);
+    __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3));
     __pyx_t_3 = 0;
 
     /* "numpy.pxd":796
@@ -15274,7 +15568,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
       __Pyx_INCREF(__pyx_t_4);
       #else
       __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
       __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_4);
       #endif
     } else if (1) {
       __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -15300,11 +15596,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
       __pyx_L6_unpacking_done:;
     }
     if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_XDECREF(((PyObject *)__pyx_v_child));
-    __pyx_v_child = ((PyArray_Descr *)__pyx_t_3);
+    __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3));
     __pyx_t_3 = 0;
-    __Pyx_XDECREF(__pyx_v_new_offset);
-    __pyx_v_new_offset = __pyx_t_4;
+    __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4);
     __pyx_t_4 = 0;
 
     /* "numpy.pxd":798
@@ -15354,9 +15648,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  *             (child.byteorder == c'<' and not little_endian)):
  *             raise ValueError(u"Non-native byte order not supported")
  */
-    __pyx_t_7 = (__pyx_v_child->byteorder == '>');
+    __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0);
     if (__pyx_t_7) {
-      __pyx_t_8 = __pyx_v_little_endian;
+      __pyx_t_8 = (__pyx_v_little_endian != 0);
     } else {
       __pyx_t_8 = __pyx_t_7;
     }
@@ -15369,9 +15663,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  *             raise ValueError(u"Non-native byte order not supported")
  *             # One could encode it in the format string and have Cython
  */
-      __pyx_t_7 = (__pyx_v_child->byteorder == '<');
+      __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0);
       if (__pyx_t_7) {
-        __pyx_t_9 = (!__pyx_v_little_endian);
+        __pyx_t_9 = ((!(__pyx_v_little_endian != 0)) != 0);
         __pyx_t_10 = __pyx_t_9;
       } else {
         __pyx_t_10 = __pyx_t_7;
@@ -15460,7 +15754,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  *             t = child.type_num
  *             if end - f < 5:
  */
-    __pyx_t_7 = (!PyDataType_HASFIELDS(__pyx_v_child));
+    __pyx_t_7 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0);
     if (__pyx_t_7) {
 
       /* "numpy.pxd":821
@@ -15472,8 +15766,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  */
       __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
-      __Pyx_XDECREF(__pyx_v_t);
-      __pyx_v_t = __pyx_t_3;
+      __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_3);
       __pyx_t_3 = 0;
 
       /* "numpy.pxd":822
@@ -15483,7 +15776,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  *                 raise RuntimeError(u"Format string allocated too short.")
  * 
  */
-      __pyx_t_7 = ((__pyx_v_end - __pyx_v_f) < 5);
+      __pyx_t_7 = (((__pyx_v_end - __pyx_v_f) < 5) != 0);
       if (__pyx_t_7) {
 
         /* "numpy.pxd":823
@@ -15905,6 +16198,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a
   PyObject *__pyx_v_baseptr;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
+  int __pyx_t_2;
   __Pyx_RefNannySetupContext("set_array_base", 0);
 
   /* "numpy.pxd":967
@@ -15915,7 +16209,8 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a
  *      else:
  */
   __pyx_t_1 = (__pyx_v_base == Py_None);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
     /* "numpy.pxd":968
  *      cdef PyObject* baseptr
@@ -15991,7 +16286,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py
  *         return None
  *     else:
  */
-  __pyx_t_1 = (__pyx_v_arr->base == NULL);
+  __pyx_t_1 = ((__pyx_v_arr->base == NULL) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":977
@@ -16036,6 +16331,9 @@ static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, P
   PyObject *__pyx_v_format = 0;
   PyObject *__pyx_v_mode = 0;
   int __pyx_v_allocate_buffer;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
@@ -16155,12 +16453,12 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
   Py_ssize_t __pyx_t_1;
   int __pyx_t_2;
   PyObject *__pyx_t_3 = NULL;
-  PyObject *__pyx_t_4 = NULL;
-  PyObject *__pyx_t_5 = NULL;
-  char *__pyx_t_6;
+  char *__pyx_t_4;
+  int __pyx_t_5;
+  int __pyx_t_6;
   int __pyx_t_7;
-  int __pyx_t_8;
-  int __pyx_t_9;
+  PyObject *__pyx_t_8 = NULL;
+  PyObject *__pyx_t_9 = NULL;
   Py_ssize_t __pyx_t_10;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
@@ -16172,7 +16470,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
   /* "View.MemoryView":120
  *         cdef PyObject **p
  * 
- *         self.ndim = len(shape)             # <<<<<<<<<<<<<<
+ *         self.ndim = <int> len(shape)             # <<<<<<<<<<<<<<
  *         self.itemsize = itemsize
  * 
  */
@@ -16181,11 +16479,11 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   __pyx_t_1 = PyTuple_GET_SIZE(((PyObject *)__pyx_v_shape)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_self->ndim = __pyx_t_1;
+  __pyx_v_self->ndim = ((int)__pyx_t_1);
 
   /* "View.MemoryView":121
  * 
- *         self.ndim = len(shape)
+ *         self.ndim = <int> len(shape)
  *         self.itemsize = itemsize             # <<<<<<<<<<<<<<
  * 
  *         if not self.ndim:
@@ -16199,7 +16497,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             raise ValueError("Empty shape tuple for cython.array")
  * 
  */
-  __pyx_t_2 = (!__pyx_v_self->ndim);
+  __pyx_t_2 = ((!(__pyx_v_self->ndim != 0)) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":124
@@ -16225,7 +16523,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             raise ValueError("itemsize <= 0 for cython.array")
  * 
  */
-  __pyx_t_2 = (__pyx_v_self->itemsize <= 0);
+  __pyx_t_2 = ((__pyx_v_self->itemsize <= 0) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":127
@@ -16251,17 +16549,11 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *         if encode:
  *             format = encode('ASCII')
  */
-  __pyx_t_3 = ((PyObject *)__pyx_n_s__encode);
-  __Pyx_INCREF(__pyx_t_3);
-  __pyx_t_4 = Py_None;
-  __Pyx_INCREF(__pyx_t_4);
-  __pyx_t_5 = __Pyx_GetAttr3(__pyx_v_format, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_v_encode = __pyx_t_5;
-  __pyx_t_5 = 0;
-
+  __pyx_t_3 = __Pyx_GetAttr3(__pyx_v_format, ((PyObject *)__pyx_n_s__encode), Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_v_encode = __pyx_t_3;
+  __pyx_t_3 = 0;
+
   /* "View.MemoryView":130
  * 
  *         encode = getattr(format, 'encode', None)
@@ -16279,11 +16571,10 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *         self._format = format
  *         self.format = self._format
  */
-    __pyx_t_5 = PyObject_Call(__pyx_v_encode, ((PyObject *)__pyx_k_tuple_99), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_v_format);
-    __pyx_v_format = __pyx_t_5;
-    __pyx_t_5 = 0;
+    __pyx_t_3 = PyObject_Call(__pyx_v_encode, ((PyObject *)__pyx_k_tuple_99), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_3);
+    __pyx_t_3 = 0;
     goto __pyx_L5;
   }
   __pyx_L5:;
@@ -16309,8 +16600,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  *         self._shape = <Py_ssize_t *> malloc(sizeof(Py_ssize_t)*self.ndim)
  */
-  __pyx_t_6 = PyBytes_AsString(((PyObject *)__pyx_v_self->_format)); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_self->format = __pyx_t_6;
+  __pyx_t_4 = __Pyx_PyObject_AsString(((PyObject *)__pyx_v_self->_format)); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_v_self->format = __pyx_t_4;
 
   /* "View.MemoryView":135
  *         self.format = self._format
@@ -16337,14 +16628,14 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             free(self._shape)
  *             free(self._strides)
  */
-  __pyx_t_2 = (!(__pyx_v_self->_shape != 0));
+  __pyx_t_2 = ((!(__pyx_v_self->_shape != 0)) != 0);
   if (!__pyx_t_2) {
-    __pyx_t_7 = (!(__pyx_v_self->_strides != 0));
-    __pyx_t_8 = __pyx_t_7;
+    __pyx_t_5 = ((!(__pyx_v_self->_strides != 0)) != 0);
+    __pyx_t_6 = __pyx_t_5;
   } else {
-    __pyx_t_8 = __pyx_t_2;
+    __pyx_t_6 = __pyx_t_2;
   }
-  if (__pyx_t_8) {
+  if (__pyx_t_6) {
 
     /* "View.MemoryView":139
  * 
@@ -16371,10 +16662,10 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  * 
  */
-    __pyx_t_5 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_101), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_101), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L6;
   }
@@ -16396,20 +16687,19 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             if dim <= 0:
  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
  */
-  __pyx_t_9 = 0;
-  __pyx_t_5 = ((PyObject *)__pyx_v_shape); __Pyx_INCREF(__pyx_t_5); __pyx_t_1 = 0;
+  __pyx_t_7 = 0;
+  __pyx_t_3 = ((PyObject *)__pyx_v_shape); __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
   for (;;) {
-    if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
+    if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
     #if CYTHON_COMPILING_IN_CPYTHON
-    __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_1); __Pyx_INCREF(__pyx_t_4); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_8); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     #else
-    __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_8 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     #endif
-    __Pyx_XDECREF(__pyx_v_dim);
-    __pyx_v_dim = __pyx_t_4;
-    __pyx_t_4 = 0;
-    __pyx_v_idx = __pyx_t_9;
-    __pyx_t_9 = (__pyx_t_9 + 1);
+    __Pyx_XDECREF_SET(__pyx_v_dim, __pyx_t_8);
+    __pyx_t_8 = 0;
+    __pyx_v_idx = __pyx_t_7;
+    __pyx_t_7 = (__pyx_t_7 + 1);
 
     /* "View.MemoryView":146
  *         idx = 0
@@ -16418,10 +16708,10 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
  * 
  */
-    __pyx_t_4 = PyObject_RichCompare(__pyx_v_dim, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    if (__pyx_t_8) {
+    __pyx_t_8 = PyObject_RichCompare(__pyx_v_dim, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    if (__pyx_t_6) {
 
       /* "View.MemoryView":147
  *         for idx, dim in enumerate(shape):
@@ -16430,29 +16720,29 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  *             self._shape[idx] = dim
  */
-      __pyx_t_4 = PyInt_FromLong(__pyx_v_idx); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
-      __Pyx_GIVEREF(__pyx_t_4);
+      __pyx_t_8 = PyInt_FromLong(__pyx_v_idx); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_8);
+      __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
+      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8);
+      __Pyx_GIVEREF(__pyx_t_8);
       __Pyx_INCREF(__pyx_v_dim);
-      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_dim);
+      PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_dim);
       __Pyx_GIVEREF(__pyx_v_dim);
-      __pyx_t_4 = 0;
-      __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_102), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
-      __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
-      __pyx_t_4 = 0;
-      __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+      __pyx_t_8 = 0;
+      __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_102), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_8));
+      __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
+      __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
+      PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_t_8));
+      __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
+      __pyx_t_8 = 0;
+      __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_8);
+      __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
+      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
+      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
       {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L9;
     }
@@ -16477,7 +16767,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  */
     __pyx_v_idx = (__pyx_v_idx + 1);
   }
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
   /* "View.MemoryView":152
  *             idx += 1
@@ -16487,21 +16777,21 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  */
   __Pyx_INCREF(__pyx_v_mode);
-  __pyx_t_5 = __pyx_v_mode;
-  __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, ((PyObject *)__pyx_n_s__fortran), Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (((int)__pyx_t_8)) {
-    __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, ((PyObject *)__pyx_n_s__c), Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_7 = ((int)__pyx_t_2);
+  __pyx_t_3 = __pyx_v_mode;
+  __pyx_t_8 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__fortran), Py_NE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+  if (((int)__pyx_t_6)) {
+    __pyx_t_8 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__c), Py_NE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    __pyx_t_5 = ((int)__pyx_t_2);
   } else {
-    __pyx_t_7 = ((int)__pyx_t_8);
+    __pyx_t_5 = ((int)__pyx_t_6);
   }
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __pyx_t_8 = __pyx_t_7;
-  if (__pyx_t_8) {
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_6 = (__pyx_t_5 != 0);
+  if (__pyx_t_6) {
 
     /* "View.MemoryView":153
  * 
@@ -16510,18 +16800,18 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  *         cdef char order
  */
-    __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_103), __pyx_v_mode); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
-    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_5));
-    __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
-    __pyx_t_5 = 0;
-    __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_103), __pyx_v_mode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+    __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_8);
+    PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_3));
+    __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
+    __pyx_t_3 = 0;
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
+    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L10;
   }
@@ -16534,10 +16824,10 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             order = 'F'
  *         else:
  */
-  __pyx_t_5 = PyObject_RichCompare(__pyx_v_mode, ((PyObject *)__pyx_n_s__fortran), Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  if (__pyx_t_8) {
+  __pyx_t_3 = PyObject_RichCompare(__pyx_v_mode, ((PyObject *)__pyx_n_s__fortran), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  if (__pyx_t_6) {
 
     /* "View.MemoryView":157
  *         cdef char order
@@ -16578,14 +16868,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *         if decode:
  *             mode = decode('ASCII')
  */
-  __pyx_t_5 = ((PyObject *)__pyx_n_s__decode);
-  __Pyx_INCREF(__pyx_t_5);
-  __pyx_t_4 = Py_None;
-  __Pyx_INCREF(__pyx_t_4);
-  __pyx_t_3 = __Pyx_GetAttr3(__pyx_v_mode, __pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_GetAttr3(__pyx_v_mode, ((PyObject *)__pyx_n_s__decode), Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   __pyx_v_decode = __pyx_t_3;
   __pyx_t_3 = 0;
 
@@ -16596,8 +16880,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             mode = decode('ASCII')
  *         self.mode = mode
  */
-  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_decode); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__pyx_t_8) {
+  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_decode); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__pyx_t_6) {
 
     /* "View.MemoryView":166
  *         decode = getattr(mode, 'decode', None)
@@ -16608,8 +16892,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  */
     __pyx_t_3 = PyObject_Call(__pyx_v_decode, ((PyObject *)__pyx_k_tuple_104), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_v_mode);
-    __pyx_v_mode = __pyx_t_3;
+    __Pyx_DECREF_SET(__pyx_v_mode, __pyx_t_3);
     __pyx_t_3 = 0;
     goto __pyx_L12;
   }
@@ -16646,9 +16929,9 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             self.data = <char *>malloc(self.len)
  */
   __pyx_t_3 = PyObject_RichCompare(__pyx_v_format, ((PyObject *)__pyx_n_b__O), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_v_self->dtype_is_object = __pyx_t_8;
+  __pyx_v_self->dtype_is_object = __pyx_t_6;
 
   /* "View.MemoryView":171
  *         self.free_data = allocate_buffer
@@ -16657,7 +16940,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             self.data = <char *>malloc(self.len)
  *             if not self.data:
  */
-  if (__pyx_v_allocate_buffer) {
+  __pyx_t_6 = (__pyx_v_allocate_buffer != 0);
+  if (__pyx_t_6) {
 
     /* "View.MemoryView":172
  *         self.dtype_is_object = format == b'O'
@@ -16675,8 +16959,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *                 raise MemoryError("unable to allocate array data.")
  * 
  */
-    __pyx_t_8 = (!(__pyx_v_self->data != 0));
-    if (__pyx_t_8) {
+    __pyx_t_6 = ((!(__pyx_v_self->data != 0)) != 0);
+    if (__pyx_t_6) {
 
       /* "View.MemoryView":174
  *             self.data = <char *>malloc(self.len)
@@ -16701,7 +16985,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *                 p = <PyObject **> self.data
  *                 for i in range(self.len / itemsize):
  */
-    if (__pyx_v_self->dtype_is_object) {
+    __pyx_t_6 = (__pyx_v_self->dtype_is_object != 0);
+    if (__pyx_t_6) {
 
       /* "View.MemoryView":177
  * 
@@ -16720,11 +17005,23 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *                     Py_INCREF(Py_None)
  */
       if (unlikely(__pyx_v_itemsize == 0)) {
+        #ifdef WITH_THREAD
+        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+        #endif
         PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero");
+        #ifdef WITH_THREAD
+        PyGILState_Release(__pyx_gilstate_save);
+        #endif
         {__pyx_filename = __pyx_f[2]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       }
       else if (sizeof(Py_ssize_t) == sizeof(long) && unlikely(__pyx_v_itemsize == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) {
+        #ifdef WITH_THREAD
+        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+        #endif
         PyErr_Format(PyExc_OverflowError, "value too large to perform division");
+        #ifdef WITH_THREAD
+        PyGILState_Release(__pyx_gilstate_save);
+        #endif
         {__pyx_filename = __pyx_f[2]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       }
       __pyx_t_1 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_itemsize);
@@ -16760,8 +17057,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_XDECREF(__pyx_t_4);
-  __Pyx_XDECREF(__pyx_t_5);
+  __Pyx_XDECREF(__pyx_t_8);
+  __Pyx_XDECREF(__pyx_t_9);
   __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
@@ -16775,8 +17072,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
 }
 
 /* Python wrapper */
-static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
-static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
+static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
+static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
@@ -16798,8 +17095,12 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
-  PyObject *__pyx_t_2 = NULL;
-  int __pyx_t_3;
+  int __pyx_t_2;
+  PyObject *__pyx_t_3 = NULL;
+  char *__pyx_t_4;
+  Py_ssize_t __pyx_t_5;
+  int __pyx_t_6;
+  Py_ssize_t *__pyx_t_7;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -16826,7 +17127,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         elif self.mode == b"fortran":
  */
   __pyx_t_1 = (__Pyx_PyUnicode_Equals(((PyObject *)__pyx_v_self->mode), ((PyObject *)__pyx_n_b__c), Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":186
  *         cdef int bufmode = -1
@@ -16846,7 +17148,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
  *         if not (flags & bufmode):
  */
-  __pyx_t_1 = (__Pyx_PyUnicode_Equals(((PyObject *)__pyx_v_self->mode), ((PyObject *)__pyx_n_b__fortran), Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = (__Pyx_PyUnicode_Equals(((PyObject *)__pyx_v_self->mode), ((PyObject *)__pyx_n_b__fortran), Py_EQ)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = (__pyx_t_2 != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":188
@@ -16868,7 +17171,7 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
  *         info.buf = self.data
  */
-  __pyx_t_1 = (!(__pyx_v_flags & __pyx_v_bufmode));
+  __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":190
@@ -16878,10 +17181,10 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.buf = self.data
  *         info.len = self.len
  */
-    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_108), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_108), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L4;
   }
@@ -16894,7 +17197,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.len = self.len
  *         info.ndim = self.ndim
  */
-  __pyx_v_info->buf = __pyx_v_self->data;
+  __pyx_t_4 = __pyx_v_self->data;
+  __pyx_v_info->buf = __pyx_t_4;
 
   /* "View.MemoryView":192
  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
@@ -16903,7 +17207,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.ndim = self.ndim
  *         info.shape = self._shape
  */
-  __pyx_v_info->len = __pyx_v_self->len;
+  __pyx_t_5 = __pyx_v_self->len;
+  __pyx_v_info->len = __pyx_t_5;
 
   /* "View.MemoryView":193
  *         info.buf = self.data
@@ -16912,7 +17217,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.shape = self._shape
  *         info.strides = self._strides
  */
-  __pyx_v_info->ndim = __pyx_v_self->ndim;
+  __pyx_t_6 = __pyx_v_self->ndim;
+  __pyx_v_info->ndim = __pyx_t_6;
 
   /* "View.MemoryView":194
  *         info.len = self.len
@@ -16921,7 +17227,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.strides = self._strides
  *         info.suboffsets = NULL
  */
-  __pyx_v_info->shape = __pyx_v_self->_shape;
+  __pyx_t_7 = __pyx_v_self->_shape;
+  __pyx_v_info->shape = __pyx_t_7;
 
   /* "View.MemoryView":195
  *         info.ndim = self.ndim
@@ -16930,7 +17237,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.suboffsets = NULL
  *         info.itemsize = self.itemsize
  */
-  __pyx_v_info->strides = __pyx_v_self->_strides;
+  __pyx_t_7 = __pyx_v_self->_strides;
+  __pyx_v_info->strides = __pyx_t_7;
 
   /* "View.MemoryView":196
  *         info.shape = self._shape
@@ -16948,7 +17256,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.readonly = 0
  * 
  */
-  __pyx_v_info->itemsize = __pyx_v_self->itemsize;
+  __pyx_t_5 = __pyx_v_self->itemsize;
+  __pyx_v_info->itemsize = __pyx_t_5;
 
   /* "View.MemoryView":198
  *         info.suboffsets = NULL
@@ -16966,8 +17275,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *             info.format = self.format
  *         else:
  */
-  __pyx_t_3 = (__pyx_v_flags & PyBUF_FORMAT);
-  if (__pyx_t_3) {
+  __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
+  if (__pyx_t_1) {
 
     /* "View.MemoryView":201
  * 
@@ -16976,7 +17285,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         else:
  *             info.format = NULL
  */
-    __pyx_v_info->format = __pyx_v_self->format;
+    __pyx_t_4 = __pyx_v_self->format;
+    __pyx_v_info->format = __pyx_t_4;
     goto __pyx_L5;
   }
   /*else*/ {
@@ -17008,7 +17318,7 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
   __pyx_r = 0;
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_2);
+  __Pyx_XDECREF(__pyx_t_3);
   __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) {
@@ -17055,7 +17365,7 @@ static void __pyx_array_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *_
  *             self.callback_free_data(self.data)
  *         elif self.free_data:
  */
-  __pyx_t_1 = (__pyx_v_self->callback_free_data != NULL);
+  __pyx_t_1 = ((__pyx_v_self->callback_free_data != NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":211
@@ -17076,7 +17386,8 @@ static void __pyx_array_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *_
  *             if self.dtype_is_object:
  *                 refcount_objects_in_slice(self.data, self._shape,
  */
-  if (__pyx_v_self->free_data) {
+  __pyx_t_1 = (__pyx_v_self->free_data != 0);
+  if (__pyx_t_1) {
 
     /* "View.MemoryView":213
  *             self.callback_free_data(self.data)
@@ -17085,7 +17396,8 @@ static void __pyx_array_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *_
  *                 refcount_objects_in_slice(self.data, self._shape,
  *                                           self._strides, self.ndim, False)
  */
-    if (__pyx_v_self->dtype_is_object) {
+    __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
+    if (__pyx_t_1) {
 
       /* "View.MemoryView":215
  *             if self.dtype_is_object:
@@ -17253,9 +17565,9 @@ static PyObject *__pyx_array_MemoryView_5array_6__getattr__(struct __pyx_array_o
  *     def __getitem__(self, item):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __pyx_r = __pyx_t_2;
@@ -17312,7 +17624,7 @@ static PyObject *__pyx_array_MemoryView_5array_8__getitem__(struct __pyx_array_o
  *     def __setitem__(self, item, value):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (!__pyx_t_2) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
@@ -17369,7 +17681,7 @@ static int __pyx_array_MemoryView_5array_10__setitem__(struct __pyx_array_obj *_
  * 
  * 
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   if (PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -17414,7 +17726,7 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize
  *         result = array(shape, itemsize, format, mode.decode('ASCII'))
  *     else:
  */
-  __pyx_t_1 = (__pyx_v_buf == NULL);
+  __pyx_t_1 = ((__pyx_v_buf == NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":245
@@ -17426,7 +17738,7 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize
  */
     __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_3 = PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_3));
     __pyx_t_4 = ((PyObject *)__Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_4));
@@ -17462,7 +17774,7 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize
  */
     __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_5 = PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_5));
     __pyx_t_3 = ((PyObject *)__Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_3));
@@ -17544,6 +17856,9 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize
 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_name = 0;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
@@ -17700,7 +18015,7 @@ static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment)
  *         aligned_p += alignment - offset
  * 
  */
-  __pyx_t_1 = (__pyx_v_offset > 0);
+  __pyx_t_1 = ((__pyx_v_offset > 0) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":303
@@ -17736,6 +18051,9 @@ static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_ar
   PyObject *__pyx_v_obj = 0;
   int __pyx_v_flags;
   int __pyx_v_dtype_is_object;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
@@ -17853,11 +18171,11 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor
  *             if <PyObject *> self.view.obj == NULL:
  */
   __pyx_t_1 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)((PyObject *)__pyx_memoryview_type)));
-  if (!__pyx_t_1) {
+  if (!(__pyx_t_1 != 0)) {
     __pyx_t_2 = (__pyx_v_obj != Py_None);
-    __pyx_t_3 = __pyx_t_2;
+    __pyx_t_3 = (__pyx_t_2 != 0);
   } else {
-    __pyx_t_3 = __pyx_t_1;
+    __pyx_t_3 = (__pyx_t_1 != 0);
   }
   if (__pyx_t_3) {
 
@@ -17877,7 +18195,7 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor
  *                 (<__pyx_buffer *> &self.view).obj = Py_None
  *                 Py_INCREF(Py_None)
  */
-    __pyx_t_3 = (((PyObject *)__pyx_v_self->view.obj) == NULL);
+    __pyx_t_3 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0);
     if (__pyx_t_3) {
 
       /* "View.MemoryView":329
@@ -17920,7 +18238,7 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor
  *             raise MemoryError
  * 
  */
-  __pyx_t_3 = (__pyx_v_self->lock == NULL);
+  __pyx_t_3 = ((__pyx_v_self->lock == NULL) != 0);
   if (__pyx_t_3) {
 
     /* "View.MemoryView":334
@@ -17942,8 +18260,8 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor
  *             self.dtype_is_object = self.view.format == b'O'
  *         else:
  */
-  __pyx_t_4 = (__pyx_v_flags & PyBUF_FORMAT);
-  if (__pyx_t_4) {
+  __pyx_t_3 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
+  if (__pyx_t_3) {
 
     /* "View.MemoryView":337
  * 
@@ -17952,7 +18270,7 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor
  *         else:
  *             self.dtype_is_object = dtype_is_object
  */
-    __pyx_t_5 = PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_5));
     __pyx_t_6 = PyObject_RichCompare(((PyObject *)__pyx_t_5), ((PyObject *)__pyx_n_b__O), Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
@@ -18024,6 +18342,7 @@ static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) {
 static void __pyx_memoryview_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) {
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
+  int __pyx_t_2;
   __Pyx_RefNannySetupContext("__dealloc__", 0);
 
   /* "View.MemoryView":346
@@ -18034,7 +18353,8 @@ static void __pyx_memoryview_MemoryView_10memoryview_2__dealloc__(struct __pyx_m
  * 
  */
   __pyx_t_1 = (__pyx_v_self->obj != Py_None);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":347
  *     def __dealloc__(memoryview self):
@@ -18055,8 +18375,8 @@ static void __pyx_memoryview_MemoryView_10memoryview_2__dealloc__(struct __pyx_m
  *             PyThread_free_lock(self.lock)
  * 
  */
-  __pyx_t_1 = (__pyx_v_self->lock != NULL);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((__pyx_v_self->lock != NULL) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":350
  * 
@@ -18150,8 +18470,7 @@ static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__py
       }
       __Pyx_GOTREF(__pyx_t_5);
     }
-    __Pyx_XDECREF(__pyx_v_idx);
-    __pyx_v_idx = __pyx_t_5;
+    __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5);
     __pyx_t_5 = 0;
     __pyx_v_dim = __pyx_t_1;
     __pyx_t_1 = (__pyx_t_1 + 1);
@@ -18218,12 +18537,13 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
-  PyObject *__pyx_t_2 = NULL;
+  int __pyx_t_2;
   PyObject *__pyx_t_3 = NULL;
   PyObject *__pyx_t_4 = NULL;
   PyObject *__pyx_t_5 = NULL;
-  PyObject *(*__pyx_t_6)(PyObject *);
-  char *__pyx_t_7;
+  PyObject *__pyx_t_6 = NULL;
+  PyObject *(*__pyx_t_7)(PyObject *);
+  char *__pyx_t_8;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -18237,7 +18557,8 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  * 
  */
   __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":364
  *     def __getitem__(memoryview self, object index):
@@ -18261,10 +18582,10 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  * 
  *         cdef char *itemp
  */
-  __pyx_t_2 = ((PyObject *)_unellipsify(__pyx_v_index, __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  if (likely(PyTuple_CheckExact(__pyx_t_2))) {
-    PyObject* sequence = __pyx_t_2;
+  __pyx_t_3 = ((PyObject *)_unellipsify(__pyx_v_index, __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  if (likely(PyTuple_CheckExact(__pyx_t_3))) {
+    PyObject* sequence = __pyx_t_3;
     #if CYTHON_COMPILING_IN_CPYTHON
     Py_ssize_t size = Py_SIZE(sequence);
     #else
@@ -18276,43 +18597,45 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
       {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     #if CYTHON_COMPILING_IN_CPYTHON
-    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
-    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
-    __Pyx_INCREF(__pyx_t_3);
+    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
+    __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
     __Pyx_INCREF(__pyx_t_4);
+    __Pyx_INCREF(__pyx_t_5);
     #else
-    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
     #endif
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   } else if (1) {
     __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   } else
   {
     Py_ssize_t index = -1;
-    __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
-    index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L4_unpacking_failed;
-    __Pyx_GOTREF(__pyx_t_3);
-    index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed;
+    __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
+    index = 0; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed;
     __Pyx_GOTREF(__pyx_t_4);
-    if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_6 = NULL;
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L4_unpacking_failed;
+    __Pyx_GOTREF(__pyx_t_5);
+    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = NULL;
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
     goto __pyx_L5_unpacking_done;
     __pyx_L4_unpacking_failed:;
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_6 = NULL;
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __pyx_t_7 = NULL;
     if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_L5_unpacking_done:;
   }
-  __pyx_v_have_slices = __pyx_t_3;
-  __pyx_t_3 = 0;
-  __pyx_v_indices = __pyx_t_4;
+  __pyx_v_have_slices = __pyx_t_4;
   __pyx_t_4 = 0;
+  __pyx_v_indices = __pyx_t_5;
+  __pyx_t_5 = 0;
 
   /* "View.MemoryView":369
  * 
@@ -18321,8 +18644,8 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  *             return memview_slice(self, indices)
  *         else:
  */
-  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__pyx_t_1) {
+  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":370
  *         cdef char *itemp
@@ -18332,10 +18655,10 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  *             itemp = self.get_item_pointer(indices)
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_2 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_r = __pyx_t_2;
-    __pyx_t_2 = 0;
+    __pyx_t_3 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_r = __pyx_t_3;
+    __pyx_t_3 = 0;
     goto __pyx_L0;
     goto __pyx_L6;
   }
@@ -18348,8 +18671,8 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  *             return self.convert_item_to_object(itemp)
  * 
  */
-    __pyx_t_7 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_v_itemp = __pyx_t_7;
+    __pyx_t_8 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_8 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_v_itemp = __pyx_t_8;
 
     /* "View.MemoryView":373
  *         else:
@@ -18359,10 +18682,10 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  *     def __setitem__(memoryview self, object index, object value):
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_r = __pyx_t_2;
-    __pyx_t_2 = 0;
+    __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_r = __pyx_t_3;
+    __pyx_t_3 = 0;
     goto __pyx_L0;
   }
   __pyx_L6:;
@@ -18370,10 +18693,10 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_5);
+  __Pyx_XDECREF(__pyx_t_6);
   __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
@@ -18448,7 +18771,9 @@ static int __pyx_memoryview_MemoryView_10memoryview_6__setitem__(struct __pyx_me
     __Pyx_INCREF(__pyx_t_3);
     #else
     __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
     __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
     #endif
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   } else if (1) {
@@ -18477,8 +18802,7 @@ static int __pyx_memoryview_MemoryView_10memoryview_6__setitem__(struct __pyx_me
   }
   __pyx_v_have_slices = __pyx_t_2;
   __pyx_t_2 = 0;
-  __Pyx_DECREF(__pyx_v_index);
-  __pyx_v_index = __pyx_t_3;
+  __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_3);
   __pyx_t_3 = 0;
 
   /* "View.MemoryView":378
@@ -18591,9 +18915,9 @@ static int __pyx_memoryview_MemoryView_10memoryview_6__setitem__(struct __pyx_me
 static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
+  int __pyx_t_1;
   int __pyx_t_2;
-  int __pyx_t_3;
+  PyObject *__pyx_t_3 = NULL;
   PyObject *__pyx_t_4 = NULL;
   PyObject *__pyx_t_5 = NULL;
   PyObject *__pyx_t_6 = NULL;
@@ -18613,12 +18937,9 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
  *             try:
  *                 obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS,
  */
-  __pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryview_type));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = (!__pyx_t_2);
-  if (__pyx_t_3) {
+  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, ((PyObject *)__pyx_memoryview_type)); 
+  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":389
  *     cdef is_slice(self, obj):
@@ -18628,10 +18949,10 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
  *                                  self.dtype_is_object)
  */
     {
-      __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
+      __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
+      __Pyx_XGOTREF(__pyx_t_3);
       __Pyx_XGOTREF(__pyx_t_4);
       __Pyx_XGOTREF(__pyx_t_5);
-      __Pyx_XGOTREF(__pyx_t_6);
       /*try:*/ {
 
         /* "View.MemoryView":390
@@ -18641,8 +18962,8 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
  *                                  self.dtype_is_object)
  *             except TypeError:
  */
-        __pyx_t_1 = PyInt_FromLong((__pyx_v_self->flags | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
-        __Pyx_GOTREF(__pyx_t_1);
+        __pyx_t_6 = PyInt_FromLong((__pyx_v_self->flags | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+        __Pyx_GOTREF(__pyx_t_6);
 
         /* "View.MemoryView":391
  *             try:
@@ -18658,25 +18979,24 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
         __Pyx_INCREF(__pyx_v_obj);
         PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj);
         __Pyx_GIVEREF(__pyx_v_obj);
-        PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_1);
-        __Pyx_GIVEREF(__pyx_t_1);
+        PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
+        __Pyx_GIVEREF(__pyx_t_6);
         PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
         __Pyx_GIVEREF(__pyx_t_7);
-        __pyx_t_1 = 0;
+        __pyx_t_6 = 0;
         __pyx_t_7 = 0;
         __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject *)__pyx_memoryview_type)), ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
         __Pyx_GOTREF(__pyx_t_7);
         __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
-        __Pyx_DECREF(__pyx_v_obj);
-        __pyx_v_obj = __pyx_t_7;
+        __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7);
         __pyx_t_7 = 0;
       }
+      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
       goto __pyx_L11_try_end;
       __pyx_L4_error:;
-      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
       __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
 
@@ -18690,10 +19010,10 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
       __pyx_t_9 = PyErr_ExceptionMatches(__pyx_builtin_TypeError);
       if (__pyx_t_9) {
         __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
-        if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
+        if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
         __Pyx_GOTREF(__pyx_t_7);
         __Pyx_GOTREF(__pyx_t_8);
-        __Pyx_GOTREF(__pyx_t_1);
+        __Pyx_GOTREF(__pyx_t_6);
 
         /* "View.MemoryView":393
  *                                  self.dtype_is_object)
@@ -18705,32 +19025,32 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
         __Pyx_XDECREF(__pyx_r);
         __Pyx_INCREF(Py_None);
         __pyx_r = Py_None;
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
         goto __pyx_L7_except_return;
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
         goto __pyx_L5_exception_handled;
       }
       __pyx_L6_except_error:;
+      __Pyx_XGIVEREF(__pyx_t_3);
       __Pyx_XGIVEREF(__pyx_t_4);
       __Pyx_XGIVEREF(__pyx_t_5);
-      __Pyx_XGIVEREF(__pyx_t_6);
-      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
+      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
       goto __pyx_L1_error;
       __pyx_L7_except_return:;
+      __Pyx_XGIVEREF(__pyx_t_3);
       __Pyx_XGIVEREF(__pyx_t_4);
       __Pyx_XGIVEREF(__pyx_t_5);
-      __Pyx_XGIVEREF(__pyx_t_6);
-      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
+      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
       goto __pyx_L0;
       __pyx_L5_exception_handled:;
+      __Pyx_XGIVEREF(__pyx_t_3);
       __Pyx_XGIVEREF(__pyx_t_4);
       __Pyx_XGIVEREF(__pyx_t_5);
-      __Pyx_XGIVEREF(__pyx_t_6);
-      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
+      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
       __pyx_L11_try_end:;
     }
     goto __pyx_L3;
@@ -18752,7 +19072,7 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_XDECREF(__pyx_t_6);
   __Pyx_XDECREF(__pyx_t_7);
   __Pyx_XDECREF(__pyx_t_8);
   __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -18778,11 +19098,9 @@ static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryvi
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
-  PyObject *__pyx_t_2 = NULL;
-  PyObject *__pyx_t_3 = NULL;
+  int __pyx_t_2;
+  int __pyx_t_3;
   int __pyx_t_4;
-  int __pyx_t_5;
-  int __pyx_t_6;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -18796,8 +19114,6 @@ static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryvi
  *                                  src.ndim, dst.ndim, self.dtype_is_object)
  */
   if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_1 = __pyx_v_src;
-  __Pyx_INCREF(__pyx_t_1);
 
   /* "View.MemoryView":402
  * 
@@ -18807,8 +19123,6 @@ static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryvi
  * 
  */
   if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_2 = __pyx_v_dst;
-  __Pyx_INCREF(__pyx_t_2);
 
   /* "View.MemoryView":403
  *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
@@ -18817,24 +19131,20 @@ static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryvi
  * 
  *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):
  */
-  __pyx_t_3 = PyObject_GetAttr(__pyx_v_src, __pyx_n_s__ndim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = PyObject_GetAttr(__pyx_v_dst, __pyx_n_s__ndim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_6 = __pyx_memoryview_copy_contents((__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_t_1), (&__pyx_v_src_slice))[0]), (__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_t_2), (&__pyx_v_dst_slice))[0]), __pyx_t_4, __pyx_t_5, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s__ndim); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __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_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s__ndim); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_4 = __pyx_memoryview_copy_contents((__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice))[0]), (__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice))[0]), __pyx_t_2, __pyx_t_3, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_XDECREF(__pyx_t_3);
   __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
@@ -18896,7 +19206,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor
  *             tmp = malloc(self.view.itemsize)
  *             if tmp == NULL:
  */
-  __pyx_t_1 = (((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array)));
+  __pyx_t_1 = ((((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":414
@@ -18915,7 +19225,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor
  *                 raise MemoryError
  *             item = tmp
  */
-    __pyx_t_1 = (__pyx_v_tmp == NULL);
+    __pyx_t_1 = ((__pyx_v_tmp == NULL) != 0);
     if (__pyx_t_1) {
 
       /* "View.MemoryView":416
@@ -18960,7 +19270,8 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor
  *             (<PyObject **> item)[0] = <PyObject *> value
  *         else:
  */
-  if (__pyx_v_self->dtype_is_object) {
+  __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
+  if (__pyx_t_1) {
 
     /* "View.MemoryView":422
  * 
@@ -19070,7 +19381,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor
  *             assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
  *         slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
  */
-  __pyx_t_1 = (__pyx_v_self->view.suboffsets != NULL);
+  __pyx_t_1 = ((__pyx_v_self->view.suboffsets != NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":433
@@ -19219,9 +19530,9 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview
  *         try:
  *             result = struct.unpack(self.view.format, bytesitem)
  */
-  __pyx_t_1 = PyBytes_FromStringAndSize(((const char*)__pyx_v_itemp) + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  __pyx_v_bytesitem = __pyx_t_1;
+  __pyx_v_bytesitem = ((PyObject*)__pyx_t_1);
   __pyx_t_1 = 0;
 
   /* "View.MemoryView":449
@@ -19245,9 +19556,9 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview
  *         except struct.error:
  *             raise ValueError("Unable to convert item to object")
  */
-      __pyx_t_1 = PyObject_GetAttr(__pyx_v_struct, __pyx_n_s__unpack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s__unpack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_5 = PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_5));
       __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       __Pyx_GOTREF(__pyx_t_6);
@@ -19274,7 +19585,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview
  *             return result
  */
       __pyx_t_7 = strlen(__pyx_v_self->view.format); 
-      __pyx_t_8 = (__pyx_t_7 == 1);
+      __pyx_t_8 = ((__pyx_t_7 == 1) != 0);
       if (__pyx_t_8) {
 
         /* "View.MemoryView":455
@@ -19285,7 +19596,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview
  * 
  */
         __Pyx_XDECREF(__pyx_r);
-        __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_result, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
+        __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_result, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_5) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
         __Pyx_GOTREF(__pyx_t_5);
         __pyx_r = __pyx_t_5;
         __pyx_t_5 = 0;
@@ -19322,7 +19633,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview
  *             raise ValueError("Unable to convert item to object")
  *         else:
  */
-    __pyx_t_5 = PyObject_GetAttr(__pyx_v_struct, __pyx_n_s__error); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
+    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s__error); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __pyx_t_9 = PyErr_ExceptionMatches(__pyx_t_5);
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
@@ -19405,15 +19716,16 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
   int __pyx_t_2;
-  PyObject *__pyx_t_3 = NULL;
+  int __pyx_t_3;
   PyObject *__pyx_t_4 = NULL;
   PyObject *__pyx_t_5 = NULL;
-  Py_ssize_t __pyx_t_6;
-  PyObject *__pyx_t_7 = NULL;
-  char *__pyx_t_8;
+  PyObject *__pyx_t_6 = NULL;
+  Py_ssize_t __pyx_t_7;
+  PyObject *__pyx_t_8 = NULL;
   char *__pyx_t_9;
   char *__pyx_t_10;
   char *__pyx_t_11;
+  char *__pyx_t_12;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -19438,11 +19750,9 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  *             bytesvalue = struct.pack(self.view.format, *value)
  *         else:
  */
-  __pyx_t_1 = ((PyObject *)((PyObject*)(&PyTuple_Type)));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_value, __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (__pyx_t_2) {
+  __pyx_t_2 = PyTuple_Check(__pyx_v_value); 
+  __pyx_t_3 = (__pyx_t_2 != 0);
+  if (__pyx_t_3) {
 
     /* "View.MemoryView":467
  * 
@@ -19451,28 +19761,28 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  *         else:
  *             bytesvalue = struct.pack(self.view.format, value)
  */
-    __pyx_t_1 = PyObject_GetAttr(__pyx_v_struct, __pyx_n_s__pack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s__pack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_3 = PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
-    __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
-    __pyx_t_3 = 0;
-    __pyx_t_3 = PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-    __pyx_t_5 = PyNumber_Add(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+    __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4));
+    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
+    __pyx_t_4 = 0;
+    __pyx_t_4 = PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+    __pyx_t_6 = PyNumber_Add(((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
+    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-    __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
-    if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_v_bytesvalue = ((PyObject*)__pyx_t_3);
-    __pyx_t_3 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+    if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_4)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
+    __pyx_t_4 = 0;
     goto __pyx_L3;
   }
   /*else*/ {
@@ -19484,25 +19794,25 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  * 
  *         for i, c in enumerate(bytesvalue):
  */
-    __pyx_t_3 = PyObject_GetAttr(__pyx_v_struct, __pyx_n_s__pack); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_5 = PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s__pack); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
     __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_5));
-    __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
+    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_6));
+    __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
     __Pyx_INCREF(__pyx_v_value);
     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_value);
     __Pyx_GIVEREF(__pyx_v_value);
-    __pyx_t_5 = 0;
-    __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __pyx_t_6 = 0;
+    __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-    if (!(likely(PyBytes_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_5)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_v_bytesvalue = ((PyObject*)__pyx_t_5);
-    __pyx_t_5 = 0;
+    if (!(likely(PyBytes_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_6)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_v_bytesvalue = ((PyObject*)__pyx_t_6);
+    __pyx_t_6 = 0;
   }
   __pyx_L3:;
 
@@ -19513,18 +19823,18 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  *             itemp[i] = c
  * 
  */
-  __pyx_t_6 = 0;
+  __pyx_t_7 = 0;
   if (unlikely(((PyObject *)__pyx_v_bytesvalue) == Py_None)) {
     PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   __Pyx_INCREF(((PyObject *)__pyx_v_bytesvalue));
-  __pyx_t_7 = __pyx_v_bytesvalue;
-  __pyx_t_9 = PyBytes_AS_STRING(__pyx_t_7);
-  __pyx_t_10 = (__pyx_t_9 + PyBytes_GET_SIZE(__pyx_t_7));
-  for (__pyx_t_11 = __pyx_t_9; __pyx_t_11 < __pyx_t_10; __pyx_t_11++) {
-    __pyx_t_8 = __pyx_t_11;
-    __pyx_v_c = (__pyx_t_8[0]);
+  __pyx_t_8 = __pyx_v_bytesvalue;
+  __pyx_t_10 = PyBytes_AS_STRING(__pyx_t_8);
+  __pyx_t_11 = (__pyx_t_10 + PyBytes_GET_SIZE(__pyx_t_8));
+  for (__pyx_t_12 = __pyx_t_10; __pyx_t_12 < __pyx_t_11; __pyx_t_12++) {
+    __pyx_t_9 = __pyx_t_12;
+    __pyx_v_c = (__pyx_t_9[0]);
 
     /* "View.MemoryView":472
  * 
@@ -19533,7 +19843,7 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  * 
  *     @cname('getbuffer')
  */
-    __pyx_v_i = __pyx_t_6;
+    __pyx_v_i = __pyx_t_7;
 
     /* "View.MemoryView":471
  *             bytesvalue = struct.pack(self.view.format, value)
@@ -19542,7 +19852,7 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  *             itemp[i] = c
  * 
  */
-    __pyx_t_6 = (__pyx_t_6 + 1);
+    __pyx_t_7 = (__pyx_t_7 + 1);
 
     /* "View.MemoryView":472
  * 
@@ -19553,16 +19863,16 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  */
     (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c;
   }
-  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_5);
-  __Pyx_XDECREF(((PyObject *)__pyx_t_7));
+  __Pyx_XDECREF(__pyx_t_6);
+  __Pyx_XDECREF(((PyObject *)__pyx_t_8));
   __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
@@ -19574,8 +19884,8 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
 }
 
 /* Python wrapper */
-static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
-static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
+static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
+static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
@@ -19596,6 +19906,11 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
+  Py_ssize_t *__pyx_t_2;
+  char *__pyx_t_3;
+  void *__pyx_t_4;
+  int __pyx_t_5;
+  Py_ssize_t __pyx_t_6;
   __Pyx_RefNannySetupContext("__getbuffer__", 0);
   if (__pyx_v_info != NULL) {
     __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
@@ -19609,7 +19924,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *             info.shape = self.view.shape
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_flags & PyBUF_STRIDES);
+  __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":477
@@ -19619,7 +19934,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         else:
  *             info.shape = NULL
  */
-    __pyx_v_info->shape = __pyx_v_self->view.shape;
+    __pyx_t_2 = __pyx_v_self->view.shape;
+    __pyx_v_info->shape = __pyx_t_2;
     goto __pyx_L3;
   }
   /*else*/ {
@@ -19642,7 +19958,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *             info.strides = self.view.strides
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_flags & PyBUF_STRIDES);
+  __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":482
@@ -19652,7 +19968,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         else:
  *             info.strides = NULL
  */
-    __pyx_v_info->strides = __pyx_v_self->view.strides;
+    __pyx_t_2 = __pyx_v_self->view.strides;
+    __pyx_v_info->strides = __pyx_t_2;
     goto __pyx_L4;
   }
   /*else*/ {
@@ -19675,7 +19992,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *             info.suboffsets = self.view.suboffsets
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_flags & PyBUF_INDIRECT);
+  __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":487
@@ -19685,7 +20002,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         else:
  *             info.suboffsets = NULL
  */
-    __pyx_v_info->suboffsets = __pyx_v_self->view.suboffsets;
+    __pyx_t_2 = __pyx_v_self->view.suboffsets;
+    __pyx_v_info->suboffsets = __pyx_t_2;
     goto __pyx_L5;
   }
   /*else*/ {
@@ -19708,7 +20026,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *             info.format = self.view.format
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_flags & PyBUF_FORMAT);
+  __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":492
@@ -19718,7 +20036,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         else:
  *             info.format = NULL
  */
-    __pyx_v_info->format = __pyx_v_self->view.format;
+    __pyx_t_3 = __pyx_v_self->view.format;
+    __pyx_v_info->format = __pyx_t_3;
     goto __pyx_L6;
   }
   /*else*/ {
@@ -19741,7 +20060,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         info.ndim = self.view.ndim
  *         info.itemsize = self.view.itemsize
  */
-  __pyx_v_info->buf = __pyx_v_self->view.buf;
+  __pyx_t_4 = __pyx_v_self->view.buf;
+  __pyx_v_info->buf = __pyx_t_4;
 
   /* "View.MemoryView":497
  * 
@@ -19750,7 +20070,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         info.itemsize = self.view.itemsize
  *         info.len = self.view.len
  */
-  __pyx_v_info->ndim = __pyx_v_self->view.ndim;
+  __pyx_t_5 = __pyx_v_self->view.ndim;
+  __pyx_v_info->ndim = __pyx_t_5;
 
   /* "View.MemoryView":498
  *         info.buf = self.view.buf
@@ -19759,7 +20080,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         info.len = self.view.len
  *         info.readonly = 0
  */
-  __pyx_v_info->itemsize = __pyx_v_self->view.itemsize;
+  __pyx_t_6 = __pyx_v_self->view.itemsize;
+  __pyx_v_info->itemsize = __pyx_t_6;
 
   /* "View.MemoryView":499
  *         info.ndim = self.view.ndim
@@ -19768,7 +20090,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         info.readonly = 0
  *         info.obj = self
  */
-  __pyx_v_info->len = __pyx_v_self->view.len;
+  __pyx_t_6 = __pyx_v_self->view.len;
+  __pyx_v_info->len = __pyx_t_6;
 
   /* "View.MemoryView":500
  *         info.itemsize = self.view.itemsize
@@ -19968,10 +20291,10 @@ static PyObject *__pyx_memoryview_get_shape_MemoryView_10memoryview_5shape___get
     __pyx_v_i = __pyx_t_3;
     __pyx_t_4 = PyInt_FromSsize_t((__pyx_v_self->view.shape[__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    if (unlikely(__Pyx_PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   }
-  __pyx_t_4 = ((PyObject *)PyList_AsTuple(__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = ((PyObject *)PyList_AsTuple(((PyObject*)__pyx_t_1))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_4));
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   __pyx_r = ((PyObject *)__pyx_t_4);
@@ -20031,7 +20354,7 @@ static PyObject *__pyx_memoryview_get_strides_MemoryView_10memoryview_7strides__
  * 
  *                 raise ValueError("Buffer view does not expose strides")
  */
-  __pyx_t_1 = (__pyx_v_self->view.strides == NULL);
+  __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":528
@@ -20065,10 +20388,10 @@ static PyObject *__pyx_memoryview_get_strides_MemoryView_10memoryview_7strides__
     __pyx_v_i = __pyx_t_4;
     __pyx_t_5 = PyInt_FromSsize_t((__pyx_v_self->view.strides[__pyx_v_i])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    if (unlikely(__Pyx_PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
   }
-  __pyx_t_5 = ((PyObject *)PyList_AsTuple(__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = ((PyObject *)PyList_AsTuple(((PyObject*)__pyx_t_2))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_5));
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __pyx_r = ((PyObject *)__pyx_t_5);
@@ -20128,7 +20451,7 @@ static PyObject *__pyx_memoryview_get_suboffsets_MemoryView_10memoryview_10subof
  *                 return [-1] * self.view.ndim
  * 
  */
-  __pyx_t_1 = (__pyx_v_self->view.suboffsets == NULL);
+  __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":536
@@ -20170,10 +20493,10 @@ static PyObject *__pyx_memoryview_get_suboffsets_MemoryView_10memoryview_10subof
     __pyx_v_i = __pyx_t_4;
     __pyx_t_5 = PyInt_FromSsize_t((__pyx_v_self->view.suboffsets[__pyx_v_i])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    if (unlikely(__Pyx_PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
   }
-  __pyx_t_5 = ((PyObject *)PyList_AsTuple(__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = ((PyObject *)PyList_AsTuple(((PyObject*)__pyx_t_2))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_5));
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __pyx_r = ((PyObject *)__pyx_t_5);
@@ -20339,7 +20662,7 @@ static PyObject *__pyx_memoryview_get_nbytes_MemoryView_10memoryview_6nbytes___g
  *     property size:
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
@@ -20390,10 +20713,11 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
-  PyObject *__pyx_t_2 = NULL;
+  int __pyx_t_2;
   PyObject *__pyx_t_3 = NULL;
-  Py_ssize_t __pyx_t_4;
-  PyObject *(*__pyx_t_5)(PyObject *);
+  PyObject *__pyx_t_4 = NULL;
+  Py_ssize_t __pyx_t_5;
+  PyObject *(*__pyx_t_6)(PyObject *);
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -20407,7 +20731,8 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__
  * 
  */
   __pyx_t_1 = (__pyx_v_self->_size == Py_None);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":559
  *         def __get__(self):
@@ -20426,46 +20751,45 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__
  *                     result *= length
  * 
  */
-    __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
-      __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
-      __pyx_t_5 = NULL;
+    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) {
+      __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
+      __pyx_t_6 = NULL;
     } else {
-      __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext;
+      __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_4);
+      __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext;
     }
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     for (;;) {
-      if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_3)) {
-        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
+      if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_4)) {
+        if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
         #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         #else
-        __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         #endif
-      } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_3)) {
-        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
+      } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_4)) {
+        if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
         #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         #else
-        __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         #endif
       } else {
-        __pyx_t_2 = __pyx_t_5(__pyx_t_3);
-        if (unlikely(!__pyx_t_2)) {
+        __pyx_t_3 = __pyx_t_6(__pyx_t_4);
+        if (unlikely(!__pyx_t_3)) {
           if (PyErr_Occurred()) {
             if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
             else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           }
           break;
         }
-        __Pyx_GOTREF(__pyx_t_2);
+        __Pyx_GOTREF(__pyx_t_3);
       }
-      __Pyx_XDECREF(__pyx_v_length);
-      __pyx_v_length = __pyx_t_2;
-      __pyx_t_2 = 0;
+      __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_3);
+      __pyx_t_3 = 0;
 
       /* "View.MemoryView":562
  * 
@@ -20474,13 +20798,12 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__
  * 
  *                 self._size = result
  */
-      __pyx_t_2 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(__pyx_v_result);
-      __pyx_v_result = __pyx_t_2;
-      __pyx_t_2 = 0;
+      __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_3);
+      __pyx_t_3 = 0;
     }
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
     /* "View.MemoryView":564
  *                     result *= length
@@ -20513,8 +20836,8 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
+  __Pyx_XDECREF(__pyx_t_4);
   __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
@@ -20557,7 +20880,7 @@ static Py_ssize_t __pyx_memoryview_MemoryView_10memoryview_10__len__(struct __py
  *             return self.view.shape[0]
  * 
  */
-  __pyx_t_1 = (__pyx_v_self->view.ndim >= 1);
+  __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":570
@@ -20627,12 +20950,12 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_12__repr__(struct __py
  * 
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__base); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__base); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____name__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s____name__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
@@ -20717,12 +21040,12 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_14__str__(struct __pyx
  * 
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__base); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__base); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____name__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s____name__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -21138,30 +21461,26 @@ static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, in
 /* "View.MemoryView":624
  * 
  * @cname('__pyx_memoryview_check')
- * cdef bint memoryview_check(object o):             # <<<<<<<<<<<<<<
+ * cdef inline bint memoryview_check(object o):             # <<<<<<<<<<<<<<
  *     return isinstance(o, memoryview)
  * 
  */
 
-static int __pyx_memoryview_check(PyObject *__pyx_v_o) {
+static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
-  int __pyx_t_2;
+  int __pyx_t_1;
   __Pyx_RefNannySetupContext("memoryview_check", 0);
 
   /* "View.MemoryView":625
  * @cname('__pyx_memoryview_check')
- * cdef bint memoryview_check(object o):
+ * cdef inline bint memoryview_check(object o):
  *     return isinstance(o, memoryview)             # <<<<<<<<<<<<<<
  * 
  * cdef tuple _unellipsify(object index, int ndim):
  */
-  __pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryview_type));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_o, __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_r = __pyx_t_2;
+  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, ((PyObject *)__pyx_memoryview_type)); 
+  __pyx_r = __pyx_t_1;
   goto __pyx_L0;
 
   __pyx_r = 0;
@@ -21188,9 +21507,9 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
   PyObject *__pyx_v_nslices = NULL;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
+  int __pyx_t_1;
   int __pyx_t_2;
-  int __pyx_t_3;
+  PyObject *__pyx_t_3 = NULL;
   PyObject *__pyx_t_4 = NULL;
   Py_ssize_t __pyx_t_5;
   PyObject *(*__pyx_t_6)(PyObject *);
@@ -21212,12 +21531,9 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *         tup = (index,)
  *     else:
  */
-  __pyx_t_1 = ((PyObject *)((PyObject*)(&PyTuple_Type)));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_index, __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = (!__pyx_t_2);
-  if (__pyx_t_3) {
+  __pyx_t_1 = PyTuple_Check(__pyx_v_index); 
+  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":633
  *     """
@@ -21226,13 +21542,13 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *     else:
  *         tup = index
  */
-    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
     __Pyx_INCREF(__pyx_v_index);
-    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_index);
+    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index);
     __Pyx_GIVEREF(__pyx_v_index);
-    __pyx_v_tup = ((PyObject *)__pyx_t_1);
-    __pyx_t_1 = 0;
+    __pyx_v_tup = ((PyObject *)__pyx_t_3);
+    __pyx_t_3 = 0;
     goto __pyx_L3;
   }
   /*else*/ {
@@ -21256,10 +21572,10 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *     have_slices = False
  *     seen_ellipsis = False
  */
-  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_v_result = __pyx_t_1;
-  __pyx_t_1 = 0;
+  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_v_result = ((PyObject*)__pyx_t_3);
+  __pyx_t_3 = 0;
 
   /* "View.MemoryView":638
  * 
@@ -21268,10 +21584,10 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *     seen_ellipsis = False
  *     for idx, item in enumerate(tup):
  */
-  __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_v_have_slices = __pyx_t_1;
-  __pyx_t_1 = 0;
+  __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_v_have_slices = __pyx_t_3;
+  __pyx_t_3 = 0;
 
   /* "View.MemoryView":639
  *     result = []
@@ -21290,7 +21606,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *             if not seen_ellipsis:
  */
   __Pyx_INCREF(__pyx_int_0);
-  __pyx_t_1 = __pyx_int_0;
+  __pyx_t_3 = __pyx_int_0;
   if (PyList_CheckExact(__pyx_v_tup) || PyTuple_CheckExact(__pyx_v_tup)) {
     __pyx_t_4 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
     __pyx_t_6 = NULL;
@@ -21325,16 +21641,14 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
       }
       __Pyx_GOTREF(__pyx_t_7);
     }
-    __Pyx_XDECREF(__pyx_v_item);
-    __pyx_v_item = __pyx_t_7;
+    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7);
     __pyx_t_7 = 0;
-    __Pyx_INCREF(__pyx_t_1);
-    __Pyx_XDECREF(__pyx_v_idx);
-    __pyx_v_idx = __pyx_t_1;
-    __pyx_t_7 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_INCREF(__pyx_t_3);
+    __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3);
+    __pyx_t_7 = PyNumber_Add(__pyx_t_3, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
-    __Pyx_DECREF(__pyx_t_1);
-    __pyx_t_1 = __pyx_t_7;
+    __Pyx_DECREF(__pyx_t_3);
+    __pyx_t_3 = __pyx_t_7;
     __pyx_t_7 = 0;
 
     /* "View.MemoryView":641
@@ -21344,8 +21658,9 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *             if not seen_ellipsis:
  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
  */
-    __pyx_t_3 = (__pyx_v_item == __pyx_builtin_Ellipsis);
-    if (__pyx_t_3) {
+    __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis);
+    __pyx_t_1 = (__pyx_t_2 != 0);
+    if (__pyx_t_1) {
 
       /* "View.MemoryView":642
  *     for idx, item in enumerate(tup):
@@ -21354,8 +21669,8 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
  *                 seen_ellipsis = True
  */
-      __pyx_t_3 = (!__pyx_v_seen_ellipsis);
-      if (__pyx_t_3) {
+      __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0);
+      if (__pyx_t_1) {
 
         /* "View.MemoryView":643
  *         if item is Ellipsis:
@@ -21364,7 +21679,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *                 seen_ellipsis = True
  *             else:
  */
-        __pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_v_result), __pyx_n_s__extend); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_result), __pyx_n_s__extend); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_7);
         __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_115), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_8);
@@ -21411,7 +21726,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  */
         __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_116), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_10);
-        __pyx_t_11 = PyList_Append(__pyx_v_result, __pyx_t_10); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_10); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
       }
       __pyx_L7:;
@@ -21425,8 +21740,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  */
       __pyx_t_10 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_10);
-      __Pyx_DECREF(__pyx_v_have_slices);
-      __pyx_v_have_slices = __pyx_t_10;
+      __Pyx_DECREF_SET(__pyx_v_have_slices, __pyx_t_10);
       __pyx_t_10 = 0;
       goto __pyx_L6;
     }
@@ -21439,14 +21753,11 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *                 raise TypeError("Cannot index with type '%s'" % type(item))
  * 
  */
-      __pyx_t_10 = ((PyObject *)((PyObject*)(&PySlice_Type)));
-      __Pyx_INCREF(__pyx_t_10);
-      __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_item, __pyx_t_10); 
-      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-      __pyx_t_2 = (!__pyx_t_3);
+      __pyx_t_1 = PySlice_Check(__pyx_v_item); 
+      __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
       if (__pyx_t_2) {
-        __pyx_t_3 = (!PyIndex_Check(__pyx_v_item));
-        __pyx_t_12 = __pyx_t_3;
+        __pyx_t_1 = ((!(__Pyx_PyIndex_Check(__pyx_v_item) != 0)) != 0);
+        __pyx_t_12 = __pyx_t_1;
       } else {
         __pyx_t_12 = __pyx_t_2;
       }
@@ -21485,10 +21796,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  */
       __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       if (!__pyx_t_12) {
-        __pyx_t_10 = ((PyObject *)((PyObject*)(&PySlice_Type)));
-        __Pyx_INCREF(__pyx_t_10);
-        __pyx_t_12 = __Pyx_TypeCheck(__pyx_v_item, __pyx_t_10); 
-        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+        __pyx_t_12 = PySlice_Check(__pyx_v_item); 
         __pyx_t_10 = __Pyx_PyBool_FromLong(__pyx_t_12); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_10);
         __pyx_t_8 = __pyx_t_10;
@@ -21497,8 +21805,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
         __Pyx_INCREF(__pyx_v_have_slices);
         __pyx_t_8 = __pyx_v_have_slices;
       }
-      __Pyx_DECREF(__pyx_v_have_slices);
-      __pyx_v_have_slices = __pyx_t_8;
+      __Pyx_DECREF_SET(__pyx_v_have_slices, __pyx_t_8);
       __pyx_t_8 = 0;
 
       /* "View.MemoryView":653
@@ -21508,12 +21815,12 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  * 
  *     nslices = ndim - len(result)
  */
-      __pyx_t_11 = PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     __pyx_L6:;
   }
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
   /* "View.MemoryView":655
  *             result.append(item)
@@ -21523,10 +21830,10 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *         result.extend([slice(None)] * nslices)
  */
   __pyx_t_5 = PyList_GET_SIZE(((PyObject *)__pyx_v_result)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_1 = PyInt_FromSsize_t((__pyx_v_ndim - __pyx_t_5)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_v_nslices = __pyx_t_1;
-  __pyx_t_1 = 0;
+  __pyx_t_3 = PyInt_FromSsize_t((__pyx_v_ndim - __pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_v_nslices = __pyx_t_3;
+  __pyx_t_3 = 0;
 
   /* "View.MemoryView":656
  * 
@@ -21545,8 +21852,8 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  * 
  *     return have_slices or nslices, tuple(result)
  */
-    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_result), __pyx_n_s__extend); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_result), __pyx_n_s__extend); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
     __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_118), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -21564,9 +21871,9 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
     PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
     __pyx_t_8 = 0;
-    __pyx_t_8 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_8 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_8);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
     goto __pyx_L9;
@@ -21591,22 +21898,22 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
   }
   __pyx_t_4 = ((PyObject *)PyList_AsTuple(__pyx_v_result)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8);
+  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_8);
   __Pyx_GIVEREF(__pyx_t_8);
-  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_t_4));
+  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_t_4));
   __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
   __pyx_t_8 = 0;
   __pyx_t_4 = 0;
-  __pyx_r = __pyx_t_1;
-  __pyx_t_1 = 0;
+  __pyx_r = ((PyObject*)__pyx_t_3);
+  __pyx_t_3 = 0;
   goto __pyx_L0;
 
   __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_7);
   __Pyx_XDECREF(__pyx_t_8);
@@ -21664,7 +21971,7 @@ static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __
  *             raise ValueError("Indirect dimensions not supported")
  * 
  */
-    __pyx_t_3 = ((__pyx_v_suboffsets[__pyx_v_i]) >= 0);
+    __pyx_t_3 = (((__pyx_v_suboffsets[__pyx_v_i]) >= 0) != 0);
     if (__pyx_t_3) {
 
       /* "View.MemoryView":665
@@ -21723,15 +22030,18 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
   PyObject *__pyx_v_index = NULL;
   struct __pyx_memoryview_obj *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
+  int __pyx_t_1;
   int __pyx_t_2;
-  int __pyx_t_3;
-  Py_ssize_t __pyx_t_4;
-  PyObject *(*__pyx_t_5)(PyObject *);
+  struct __pyx_memoryview_obj *__pyx_t_3;
+  char *__pyx_t_4;
+  int __pyx_t_5;
   PyObject *__pyx_t_6 = NULL;
-  int __pyx_t_7;
-  Py_ssize_t __pyx_t_8;
+  Py_ssize_t __pyx_t_7;
+  PyObject *(*__pyx_t_8)(PyObject *);
   PyObject *__pyx_t_9 = NULL;
+  Py_ssize_t __pyx_t_10;
+  int __pyx_t_11;
+  PyObject *__pyx_t_12 = NULL;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -21764,7 +22074,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *     if isinstance(memview, _memoryviewslice):
  */
   #ifndef CYTHON_WITHOUT_ASSERTIONS
-  if (unlikely(!(__pyx_v_memview->view.ndim > 0))) {
+  if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) {
     PyErr_SetNone(PyExc_AssertionError);
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
@@ -21777,10 +22087,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *         memviewsliceobj = memview
  *         p_src = &memviewsliceobj.from_slice
  */
-  __pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryviewslice_type));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), ((PyObject *)__pyx_memoryviewslice_type)); 
+  __pyx_t_2 = (__pyx_t_1 != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":687
@@ -21833,7 +22141,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *     dst.data = p_src.data
  * 
  */
-  __pyx_v_dst.memview = __pyx_v_p_src->memview;
+  __pyx_t_3 = __pyx_v_p_src->memview;
+  __pyx_v_dst.memview = __pyx_t_3;
 
   /* "View.MemoryView":698
  * 
@@ -21842,7 +22151,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  * 
  * 
  */
-  __pyx_v_dst.data = __pyx_v_p_src->data;
+  __pyx_t_4 = __pyx_v_p_src->data;
+  __pyx_v_dst.data = __pyx_t_4;
 
   /* "View.MemoryView":703
  * 
@@ -21869,46 +22179,45 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *         if PyIndex_Check(index):
  *             slice_memviewslice(
  */
-  __pyx_t_3 = 0;
+  __pyx_t_5 = 0;
   if (PyList_CheckExact(__pyx_v_indices) || PyTuple_CheckExact(__pyx_v_indices)) {
-    __pyx_t_1 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0;
-    __pyx_t_5 = NULL;
+    __pyx_t_6 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_6); __pyx_t_7 = 0;
+    __pyx_t_8 = NULL;
   } else {
-    __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext;
+    __pyx_t_7 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __pyx_t_8 = Py_TYPE(__pyx_t_6)->tp_iternext;
   }
   for (;;) {
-    if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_1)) {
-      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
+    if (!__pyx_t_8 && PyList_CheckExact(__pyx_t_6)) {
+      if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_6)) break;
       #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       #else
-      __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       #endif
-    } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_1)) {
-      if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+    } else if (!__pyx_t_8 && PyTuple_CheckExact(__pyx_t_6)) {
+      if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
       #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       #else
-      __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       #endif
     } else {
-      __pyx_t_6 = __pyx_t_5(__pyx_t_1);
-      if (unlikely(!__pyx_t_6)) {
+      __pyx_t_9 = __pyx_t_8(__pyx_t_6);
+      if (unlikely(!__pyx_t_9)) {
         if (PyErr_Occurred()) {
           if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
           else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         }
         break;
       }
-      __Pyx_GOTREF(__pyx_t_6);
+      __Pyx_GOTREF(__pyx_t_9);
     }
-    __Pyx_XDECREF(__pyx_v_index);
-    __pyx_v_index = __pyx_t_6;
-    __pyx_t_6 = 0;
-    __pyx_v_dim = __pyx_t_3;
-    __pyx_t_3 = (__pyx_t_3 + 1);
+    __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9);
+    __pyx_t_9 = 0;
+    __pyx_v_dim = __pyx_t_5;
+    __pyx_t_5 = (__pyx_t_5 + 1);
 
     /* "View.MemoryView":709
  * 
@@ -21917,8 +22226,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             slice_memviewslice(
  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
  */
-    __pyx_t_7 = PyIndex_Check(__pyx_v_index);
-    if (__pyx_t_7) {
+    __pyx_t_2 = (__Pyx_PyIndex_Check(__pyx_v_index) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":713
  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
@@ -21927,7 +22236,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *                 0, 0, 0, # have_{start,stop,step}
  *                 False)
  */
-      __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
       /* "View.MemoryView":715
  *                 index, 0, 0, # start, stop, step
@@ -21936,7 +22245,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *         elif index is None:
  *             p_dst.shape[new_ndim] = 1
  */
-      __pyx_t_7 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_8, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_10, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L6;
     }
 
@@ -21948,7 +22257,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             p_dst.strides[new_ndim] = 0
  */
     __pyx_t_2 = (__pyx_v_index == Py_None);
-    if (__pyx_t_2) {
+    __pyx_t_1 = (__pyx_t_2 != 0);
+    if (__pyx_t_1) {
 
       /* "View.MemoryView":717
  *                 False)
@@ -21996,20 +22306,20 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             stop = index.stop or 0
  *             step = index.step or 0
  */
-      __pyx_t_6 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_6);
-      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      if (!__pyx_t_2) {
-        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
+      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      if (!__pyx_t_1) {
+        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
         __Pyx_INCREF(__pyx_int_0);
-        __pyx_t_9 = __pyx_int_0;
+        __pyx_t_12 = __pyx_int_0;
       } else {
-        __pyx_t_9 = __pyx_t_6;
-        __pyx_t_6 = 0;
+        __pyx_t_12 = __pyx_t_9;
+        __pyx_t_9 = 0;
       }
-      __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_v_start = __pyx_t_8;
+      __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_12); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+      __pyx_v_start = __pyx_t_10;
 
       /* "View.MemoryView":723
  *         else:
@@ -22018,20 +22328,20 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             step = index.step or 0
  * 
  */
-      __pyx_t_9 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__stop); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      if (!__pyx_t_2) {
-        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__stop); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_12);
+      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      if (!__pyx_t_1) {
+        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
         __Pyx_INCREF(__pyx_int_0);
-        __pyx_t_6 = __pyx_int_0;
+        __pyx_t_9 = __pyx_int_0;
       } else {
-        __pyx_t_6 = __pyx_t_9;
-        __pyx_t_9 = 0;
+        __pyx_t_9 = __pyx_t_12;
+        __pyx_t_12 = 0;
       }
-      __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-      __pyx_v_stop = __pyx_t_8;
+      __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_v_stop = __pyx_t_10;
 
       /* "View.MemoryView":724
  *             start = index.start or 0
@@ -22040,20 +22350,20 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  * 
  *             have_start = index.start is not None
  */
-      __pyx_t_6 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_6);
-      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      if (!__pyx_t_2) {
-        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
+      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      if (!__pyx_t_1) {
+        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
         __Pyx_INCREF(__pyx_int_0);
-        __pyx_t_9 = __pyx_int_0;
+        __pyx_t_12 = __pyx_int_0;
       } else {
-        __pyx_t_9 = __pyx_t_6;
-        __pyx_t_6 = 0;
+        __pyx_t_12 = __pyx_t_9;
+        __pyx_t_9 = 0;
       }
-      __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_v_step = __pyx_t_8;
+      __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_12); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+      __pyx_v_step = __pyx_t_10;
 
       /* "View.MemoryView":726
  *             step = index.step or 0
@@ -22062,11 +22372,11 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             have_stop = index.stop is not None
  *             have_step = index.step is not None
  */
-      __pyx_t_9 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_2 = (__pyx_t_9 != Py_None);
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_v_have_start = __pyx_t_2;
+      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_12);
+      __pyx_t_1 = (__pyx_t_12 != Py_None);
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+      __pyx_v_have_start = __pyx_t_1;
 
       /* "View.MemoryView":727
  * 
@@ -22075,11 +22385,11 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             have_step = index.step is not None
  * 
  */
-      __pyx_t_9 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__stop); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_2 = (__pyx_t_9 != Py_None);
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_v_have_stop = __pyx_t_2;
+      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__stop); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_12);
+      __pyx_t_1 = (__pyx_t_12 != Py_None);
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+      __pyx_v_have_stop = __pyx_t_1;
 
       /* "View.MemoryView":728
  *             have_start = index.start is not None
@@ -22088,11 +22398,11 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  * 
  *             slice_memviewslice(
  */
-      __pyx_t_9 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_2 = (__pyx_t_9 != Py_None);
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_v_have_step = __pyx_t_2;
+      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_12);
+      __pyx_t_1 = (__pyx_t_12 != Py_None);
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+      __pyx_v_have_step = __pyx_t_1;
 
       /* "View.MemoryView":735
  *                 start, stop, step,
@@ -22101,7 +22411,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             new_ndim += 1
  * 
  */
-      __pyx_t_7 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
       /* "View.MemoryView":736
  *                 have_start, have_stop, have_step,
@@ -22114,7 +22424,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
     }
     __pyx_L6:;
   }
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
 
   /* "View.MemoryView":738
  *             new_ndim += 1
@@ -22123,10 +22433,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *         return memoryview_fromslice(dst, new_ndim,
  *                                     memviewsliceobj.to_object_func,
  */
-  __pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryviewslice_type));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), ((PyObject *)__pyx_memoryviewslice_type)); 
+  __pyx_t_2 = (__pyx_t_1 != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":739
@@ -22154,11 +22462,11 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *     else:
  *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,
  */
-    __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_1);
-    __pyx_t_1 = 0;
+    __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_6);
+    __pyx_t_6 = 0;
     goto __pyx_L0;
     goto __pyx_L7;
   }
@@ -22180,11 +22488,11 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  * 
  * 
  */
-    __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_1);
-    __pyx_t_1 = 0;
+    __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_6);
+    __pyx_t_6 = 0;
     goto __pyx_L0;
   }
   __pyx_L7:;
@@ -22192,9 +22500,9 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
   __pyx_r = ((struct __pyx_memoryview_obj *)Py_None); __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_6);
   __Pyx_XDECREF(__pyx_t_9);
+  __Pyx_XDECREF(__pyx_t_12);
   __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
@@ -22221,7 +22529,6 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
   int __pyx_t_2;
   int __pyx_t_3;
   int __pyx_t_4;
-  Py_ssize_t __pyx_t_5;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -22233,7 +22540,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  * 
  *         if start < 0:
  */
-  __pyx_t_1 = (!__pyx_v_is_slice);
+  __pyx_t_1 = ((!(__pyx_v_is_slice != 0)) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":791
@@ -22243,7 +22550,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             start += shape
  *         if not 0 <= start < shape:
  */
-    __pyx_t_1 = (__pyx_v_start < 0);
+    __pyx_t_1 = ((__pyx_v_start < 0) != 0);
     if (__pyx_t_1) {
 
       /* "View.MemoryView":792
@@ -22269,7 +22576,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
     if (__pyx_t_1) {
       __pyx_t_1 = (__pyx_v_start < __pyx_v_shape);
     }
-    __pyx_t_2 = (!__pyx_t_1);
+    __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":794
@@ -22310,11 +22617,11 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
  * 
  */
-    if (__pyx_v_have_step) {
+    if ((__pyx_v_have_step != 0)) {
       __pyx_t_4 = (__pyx_v_step == 0);
       __pyx_t_2 = __pyx_t_4;
     } else {
-      __pyx_t_2 = __pyx_v_have_step;
+      __pyx_t_2 = (__pyx_v_have_step != 0);
     }
     if (__pyx_t_2) {
 
@@ -22337,7 +22644,8 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             if start < 0:
  *                 start += shape
  */
-    if (__pyx_v_have_start) {
+    __pyx_t_2 = (__pyx_v_have_start != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":804
  * 
@@ -22346,7 +22654,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 start += shape
  *                 if start < 0:
  */
-      __pyx_t_2 = (__pyx_v_start < 0);
+      __pyx_t_2 = ((__pyx_v_start < 0) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":805
@@ -22365,7 +22673,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                     start = 0
  *             elif start >= shape:
  */
-        __pyx_t_2 = (__pyx_v_start < 0);
+        __pyx_t_2 = ((__pyx_v_start < 0) != 0);
         if (__pyx_t_2) {
 
           /* "View.MemoryView":807
@@ -22389,7 +22697,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 if negative_step:
  *                     start = shape - 1
  */
-      __pyx_t_2 = (__pyx_v_start >= __pyx_v_shape);
+      __pyx_t_2 = ((__pyx_v_start >= __pyx_v_shape) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":809
@@ -22399,7 +22707,8 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                     start = shape - 1
  *                 else:
  */
-        if (__pyx_v_negative_step) {
+        __pyx_t_2 = (__pyx_v_negative_step != 0);
+        if (__pyx_t_2) {
 
           /* "View.MemoryView":810
  *             elif start >= shape:
@@ -22437,7 +22746,8 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 start = shape - 1
  *             else:
  */
-      if (__pyx_v_negative_step) {
+      __pyx_t_2 = (__pyx_v_negative_step != 0);
+      if (__pyx_t_2) {
 
         /* "View.MemoryView":815
  *         else:
@@ -22471,7 +22781,8 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             if stop < 0:
  *                 stop += shape
  */
-    if (__pyx_v_have_stop) {
+    __pyx_t_2 = (__pyx_v_have_stop != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":820
  * 
@@ -22480,7 +22791,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 stop += shape
  *                 if stop < 0:
  */
-      __pyx_t_2 = (__pyx_v_stop < 0);
+      __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":821
@@ -22499,7 +22810,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                     stop = 0
  *             elif stop > shape:
  */
-        __pyx_t_2 = (__pyx_v_stop < 0);
+        __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
         if (__pyx_t_2) {
 
           /* "View.MemoryView":823
@@ -22523,7 +22834,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 stop = shape
  *         else:
  */
-      __pyx_t_2 = (__pyx_v_stop > __pyx_v_shape);
+      __pyx_t_2 = ((__pyx_v_stop > __pyx_v_shape) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":825
@@ -22548,7 +22859,8 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 stop = -1
  *             else:
  */
-      if (__pyx_v_negative_step) {
+      __pyx_t_2 = (__pyx_v_negative_step != 0);
+      if (__pyx_t_2) {
 
         /* "View.MemoryView":828
  *         else:
@@ -22582,7 +22894,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             step = 1
  * 
  */
-    __pyx_t_2 = (!__pyx_v_have_step);
+    __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":833
@@ -22602,23 +22914,23 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *         with cython.cdivision(True):
  *             new_shape = (stop - start) // step             # <<<<<<<<<<<<<<
  * 
- *             if (stop - start) % step:
+ *             if (stop - start) - step * new_shape:
  */
     __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step);
 
     /* "View.MemoryView":839
  *             new_shape = (stop - start) // step
  * 
- *             if (stop - start) % step:             # <<<<<<<<<<<<<<
+ *             if (stop - start) - step * new_shape:             # <<<<<<<<<<<<<<
  *                 new_shape += 1
  * 
  */
-    __pyx_t_5 = ((__pyx_v_stop - __pyx_v_start) % __pyx_v_step);
-    if (__pyx_t_5) {
+    __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":840
  * 
- *             if (stop - start) % step:
+ *             if (stop - start) - step * new_shape:
  *                 new_shape += 1             # <<<<<<<<<<<<<<
  * 
  *         if new_shape < 0:
@@ -22635,7 +22947,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             new_shape = 0
  * 
  */
-    __pyx_t_2 = (__pyx_v_new_shape < 0);
+    __pyx_t_2 = ((__pyx_v_new_shape < 0) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":843
@@ -22686,7 +22998,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *         dst.data += start * stride
  *     else:
  */
-  __pyx_t_2 = ((__pyx_v_suboffset_dim[0]) < 0);
+  __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":852
@@ -22720,7 +23032,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *         if not is_slice:
  *             if new_ndim == 0:
  */
-  __pyx_t_2 = (__pyx_v_suboffset >= 0);
+  __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":857
@@ -22730,7 +23042,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             if new_ndim == 0:
  *                 dst.data = (<char **> dst.data)[0] + suboffset
  */
-    __pyx_t_2 = (!__pyx_v_is_slice);
+    __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":858
@@ -22740,7 +23052,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 dst.data = (<char **> dst.data)[0] + suboffset
  *             else:
  */
-      __pyx_t_2 = (__pyx_v_new_ndim == 0);
+      __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":859
@@ -22814,11 +23126,11 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  * 
  * @cname('__pyx_pybuffer_index')
  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,             # <<<<<<<<<<<<<<
- *                           int dim) except NULL:
+ *                           Py_ssize_t dim) except NULL:
  *     cdef Py_ssize_t shape, stride, suboffset = -1
  */
 
-static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, int __pyx_v_dim) {
+static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) {
   Py_ssize_t __pyx_v_shape;
   Py_ssize_t __pyx_v_stride;
   Py_ssize_t __pyx_v_suboffset;
@@ -22826,9 +23138,10 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
   char *__pyx_v_resultp;
   char *__pyx_r;
   __Pyx_RefNannyDeclarations
-  int __pyx_t_1;
-  PyObject *__pyx_t_2 = NULL;
+  Py_ssize_t __pyx_t_1;
+  int __pyx_t_2;
   PyObject *__pyx_t_3 = NULL;
+  PyObject *__pyx_t_4 = NULL;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -22836,7 +23149,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
 
   /* "View.MemoryView":874
  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,
- *                           int dim) except NULL:
+ *                           Py_ssize_t dim) except NULL:
  *     cdef Py_ssize_t shape, stride, suboffset = -1             # <<<<<<<<<<<<<<
  *     cdef Py_ssize_t itemsize = view.itemsize
  *     cdef char *resultp
@@ -22844,13 +23157,14 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
   __pyx_v_suboffset = -1;
 
   /* "View.MemoryView":875
- *                           int dim) except NULL:
+ *                           Py_ssize_t dim) except NULL:
  *     cdef Py_ssize_t shape, stride, suboffset = -1
  *     cdef Py_ssize_t itemsize = view.itemsize             # <<<<<<<<<<<<<<
  *     cdef char *resultp
  * 
  */
-  __pyx_v_itemsize = __pyx_v_view->itemsize;
+  __pyx_t_1 = __pyx_v_view->itemsize;
+  __pyx_v_itemsize = __pyx_t_1;
 
   /* "View.MemoryView":878
  *     cdef char *resultp
@@ -22859,8 +23173,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *         shape = view.len / itemsize
  *         stride = itemsize
  */
-  __pyx_t_1 = (__pyx_v_view->ndim == 0);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":879
  * 
@@ -22870,11 +23184,23 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *     else:
  */
     if (unlikely(__pyx_v_itemsize == 0)) {
+      #ifdef WITH_THREAD
+      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+      #endif
       PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero");
+      #ifdef WITH_THREAD
+      PyGILState_Release(__pyx_gilstate_save);
+      #endif
       {__pyx_filename = __pyx_f[2]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     else if (sizeof(Py_ssize_t) == sizeof(long) && unlikely(__pyx_v_itemsize == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) {
+      #ifdef WITH_THREAD
+      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+      #endif
       PyErr_Format(PyExc_OverflowError, "value too large to perform division");
+      #ifdef WITH_THREAD
+      PyGILState_Release(__pyx_gilstate_save);
+      #endif
       {__pyx_filename = __pyx_f[2]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize);
@@ -22916,8 +23242,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *             suboffset = view.suboffsets[dim]
  * 
  */
-    __pyx_t_1 = (__pyx_v_view->suboffsets != NULL);
-    if (__pyx_t_1) {
+    __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":885
  *         stride = view.strides[dim]
@@ -22940,8 +23266,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *         index += view.shape[dim]
  *         if index < 0:
  */
-  __pyx_t_1 = (__pyx_v_index < 0);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((__pyx_v_index < 0) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":888
  * 
@@ -22959,8 +23285,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
  * 
  */
-    __pyx_t_1 = (__pyx_v_index < 0);
-    if (__pyx_t_1) {
+    __pyx_t_2 = ((__pyx_v_index < 0) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":890
  *         index += view.shape[dim]
@@ -22969,21 +23295,21 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  * 
  *     if index >= shape:
  */
-      __pyx_t_2 = PyInt_FromLong(__pyx_v_dim); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_124), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3));
-      __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
-      __pyx_t_3 = 0;
-      __pyx_t_3 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
-      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+      __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_124), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
+      __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
+      __pyx_t_4 = 0;
+      __pyx_t_4 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_4);
+      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
+      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
       {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L6;
     }
@@ -22999,8 +23325,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
  * 
  */
-  __pyx_t_1 = (__pyx_v_index >= __pyx_v_shape);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":893
  * 
@@ -23009,21 +23335,21 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  * 
  *     resultp = bufp + index * stride
  */
-    __pyx_t_3 = PyInt_FromLong(__pyx_v_dim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_124), __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
+    __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
+    __pyx_t_3 = 0;
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_124), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
-    __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
-    __pyx_t_2 = 0;
-    __pyx_t_2 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L7;
   }
@@ -23045,8 +23371,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *         resultp = (<char **> resultp)[0] + suboffset
  * 
  */
-  __pyx_t_1 = (__pyx_v_suboffset >= 0);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":897
  *     resultp = bufp + index * stride
@@ -23073,8 +23399,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
   __pyx_r = 0;
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
+  __Pyx_XDECREF(__pyx_t_4);
   __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
@@ -23097,14 +23423,15 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
   int __pyx_v_i;
   int __pyx_v_j;
   int __pyx_r;
-  long __pyx_t_1;
-  int __pyx_t_2;
-  Py_ssize_t __pyx_t_3;
+  int __pyx_t_1;
+  Py_ssize_t *__pyx_t_2;
+  long __pyx_t_3;
   Py_ssize_t __pyx_t_4;
-  int __pyx_t_5;
+  Py_ssize_t __pyx_t_5;
   int __pyx_t_6;
   int __pyx_t_7;
   int __pyx_t_8;
+  int __pyx_t_9;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -23116,7 +23443,8 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  * 
  *     cdef Py_ssize_t *shape = memslice.shape
  */
-  __pyx_v_ndim = __pyx_v_memslice->memview->view.ndim;
+  __pyx_t_1 = __pyx_v_memslice->memview->view.ndim;
+  __pyx_v_ndim = __pyx_t_1;
 
   /* "View.MemoryView":908
  *     cdef int ndim = memslice.memview.view.ndim
@@ -23125,7 +23453,8 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  *     cdef Py_ssize_t *strides = memslice.strides
  * 
  */
-  __pyx_v_shape = __pyx_v_memslice->shape;
+  __pyx_t_2 = __pyx_v_memslice->shape;
+  __pyx_v_shape = __pyx_t_2;
 
   /* "View.MemoryView":909
  * 
@@ -23134,7 +23463,8 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  * 
  * 
  */
-  __pyx_v_strides = __pyx_v_memslice->strides;
+  __pyx_t_2 = __pyx_v_memslice->strides;
+  __pyx_v_strides = __pyx_t_2;
 
   /* "View.MemoryView":913
  * 
@@ -23143,9 +23473,9 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  *         j = ndim - 1 - i
  *         strides[i], strides[j] = strides[j], strides[i]
  */
-  __pyx_t_1 = __Pyx_div_long(__pyx_v_ndim, 2);
-  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
-    __pyx_v_i = __pyx_t_2;
+  __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2);
+  for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_3; __pyx_t_1+=1) {
+    __pyx_v_i = __pyx_t_1;
 
     /* "View.MemoryView":914
  *     cdef int i, j
@@ -23163,10 +23493,10 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  *         shape[i], shape[j] = shape[j], shape[i]
  * 
  */
-    __pyx_t_3 = (__pyx_v_strides[__pyx_v_j]);
-    __pyx_t_4 = (__pyx_v_strides[__pyx_v_i]);
-    (__pyx_v_strides[__pyx_v_i]) = __pyx_t_3;
-    (__pyx_v_strides[__pyx_v_j]) = __pyx_t_4;
+    __pyx_t_4 = (__pyx_v_strides[__pyx_v_j]);
+    __pyx_t_5 = (__pyx_v_strides[__pyx_v_i]);
+    (__pyx_v_strides[__pyx_v_i]) = __pyx_t_4;
+    (__pyx_v_strides[__pyx_v_j]) = __pyx_t_5;
 
     /* "View.MemoryView":916
  *         j = ndim - 1 - i
@@ -23175,10 +23505,10 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  * 
  *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
  */
-    __pyx_t_4 = (__pyx_v_shape[__pyx_v_j]);
-    __pyx_t_3 = (__pyx_v_shape[__pyx_v_i]);
-    (__pyx_v_shape[__pyx_v_i]) = __pyx_t_4;
-    (__pyx_v_shape[__pyx_v_j]) = __pyx_t_3;
+    __pyx_t_5 = (__pyx_v_shape[__pyx_v_j]);
+    __pyx_t_4 = (__pyx_v_shape[__pyx_v_i]);
+    (__pyx_v_shape[__pyx_v_i]) = __pyx_t_5;
+    (__pyx_v_shape[__pyx_v_j]) = __pyx_t_4;
 
     /* "View.MemoryView":918
  *         shape[i], shape[j] = shape[j], shape[i]
@@ -23187,14 +23517,14 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
  * 
  */
-    __pyx_t_5 = ((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0);
-    if (!__pyx_t_5) {
-      __pyx_t_6 = ((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0);
-      __pyx_t_7 = __pyx_t_6;
+    __pyx_t_6 = (((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0) != 0);
+    if (!__pyx_t_6) {
+      __pyx_t_7 = (((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0) != 0);
+      __pyx_t_8 = __pyx_t_7;
     } else {
-      __pyx_t_7 = __pyx_t_5;
+      __pyx_t_8 = __pyx_t_6;
     }
-    if (__pyx_t_7) {
+    if (__pyx_t_8) {
 
       /* "View.MemoryView":919
  * 
@@ -23203,7 +23533,7 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  * 
  *     return 1
  */
-      __pyx_t_8 = __pyx_memoryview_err(__pyx_builtin_ValueError, __pyx_k_125); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = __pyx_memoryview_err(__pyx_builtin_ValueError, __pyx_k_125); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L5;
     }
     __pyx_L5:;
@@ -23294,7 +23624,7 @@ static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memor
  *             return self.to_object_func(itemp)
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_self->to_object_func != NULL);
+  __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":943
@@ -23368,7 +23698,7 @@ static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memo
  *             self.to_dtype_func(itemp, value)
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_self->to_dtype_func != NULL);
+  __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":949
@@ -23467,8 +23797,11 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
   int __pyx_t_1;
   PyObject *__pyx_t_2 = NULL;
   PyObject *__pyx_t_3 = NULL;
-  int __pyx_t_4;
-  int __pyx_t_5;
+  __Pyx_TypeInfo *__pyx_t_4;
+  Py_buffer __pyx_t_5;
+  Py_ssize_t __pyx_t_6;
+  int __pyx_t_7;
+  int __pyx_t_8;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -23481,7 +23814,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
  *         return None
  * 
  */
-  __pyx_t_1 = (((PyObject *)__pyx_v_memviewslice.memview) == Py_None);
+  __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":972
@@ -23550,7 +23883,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
  *     result.typeinfo = memviewslice.memview.typeinfo
  * 
  */
-  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s__base); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s__base); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_GIVEREF(__pyx_t_2);
   __Pyx_GOTREF(__pyx_v_result->from_object);
@@ -23565,7 +23898,8 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
  * 
  *     result.view = memviewslice.memview.view
  */
-  __pyx_v_result->__pyx_base.typeinfo = __pyx_v_memviewslice.memview->typeinfo;
+  __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo;
+  __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4;
 
   /* "View.MemoryView":985
  *     result.typeinfo = memviewslice.memview.typeinfo
@@ -23574,7 +23908,8 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
  *     result.view.buf = <void *> memviewslice.data
  *     result.view.ndim = ndim
  */
-  __pyx_v_result->__pyx_base.view = __pyx_v_memviewslice.memview->view;
+  __pyx_t_5 = __pyx_v_memviewslice.memview->view;
+  __pyx_v_result->__pyx_base.view = __pyx_t_5;
 
   /* "View.MemoryView":986
  * 
@@ -23655,7 +23990,8 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
  *     for i in range(ndim):
  *         result.view.len *= result.view.shape[i]
  */
-  __pyx_v_result->__pyx_base.view.len = __pyx_v_result->__pyx_base.view.itemsize;
+  __pyx_t_6 = __pyx_v_result->__pyx_base.view.itemsize;
+  __pyx_v_result->__pyx_base.view.len = __pyx_t_6;
 
   /* "View.MemoryView":998
  * 
@@ -23664,9 +24000,9 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
  *         result.view.len *= result.view.shape[i]
  * 
  */
-  __pyx_t_4 = __pyx_v_ndim;
-  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
-    __pyx_v_i = __pyx_t_5;
+  __pyx_t_7 = __pyx_v_ndim;
+  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
+    __pyx_v_i = __pyx_t_8;
 
     /* "View.MemoryView":999
  *     result.view.len = result.view.itemsize
@@ -23734,7 +24070,7 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p
   struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0;
   __Pyx_memviewslice *__pyx_r;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
+  int __pyx_t_1;
   int __pyx_t_2;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
@@ -23748,10 +24084,8 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p
  *         obj = memview
  *         return &obj.from_slice
  */
-  __pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryviewslice_type));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), ((PyObject *)__pyx_memoryviewslice_type)); 
+  __pyx_t_2 = (__pyx_t_1 != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":1011
@@ -23802,7 +24136,6 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p
   __pyx_r = 0;
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
   __Pyx_WriteUnraisable("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
@@ -23825,9 +24158,10 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem
   Py_ssize_t *__pyx_v_strides;
   Py_ssize_t *__pyx_v_suboffsets;
   __Pyx_RefNannyDeclarations
-  int __pyx_t_1;
+  Py_ssize_t *__pyx_t_1;
   int __pyx_t_2;
   int __pyx_t_3;
+  int __pyx_t_4;
   __Pyx_RefNannySetupContext("slice_copy", 0);
 
   /* "View.MemoryView":1022
@@ -23837,7 +24171,8 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem
  *     strides = memview.view.strides
  *     suboffsets = memview.view.suboffsets
  */
-  __pyx_v_shape = __pyx_v_memview->view.shape;
+  __pyx_t_1 = __pyx_v_memview->view.shape;
+  __pyx_v_shape = __pyx_t_1;
 
   /* "View.MemoryView":1023
  * 
@@ -23846,7 +24181,8 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem
  *     suboffsets = memview.view.suboffsets
  * 
  */
-  __pyx_v_strides = __pyx_v_memview->view.strides;
+  __pyx_t_1 = __pyx_v_memview->view.strides;
+  __pyx_v_strides = __pyx_t_1;
 
   /* "View.MemoryView":1024
  *     shape = memview.view.shape
@@ -23855,7 +24191,8 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem
  * 
  *     dst.memview = <__pyx_memoryview *> memview
  */
-  __pyx_v_suboffsets = __pyx_v_memview->view.suboffsets;
+  __pyx_t_1 = __pyx_v_memview->view.suboffsets;
+  __pyx_v_suboffsets = __pyx_t_1;
 
   /* "View.MemoryView":1026
  *     suboffsets = memview.view.suboffsets
@@ -23882,9 +24219,9 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem
  *         dst.shape[dim] = shape[dim]
  *         dst.strides[dim] = strides[dim]
  */
-  __pyx_t_1 = __pyx_v_memview->view.ndim;
-  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
-    __pyx_v_dim = __pyx_t_2;
+  __pyx_t_2 = __pyx_v_memview->view.ndim;
+  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
+    __pyx_v_dim = __pyx_t_3;
 
     /* "View.MemoryView":1030
  * 
@@ -23911,8 +24248,8 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem
  *             dst.suboffsets[dim] = -1
  *         else:
  */
-    __pyx_t_3 = (__pyx_v_suboffsets == NULL);
-    if (__pyx_t_3) {
+    __pyx_t_4 = ((__pyx_v_suboffsets == NULL) != 0);
+    if (__pyx_t_4) {
 
       /* "View.MemoryView":1033
  *         dst.strides[dim] = strides[dim]
@@ -24007,8 +24344,11 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview
   int (*__pyx_v_to_dtype_func)(char *, PyObject *);
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
+  int __pyx_t_1;
   int __pyx_t_2;
+  PyObject *(*__pyx_t_3)(char *);
+  int (*__pyx_t_4)(char *, PyObject *);
+  PyObject *__pyx_t_5 = NULL;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -24021,10 +24361,8 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview
  *         to_object_func = (<_memoryviewslice> memview).to_object_func
  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
  */
-  __pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryviewslice_type));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), ((PyObject *)__pyx_memoryviewslice_type)); 
+  __pyx_t_2 = (__pyx_t_1 != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":1053
@@ -24034,7 +24372,8 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview
  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
  *     else:
  */
-    __pyx_v_to_object_func = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
+    __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
+    __pyx_v_to_object_func = __pyx_t_3;
 
     /* "View.MemoryView":1054
  *     if isinstance(memview, _memoryviewslice):
@@ -24043,7 +24382,8 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview
  *     else:
  *         to_object_func = NULL
  */
-    __pyx_v_to_dtype_func = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
+    __pyx_t_4 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
+    __pyx_v_to_dtype_func = __pyx_t_4;
     goto __pyx_L3;
   }
   /*else*/ {
@@ -24084,16 +24424,16 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview
  * 
  * 
  */
-  __pyx_t_1 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_r = __pyx_t_1;
-  __pyx_t_1 = 0;
+  __pyx_t_5 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
+  __pyx_r = __pyx_t_5;
+  __pyx_t_5 = 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_5);
   __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
@@ -24121,7 +24461,7 @@ static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) {
  *         return -arg
  *     else:
  */
-  __pyx_t_1 = (__pyx_v_arg < 0);
+  __pyx_t_1 = ((__pyx_v_arg < 0) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":1069
@@ -24206,7 +24546,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _
  *             c_stride = mslice.strides[i]
  *             break
  */
-    __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1);
+    __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":1084
@@ -24250,7 +24590,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _
  *             f_stride = mslice.strides[i]
  *             break
  */
-    __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1);
+    __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":1089
@@ -24283,7 +24623,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _
  *         return 'C'
  *     else:
  */
-  __pyx_t_2 = (abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride));
+  __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":1093
@@ -24380,7 +24720,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v
  *        if (src_stride > 0 and dst_stride > 0 and
  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
  */
-  __pyx_t_1 = (__pyx_v_ndim == 1);
+  __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":1111
@@ -24390,9 +24730,9 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v
  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
  *            memcpy(dst_data, src_data, itemsize * dst_extent)
  */
-    __pyx_t_1 = (__pyx_v_src_stride > 0);
+    __pyx_t_1 = ((__pyx_v_src_stride > 0) != 0);
     if (__pyx_t_1) {
-      __pyx_t_2 = (__pyx_v_dst_stride > 0);
+      __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":1112
@@ -24406,7 +24746,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v
         if (__pyx_t_3) {
           __pyx_t_3 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride));
         }
-        __pyx_t_4 = __pyx_t_3;
+        __pyx_t_4 = (__pyx_t_3 != 0);
       } else {
         __pyx_t_4 = __pyx_t_2;
       }
@@ -24548,8 +24888,9 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_sr
   int __pyx_v_i;
   Py_ssize_t __pyx_v_size;
   Py_ssize_t __pyx_r;
-  int __pyx_t_1;
+  Py_ssize_t __pyx_t_1;
   int __pyx_t_2;
+  int __pyx_t_3;
 
   /* "View.MemoryView":1138
  *     "Return the size of the memory occupied by the slice in number of bytes"
@@ -24558,7 +24899,8 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_sr
  * 
  *     for i in range(ndim):
  */
-  __pyx_v_size = __pyx_v_src->memview->view.itemsize;
+  __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
+  __pyx_v_size = __pyx_t_1;
 
   /* "View.MemoryView":1140
  *     cdef Py_ssize_t size = src.memview.view.itemsize
@@ -24567,9 +24909,9 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_sr
  *         size *= src.shape[i]
  * 
  */
-  __pyx_t_1 = __pyx_v_ndim;
-  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
-    __pyx_v_i = __pyx_t_2;
+  __pyx_t_2 = __pyx_v_ndim;
+  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
+    __pyx_v_i = __pyx_t_3;
 
     /* "View.MemoryView":1141
  * 
@@ -24618,7 +24960,7 @@ static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_
  *         for idx in range(ndim):
  *             strides[idx] = stride
  */
-  __pyx_t_1 = (__pyx_v_order == 'F');
+  __pyx_t_1 = ((__pyx_v_order == 'F') != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":1156
@@ -24714,9 +25056,11 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
   size_t __pyx_v_itemsize;
   size_t __pyx_v_size;
   void *__pyx_r;
-  int __pyx_t_1;
+  Py_ssize_t __pyx_t_1;
   int __pyx_t_2;
   int __pyx_t_3;
+  struct __pyx_memoryview_obj *__pyx_t_4;
+  int __pyx_t_5;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -24728,7 +25072,8 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *     cdef size_t size = slice_get_size(src, ndim)
  * 
  */
-  __pyx_v_itemsize = __pyx_v_src->memview->view.itemsize;
+  __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
+  __pyx_v_itemsize = __pyx_t_1;
 
   /* "View.MemoryView":1179
  * 
@@ -24755,8 +25100,8 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *         _err(MemoryError, NULL)
  * 
  */
-  __pyx_t_1 = (!(__pyx_v_result != 0));
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":1183
  *     result = malloc(size)
@@ -24765,7 +25110,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  * 
  * 
  */
-    __pyx_t_2 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L3;
   }
   __pyx_L3:;
@@ -24786,7 +25131,8 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *     for i in range(ndim):
  *         tmpslice.shape[i] = src.shape[i]
  */
-  __pyx_v_tmpslice->memview = __pyx_v_src->memview;
+  __pyx_t_4 = __pyx_v_src->memview;
+  __pyx_v_tmpslice->memview = __pyx_t_4;
 
   /* "View.MemoryView":1188
  *     tmpslice.data = <char *> result
@@ -24795,9 +25141,9 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *         tmpslice.shape[i] = src.shape[i]
  *         tmpslice.suboffsets[i] = -1
  */
-  __pyx_t_2 = __pyx_v_ndim;
-  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
-    __pyx_v_i = __pyx_t_3;
+  __pyx_t_3 = __pyx_v_ndim;
+  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_3; __pyx_t_5+=1) {
+    __pyx_v_i = __pyx_t_5;
 
     /* "View.MemoryView":1189
  *     tmpslice.memview = src.memview
@@ -24834,9 +25180,9 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *         if tmpslice.shape[i] == 1:
  *             tmpslice.strides[i] = 0
  */
-  __pyx_t_2 = __pyx_v_ndim;
-  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
-    __pyx_v_i = __pyx_t_3;
+  __pyx_t_3 = __pyx_v_ndim;
+  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_3; __pyx_t_5+=1) {
+    __pyx_v_i = __pyx_t_5;
 
     /* "View.MemoryView":1197
  * 
@@ -24845,8 +25191,8 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *             tmpslice.strides[i] = 0
  * 
  */
-    __pyx_t_1 = ((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1);
-    if (__pyx_t_1) {
+    __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1198
  *     for i in range(ndim):
@@ -24868,8 +25214,8 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *         memcpy(result, src.data, size)
  *     else:
  */
-  __pyx_t_1 = __pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":1201
  * 
@@ -25097,7 +25443,7 @@ static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) {
  *         raise error(msg.decode('ascii'))
  *     else:
  */
-  __pyx_t_1 = (__pyx_v_msg != NULL);
+  __pyx_t_1 = ((__pyx_v_msg != NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":1222
@@ -25170,11 +25516,13 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
   __Pyx_memviewslice __pyx_v_tmp;
   int __pyx_v_ndim;
   int __pyx_r;
-  int __pyx_t_1;
+  Py_ssize_t __pyx_t_1;
   int __pyx_t_2;
   int __pyx_t_3;
   int __pyx_t_4;
-  void *__pyx_t_5;
+  int __pyx_t_5;
+  void *__pyx_t_6;
+  int __pyx_t_7;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -25195,7 +25543,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *     cdef int i
  *     cdef char order = get_best_order(&src, src_ndim)
  */
-  __pyx_v_itemsize = __pyx_v_src.memview->view.itemsize;
+  __pyx_t_1 = __pyx_v_src.memview->view.itemsize;
+  __pyx_v_itemsize = __pyx_t_1;
 
   /* "View.MemoryView":1238
  *     cdef size_t itemsize = src.memview.view.itemsize
@@ -25231,8 +25580,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *         broadcast_leading(&src, src_ndim, dst_ndim)
  *     elif dst_ndim < src_ndim:
  */
-  __pyx_t_1 = (__pyx_v_src_ndim < __pyx_v_dst_ndim);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":1244
  * 
@@ -25252,8 +25601,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *         broadcast_leading(&dst, dst_ndim, src_ndim)
  * 
  */
-  __pyx_t_1 = (__pyx_v_dst_ndim < __pyx_v_src_ndim);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":1246
  *         broadcast_leading(&src, src_ndim, dst_ndim)
@@ -25274,14 +25623,14 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  *     for i in range(ndim):
  */
-  __pyx_t_2 = __pyx_v_dst_ndim;
-  __pyx_t_3 = __pyx_v_src_ndim;
-  if ((__pyx_t_2 > __pyx_t_3)) {
-    __pyx_t_4 = __pyx_t_2;
+  __pyx_t_3 = __pyx_v_dst_ndim;
+  __pyx_t_4 = __pyx_v_src_ndim;
+  if (((__pyx_t_3 > __pyx_t_4) != 0)) {
+    __pyx_t_5 = __pyx_t_3;
   } else {
-    __pyx_t_4 = __pyx_t_3;
+    __pyx_t_5 = __pyx_t_4;
   }
-  __pyx_v_ndim = __pyx_t_4;
+  __pyx_v_ndim = __pyx_t_5;
 
   /* "View.MemoryView":1250
  *     cdef int ndim = max(src_ndim, dst_ndim)
@@ -25290,9 +25639,9 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *         if src.shape[i] != dst.shape[i]:
  *             if src.shape[i] == 1:
  */
-  __pyx_t_4 = __pyx_v_ndim;
-  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_4; __pyx_t_2+=1) {
-    __pyx_v_i = __pyx_t_2;
+  __pyx_t_5 = __pyx_v_ndim;
+  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_5; __pyx_t_3+=1) {
+    __pyx_v_i = __pyx_t_3;
 
     /* "View.MemoryView":1251
  * 
@@ -25301,8 +25650,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *             if src.shape[i] == 1:
  *                 broadcasting = True
  */
-    __pyx_t_1 = ((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i]));
-    if (__pyx_t_1) {
+    __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1252
  *     for i in range(ndim):
@@ -25311,8 +25660,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *                 broadcasting = True
  *                 src.strides[i] = 0
  */
-      __pyx_t_1 = ((__pyx_v_src.shape[__pyx_v_i]) == 1);
-      if (__pyx_t_1) {
+      __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0);
+      if (__pyx_t_2) {
 
         /* "View.MemoryView":1253
  *         if src.shape[i] != dst.shape[i]:
@@ -25342,7 +25691,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  *         if src.suboffsets[i] >= 0:
  */
-        __pyx_t_3 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_4 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       }
       __pyx_L7:;
       goto __pyx_L6;
@@ -25356,8 +25705,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *             _err_dim(ValueError, "Dimension %d is not direct", i)
  * 
  */
-    __pyx_t_1 = ((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0);
-    if (__pyx_t_1) {
+    __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1259
  * 
@@ -25366,7 +25715,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  *     if slices_overlap(&src, &dst, ndim, itemsize):
  */
-      __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, __pyx_k_127, __pyx_v_i); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, __pyx_k_127, __pyx_v_i); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L8;
     }
     __pyx_L8:;
@@ -25379,8 +25728,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  *         if not slice_is_contig(&src, order, ndim):
  */
-  __pyx_t_1 = __pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":1263
  *     if slices_overlap(&src, &dst, ndim, itemsize):
@@ -25389,8 +25738,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *             order = get_best_order(&dst, ndim)
  * 
  */
-    __pyx_t_1 = (!__pyx_memviewslice_is_contig((&__pyx_v_src), __pyx_v_order, __pyx_v_ndim));
-    if (__pyx_t_1) {
+    __pyx_t_2 = ((!(__pyx_memviewslice_is_contig((&__pyx_v_src), __pyx_v_order, __pyx_v_ndim) != 0)) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1264
  * 
@@ -25411,8 +25760,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *         src = tmp
  * 
  */
-    __pyx_t_5 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_v_tmpdata = __pyx_t_5;
+    __pyx_t_6 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_v_tmpdata = __pyx_t_6;
 
     /* "View.MemoryView":1267
  * 
@@ -25433,8 +25782,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  * 
  */
-  __pyx_t_1 = (!__pyx_v_broadcasting);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":1272
  * 
@@ -25443,8 +25792,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *             direct_copy = slice_is_contig(&dst, 'C', ndim)
  *         elif slice_is_contig(&src, 'F', ndim):
  */
-    __pyx_t_1 = __pyx_memviewslice_is_contig((&__pyx_v_src), 'C', __pyx_v_ndim);
-    if (__pyx_t_1) {
+    __pyx_t_2 = (__pyx_memviewslice_is_contig((&__pyx_v_src), 'C', __pyx_v_ndim) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1273
  * 
@@ -25464,8 +25813,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *             direct_copy = slice_is_contig(&dst, 'F', ndim)
  * 
  */
-    __pyx_t_1 = __pyx_memviewslice_is_contig((&__pyx_v_src), 'F', __pyx_v_ndim);
-    if (__pyx_t_1) {
+    __pyx_t_2 = (__pyx_memviewslice_is_contig((&__pyx_v_src), 'F', __pyx_v_ndim) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1275
  *             direct_copy = slice_is_contig(&dst, 'C', ndim)
@@ -25486,7 +25835,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  *             refcount_copying(&dst, dtype_is_object, ndim, False)
  */
-    if (__pyx_v_direct_copy) {
+    __pyx_t_2 = (__pyx_v_direct_copy != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1279
  *         if direct_copy:
@@ -25538,11 +25888,12 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  * 
  */
-  __pyx_t_1 = (__pyx_v_order == 'F');
-  if (__pyx_t_1) {
-    __pyx_t_1 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
+  __pyx_t_2 = (__pyx_v_order == 'F');
+  if (__pyx_t_2) {
+    __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
   }
-  if (__pyx_t_1) {
+  __pyx_t_7 = (__pyx_t_2 != 0);
+  if (__pyx_t_7) {
 
     /* "View.MemoryView":1287
  * 
@@ -25551,7 +25902,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *         transpose_memslice(&dst)
  * 
  */
-    __pyx_t_4 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_4 == 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
     /* "View.MemoryView":1288
  * 
@@ -25560,7 +25911,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  *     refcount_copying(&dst, dtype_is_object, ndim, False)
  */
-    __pyx_t_4 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_4 == 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L14;
   }
   __pyx_L14:;
@@ -25739,6 +26090,7 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_slice
  */
 
 static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) {
+  int __pyx_t_1;
 
   /* "View.MemoryView":1324
  * 
@@ -25747,7 +26099,8 @@ static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, i
  *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,
  *                                            dst.strides, ndim, inc)
  */
-  if (__pyx_v_dtype_is_object) {
+  __pyx_t_1 = (__pyx_v_dtype_is_object != 0);
+  if (__pyx_t_1) {
 
     /* "View.MemoryView":1326
  *     if dtype_is_object:
@@ -25827,7 +26180,7 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss
  *             if inc:
  *                 Py_INCREF((<PyObject **> data)[0])
  */
-    __pyx_t_3 = (__pyx_v_ndim == 1);
+    __pyx_t_3 = ((__pyx_v_ndim == 1) != 0);
     if (__pyx_t_3) {
 
       /* "View.MemoryView":1341
@@ -25837,7 +26190,8 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss
  *                 Py_INCREF((<PyObject **> data)[0])
  *             else:
  */
-      if (__pyx_v_inc) {
+      __pyx_t_3 = (__pyx_v_inc != 0);
+      if (__pyx_t_3) {
 
         /* "View.MemoryView":1342
  *         if ndim == 1:
@@ -25969,7 +26323,7 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t
  *         for i in range(extent):
  *             memcpy(data, item, itemsize)
  */
-  __pyx_t_1 = (__pyx_v_ndim == 1);
+  __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":1373
@@ -26038,109 +26392,157 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t
   __pyx_L3:;
 
 }
-static struct __pyx_vtabstruct_11_distortion_Quad __pyx_vtable_11_distortion_Quad;
+static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;
 
-static PyObject *__pyx_tp_new_11_distortion_Quad(PyTypeObject *t, PyObject *a, PyObject *k) {
-  struct __pyx_obj_11_distortion_Quad *p;
-  PyObject *o = (*t->tp_alloc)(t, 0);
-  if (!o) return 0;
-  p = ((struct __pyx_obj_11_distortion_Quad *)o);
-  p->__pyx_vtab = __pyx_vtabptr_11_distortion_Quad;
-  p->box.data = NULL;
-  p->box.memview = NULL;
-  if (__pyx_pw_11_distortion_4Quad_1__cinit__(o, a, k) < 0) {
+static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
+  struct __pyx_memoryview_obj *p;
+  PyObject *o;
+  o = (*t->tp_alloc)(t, 0);
+  if (unlikely(!o)) return 0;
+  p = ((struct __pyx_memoryview_obj *)o);
+  p->__pyx_vtab = __pyx_vtabptr_memoryview;
+  p->obj = Py_None; Py_INCREF(Py_None);
+  p->_size = Py_None; Py_INCREF(Py_None);
+  p->_array_interface = Py_None; Py_INCREF(Py_None);
+  p->view.obj = NULL;
+  if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) {
     Py_DECREF(o); o = 0;
   }
   return o;
 }
 
-static void __pyx_tp_dealloc_11_distortion_Quad(PyObject *o) {
-  struct __pyx_obj_11_distortion_Quad *p = (struct __pyx_obj_11_distortion_Quad *)o;
-  __PYX_XDEC_MEMVIEW(&p->box, 1);
+static void __pyx_tp_dealloc_memoryview(PyObject *o) {
+  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
+  PyObject_GC_UnTrack(o);
+  {
+    PyObject *etype, *eval, *etb;
+    PyErr_Fetch(&etype, &eval, &etb);
+    ++Py_REFCNT(o);
+    __pyx_memoryview___dealloc__(o);
+    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
+    --Py_REFCNT(o);
+    PyErr_Restore(etype, eval, etb);
+  }
+  Py_CLEAR(p->obj);
+  Py_CLEAR(p->_size);
+  Py_CLEAR(p->_array_interface);
   (*Py_TYPE(o)->tp_free)(o);
 }
 
-static PyMethodDef __pyx_methods_11_distortion_Quad[] = {
-  {__Pyx_NAMESTR("reinit"), (PyCFunction)__pyx_pw_11_distortion_4Quad_3reinit, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
-  {__Pyx_NAMESTR("get_box"), (PyCFunction)__pyx_pw_11_distortion_4Quad_7get_box, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
-  {__Pyx_NAMESTR("get_offset0"), (PyCFunction)__pyx_pw_11_distortion_4Quad_9get_offset0, METH_NOARGS, __Pyx_DOCSTR(0)},
-  {__Pyx_NAMESTR("get_offset1"), (PyCFunction)__pyx_pw_11_distortion_4Quad_11get_offset1, METH_NOARGS, __Pyx_DOCSTR(0)},
-  {__Pyx_NAMESTR("get_box_size0"), (PyCFunction)__pyx_pw_11_distortion_4Quad_13get_box_size0, METH_NOARGS, __Pyx_DOCSTR(0)},
-  {__Pyx_NAMESTR("get_box_size1"), (PyCFunction)__pyx_pw_11_distortion_4Quad_15get_box_size1, METH_NOARGS, __Pyx_DOCSTR(0)},
-  {__Pyx_NAMESTR("init_slope"), (PyCFunction)__pyx_pw_11_distortion_4Quad_17init_slope, METH_NOARGS, __Pyx_DOCSTR(0)},
-  {__Pyx_NAMESTR("calc_area_AB"), (PyCFunction)__pyx_pw_11_distortion_4Quad_19calc_area_AB, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
-  {__Pyx_NAMESTR("calc_area_BC"), (PyCFunction)__pyx_pw_11_distortion_4Quad_21calc_area_BC, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
-  {__Pyx_NAMESTR("calc_area_CD"), (PyCFunction)__pyx_pw_11_distortion_4Quad_23calc_area_CD, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
-  {__Pyx_NAMESTR("calc_area_DA"), (PyCFunction)__pyx_pw_11_distortion_4Quad_25calc_area_DA, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
-  {__Pyx_NAMESTR("calc_area"), (PyCFunction)__pyx_pw_11_distortion_4Quad_27calc_area, METH_NOARGS, __Pyx_DOCSTR(0)},
-  {__Pyx_NAMESTR("populate_box"), (PyCFunction)__pyx_pw_11_distortion_4Quad_29populate_box, METH_NOARGS, __Pyx_DOCSTR(0)},
-  {__Pyx_NAMESTR("integrate"), (PyCFunction)__pyx_pw_11_distortion_4Quad_31integrate, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
+static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) {
+  int e;
+  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
+  if (p->obj) {
+    e = (*v)(p->obj, a); if (e) return e;
+  }
+  if (p->_size) {
+    e = (*v)(p->_size, a); if (e) return e;
+  }
+  if (p->_array_interface) {
+    e = (*v)(p->_array_interface, a); if (e) return e;
+  }
+  if (p->view.obj) {
+    e = (*v)(p->view.obj, a); if (e) return e;
+  }
+  return 0;
+}
+
+static int __pyx_tp_clear_memoryview(PyObject *o) {
+  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
+  PyObject* tmp;
+  tmp = ((PyObject*)p->obj);
+  p->obj = Py_None; Py_INCREF(Py_None);
+  Py_XDECREF(tmp);
+  tmp = ((PyObject*)p->_size);
+  p->_size = Py_None; Py_INCREF(Py_None);
+  Py_XDECREF(tmp);
+  tmp = ((PyObject*)p->_array_interface);
+  p->_array_interface = Py_None; Py_INCREF(Py_None);
+  Py_XDECREF(tmp);
+  Py_CLEAR(p->view.obj);
+  return 0;
+}
+static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
+  PyObject *r;
+  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
+  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
+  Py_DECREF(x);
+  return r;
+}
+
+static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) {
+  if (v) {
+    return __pyx_memoryview___setitem__(o, i, v);
+  }
+  else {
+    PyErr_Format(PyExc_NotImplementedError,
+      "Subscript deletion not supported by %s", Py_TYPE(o)->tp_name);
+    return -1;
+  }
+}
+
+static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_transpose(o);
+}
+
+static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview__get__base(o);
+}
+
+static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_shape(o);
+}
+
+static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_strides(o);
+}
+
+static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_suboffsets(o);
+}
+
+static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_ndim(o);
+}
+
+static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_itemsize(o);
+}
+
+static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_nbytes(o);
+}
+
+static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_size(o);
+}
+
+static PyMethodDef __pyx_methods_memoryview[] = {
+  {__Pyx_NAMESTR("is_c_contig"), (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, __Pyx_DOCSTR(0)},
+  {__Pyx_NAMESTR("is_f_contig"), (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, __Pyx_DOCSTR(0)},
+  {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, __Pyx_DOCSTR(0)},
+  {__Pyx_NAMESTR("copy_fortran"), (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, __Pyx_DOCSTR(0)},
   {0, 0, 0, 0}
 };
 
-static PyNumberMethods __pyx_tp_as_number_Quad = {
-  0, /*nb_add*/
-  0, /*nb_subtract*/
-  0, /*nb_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_divide*/
-  #endif
-  0, /*nb_remainder*/
-  0, /*nb_divmod*/
-  0, /*nb_power*/
-  0, /*nb_negative*/
-  0, /*nb_positive*/
-  0, /*nb_absolute*/
-  0, /*nb_nonzero*/
-  0, /*nb_invert*/
-  0, /*nb_lshift*/
-  0, /*nb_rshift*/
-  0, /*nb_and*/
-  0, /*nb_xor*/
-  0, /*nb_or*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_coerce*/
-  #endif
-  0, /*nb_int*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_long*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*nb_float*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_oct*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_hex*/
-  #endif
-  0, /*nb_inplace_add*/
-  0, /*nb_inplace_subtract*/
-  0, /*nb_inplace_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_inplace_divide*/
-  #endif
-  0, /*nb_inplace_remainder*/
-  0, /*nb_inplace_power*/
-  0, /*nb_inplace_lshift*/
-  0, /*nb_inplace_rshift*/
-  0, /*nb_inplace_and*/
-  0, /*nb_inplace_xor*/
-  0, /*nb_inplace_or*/
-  0, /*nb_floor_divide*/
-  0, /*nb_true_divide*/
-  0, /*nb_inplace_floor_divide*/
-  0, /*nb_inplace_true_divide*/
-  #if PY_VERSION_HEX >= 0x02050000
-  0, /*nb_index*/
-  #endif
+static struct PyGetSetDef __pyx_getsets_memoryview[] = {
+  {(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, 0, 0},
+  {(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, 0, 0},
+  {(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, 0, 0},
+  {(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, 0, 0},
+  {(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, 0, 0},
+  {(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, 0, 0},
+  {(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, 0, 0},
+  {(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, 0, 0},
+  {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, 0, 0},
+  {0, 0, 0, 0, 0}
 };
 
-static PySequenceMethods __pyx_tp_as_sequence_Quad = {
-  0, /*sq_length*/
+static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
+  __pyx_memoryview___len__, /*sq_length*/
   0, /*sq_concat*/
   0, /*sq_repeat*/
-  0, /*sq_item*/
+  __pyx_sq_item_memoryview, /*sq_item*/
   0, /*sq_slice*/
   0, /*sq_ass_item*/
   0, /*sq_ass_slice*/
@@ -26149,13 +26551,13 @@ static PySequenceMethods __pyx_tp_as_sequence_Quad = {
   0, /*sq_inplace_repeat*/
 };
 
-static PyMappingMethods __pyx_tp_as_mapping_Quad = {
-  0, /*mp_length*/
-  0, /*mp_subscript*/
-  0, /*mp_ass_subscript*/
+static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
+  __pyx_memoryview___len__, /*mp_length*/
+  __pyx_memoryview___getitem__, /*mp_subscript*/
+  __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/
 };
 
-static PyBufferProcs __pyx_tp_as_buffer_Quad = {
+static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
   #if PY_MAJOR_VERSION < 3
   0, /*bf_getreadbuffer*/
   #endif
@@ -26169,19 +26571,19 @@ static PyBufferProcs __pyx_tp_as_buffer_Quad = {
   0, /*bf_getcharbuffer*/
   #endif
   #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_getbuffer*/
+  __pyx_memoryview_getbuffer, /*bf_getbuffer*/
   #endif
   #if PY_VERSION_HEX >= 0x02060000
   0, /*bf_releasebuffer*/
   #endif
 };
 
-static PyTypeObject __pyx_type_11_distortion_Quad = {
+static PyTypeObject __pyx_type___pyx_memoryview = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("_distortion.Quad"), /*tp_name*/
-  sizeof(struct __pyx_obj_11_distortion_Quad), /*tp_basicsize*/
+  __Pyx_NAMESTR("_distortion.memoryview"), /*tp_name*/
+  sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_11_distortion_Quad, /*tp_dealloc*/
+  __pyx_tp_dealloc_memoryview, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -26190,27 +26592,27 @@ static PyTypeObject __pyx_type_11_distortion_Quad = {
   #else
   0, /*reserved*/
   #endif
-  __pyx_pw_11_distortion_4Quad_5__repr__, /*tp_repr*/
-  &__pyx_tp_as_number_Quad, /*tp_as_number*/
-  &__pyx_tp_as_sequence_Quad, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping_Quad, /*tp_as_mapping*/
+  __pyx_memoryview___repr__, /*tp_repr*/
+  0, /*tp_as_number*/
+  &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/
+  &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/
   0, /*tp_hash*/
   0, /*tp_call*/
-  0, /*tp_str*/
+  __pyx_memoryview___str__, /*tp_str*/
   0, /*tp_getattro*/
   0, /*tp_setattro*/
-  &__pyx_tp_as_buffer_Quad, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
-  __Pyx_DOCSTR("\n    Basic quadrilatere object\n\n                                     |\n                                     |\n                                     |                       xxxxxA\n                                     |      xxxxxxxI'xxxxxxxx     x\n                             xxxxxxxxIxxxxxx       |               x\n                Bxxxxxxxxxxxx        |             |               x\n                x                    |             |               x\n              [...]
-  0, /*tp_traverse*/
-  0, /*tp_clear*/
+  &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+  0, /*tp_doc*/
+  __pyx_tp_traverse_memoryview, /*tp_traverse*/
+  __pyx_tp_clear_memoryview, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
   0, /*tp_iter*/
   0, /*tp_iternext*/
-  __pyx_methods_11_distortion_Quad, /*tp_methods*/
+  __pyx_methods_memoryview, /*tp_methods*/
   0, /*tp_members*/
-  0, /*tp_getset*/
+  __pyx_getsets_memoryview, /*tp_getset*/
   0, /*tp_base*/
   0, /*tp_dict*/
   0, /*tp_descr_get*/
@@ -26218,7 +26620,105 @@ static PyTypeObject __pyx_type_11_distortion_Quad = {
   0, /*tp_dictoffset*/
   0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_11_distortion_Quad, /*tp_new*/
+  __pyx_tp_new_memoryview, /*tp_new*/
+  0, /*tp_free*/
+  0, /*tp_is_gc*/
+  0, /*tp_bases*/
+  0, /*tp_mro*/
+  0, /*tp_cache*/
+  0, /*tp_subclasses*/
+  0, /*tp_weaklist*/
+  0, /*tp_del*/
+  #if PY_VERSION_HEX >= 0x02060000
+  0, /*tp_version_tag*/
+  #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
+};
+
+static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+  struct __pyx_MemviewEnum_obj *p;
+  PyObject *o;
+  o = (*t->tp_alloc)(t, 0);
+  if (unlikely(!o)) return 0;
+  p = ((struct __pyx_MemviewEnum_obj *)o);
+  p->name = Py_None; Py_INCREF(Py_None);
+  return o;
+}
+
+static void __pyx_tp_dealloc_Enum(PyObject *o) {
+  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
+  PyObject_GC_UnTrack(o);
+  Py_CLEAR(p->name);
+  (*Py_TYPE(o)->tp_free)(o);
+}
+
+static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) {
+  int e;
+  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
+  if (p->name) {
+    e = (*v)(p->name, a); if (e) return e;
+  }
+  return 0;
+}
+
+static int __pyx_tp_clear_Enum(PyObject *o) {
+  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
+  PyObject* tmp;
+  tmp = ((PyObject*)p->name);
+  p->name = Py_None; Py_INCREF(Py_None);
+  Py_XDECREF(tmp);
+  return 0;
+}
+
+static PyMethodDef __pyx_methods_Enum[] = {
+  {0, 0, 0, 0}
+};
+
+static PyTypeObject __pyx_type___pyx_MemviewEnum = {
+  PyVarObject_HEAD_INIT(0, 0)
+  __Pyx_NAMESTR("_distortion.Enum"), /*tp_name*/
+  sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/
+  0, /*tp_itemsize*/
+  __pyx_tp_dealloc_Enum, /*tp_dealloc*/
+  0, /*tp_print*/
+  0, /*tp_getattr*/
+  0, /*tp_setattr*/
+  #if PY_MAJOR_VERSION < 3
+  0, /*tp_compare*/
+  #else
+  0, /*reserved*/
+  #endif
+  __pyx_MemviewEnum___repr__, /*tp_repr*/
+  0, /*tp_as_number*/
+  0, /*tp_as_sequence*/
+  0, /*tp_as_mapping*/
+  0, /*tp_hash*/
+  0, /*tp_call*/
+  0, /*tp_str*/
+  0, /*tp_getattro*/
+  0, /*tp_setattro*/
+  0, /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+  0, /*tp_doc*/
+  __pyx_tp_traverse_Enum, /*tp_traverse*/
+  __pyx_tp_clear_Enum, /*tp_clear*/
+  0, /*tp_richcompare*/
+  0, /*tp_weaklistoffset*/
+  0, /*tp_iter*/
+  0, /*tp_iternext*/
+  __pyx_methods_Enum, /*tp_methods*/
+  0, /*tp_members*/
+  0, /*tp_getset*/
+  0, /*tp_base*/
+  0, /*tp_dict*/
+  0, /*tp_descr_get*/
+  0, /*tp_descr_set*/
+  0, /*tp_dictoffset*/
+  __pyx_MemviewEnum___init__, /*tp_init*/
+  0, /*tp_alloc*/
+  __pyx_tp_new_Enum, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -26230,16 +26730,20 @@ static PyTypeObject __pyx_type_11_distortion_Quad = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
 static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
   struct __pyx_array_obj *p;
-  PyObject *o = (*t->tp_alloc)(t, 0);
-  if (!o) return 0;
+  PyObject *o;
+  o = (*t->tp_alloc)(t, 0);
+  if (unlikely(!o)) return 0;
   p = ((struct __pyx_array_obj *)o);
   p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
   p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
-  if (__pyx_array___cinit__(o, a, k) < 0) {
+  if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) {
     Py_DECREF(o); o = 0;
   }
   return o;
@@ -26247,6 +26751,7 @@ static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
 
 static void __pyx_tp_dealloc_array(PyObject *o) {
   struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
+  PyObject_GC_UnTrack(o);
   {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
@@ -26326,64 +26831,6 @@ static struct PyGetSetDef __pyx_getsets_array[] = {
   {0, 0, 0, 0, 0}
 };
 
-static PyNumberMethods __pyx_tp_as_number_array = {
-  0, /*nb_add*/
-  0, /*nb_subtract*/
-  0, /*nb_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_divide*/
-  #endif
-  0, /*nb_remainder*/
-  0, /*nb_divmod*/
-  0, /*nb_power*/
-  0, /*nb_negative*/
-  0, /*nb_positive*/
-  0, /*nb_absolute*/
-  0, /*nb_nonzero*/
-  0, /*nb_invert*/
-  0, /*nb_lshift*/
-  0, /*nb_rshift*/
-  0, /*nb_and*/
-  0, /*nb_xor*/
-  0, /*nb_or*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_coerce*/
-  #endif
-  0, /*nb_int*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_long*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*nb_float*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_oct*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_hex*/
-  #endif
-  0, /*nb_inplace_add*/
-  0, /*nb_inplace_subtract*/
-  0, /*nb_inplace_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_inplace_divide*/
-  #endif
-  0, /*nb_inplace_remainder*/
-  0, /*nb_inplace_power*/
-  0, /*nb_inplace_lshift*/
-  0, /*nb_inplace_rshift*/
-  0, /*nb_inplace_and*/
-  0, /*nb_inplace_xor*/
-  0, /*nb_inplace_or*/
-  0, /*nb_floor_divide*/
-  0, /*nb_true_divide*/
-  0, /*nb_inplace_floor_divide*/
-  0, /*nb_inplace_true_divide*/
-  #if PY_VERSION_HEX >= 0x02050000
-  0, /*nb_index*/
-  #endif
-};
-
 static PySequenceMethods __pyx_tp_as_sequence_array = {
   0, /*sq_length*/
   0, /*sq_concat*/
@@ -26439,7 +26886,7 @@ static PyTypeObject __pyx_type___pyx_array = {
   0, /*reserved*/
   #endif
   0, /*tp_repr*/
-  &__pyx_tp_as_number_array, /*tp_as_number*/
+  0, /*tp_as_number*/
   &__pyx_tp_as_sequence_array, /*tp_as_sequence*/
   &__pyx_tp_as_mapping_array, /*tp_as_mapping*/
   0, /*tp_hash*/
@@ -26448,7 +26895,7 @@ static PyTypeObject __pyx_type___pyx_array = {
   __pyx_tp_getattro_array, /*tp_getattro*/
   0, /*tp_setattro*/
   &__pyx_tp_as_buffer_array, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
   0, /*tp_doc*/
   __pyx_tp_traverse_array, /*tp_traverse*/
   __pyx_tp_clear_array, /*tp_clear*/
@@ -26478,149 +26925,57 @@ static PyTypeObject __pyx_type___pyx_array = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
+static struct __pyx_vtabstruct_11_distortion_Quad __pyx_vtable_11_distortion_Quad;
 
-static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
-  struct __pyx_MemviewEnum_obj *p;
-  PyObject *o = (*t->tp_alloc)(t, 0);
-  if (!o) return 0;
-  p = ((struct __pyx_MemviewEnum_obj *)o);
-  p->name = Py_None; Py_INCREF(Py_None);
+static PyObject *__pyx_tp_new_11_distortion_Quad(PyTypeObject *t, PyObject *a, PyObject *k) {
+  struct __pyx_obj_11_distortion_Quad *p;
+  PyObject *o;
+  o = (*t->tp_alloc)(t, 0);
+  if (unlikely(!o)) return 0;
+  p = ((struct __pyx_obj_11_distortion_Quad *)o);
+  p->__pyx_vtab = __pyx_vtabptr_11_distortion_Quad;
+  p->box.data = NULL;
+  p->box.memview = NULL;
+  if (unlikely(__pyx_pw_11_distortion_4Quad_1__cinit__(o, a, k) < 0)) {
+    Py_DECREF(o); o = 0;
+  }
   return o;
 }
 
-static void __pyx_tp_dealloc_Enum(PyObject *o) {
-  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
-  Py_CLEAR(p->name);
+static void __pyx_tp_dealloc_11_distortion_Quad(PyObject *o) {
+  struct __pyx_obj_11_distortion_Quad *p = (struct __pyx_obj_11_distortion_Quad *)o;
+  __PYX_XDEC_MEMVIEW(&p->box, 1);
   (*Py_TYPE(o)->tp_free)(o);
 }
 
-static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) {
-  int e;
-  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
-  if (p->name) {
-    e = (*v)(p->name, a); if (e) return e;
-  }
-  return 0;
-}
-
-static int __pyx_tp_clear_Enum(PyObject *o) {
-  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
-  PyObject* tmp;
-  tmp = ((PyObject*)p->name);
-  p->name = Py_None; Py_INCREF(Py_None);
-  Py_XDECREF(tmp);
-  return 0;
-}
-
-static PyMethodDef __pyx_methods_Enum[] = {
+static PyMethodDef __pyx_methods_11_distortion_Quad[] = {
+  {__Pyx_NAMESTR("reinit"), (PyCFunction)__pyx_pw_11_distortion_4Quad_3reinit, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
+  {__Pyx_NAMESTR("get_box"), (PyCFunction)__pyx_pw_11_distortion_4Quad_7get_box, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
+  {__Pyx_NAMESTR("get_offset0"), (PyCFunction)__pyx_pw_11_distortion_4Quad_9get_offset0, METH_NOARGS, __Pyx_DOCSTR(0)},
+  {__Pyx_NAMESTR("get_offset1"), (PyCFunction)__pyx_pw_11_distortion_4Quad_11get_offset1, METH_NOARGS, __Pyx_DOCSTR(0)},
+  {__Pyx_NAMESTR("get_box_size0"), (PyCFunction)__pyx_pw_11_distortion_4Quad_13get_box_size0, METH_NOARGS, __Pyx_DOCSTR(0)},
+  {__Pyx_NAMESTR("get_box_size1"), (PyCFunction)__pyx_pw_11_distortion_4Quad_15get_box_size1, METH_NOARGS, __Pyx_DOCSTR(0)},
+  {__Pyx_NAMESTR("init_slope"), (PyCFunction)__pyx_pw_11_distortion_4Quad_17init_slope, METH_NOARGS, __Pyx_DOCSTR(0)},
+  {__Pyx_NAMESTR("calc_area_AB"), (PyCFunction)__pyx_pw_11_distortion_4Quad_19calc_area_AB, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
+  {__Pyx_NAMESTR("calc_area_BC"), (PyCFunction)__pyx_pw_11_distortion_4Quad_21calc_area_BC, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
+  {__Pyx_NAMESTR("calc_area_CD"), (PyCFunction)__pyx_pw_11_distortion_4Quad_23calc_area_CD, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
+  {__Pyx_NAMESTR("calc_area_DA"), (PyCFunction)__pyx_pw_11_distortion_4Quad_25calc_area_DA, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
+  {__Pyx_NAMESTR("calc_area"), (PyCFunction)__pyx_pw_11_distortion_4Quad_27calc_area, METH_NOARGS, __Pyx_DOCSTR(0)},
+  {__Pyx_NAMESTR("populate_box"), (PyCFunction)__pyx_pw_11_distortion_4Quad_29populate_box, METH_NOARGS, __Pyx_DOCSTR(0)},
+  {__Pyx_NAMESTR("integrate"), (PyCFunction)__pyx_pw_11_distortion_4Quad_31integrate, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
   {0, 0, 0, 0}
 };
 
-static PyNumberMethods __pyx_tp_as_number_Enum = {
-  0, /*nb_add*/
-  0, /*nb_subtract*/
-  0, /*nb_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_divide*/
-  #endif
-  0, /*nb_remainder*/
-  0, /*nb_divmod*/
-  0, /*nb_power*/
-  0, /*nb_negative*/
-  0, /*nb_positive*/
-  0, /*nb_absolute*/
-  0, /*nb_nonzero*/
-  0, /*nb_invert*/
-  0, /*nb_lshift*/
-  0, /*nb_rshift*/
-  0, /*nb_and*/
-  0, /*nb_xor*/
-  0, /*nb_or*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_coerce*/
-  #endif
-  0, /*nb_int*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_long*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*nb_float*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_oct*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_hex*/
-  #endif
-  0, /*nb_inplace_add*/
-  0, /*nb_inplace_subtract*/
-  0, /*nb_inplace_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_inplace_divide*/
-  #endif
-  0, /*nb_inplace_remainder*/
-  0, /*nb_inplace_power*/
-  0, /*nb_inplace_lshift*/
-  0, /*nb_inplace_rshift*/
-  0, /*nb_inplace_and*/
-  0, /*nb_inplace_xor*/
-  0, /*nb_inplace_or*/
-  0, /*nb_floor_divide*/
-  0, /*nb_true_divide*/
-  0, /*nb_inplace_floor_divide*/
-  0, /*nb_inplace_true_divide*/
-  #if PY_VERSION_HEX >= 0x02050000
-  0, /*nb_index*/
-  #endif
-};
-
-static PySequenceMethods __pyx_tp_as_sequence_Enum = {
-  0, /*sq_length*/
-  0, /*sq_concat*/
-  0, /*sq_repeat*/
-  0, /*sq_item*/
-  0, /*sq_slice*/
-  0, /*sq_ass_item*/
-  0, /*sq_ass_slice*/
-  0, /*sq_contains*/
-  0, /*sq_inplace_concat*/
-  0, /*sq_inplace_repeat*/
-};
-
-static PyMappingMethods __pyx_tp_as_mapping_Enum = {
-  0, /*mp_length*/
-  0, /*mp_subscript*/
-  0, /*mp_ass_subscript*/
-};
-
-static PyBufferProcs __pyx_tp_as_buffer_Enum = {
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getreadbuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getwritebuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getsegcount*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getcharbuffer*/
-  #endif
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_getbuffer*/
-  #endif
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_releasebuffer*/
-  #endif
-};
-
-static PyTypeObject __pyx_type___pyx_MemviewEnum = {
+static PyTypeObject __pyx_type_11_distortion_Quad = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("_distortion.Enum"), /*tp_name*/
-  sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/
+  __Pyx_NAMESTR("_distortion.Quad"), /*tp_name*/
+  sizeof(struct __pyx_obj_11_distortion_Quad), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_Enum, /*tp_dealloc*/
+  __pyx_tp_dealloc_11_distortion_Quad, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -26629,25 +26984,25 @@ static PyTypeObject __pyx_type___pyx_MemviewEnum = {
   #else
   0, /*reserved*/
   #endif
-  __pyx_MemviewEnum___repr__, /*tp_repr*/
-  &__pyx_tp_as_number_Enum, /*tp_as_number*/
-  &__pyx_tp_as_sequence_Enum, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping_Enum, /*tp_as_mapping*/
+  __pyx_pw_11_distortion_4Quad_5__repr__, /*tp_repr*/
+  0, /*tp_as_number*/
+  0, /*tp_as_sequence*/
+  0, /*tp_as_mapping*/
   0, /*tp_hash*/
   0, /*tp_call*/
   0, /*tp_str*/
   0, /*tp_getattro*/
   0, /*tp_setattro*/
-  &__pyx_tp_as_buffer_Enum, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
-  0, /*tp_doc*/
-  __pyx_tp_traverse_Enum, /*tp_traverse*/
-  __pyx_tp_clear_Enum, /*tp_clear*/
+  0, /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
+  __Pyx_DOCSTR("\n    Basic quadrilatere object\n\n                                     |\n                                     |\n                                     |                       xxxxxA\n                                     |      xxxxxxxI'xxxxxxxx     x\n                             xxxxxxxxIxxxxxx       |               x\n                Bxxxxxxxxxxxx        |             |               x\n                x                    |             |               x\n              [...]
+  0, /*tp_traverse*/
+  0, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
   0, /*tp_iter*/
   0, /*tp_iternext*/
-  __pyx_methods_Enum, /*tp_methods*/
+  __pyx_methods_11_distortion_Quad, /*tp_methods*/
   0, /*tp_members*/
   0, /*tp_getset*/
   0, /*tp_base*/
@@ -26655,9 +27010,9 @@ static PyTypeObject __pyx_type___pyx_MemviewEnum = {
   0, /*tp_descr_get*/
   0, /*tp_descr_set*/
   0, /*tp_dictoffset*/
-  __pyx_MemviewEnum___init__, /*tp_init*/
+  0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_Enum, /*tp_new*/
+  __pyx_tp_new_11_distortion_Quad, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -26669,255 +27024,80 @@ static PyTypeObject __pyx_type___pyx_MemviewEnum = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
-static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;
+static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice;
 
-static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
-  struct __pyx_memoryview_obj *p;
-  PyObject *o = (*t->tp_alloc)(t, 0);
-  if (!o) return 0;
-  p = ((struct __pyx_memoryview_obj *)o);
-  p->__pyx_vtab = __pyx_vtabptr_memoryview;
-  p->obj = Py_None; Py_INCREF(Py_None);
-  p->_size = Py_None; Py_INCREF(Py_None);
-  p->_array_interface = Py_None; Py_INCREF(Py_None);
-  p->view.obj = NULL;
-  if (__pyx_memoryview___cinit__(o, a, k) < 0) {
-    Py_DECREF(o); o = 0;
-  }
+static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) {
+  struct __pyx_memoryviewslice_obj *p;
+  PyObject *o = __pyx_tp_new_memoryview(t, a, k);
+  if (unlikely(!o)) return 0;
+  p = ((struct __pyx_memoryviewslice_obj *)o);
+  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice;
+  p->from_object = Py_None; Py_INCREF(Py_None);
+  p->from_slice.memview = NULL;
   return o;
 }
 
-static void __pyx_tp_dealloc_memoryview(PyObject *o) {
-  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
+static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) {
+  struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
+  PyObject_GC_UnTrack(o);
   {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
     ++Py_REFCNT(o);
-    __pyx_memoryview___dealloc__(o);
+    __pyx_memoryviewslice___dealloc__(o);
     if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
     --Py_REFCNT(o);
     PyErr_Restore(etype, eval, etb);
   }
-  Py_CLEAR(p->obj);
-  Py_CLEAR(p->_size);
-  Py_CLEAR(p->_array_interface);
-  (*Py_TYPE(o)->tp_free)(o);
+  Py_CLEAR(p->from_object);
+  PyObject_GC_Track(o);
+  __pyx_tp_dealloc_memoryview(o);
 }
 
-static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v, void *a) {
   int e;
-  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
-  if (p->obj) {
-    e = (*v)(p->obj, a); if (e) return e;
-  }
-  if (p->_size) {
-    e = (*v)(p->_size, a); if (e) return e;
-  }
-  if (p->_array_interface) {
-    e = (*v)(p->_array_interface, a); if (e) return e;
-  }
-  if (p->view.obj) {
-    e = (*v)(p->view.obj, a); if (e) return e;
+  struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
+  e = __pyx_tp_traverse_memoryview(o, v, a); if (e) return e;
+  if (p->from_object) {
+    e = (*v)(p->from_object, a); if (e) return e;
   }
   return 0;
 }
 
-static int __pyx_tp_clear_memoryview(PyObject *o) {
-  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
+static int __pyx_tp_clear__memoryviewslice(PyObject *o) {
+  struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
   PyObject* tmp;
-  tmp = ((PyObject*)p->obj);
-  p->obj = Py_None; Py_INCREF(Py_None);
-  Py_XDECREF(tmp);
-  tmp = ((PyObject*)p->_size);
-  p->_size = Py_None; Py_INCREF(Py_None);
-  Py_XDECREF(tmp);
-  tmp = ((PyObject*)p->_array_interface);
-  p->_array_interface = Py_None; Py_INCREF(Py_None);
+  __pyx_tp_clear_memoryview(o);
+  tmp = ((PyObject*)p->from_object);
+  p->from_object = Py_None; Py_INCREF(Py_None);
   Py_XDECREF(tmp);
-  Py_CLEAR(p->view.obj);
+  __PYX_XDEC_MEMVIEW(&p->from_slice, 1);
   return 0;
 }
-static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
-  PyObject *r;
-  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
-  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
-  Py_DECREF(x);
-  return r;
-}
-
-static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) {
-  if (v) {
-    return __pyx_memoryview___setitem__(o, i, v);
-  }
-  else {
-    PyErr_Format(PyExc_NotImplementedError,
-      "Subscript deletion not supported by %s", Py_TYPE(o)->tp_name);
-    return -1;
-  }
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_transpose(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview__get__base(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_shape(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_strides(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_suboffsets(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_ndim(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_itemsize(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_nbytes(o);
-}
 
-static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_size(o);
+static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryviewslice__get__base(o);
 }
 
-static PyMethodDef __pyx_methods_memoryview[] = {
-  {__Pyx_NAMESTR("is_c_contig"), (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, __Pyx_DOCSTR(0)},
-  {__Pyx_NAMESTR("is_f_contig"), (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, __Pyx_DOCSTR(0)},
-  {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, __Pyx_DOCSTR(0)},
-  {__Pyx_NAMESTR("copy_fortran"), (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, __Pyx_DOCSTR(0)},
+static PyMethodDef __pyx_methods__memoryviewslice[] = {
   {0, 0, 0, 0}
 };
 
-static struct PyGetSetDef __pyx_getsets_memoryview[] = {
-  {(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, 0, 0},
-  {(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, 0, 0},
-  {(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, 0, 0},
-  {(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, 0, 0},
-  {(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, 0, 0},
-  {(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, 0, 0},
-  {(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, 0, 0},
-  {(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, 0, 0},
-  {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, 0, 0},
+static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = {
+  {(char *)"base", __pyx_getprop___pyx_memoryviewslice_base, 0, 0, 0},
   {0, 0, 0, 0, 0}
 };
 
-static PyNumberMethods __pyx_tp_as_number_memoryview = {
-  0, /*nb_add*/
-  0, /*nb_subtract*/
-  0, /*nb_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_divide*/
-  #endif
-  0, /*nb_remainder*/
-  0, /*nb_divmod*/
-  0, /*nb_power*/
-  0, /*nb_negative*/
-  0, /*nb_positive*/
-  0, /*nb_absolute*/
-  0, /*nb_nonzero*/
-  0, /*nb_invert*/
-  0, /*nb_lshift*/
-  0, /*nb_rshift*/
-  0, /*nb_and*/
-  0, /*nb_xor*/
-  0, /*nb_or*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_coerce*/
-  #endif
-  0, /*nb_int*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_long*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*nb_float*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_oct*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_hex*/
-  #endif
-  0, /*nb_inplace_add*/
-  0, /*nb_inplace_subtract*/
-  0, /*nb_inplace_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_inplace_divide*/
-  #endif
-  0, /*nb_inplace_remainder*/
-  0, /*nb_inplace_power*/
-  0, /*nb_inplace_lshift*/
-  0, /*nb_inplace_rshift*/
-  0, /*nb_inplace_and*/
-  0, /*nb_inplace_xor*/
-  0, /*nb_inplace_or*/
-  0, /*nb_floor_divide*/
-  0, /*nb_true_divide*/
-  0, /*nb_inplace_floor_divide*/
-  0, /*nb_inplace_true_divide*/
-  #if PY_VERSION_HEX >= 0x02050000
-  0, /*nb_index*/
-  #endif
-};
-
-static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
-  __pyx_memoryview___len__, /*sq_length*/
-  0, /*sq_concat*/
-  0, /*sq_repeat*/
-  __pyx_sq_item_memoryview, /*sq_item*/
-  0, /*sq_slice*/
-  0, /*sq_ass_item*/
-  0, /*sq_ass_slice*/
-  0, /*sq_contains*/
-  0, /*sq_inplace_concat*/
-  0, /*sq_inplace_repeat*/
-};
-
-static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
-  __pyx_memoryview___len__, /*mp_length*/
-  __pyx_memoryview___getitem__, /*mp_subscript*/
-  __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/
-};
-
-static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getreadbuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getwritebuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getsegcount*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getcharbuffer*/
-  #endif
-  #if PY_VERSION_HEX >= 0x02060000
-  __pyx_memoryview_getbuffer, /*bf_getbuffer*/
-  #endif
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_releasebuffer*/
-  #endif
-};
-
-static PyTypeObject __pyx_type___pyx_memoryview = {
+static PyTypeObject __pyx_type___pyx_memoryviewslice = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("_distortion.memoryview"), /*tp_name*/
-  sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/
+  __Pyx_NAMESTR("_distortion._memoryviewslice"), /*tp_name*/
+  sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_memoryview, /*tp_dealloc*/
+  __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -26926,27 +27106,35 @@ static PyTypeObject __pyx_type___pyx_memoryview = {
   #else
   0, /*reserved*/
   #endif
+  #if CYTHON_COMPILING_IN_PYPY
   __pyx_memoryview___repr__, /*tp_repr*/
-  &__pyx_tp_as_number_memoryview, /*tp_as_number*/
-  &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/
+  #else
+  0, /*tp_repr*/
+  #endif
+  0, /*tp_as_number*/
+  0, /*tp_as_sequence*/
+  0, /*tp_as_mapping*/
   0, /*tp_hash*/
   0, /*tp_call*/
+  #if CYTHON_COMPILING_IN_PYPY
   __pyx_memoryview___str__, /*tp_str*/
+  #else
+  0, /*tp_str*/
+  #endif
   0, /*tp_getattro*/
   0, /*tp_setattro*/
-  &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
-  0, /*tp_doc*/
-  __pyx_tp_traverse_memoryview, /*tp_traverse*/
-  __pyx_tp_clear_memoryview, /*tp_clear*/
+  0, /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+  __Pyx_DOCSTR("Internal class for passing memoryview slices to Python"), /*tp_doc*/
+  __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/
+  __pyx_tp_clear__memoryviewslice, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
   0, /*tp_iter*/
   0, /*tp_iternext*/
-  __pyx_methods_memoryview, /*tp_methods*/
+  __pyx_methods__memoryviewslice, /*tp_methods*/
   0, /*tp_members*/
-  __pyx_getsets_memoryview, /*tp_getset*/
+  __pyx_getsets__memoryviewslice, /*tp_getset*/
   0, /*tp_base*/
   0, /*tp_dict*/
   0, /*tp_descr_get*/
@@ -26954,7 +27142,7 @@ static PyTypeObject __pyx_type___pyx_memoryview = {
   0, /*tp_dictoffset*/
   0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_memoryview, /*tp_new*/
+  __pyx_tp_new__memoryviewslice, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -26966,265 +27154,33 @@ static PyTypeObject __pyx_type___pyx_memoryview = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
-static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice;
 
-static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) {
-  struct __pyx_memoryviewslice_obj *p;
-  PyObject *o = __pyx_tp_new_memoryview(t, a, k);
-  if (!o) return 0;
-  p = ((struct __pyx_memoryviewslice_obj *)o);
-  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice;
-  p->from_object = Py_None; Py_INCREF(Py_None);
-  p->from_slice.memview = NULL;
-  return o;
-}
+static PyMethodDef __pyx_methods[] = {
+  {__Pyx_NAMESTR("calc_area"), (PyCFunction)__pyx_pw_11_distortion_1calc_area, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_11_distortion_calc_area)},
+  {0, 0, 0, 0}
+};
 
-static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) {
-  struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
-  {
-    PyObject *etype, *eval, *etb;
-    PyErr_Fetch(&etype, &eval, &etb);
-    ++Py_REFCNT(o);
-    __pyx_memoryviewslice___dealloc__(o);
-    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
-    --Py_REFCNT(o);
-    PyErr_Restore(etype, eval, etb);
-  }
-  Py_CLEAR(p->from_object);
-  __pyx_tp_dealloc_memoryview(o);
-}
-
-static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v, void *a) {
-  int e;
-  struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
-  e = __pyx_tp_traverse_memoryview(o, v, a); if (e) return e;
-  if (p->from_object) {
-    e = (*v)(p->from_object, a); if (e) return e;
-  }
-  return 0;
-}
-
-static int __pyx_tp_clear__memoryviewslice(PyObject *o) {
-  struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
-  PyObject* tmp;
-  __pyx_tp_clear_memoryview(o);
-  tmp = ((PyObject*)p->from_object);
-  p->from_object = Py_None; Py_INCREF(Py_None);
-  Py_XDECREF(tmp);
-  __PYX_XDEC_MEMVIEW(&p->from_slice, 1);
-  return 0;
-}
-
-static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryviewslice__get__base(o);
-}
-
-static PyMethodDef __pyx_methods__memoryviewslice[] = {
-  {0, 0, 0, 0}
-};
-
-static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = {
-  {(char *)"base", __pyx_getprop___pyx_memoryviewslice_base, 0, 0, 0},
-  {0, 0, 0, 0, 0}
-};
-
-static PyNumberMethods __pyx_tp_as_number__memoryviewslice = {
-  0, /*nb_add*/
-  0, /*nb_subtract*/
-  0, /*nb_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_divide*/
-  #endif
-  0, /*nb_remainder*/
-  0, /*nb_divmod*/
-  0, /*nb_power*/
-  0, /*nb_negative*/
-  0, /*nb_positive*/
-  0, /*nb_absolute*/
-  0, /*nb_nonzero*/
-  0, /*nb_invert*/
-  0, /*nb_lshift*/
-  0, /*nb_rshift*/
-  0, /*nb_and*/
-  0, /*nb_xor*/
-  0, /*nb_or*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_coerce*/
-  #endif
-  0, /*nb_int*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_long*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*nb_float*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_oct*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_hex*/
-  #endif
-  0, /*nb_inplace_add*/
-  0, /*nb_inplace_subtract*/
-  0, /*nb_inplace_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_inplace_divide*/
-  #endif
-  0, /*nb_inplace_remainder*/
-  0, /*nb_inplace_power*/
-  0, /*nb_inplace_lshift*/
-  0, /*nb_inplace_rshift*/
-  0, /*nb_inplace_and*/
-  0, /*nb_inplace_xor*/
-  0, /*nb_inplace_or*/
-  0, /*nb_floor_divide*/
-  0, /*nb_true_divide*/
-  0, /*nb_inplace_floor_divide*/
-  0, /*nb_inplace_true_divide*/
-  #if PY_VERSION_HEX >= 0x02050000
-  0, /*nb_index*/
-  #endif
-};
-
-static PySequenceMethods __pyx_tp_as_sequence__memoryviewslice = {
-  #if CYTHON_COMPILING_IN_PYPY
-  __pyx_memoryview___len__, /*sq_length*/
-  #else
-  0, /*sq_length*/
-  #endif
-  0, /*sq_concat*/
-  0, /*sq_repeat*/
-  0, /*sq_item*/
-  0, /*sq_slice*/
-  0, /*sq_ass_item*/
-  0, /*sq_ass_slice*/
-  0, /*sq_contains*/
-  0, /*sq_inplace_concat*/
-  0, /*sq_inplace_repeat*/
-};
-
-static PyMappingMethods __pyx_tp_as_mapping__memoryviewslice = {
-  #if CYTHON_COMPILING_IN_PYPY
-  __pyx_memoryview___len__, /*mp_length*/
-  #else
-  0, /*mp_length*/
-  #endif
-  #if CYTHON_COMPILING_IN_PYPY
-  __pyx_memoryview___getitem__, /*mp_subscript*/
-  #else
-  0, /*mp_subscript*/
-  #endif
-  0, /*mp_ass_subscript*/
-};
-
-static PyBufferProcs __pyx_tp_as_buffer__memoryviewslice = {
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getreadbuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getwritebuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getsegcount*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getcharbuffer*/
-  #endif
-  #if CYTHON_COMPILING_IN_PYPY
-  __pyx_memoryview_getbuffer, /*bf_getbuffer*/
-  #else
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_getbuffer*/
-  #endif
-  #endif
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_releasebuffer*/
-  #endif
-};
-
-static PyTypeObject __pyx_type___pyx_memoryviewslice = {
-  PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("_distortion._memoryviewslice"), /*tp_name*/
-  sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/
-  0, /*tp_itemsize*/
-  __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/
-  0, /*tp_print*/
-  0, /*tp_getattr*/
-  0, /*tp_setattr*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*tp_compare*/
-  #else
-  0, /*reserved*/
-  #endif
-  #if CYTHON_COMPILING_IN_PYPY
-  __pyx_memoryview___repr__, /*tp_repr*/
-  #else
-  0, /*tp_repr*/
-  #endif
-  &__pyx_tp_as_number__memoryviewslice, /*tp_as_number*/
-  &__pyx_tp_as_sequence__memoryviewslice, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping__memoryviewslice, /*tp_as_mapping*/
-  0, /*tp_hash*/
-  0, /*tp_call*/
-  #if CYTHON_COMPILING_IN_PYPY
-  __pyx_memoryview___str__, /*tp_str*/
-  #else
-  0, /*tp_str*/
-  #endif
-  0, /*tp_getattro*/
-  0, /*tp_setattro*/
-  &__pyx_tp_as_buffer__memoryviewslice, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
-  __Pyx_DOCSTR("Internal class for passing memoryview slices to Python"), /*tp_doc*/
-  __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/
-  __pyx_tp_clear__memoryviewslice, /*tp_clear*/
-  0, /*tp_richcompare*/
-  0, /*tp_weaklistoffset*/
-  0, /*tp_iter*/
-  0, /*tp_iternext*/
-  __pyx_methods__memoryviewslice, /*tp_methods*/
-  0, /*tp_members*/
-  __pyx_getsets__memoryviewslice, /*tp_getset*/
-  0, /*tp_base*/
-  0, /*tp_dict*/
-  0, /*tp_descr_get*/
-  0, /*tp_descr_set*/
-  0, /*tp_dictoffset*/
-  0, /*tp_init*/
-  0, /*tp_alloc*/
-  __pyx_tp_new__memoryviewslice, /*tp_new*/
-  0, /*tp_free*/
-  0, /*tp_is_gc*/
-  0, /*tp_bases*/
-  0, /*tp_mro*/
-  0, /*tp_cache*/
-  0, /*tp_subclasses*/
-  0, /*tp_weaklist*/
-  0, /*tp_del*/
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*tp_version_tag*/
-  #endif
-};
-
-static PyMethodDef __pyx_methods[] = {
-  {__Pyx_NAMESTR("calc_area"), (PyCFunction)__pyx_pw_11_distortion_1calc_area, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_11_distortion_calc_area)},
-  {0, 0, 0, 0}
-};
-
-#if PY_MAJOR_VERSION >= 3
-static struct PyModuleDef __pyx_moduledef = {
-    PyModuleDef_HEAD_INIT,
-    __Pyx_NAMESTR("_distortion"),
-    0, /* m_doc */
-    -1, /* m_size */
-    __pyx_methods /* m_methods */,
-    NULL, /* m_reload */
-    NULL, /* m_traverse */
-    NULL, /* m_clear */
-    NULL /* m_free */
-};
-#endif
+#if PY_MAJOR_VERSION >= 3
+static struct PyModuleDef __pyx_moduledef = {
+  #if PY_VERSION_HEX < 0x03020000
+    { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
+  #else
+    PyModuleDef_HEAD_INIT,
+  #endif
+    __Pyx_NAMESTR("_distortion"),
+    0, /* m_doc */
+    -1, /* m_size */
+    __pyx_methods /* m_methods */,
+    NULL, /* m_reload */
+    NULL, /* m_traverse */
+    NULL, /* m_clear */
+    NULL /* m_free */
+};
+#endif
 
 static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0},
@@ -27243,12 +27199,19 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_kp_s_126, __pyx_k_126, sizeof(__pyx_k_126), 0, 0, 1, 0},
   {&__pyx_kp_s_128, __pyx_k_128, sizeof(__pyx_k_128), 0, 0, 1, 0},
   {&__pyx_kp_s_132, __pyx_k_132, sizeof(__pyx_k_132), 0, 0, 1, 0},
-  {&__pyx_kp_s_146, __pyx_k_146, sizeof(__pyx_k_146), 0, 0, 1, 0},
-  {&__pyx_kp_s_148, __pyx_k_148, sizeof(__pyx_k_148), 0, 0, 1, 0},
-  {&__pyx_kp_s_150, __pyx_k_150, sizeof(__pyx_k_150), 0, 0, 1, 0},
-  {&__pyx_kp_s_152, __pyx_k_152, sizeof(__pyx_k_152), 0, 0, 1, 0},
-  {&__pyx_kp_s_154, __pyx_k_154, sizeof(__pyx_k_154), 0, 0, 1, 0},
-  {&__pyx_kp_s_156, __pyx_k_156, sizeof(__pyx_k_156), 0, 0, 1, 0},
+  {&__pyx_n_s_134, __pyx_k_134, sizeof(__pyx_k_134), 0, 0, 1, 1},
+  {&__pyx_n_s_137, __pyx_k_137, sizeof(__pyx_k_137), 0, 0, 1, 1},
+  {&__pyx_n_s_140, __pyx_k_140, sizeof(__pyx_k_140), 0, 0, 1, 1},
+  {&__pyx_n_s_143, __pyx_k_143, sizeof(__pyx_k_143), 0, 0, 1, 1},
+  {&__pyx_n_s_146, __pyx_k_146, sizeof(__pyx_k_146), 0, 0, 1, 1},
+  {&__pyx_n_s_149, __pyx_k_149, sizeof(__pyx_k_149), 0, 0, 1, 1},
+  {&__pyx_n_s_152, __pyx_k_152, sizeof(__pyx_k_152), 0, 0, 1, 1},
+  {&__pyx_kp_s_153, __pyx_k_153, sizeof(__pyx_k_153), 0, 0, 1, 0},
+  {&__pyx_kp_s_155, __pyx_k_155, sizeof(__pyx_k_155), 0, 0, 1, 0},
+  {&__pyx_kp_s_157, __pyx_k_157, sizeof(__pyx_k_157), 0, 0, 1, 0},
+  {&__pyx_kp_s_159, __pyx_k_159, sizeof(__pyx_k_159), 0, 0, 1, 0},
+  {&__pyx_kp_s_161, __pyx_k_161, sizeof(__pyx_k_161), 0, 0, 1, 0},
+  {&__pyx_kp_s_163, __pyx_k_163, sizeof(__pyx_k_163), 0, 0, 1, 0},
   {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0},
   {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0},
   {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0},
@@ -27301,10 +27264,16 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s____class__, __pyx_k____class__, sizeof(__pyx_k____class__), 0, 0, 1, 1},
   {&__pyx_n_s____enter__, __pyx_k____enter__, sizeof(__pyx_k____enter__), 0, 0, 1, 1},
   {&__pyx_n_s____exit__, __pyx_k____exit__, sizeof(__pyx_k____exit__), 0, 0, 1, 1},
+  {&__pyx_n_s____import__, __pyx_k____import__, sizeof(__pyx_k____import__), 0, 0, 1, 1},
   {&__pyx_n_s____init__, __pyx_k____init__, sizeof(__pyx_k____init__), 0, 0, 1, 1},
   {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
+  {&__pyx_n_s____metaclass__, __pyx_k____metaclass__, sizeof(__pyx_k____metaclass__), 0, 0, 1, 1},
+  {&__pyx_n_s____module__, __pyx_k____module__, sizeof(__pyx_k____module__), 0, 0, 1, 1},
   {&__pyx_n_s____name__, __pyx_k____name__, sizeof(__pyx_k____name__), 0, 0, 1, 1},
   {&__pyx_n_s____pyx_getbuffer, __pyx_k____pyx_getbuffer, sizeof(__pyx_k____pyx_getbuffer), 0, 0, 1, 1},
+  {&__pyx_n_s____pyx_releasebuffer, __pyx_k____pyx_releasebuffer, sizeof(__pyx_k____pyx_releasebuffer), 0, 0, 1, 1},
+  {&__pyx_n_s____pyx_vtable__, __pyx_k____pyx_vtable__, sizeof(__pyx_k____pyx_vtable__), 0, 0, 1, 1},
+  {&__pyx_n_s____qualname__, __pyx_k____qualname__, sizeof(__pyx_k____qualname__), 0, 0, 1, 1},
   {&__pyx_n_s____repr__, __pyx_k____repr__, sizeof(__pyx_k____repr__), 0, 0, 1, 1},
   {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
   {&__pyx_n_s___distortion, __pyx_k___distortion, sizeof(__pyx_k___distortion), 0, 0, 1, 1},
@@ -27351,10 +27320,12 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s__dtype_is_object, __pyx_k__dtype_is_object, sizeof(__pyx_k__dtype_is_object), 0, 0, 1, 1},
   {&__pyx_n_s__empty, __pyx_k__empty, sizeof(__pyx_k__empty), 0, 0, 1, 1},
   {&__pyx_n_s__encode, __pyx_k__encode, sizeof(__pyx_k__encode), 0, 0, 1, 1},
+  {&__pyx_n_s__end, __pyx_k__end, sizeof(__pyx_k__end), 0, 0, 1, 1},
   {&__pyx_n_s__enumerate, __pyx_k__enumerate, sizeof(__pyx_k__enumerate), 0, 0, 1, 1},
   {&__pyx_n_s__error, __pyx_k__error, sizeof(__pyx_k__error), 0, 0, 1, 1},
   {&__pyx_n_s__extend, __pyx_k__extend, sizeof(__pyx_k__extend), 0, 0, 1, 1},
   {&__pyx_n_s__fabio, __pyx_k__fabio, sizeof(__pyx_k__fabio), 0, 0, 1, 1},
+  {&__pyx_n_s__file, __pyx_k__file, sizeof(__pyx_k__file), 0, 0, 1, 1},
   {&__pyx_n_s__flags, __pyx_k__flags, sizeof(__pyx_k__flags), 0, 0, 1, 1},
   {&__pyx_n_s__float32, __pyx_k__float32, sizeof(__pyx_k__float32), 0, 0, 1, 1},
   {&__pyx_n_s__float64, __pyx_k__float64, sizeof(__pyx_k__float64), 0, 0, 1, 1},
@@ -27432,6 +27403,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s__pos1max, __pyx_k__pos1max, sizeof(__pyx_k__pos1max), 0, 0, 1, 1},
   {&__pyx_n_s__pos1min, __pyx_k__pos1min, sizeof(__pyx_k__pos1min), 0, 0, 1, 1},
   {&__pyx_n_s__pos_corners, __pyx_k__pos_corners, sizeof(__pyx_k__pos_corners), 0, 0, 1, 1},
+  {&__pyx_n_s__print, __pyx_k__print, sizeof(__pyx_k__print), 0, 0, 1, 1},
   {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1},
   {&__pyx_n_s__ravel, __pyx_k__ravel, sizeof(__pyx_k__ravel), 0, 0, 1, 1},
   {&__pyx_n_s__recarray, __pyx_k__recarray, sizeof(__pyx_k__recarray), 0, 0, 1, 1},
@@ -27465,21 +27437,21 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {0, 0, 0, 0, 0, 0, 0}
 };
 static int __Pyx_InitCachedBuiltins(void) {
-  __pyx_builtin_object = __Pyx_GetName(__pyx_b, __pyx_n_s__object); if (!__pyx_builtin_object) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_MemoryError = __Pyx_GetName(__pyx_b, __pyx_n_s__MemoryError); if (!__pyx_builtin_MemoryError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_enumerate = __Pyx_GetName(__pyx_b, __pyx_n_s__enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_Ellipsis = __Pyx_GetName(__pyx_b, __pyx_n_s__Ellipsis); if (!__pyx_builtin_Ellipsis) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_n_s__object); if (!__pyx_builtin_object) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s__MemoryError); if (!__pyx_builtin_MemoryError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s__enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s__Ellipsis); if (!__pyx_builtin_Ellipsis) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   #if PY_MAJOR_VERSION >= 3
-  __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   #else
-  __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__xrange); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s__xrange); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   #endif
-  __pyx_builtin_id = __Pyx_GetName(__pyx_b, __pyx_n_s__id); if (!__pyx_builtin_id) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_IndexError = __Pyx_GetName(__pyx_b, __pyx_n_s__IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s__id); if (!__pyx_builtin_id) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s__IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   return 0;
   __pyx_L1_error:;
   return -1;
@@ -27502,17 +27474,8 @@ static int __Pyx_InitCachedConstants(void) {
   __pyx_k_slice_8 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_slice_8);
   __Pyx_GIVEREF(__pyx_k_slice_8);
-  __pyx_k_tuple_9 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_9 = PyTuple_Pack(3, __pyx_k_slice_7, __pyx_k_slice_8, __pyx_int_0); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_9);
-  __Pyx_INCREF(__pyx_k_slice_7);
-  PyTuple_SET_ITEM(__pyx_k_tuple_9, 0, __pyx_k_slice_7);
-  __Pyx_GIVEREF(__pyx_k_slice_7);
-  __Pyx_INCREF(__pyx_k_slice_8);
-  PyTuple_SET_ITEM(__pyx_k_tuple_9, 1, __pyx_k_slice_8);
-  __Pyx_GIVEREF(__pyx_k_slice_8);
-  __Pyx_INCREF(__pyx_int_0);
-  PyTuple_SET_ITEM(__pyx_k_tuple_9, 2, __pyx_int_0);
-  __Pyx_GIVEREF(__pyx_int_0);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9));
   __pyx_k_slice_10 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_slice_10);
@@ -27520,17 +27483,8 @@ static int __Pyx_InitCachedConstants(void) {
   __pyx_k_slice_11 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_slice_11);
   __Pyx_GIVEREF(__pyx_k_slice_11);
-  __pyx_k_tuple_12 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_12 = PyTuple_Pack(3, __pyx_k_slice_10, __pyx_k_slice_11, __pyx_int_1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_12);
-  __Pyx_INCREF(__pyx_k_slice_10);
-  PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, __pyx_k_slice_10);
-  __Pyx_GIVEREF(__pyx_k_slice_10);
-  __Pyx_INCREF(__pyx_k_slice_11);
-  PyTuple_SET_ITEM(__pyx_k_tuple_12, 1, __pyx_k_slice_11);
-  __Pyx_GIVEREF(__pyx_k_slice_11);
-  __Pyx_INCREF(__pyx_int_1);
-  PyTuple_SET_ITEM(__pyx_k_tuple_12, 2, __pyx_int_1);
-  __Pyx_GIVEREF(__pyx_int_1);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12));
 
   /* "_distortion.pyx":563
@@ -27546,17 +27500,8 @@ static int __Pyx_InitCachedConstants(void) {
   __pyx_k_slice_14 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_slice_14);
   __Pyx_GIVEREF(__pyx_k_slice_14);
-  __pyx_k_tuple_15 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_15 = PyTuple_Pack(3, __pyx_k_slice_13, __pyx_k_slice_14, __pyx_int_0); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_15);
-  __Pyx_INCREF(__pyx_k_slice_13);
-  PyTuple_SET_ITEM(__pyx_k_tuple_15, 0, __pyx_k_slice_13);
-  __Pyx_GIVEREF(__pyx_k_slice_13);
-  __Pyx_INCREF(__pyx_k_slice_14);
-  PyTuple_SET_ITEM(__pyx_k_tuple_15, 1, __pyx_k_slice_14);
-  __Pyx_GIVEREF(__pyx_k_slice_14);
-  __Pyx_INCREF(__pyx_int_0);
-  PyTuple_SET_ITEM(__pyx_k_tuple_15, 2, __pyx_int_0);
-  __Pyx_GIVEREF(__pyx_int_0);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15));
 
   /* "_distortion.pyx":564
@@ -27572,17 +27517,8 @@ static int __Pyx_InitCachedConstants(void) {
   __pyx_k_slice_17 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_slice_17);
   __Pyx_GIVEREF(__pyx_k_slice_17);
-  __pyx_k_tuple_18 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_18 = PyTuple_Pack(3, __pyx_k_slice_16, __pyx_k_slice_17, __pyx_int_1); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_18);
-  __Pyx_INCREF(__pyx_k_slice_16);
-  PyTuple_SET_ITEM(__pyx_k_tuple_18, 0, __pyx_k_slice_16);
-  __Pyx_GIVEREF(__pyx_k_slice_16);
-  __Pyx_INCREF(__pyx_k_slice_17);
-  PyTuple_SET_ITEM(__pyx_k_tuple_18, 1, __pyx_k_slice_17);
-  __Pyx_GIVEREF(__pyx_k_slice_17);
-  __Pyx_INCREF(__pyx_int_1);
-  PyTuple_SET_ITEM(__pyx_k_tuple_18, 2, __pyx_int_1);
-  __Pyx_GIVEREF(__pyx_int_1);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18));
 
   /* "_distortion.pyx":566
@@ -27598,14 +27534,8 @@ static int __Pyx_InitCachedConstants(void) {
   __pyx_k_slice_20 = PySlice_New(Py_None, __pyx_int_neg_1, Py_None); if (unlikely(!__pyx_k_slice_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_slice_20);
   __Pyx_GIVEREF(__pyx_k_slice_20);
-  __pyx_k_tuple_21 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_21 = PyTuple_Pack(2, __pyx_k_slice_19, __pyx_k_slice_20); if (unlikely(!__pyx_k_tuple_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_21);
-  __Pyx_INCREF(__pyx_k_slice_19);
-  PyTuple_SET_ITEM(__pyx_k_tuple_21, 0, __pyx_k_slice_19);
-  __Pyx_GIVEREF(__pyx_k_slice_19);
-  __Pyx_INCREF(__pyx_k_slice_20);
-  PyTuple_SET_ITEM(__pyx_k_tuple_21, 1, __pyx_k_slice_20);
-  __Pyx_GIVEREF(__pyx_k_slice_20);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_21));
   __pyx_k_slice_22 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_slice_22);
@@ -27616,20 +27546,8 @@ static int __Pyx_InitCachedConstants(void) {
   __pyx_k_slice_24 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_slice_24);
   __Pyx_GIVEREF(__pyx_k_slice_24);
-  __pyx_k_tuple_25 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_25 = PyTuple_Pack(4, __pyx_k_slice_22, __pyx_k_slice_23, __pyx_int_0, __pyx_k_slice_24); if (unlikely(!__pyx_k_tuple_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_25);
-  __Pyx_INCREF(__pyx_k_slice_22);
-  PyTuple_SET_ITEM(__pyx_k_tuple_25, 0, __pyx_k_slice_22);
-  __Pyx_GIVEREF(__pyx_k_slice_22);
-  __Pyx_INCREF(__pyx_k_slice_23);
-  PyTuple_SET_ITEM(__pyx_k_tuple_25, 1, __pyx_k_slice_23);
-  __Pyx_GIVEREF(__pyx_k_slice_23);
-  __Pyx_INCREF(__pyx_int_0);
-  PyTuple_SET_ITEM(__pyx_k_tuple_25, 2, __pyx_int_0);
-  __Pyx_GIVEREF(__pyx_int_0);
-  __Pyx_INCREF(__pyx_k_slice_24);
-  PyTuple_SET_ITEM(__pyx_k_tuple_25, 3, __pyx_k_slice_24);
-  __Pyx_GIVEREF(__pyx_k_slice_24);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_25));
 
   /* "_distortion.pyx":567
@@ -27645,14 +27563,8 @@ static int __Pyx_InitCachedConstants(void) {
   __pyx_k_slice_27 = PySlice_New(__pyx_int_1, Py_None, Py_None); if (unlikely(!__pyx_k_slice_27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_slice_27);
   __Pyx_GIVEREF(__pyx_k_slice_27);
-  __pyx_k_tuple_28 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_28 = PyTuple_Pack(2, __pyx_k_slice_26, __pyx_k_slice_27); if (unlikely(!__pyx_k_tuple_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_28);
-  __Pyx_INCREF(__pyx_k_slice_26);
-  PyTuple_SET_ITEM(__pyx_k_tuple_28, 0, __pyx_k_slice_26);
-  __Pyx_GIVEREF(__pyx_k_slice_26);
-  __Pyx_INCREF(__pyx_k_slice_27);
-  PyTuple_SET_ITEM(__pyx_k_tuple_28, 1, __pyx_k_slice_27);
-  __Pyx_GIVEREF(__pyx_k_slice_27);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_28));
   __pyx_k_slice_29 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_slice_29);
@@ -27663,20 +27575,8 @@ static int __Pyx_InitCachedConstants(void) {
   __pyx_k_slice_31 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_slice_31);
   __Pyx_GIVEREF(__pyx_k_slice_31);
-  __pyx_k_tuple_32 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_32 = PyTuple_Pack(4, __pyx_k_slice_29, __pyx_k_slice_30, __pyx_int_1, __pyx_k_slice_31); if (unlikely(!__pyx_k_tuple_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_32);
-  __Pyx_INCREF(__pyx_k_slice_29);
-  PyTuple_SET_ITEM(__pyx_k_tuple_32, 0, __pyx_k_slice_29);
-  __Pyx_GIVEREF(__pyx_k_slice_29);
-  __Pyx_INCREF(__pyx_k_slice_30);
-  PyTuple_SET_ITEM(__pyx_k_tuple_32, 1, __pyx_k_slice_30);
-  __Pyx_GIVEREF(__pyx_k_slice_30);
-  __Pyx_INCREF(__pyx_int_1);
-  PyTuple_SET_ITEM(__pyx_k_tuple_32, 2, __pyx_int_1);
-  __Pyx_GIVEREF(__pyx_int_1);
-  __Pyx_INCREF(__pyx_k_slice_31);
-  PyTuple_SET_ITEM(__pyx_k_tuple_32, 3, __pyx_k_slice_31);
-  __Pyx_GIVEREF(__pyx_k_slice_31);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_32));
 
   /* "_distortion.pyx":568
@@ -27692,14 +27592,8 @@ static int __Pyx_InitCachedConstants(void) {
   __pyx_k_slice_34 = PySlice_New(__pyx_int_1, Py_None, Py_None); if (unlikely(!__pyx_k_slice_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_slice_34);
   __Pyx_GIVEREF(__pyx_k_slice_34);
-  __pyx_k_tuple_35 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_35 = PyTuple_Pack(2, __pyx_k_slice_33, __pyx_k_slice_34); if (unlikely(!__pyx_k_tuple_35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_35);
-  __Pyx_INCREF(__pyx_k_slice_33);
-  PyTuple_SET_ITEM(__pyx_k_tuple_35, 0, __pyx_k_slice_33);
-  __Pyx_GIVEREF(__pyx_k_slice_33);
-  __Pyx_INCREF(__pyx_k_slice_34);
-  PyTuple_SET_ITEM(__pyx_k_tuple_35, 1, __pyx_k_slice_34);
-  __Pyx_GIVEREF(__pyx_k_slice_34);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_35));
   __pyx_k_slice_36 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_slice_36);
@@ -27710,20 +27604,8 @@ static int __Pyx_InitCachedConstants(void) {
   __pyx_k_slice_38 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_38)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_slice_38);
   __Pyx_GIVEREF(__pyx_k_slice_38);
-  __pyx_k_tuple_39 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_39)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_39 = PyTuple_Pack(4, __pyx_k_slice_36, __pyx_k_slice_37, __pyx_int_2, __pyx_k_slice_38); if (unlikely(!__pyx_k_tuple_39)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_39);
-  __Pyx_INCREF(__pyx_k_slice_36);
-  PyTuple_SET_ITEM(__pyx_k_tuple_39, 0, __pyx_k_slice_36);
-  __Pyx_GIVEREF(__pyx_k_slice_36);
-  __Pyx_INCREF(__pyx_k_slice_37);
-  PyTuple_SET_ITEM(__pyx_k_tuple_39, 1, __pyx_k_slice_37);
-  __Pyx_GIVEREF(__pyx_k_slice_37);
-  __Pyx_INCREF(__pyx_int_2);
-  PyTuple_SET_ITEM(__pyx_k_tuple_39, 2, __pyx_int_2);
-  __Pyx_GIVEREF(__pyx_int_2);
-  __Pyx_INCREF(__pyx_k_slice_38);
-  PyTuple_SET_ITEM(__pyx_k_tuple_39, 3, __pyx_k_slice_38);
-  __Pyx_GIVEREF(__pyx_k_slice_38);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_39));
 
   /* "_distortion.pyx":569
@@ -27739,14 +27621,8 @@ static int __Pyx_InitCachedConstants(void) {
   __pyx_k_slice_41 = PySlice_New(Py_None, __pyx_int_neg_1, Py_None); if (unlikely(!__pyx_k_slice_41)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_slice_41);
   __Pyx_GIVEREF(__pyx_k_slice_41);
-  __pyx_k_tuple_42 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_42)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_42 = PyTuple_Pack(2, __pyx_k_slice_40, __pyx_k_slice_41); if (unlikely(!__pyx_k_tuple_42)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_42);
-  __Pyx_INCREF(__pyx_k_slice_40);
-  PyTuple_SET_ITEM(__pyx_k_tuple_42, 0, __pyx_k_slice_40);
-  __Pyx_GIVEREF(__pyx_k_slice_40);
-  __Pyx_INCREF(__pyx_k_slice_41);
-  PyTuple_SET_ITEM(__pyx_k_tuple_42, 1, __pyx_k_slice_41);
-  __Pyx_GIVEREF(__pyx_k_slice_41);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_42));
   __pyx_k_slice_43 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_43)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_slice_43);
@@ -27757,20 +27633,8 @@ static int __Pyx_InitCachedConstants(void) {
   __pyx_k_slice_45 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_45)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_slice_45);
   __Pyx_GIVEREF(__pyx_k_slice_45);
-  __pyx_k_tuple_46 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_46)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_46 = PyTuple_Pack(4, __pyx_k_slice_43, __pyx_k_slice_44, __pyx_int_3, __pyx_k_slice_45); if (unlikely(!__pyx_k_tuple_46)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_46);
-  __Pyx_INCREF(__pyx_k_slice_43);
-  PyTuple_SET_ITEM(__pyx_k_tuple_46, 0, __pyx_k_slice_43);
-  __Pyx_GIVEREF(__pyx_k_slice_43);
-  __Pyx_INCREF(__pyx_k_slice_44);
-  PyTuple_SET_ITEM(__pyx_k_tuple_46, 1, __pyx_k_slice_44);
-  __Pyx_GIVEREF(__pyx_k_slice_44);
-  __Pyx_INCREF(__pyx_int_3);
-  PyTuple_SET_ITEM(__pyx_k_tuple_46, 2, __pyx_int_3);
-  __Pyx_GIVEREF(__pyx_int_3);
-  __Pyx_INCREF(__pyx_k_slice_45);
-  PyTuple_SET_ITEM(__pyx_k_tuple_46, 3, __pyx_k_slice_45);
-  __Pyx_GIVEREF(__pyx_k_slice_45);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_46));
 
   /* "_distortion.pyx":571
@@ -27786,17 +27650,8 @@ static int __Pyx_InitCachedConstants(void) {
   __pyx_k_slice_48 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_48)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_slice_48);
   __Pyx_GIVEREF(__pyx_k_slice_48);
-  __pyx_k_tuple_49 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_49)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_49 = PyTuple_Pack(3, __pyx_k_slice_47, __pyx_k_slice_48, __pyx_int_0); if (unlikely(!__pyx_k_tuple_49)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_49);
-  __Pyx_INCREF(__pyx_k_slice_47);
-  PyTuple_SET_ITEM(__pyx_k_tuple_49, 0, __pyx_k_slice_47);
-  __Pyx_GIVEREF(__pyx_k_slice_47);
-  __Pyx_INCREF(__pyx_k_slice_48);
-  PyTuple_SET_ITEM(__pyx_k_tuple_49, 1, __pyx_k_slice_48);
-  __Pyx_GIVEREF(__pyx_k_slice_48);
-  __Pyx_INCREF(__pyx_int_0);
-  PyTuple_SET_ITEM(__pyx_k_tuple_49, 2, __pyx_int_0);
-  __Pyx_GIVEREF(__pyx_int_0);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_49));
   __pyx_k_slice_50 = PySlice_New(Py_None, __pyx_int_neg_1, Py_None); if (unlikely(!__pyx_k_slice_50)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_slice_50);
@@ -27804,17 +27659,8 @@ static int __Pyx_InitCachedConstants(void) {
   __pyx_k_slice_51 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_51)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_slice_51);
   __Pyx_GIVEREF(__pyx_k_slice_51);
-  __pyx_k_tuple_52 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_52)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_52 = PyTuple_Pack(3, __pyx_k_slice_50, __pyx_k_slice_51, __pyx_int_0); if (unlikely(!__pyx_k_tuple_52)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_52);
-  __Pyx_INCREF(__pyx_k_slice_50);
-  PyTuple_SET_ITEM(__pyx_k_tuple_52, 0, __pyx_k_slice_50);
-  __Pyx_GIVEREF(__pyx_k_slice_50);
-  __Pyx_INCREF(__pyx_k_slice_51);
-  PyTuple_SET_ITEM(__pyx_k_tuple_52, 1, __pyx_k_slice_51);
-  __Pyx_GIVEREF(__pyx_k_slice_51);
-  __Pyx_INCREF(__pyx_int_0);
-  PyTuple_SET_ITEM(__pyx_k_tuple_52, 2, __pyx_int_0);
-  __Pyx_GIVEREF(__pyx_int_0);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_52));
 
   /* "_distortion.pyx":572
@@ -27830,17 +27676,8 @@ static int __Pyx_InitCachedConstants(void) {
   __pyx_k_slice_54 = PySlice_New(__pyx_int_1, Py_None, Py_None); if (unlikely(!__pyx_k_slice_54)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_slice_54);
   __Pyx_GIVEREF(__pyx_k_slice_54);
-  __pyx_k_tuple_55 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_55)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_55 = PyTuple_Pack(3, __pyx_k_slice_53, __pyx_k_slice_54, __pyx_int_1); if (unlikely(!__pyx_k_tuple_55)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_55);
-  __Pyx_INCREF(__pyx_k_slice_53);
-  PyTuple_SET_ITEM(__pyx_k_tuple_55, 0, __pyx_k_slice_53);
-  __Pyx_GIVEREF(__pyx_k_slice_53);
-  __Pyx_INCREF(__pyx_k_slice_54);
-  PyTuple_SET_ITEM(__pyx_k_tuple_55, 1, __pyx_k_slice_54);
-  __Pyx_GIVEREF(__pyx_k_slice_54);
-  __Pyx_INCREF(__pyx_int_1);
-  PyTuple_SET_ITEM(__pyx_k_tuple_55, 2, __pyx_int_1);
-  __Pyx_GIVEREF(__pyx_int_1);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_55));
   __pyx_k_slice_56 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_56)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_slice_56);
@@ -27848,17 +27685,8 @@ static int __Pyx_InitCachedConstants(void) {
   __pyx_k_slice_57 = PySlice_New(Py_None, __pyx_int_neg_1, Py_None); if (unlikely(!__pyx_k_slice_57)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_slice_57);
   __Pyx_GIVEREF(__pyx_k_slice_57);
-  __pyx_k_tuple_58 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_58)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_58 = PyTuple_Pack(3, __pyx_k_slice_56, __pyx_k_slice_57, __pyx_int_1); if (unlikely(!__pyx_k_tuple_58)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_58);
-  __Pyx_INCREF(__pyx_k_slice_56);
-  PyTuple_SET_ITEM(__pyx_k_tuple_58, 0, __pyx_k_slice_56);
-  __Pyx_GIVEREF(__pyx_k_slice_56);
-  __Pyx_INCREF(__pyx_k_slice_57);
-  PyTuple_SET_ITEM(__pyx_k_tuple_58, 1, __pyx_k_slice_57);
-  __Pyx_GIVEREF(__pyx_k_slice_57);
-  __Pyx_INCREF(__pyx_int_1);
-  PyTuple_SET_ITEM(__pyx_k_tuple_58, 2, __pyx_int_1);
-  __Pyx_GIVEREF(__pyx_int_1);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_58));
 
   /* "_distortion.pyx":557
@@ -27868,17 +27696,8 @@ static int __Pyx_InitCachedConstants(void) {
  *                 if self.pos is None:
  *                     pos_corners = numpy.empty((self.shape[0] + 1, self.shape[1] + 1, 2), dtype=numpy.float64)
  */
-  __pyx_k_tuple_59 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_59)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_59 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_tuple_59)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_59);
-  __Pyx_INCREF(Py_None);
-  PyTuple_SET_ITEM(__pyx_k_tuple_59, 0, Py_None);
-  __Pyx_GIVEREF(Py_None);
-  __Pyx_INCREF(Py_None);
-  PyTuple_SET_ITEM(__pyx_k_tuple_59, 1, Py_None);
-  __Pyx_GIVEREF(Py_None);
-  __Pyx_INCREF(Py_None);
-  PyTuple_SET_ITEM(__pyx_k_tuple_59, 2, Py_None);
-  __Pyx_GIVEREF(Py_None);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_59));
 
   /* "_distortion.pyx":599
@@ -27897,20 +27716,8 @@ static int __Pyx_InitCachedConstants(void) {
   __pyx_k_slice_62 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_62)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_slice_62);
   __Pyx_GIVEREF(__pyx_k_slice_62);
-  __pyx_k_tuple_63 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_63)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_63 = PyTuple_Pack(4, __pyx_k_slice_60, __pyx_k_slice_61, __pyx_k_slice_62, __pyx_int_0); if (unlikely(!__pyx_k_tuple_63)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_63);
-  __Pyx_INCREF(__pyx_k_slice_60);
-  PyTuple_SET_ITEM(__pyx_k_tuple_63, 0, __pyx_k_slice_60);
-  __Pyx_GIVEREF(__pyx_k_slice_60);
-  __Pyx_INCREF(__pyx_k_slice_61);
-  PyTuple_SET_ITEM(__pyx_k_tuple_63, 1, __pyx_k_slice_61);
-  __Pyx_GIVEREF(__pyx_k_slice_61);
-  __Pyx_INCREF(__pyx_k_slice_62);
-  PyTuple_SET_ITEM(__pyx_k_tuple_63, 2, __pyx_k_slice_62);
-  __Pyx_GIVEREF(__pyx_k_slice_62);
-  __Pyx_INCREF(__pyx_int_0);
-  PyTuple_SET_ITEM(__pyx_k_tuple_63, 3, __pyx_int_0);
-  __Pyx_GIVEREF(__pyx_int_0);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_63));
 
   /* "_distortion.pyx":600
@@ -27929,20 +27736,8 @@ static int __Pyx_InitCachedConstants(void) {
   __pyx_k_slice_66 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_66)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_slice_66);
   __Pyx_GIVEREF(__pyx_k_slice_66);
-  __pyx_k_tuple_67 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_67)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_67 = PyTuple_Pack(4, __pyx_k_slice_64, __pyx_k_slice_65, __pyx_k_slice_66, __pyx_int_1); if (unlikely(!__pyx_k_tuple_67)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_67);
-  __Pyx_INCREF(__pyx_k_slice_64);
-  PyTuple_SET_ITEM(__pyx_k_tuple_67, 0, __pyx_k_slice_64);
-  __Pyx_GIVEREF(__pyx_k_slice_64);
-  __Pyx_INCREF(__pyx_k_slice_65);
-  PyTuple_SET_ITEM(__pyx_k_tuple_67, 1, __pyx_k_slice_65);
-  __Pyx_GIVEREF(__pyx_k_slice_65);
-  __Pyx_INCREF(__pyx_k_slice_66);
-  PyTuple_SET_ITEM(__pyx_k_tuple_67, 2, __pyx_k_slice_66);
-  __Pyx_GIVEREF(__pyx_k_slice_66);
-  __Pyx_INCREF(__pyx_int_1);
-  PyTuple_SET_ITEM(__pyx_k_tuple_67, 3, __pyx_int_1);
-  __Pyx_GIVEREF(__pyx_int_1);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_67));
 
   /* "_distortion.pyx":601
@@ -27961,20 +27756,8 @@ static int __Pyx_InitCachedConstants(void) {
   __pyx_k_slice_70 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_70)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_slice_70);
   __Pyx_GIVEREF(__pyx_k_slice_70);
-  __pyx_k_tuple_71 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_71)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_71 = PyTuple_Pack(4, __pyx_k_slice_68, __pyx_k_slice_69, __pyx_k_slice_70, __pyx_int_0); if (unlikely(!__pyx_k_tuple_71)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_71);
-  __Pyx_INCREF(__pyx_k_slice_68);
-  PyTuple_SET_ITEM(__pyx_k_tuple_71, 0, __pyx_k_slice_68);
-  __Pyx_GIVEREF(__pyx_k_slice_68);
-  __Pyx_INCREF(__pyx_k_slice_69);
-  PyTuple_SET_ITEM(__pyx_k_tuple_71, 1, __pyx_k_slice_69);
-  __Pyx_GIVEREF(__pyx_k_slice_69);
-  __Pyx_INCREF(__pyx_k_slice_70);
-  PyTuple_SET_ITEM(__pyx_k_tuple_71, 2, __pyx_k_slice_70);
-  __Pyx_GIVEREF(__pyx_k_slice_70);
-  __Pyx_INCREF(__pyx_int_0);
-  PyTuple_SET_ITEM(__pyx_k_tuple_71, 3, __pyx_int_0);
-  __Pyx_GIVEREF(__pyx_int_0);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_71));
 
   /* "_distortion.pyx":602
@@ -27993,20 +27776,8 @@ static int __Pyx_InitCachedConstants(void) {
   __pyx_k_slice_74 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_74)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_slice_74);
   __Pyx_GIVEREF(__pyx_k_slice_74);
-  __pyx_k_tuple_75 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_75)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_75 = PyTuple_Pack(4, __pyx_k_slice_72, __pyx_k_slice_73, __pyx_k_slice_74, __pyx_int_1); if (unlikely(!__pyx_k_tuple_75)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_75);
-  __Pyx_INCREF(__pyx_k_slice_72);
-  PyTuple_SET_ITEM(__pyx_k_tuple_75, 0, __pyx_k_slice_72);
-  __Pyx_GIVEREF(__pyx_k_slice_72);
-  __Pyx_INCREF(__pyx_k_slice_73);
-  PyTuple_SET_ITEM(__pyx_k_tuple_75, 1, __pyx_k_slice_73);
-  __Pyx_GIVEREF(__pyx_k_slice_73);
-  __Pyx_INCREF(__pyx_k_slice_74);
-  PyTuple_SET_ITEM(__pyx_k_tuple_75, 2, __pyx_k_slice_74);
-  __Pyx_GIVEREF(__pyx_k_slice_74);
-  __Pyx_INCREF(__pyx_int_1);
-  PyTuple_SET_ITEM(__pyx_k_tuple_75, 3, __pyx_int_1);
-  __Pyx_GIVEREF(__pyx_int_1);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_75));
 
   /* "_distortion.pyx":596
@@ -28016,17 +27787,8 @@ static int __Pyx_InitCachedConstants(void) {
  *                 if self.lut_size is None:
  *                     shape0, shape1 = self.shape
  */
-  __pyx_k_tuple_76 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_76)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_76 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_tuple_76)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_76);
-  __Pyx_INCREF(Py_None);
-  PyTuple_SET_ITEM(__pyx_k_tuple_76, 0, Py_None);
-  __Pyx_GIVEREF(Py_None);
-  __Pyx_INCREF(Py_None);
-  PyTuple_SET_ITEM(__pyx_k_tuple_76, 1, Py_None);
-  __Pyx_GIVEREF(Py_None);
-  __Pyx_INCREF(Py_None);
-  PyTuple_SET_ITEM(__pyx_k_tuple_76, 2, Py_None);
-  __Pyx_GIVEREF(Py_None);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_76));
 
   /* "_distortion.pyx":632
@@ -28036,17 +27798,8 @@ static int __Pyx_InitCachedConstants(void) {
  *                 if self.LUT is None:
  *                     pos = self.pos#.reshape(shape0,shape1,4*sizeof(float))
  */
-  __pyx_k_tuple_79 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_79)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_79 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_tuple_79)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_79);
-  __Pyx_INCREF(Py_None);
-  PyTuple_SET_ITEM(__pyx_k_tuple_79, 0, Py_None);
-  __Pyx_GIVEREF(Py_None);
-  __Pyx_INCREF(Py_None);
-  PyTuple_SET_ITEM(__pyx_k_tuple_79, 1, Py_None);
-  __Pyx_GIVEREF(Py_None);
-  __Pyx_INCREF(Py_None);
-  PyTuple_SET_ITEM(__pyx_k_tuple_79, 2, Py_None);
-  __Pyx_GIVEREF(Py_None);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_79));
 
   /* "_distortion.pyx":763
@@ -28056,17 +27809,8 @@ static int __Pyx_InitCachedConstants(void) {
  *                 if self.LUT is None:
  *                     self.calc_LUT()
  */
-  __pyx_k_tuple_82 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_82)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_82 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_tuple_82)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_82);
-  __Pyx_INCREF(Py_None);
-  PyTuple_SET_ITEM(__pyx_k_tuple_82, 0, Py_None);
-  __Pyx_GIVEREF(Py_None);
-  __Pyx_INCREF(Py_None);
-  PyTuple_SET_ITEM(__pyx_k_tuple_82, 1, Py_None);
-  __Pyx_GIVEREF(Py_None);
-  __Pyx_INCREF(Py_None);
-  PyTuple_SET_ITEM(__pyx_k_tuple_82, 2, Py_None);
-  __Pyx_GIVEREF(Py_None);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_82));
 
   /* "numpy.pxd":215
@@ -28076,11 +27820,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
  */
-  __pyx_k_tuple_84 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_84)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_84 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_83)); if (unlikely(!__pyx_k_tuple_84)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_84);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_83));
-  PyTuple_SET_ITEM(__pyx_k_tuple_84, 0, ((PyObject *)__pyx_kp_u_83));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_83));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_84));
 
   /* "numpy.pxd":219
@@ -28090,11 +27831,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *             info.buf = PyArray_DATA(self)
  */
-  __pyx_k_tuple_86 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_86)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_86 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_85)); if (unlikely(!__pyx_k_tuple_86)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_86);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_85));
-  PyTuple_SET_ITEM(__pyx_k_tuple_86, 0, ((PyObject *)__pyx_kp_u_85));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_85));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_86));
 
   /* "numpy.pxd":257
@@ -28104,11 +27842,8 @@ static int __Pyx_InitCachedConstants(void) {
  *                 if   t == NPY_BYTE:        f = "b"
  *                 elif t == NPY_UBYTE:       f = "B"
  */
-  __pyx_k_tuple_88 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_88)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_88 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_87)); if (unlikely(!__pyx_k_tuple_88)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_88);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_87));
-  PyTuple_SET_ITEM(__pyx_k_tuple_88, 0, ((PyObject *)__pyx_kp_u_87));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_87));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_88));
 
   /* "numpy.pxd":799
@@ -28118,11 +27853,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *         if ((child.byteorder == c'>' and little_endian) or
  */
-  __pyx_k_tuple_91 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_91)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_91 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_90)); if (unlikely(!__pyx_k_tuple_91)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_91);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_90));
-  PyTuple_SET_ITEM(__pyx_k_tuple_91, 0, ((PyObject *)__pyx_kp_u_90));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_90));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_91));
 
   /* "numpy.pxd":803
@@ -28132,11 +27864,8 @@ static int __Pyx_InitCachedConstants(void) {
  *             # One could encode it in the format string and have Cython
  *             # complain instead, BUT: < and > in format strings also imply
  */
-  __pyx_k_tuple_92 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_92)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_92 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_87)); if (unlikely(!__pyx_k_tuple_92)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_92);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_87));
-  PyTuple_SET_ITEM(__pyx_k_tuple_92, 0, ((PyObject *)__pyx_kp_u_87));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_87));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_92));
 
   /* "numpy.pxd":823
@@ -28146,11 +27875,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *             # Until ticket #99 is fixed, use integers to avoid warnings
  */
-  __pyx_k_tuple_94 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_94)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_94 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_93)); if (unlikely(!__pyx_k_tuple_94)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_94);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_93));
-  PyTuple_SET_ITEM(__pyx_k_tuple_94, 0, ((PyObject *)__pyx_kp_u_93));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_93));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_94));
 
   /* "View.MemoryView":124
@@ -28160,11 +27886,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *         if self.itemsize <= 0:
  */
-  __pyx_k_tuple_96 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_96)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_96 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_95)); if (unlikely(!__pyx_k_tuple_96)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_96);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_95));
-  PyTuple_SET_ITEM(__pyx_k_tuple_96, 0, ((PyObject *)__pyx_kp_s_95));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_95));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_96));
 
   /* "View.MemoryView":127
@@ -28174,11 +27897,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *         encode = getattr(format, 'encode', None)
  */
-  __pyx_k_tuple_98 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_98)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_98 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_97)); if (unlikely(!__pyx_k_tuple_98)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_98);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_97));
-  PyTuple_SET_ITEM(__pyx_k_tuple_98, 0, ((PyObject *)__pyx_kp_s_97));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_97));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_98));
 
   /* "View.MemoryView":131
@@ -28188,11 +27908,8 @@ static int __Pyx_InitCachedConstants(void) {
  *         self._format = format
  *         self.format = self._format
  */
-  __pyx_k_tuple_99 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_99)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_99 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__ASCII)); if (unlikely(!__pyx_k_tuple_99)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_99);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__ASCII));
-  PyTuple_SET_ITEM(__pyx_k_tuple_99, 0, ((PyObject *)__pyx_n_s__ASCII));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ASCII));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_99));
 
   /* "View.MemoryView":141
@@ -28202,11 +27919,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  * 
  */
-  __pyx_k_tuple_101 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_101)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_101 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_100)); if (unlikely(!__pyx_k_tuple_101)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_101);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_100));
-  PyTuple_SET_ITEM(__pyx_k_tuple_101, 0, ((PyObject *)__pyx_kp_s_100));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_100));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_101));
 
   /* "View.MemoryView":166
@@ -28216,11 +27930,8 @@ static int __Pyx_InitCachedConstants(void) {
  *         self.mode = mode
  * 
  */
-  __pyx_k_tuple_104 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_104)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_104 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__ASCII)); if (unlikely(!__pyx_k_tuple_104)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_104);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__ASCII));
-  PyTuple_SET_ITEM(__pyx_k_tuple_104, 0, ((PyObject *)__pyx_n_s__ASCII));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ASCII));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_104));
 
   /* "View.MemoryView":174
@@ -28230,11 +27941,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *             if self.dtype_is_object:
  */
-  __pyx_k_tuple_106 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_106)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_106 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_105)); if (unlikely(!__pyx_k_tuple_106)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_106);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_105));
-  PyTuple_SET_ITEM(__pyx_k_tuple_106, 0, ((PyObject *)__pyx_kp_s_105));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_105));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_106));
 
   /* "View.MemoryView":190
@@ -28244,11 +27952,8 @@ static int __Pyx_InitCachedConstants(void) {
  *         info.buf = self.data
  *         info.len = self.len
  */
-  __pyx_k_tuple_108 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_108)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_108 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_107)); if (unlikely(!__pyx_k_tuple_108)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_108);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_107));
-  PyTuple_SET_ITEM(__pyx_k_tuple_108, 0, ((PyObject *)__pyx_kp_s_107));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_107));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_108));
 
   /* "View.MemoryView":452
@@ -28258,11 +27963,8 @@ static int __Pyx_InitCachedConstants(void) {
  *         else:
  *             if len(self.view.format) == 1:
  */
-  __pyx_k_tuple_110 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_110)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_110 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_109)); if (unlikely(!__pyx_k_tuple_110)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_110);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_109));
-  PyTuple_SET_ITEM(__pyx_k_tuple_110, 0, ((PyObject *)__pyx_kp_s_109));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_109));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_110));
 
   /* "View.MemoryView":528
@@ -28272,11 +27974,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *             return tuple([self.view.strides[i] for i in xrange(self.view.ndim)])
  */
-  __pyx_k_tuple_112 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_112)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_112 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_111)); if (unlikely(!__pyx_k_tuple_112)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_112);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_111));
-  PyTuple_SET_ITEM(__pyx_k_tuple_112, 0, ((PyObject *)__pyx_kp_s_111));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_111));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_112));
 
   /* "View.MemoryView":643
@@ -28286,11 +27985,8 @@ static int __Pyx_InitCachedConstants(void) {
  *                 seen_ellipsis = True
  *             else:
  */
-  __pyx_k_tuple_115 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_115)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_115 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_k_tuple_115)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_115);
-  __Pyx_INCREF(Py_None);
-  PyTuple_SET_ITEM(__pyx_k_tuple_115, 0, Py_None);
-  __Pyx_GIVEREF(Py_None);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_115));
 
   /* "View.MemoryView":646
@@ -28300,11 +27996,8 @@ static int __Pyx_InitCachedConstants(void) {
  *             have_slices = True
  *         else:
  */
-  __pyx_k_tuple_116 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_116)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_116 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_k_tuple_116)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_116);
-  __Pyx_INCREF(Py_None);
-  PyTuple_SET_ITEM(__pyx_k_tuple_116, 0, Py_None);
-  __Pyx_GIVEREF(Py_None);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_116));
 
   /* "View.MemoryView":657
@@ -28314,11 +28007,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *     return have_slices or nslices, tuple(result)
  */
-  __pyx_k_tuple_118 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_118)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_118 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_k_tuple_118)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_118);
-  __Pyx_INCREF(Py_None);
-  PyTuple_SET_ITEM(__pyx_k_tuple_118, 0, Py_None);
-  __Pyx_GIVEREF(Py_None);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_118));
 
   /* "View.MemoryView":665
@@ -28328,11 +28018,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  * 
  */
-  __pyx_k_tuple_120 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_120)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_120 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_119)); if (unlikely(!__pyx_k_tuple_120)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_120);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_119));
-  PyTuple_SET_ITEM(__pyx_k_tuple_120, 0, ((PyObject *)__pyx_kp_s_119));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_119));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_120));
 
   /* "_distortion.pyx":34
@@ -28342,11 +28029,8 @@ static int __Pyx_InitCachedConstants(void) {
  * from .detectors import detector_factory
  * from .utils import timeit
  */
-  __pyx_k_tuple_129 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_129)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_129 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_128)); if (unlikely(!__pyx_k_tuple_129)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_129);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_128));
-  PyTuple_SET_ITEM(__pyx_k_tuple_129, 0, ((PyObject *)__pyx_kp_s_128));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_128));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_129));
 
   /* "_distortion.pyx":532
@@ -28356,30 +28040,12 @@ static int __Pyx_InitCachedConstants(void) {
  *         """
  *         @param detector: detector instance or detector name
  */
-  __pyx_k_tuple_130 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_130)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_130 = PyTuple_Pack(4, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__detector), ((PyObject *)__pyx_n_s__shape), ((PyObject *)__pyx_n_s__i)); if (unlikely(!__pyx_k_tuple_130)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_130);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_130, 0, ((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__detector));
-  PyTuple_SET_ITEM(__pyx_k_tuple_130, 1, ((PyObject *)__pyx_n_s__detector));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__detector));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__shape));
-  PyTuple_SET_ITEM(__pyx_k_tuple_130, 2, ((PyObject *)__pyx_n_s__shape));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__shape));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
-  PyTuple_SET_ITEM(__pyx_k_tuple_130, 3, ((PyObject *)__pyx_n_s__i));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_130));
   __pyx_k_codeobj_131 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_130, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_132, __pyx_n_s____init__, 532, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_131)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_k_tuple_133 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_133)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_133 = PyTuple_Pack(2, ((PyObject *)((PyObject*)__pyx_n_s__detector)), ((PyObject *)Py_None)); if (unlikely(!__pyx_k_tuple_133)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_133);
-  __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_n_s__detector)));
-  PyTuple_SET_ITEM(__pyx_k_tuple_133, 0, ((PyObject *)((PyObject*)__pyx_n_s__detector)));
-  __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_n_s__detector)));
-  __Pyx_INCREF(((PyObject *)Py_None));
-  PyTuple_SET_ITEM(__pyx_k_tuple_133, 1, ((PyObject *)Py_None));
-  __Pyx_GIVEREF(((PyObject *)Py_None));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_133));
 
   /* "_distortion.pyx":552
@@ -28389,13 +28055,10 @@ static int __Pyx_InitCachedConstants(void) {
  *         return os.linesep.join(["Distortion correction for detector:",
  *                                 self.detector.__repr__()])
  */
-  __pyx_k_tuple_134 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_134)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_134);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_134, 0, ((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_134));
-  __pyx_k_codeobj_135 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_134, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_132, __pyx_n_s____repr__, 552, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_135)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_135 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__self)); if (unlikely(!__pyx_k_tuple_135)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_135);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_135));
+  __pyx_k_codeobj_136 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_135, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_132, __pyx_n_s____repr__, 552, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_136)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   /* "_distortion.pyx":555
  *         return os.linesep.join(["Distortion correction for detector:",
@@ -28404,25 +28067,10 @@ static int __Pyx_InitCachedConstants(void) {
  *         if self.pos is None:
  *             with self._sem:
  */
-  __pyx_k_tuple_136 = PyTuple_New(5); if (unlikely(!__pyx_k_tuple_136)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_136);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_136, 0, ((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos_corners));
-  PyTuple_SET_ITEM(__pyx_k_tuple_136, 1, ((PyObject *)__pyx_n_s__pos_corners));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos_corners));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__d1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_136, 2, ((PyObject *)__pyx_n_s__d1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__d1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__d2));
-  PyTuple_SET_ITEM(__pyx_k_tuple_136, 3, ((PyObject *)__pyx_n_s__d2));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__d2));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos));
-  PyTuple_SET_ITEM(__pyx_k_tuple_136, 4, ((PyObject *)__pyx_n_s__pos));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_136));
-  __pyx_k_codeobj_137 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_136, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_132, __pyx_n_s__calc_pos, 555, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_137)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_138 = PyTuple_Pack(5, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__pos_corners), ((PyObject *)__pyx_n_s__d1), ((PyObject *)__pyx_n_s__d2), ((PyObject *)__pyx_n_s__pos)); if (unlikely(!__pyx_k_tuple_138)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_138);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_138));
+  __pyx_k_codeobj_139 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_138, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_132, __pyx_n_s__calc_pos, 555, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_139)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   /* "_distortion.pyx":577
  *     @cython.wraparound(False)
@@ -28431,49 +28079,10 @@ static int __Pyx_InitCachedConstants(void) {
  *         """
  *         Considering the "half-CCD" spline from ID11 which describes a (1025,2048) detector,
  */
-  __pyx_k_tuple_138 = PyTuple_New(13); if (unlikely(!__pyx_k_tuple_138)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_138);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_138, 0, ((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
-  PyTuple_SET_ITEM(__pyx_k_tuple_138, 1, ((PyObject *)__pyx_n_s__i));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
-  PyTuple_SET_ITEM(__pyx_k_tuple_138, 2, ((PyObject *)__pyx_n_s__j));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__k));
-  PyTuple_SET_ITEM(__pyx_k_tuple_138, 3, ((PyObject *)__pyx_n_s__k));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__l));
-  PyTuple_SET_ITEM(__pyx_k_tuple_138, 4, ((PyObject *)__pyx_n_s__l));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__l));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__shape0));
-  PyTuple_SET_ITEM(__pyx_k_tuple_138, 5, ((PyObject *)__pyx_n_s__shape0));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__shape0));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__shape1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_138, 6, ((PyObject *)__pyx_n_s__shape1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__shape1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos));
-  PyTuple_SET_ITEM(__pyx_k_tuple_138, 7, ((PyObject *)__pyx_n_s__pos));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0min));
-  PyTuple_SET_ITEM(__pyx_k_tuple_138, 8, ((PyObject *)__pyx_n_s__pos0min));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0min));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1min));
-  PyTuple_SET_ITEM(__pyx_k_tuple_138, 9, ((PyObject *)__pyx_n_s__pos1min));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1min));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0max));
-  PyTuple_SET_ITEM(__pyx_k_tuple_138, 10, ((PyObject *)__pyx_n_s__pos0max));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0max));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1max));
-  PyTuple_SET_ITEM(__pyx_k_tuple_138, 11, ((PyObject *)__pyx_n_s__pos1max));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1max));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__lut_size));
-  PyTuple_SET_ITEM(__pyx_k_tuple_138, 12, ((PyObject *)__pyx_n_s__lut_size));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lut_size));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_138));
-  __pyx_k_codeobj_139 = (PyObject*)__Pyx_PyCode_New(1, 0, 13, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_138, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_132, __pyx_n_s__calc_LUT_size, 577, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_139)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_141 = PyTuple_Pack(13, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__j), ((PyObject *)__pyx_n_s__k), ((PyObject *)__pyx_n_s__l), ((PyObject *)__pyx_n_s__shape0), ((PyObject *)__pyx_n_s__shape1), ((PyObject *)__pyx_n_s__pos), ((PyObject *)__pyx_n_s__pos0min), ((PyObject *)__pyx_n_s__pos1min), ((PyObject *)__pyx_n_s__pos0max), ((PyObject *)__pyx_n_s__pos1max), ((PyObject *)__pyx_n_s__lut_size)); if (unlikely(!__pyx_k_tuple_141)) {__pyx_f [...]
+  __Pyx_GOTREF(__pyx_k_tuple_141);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_141));
+  __pyx_k_codeobj_142 = (PyObject*)__Pyx_PyCode_New(1, 0, 13, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_141, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_132, __pyx_n_s__calc_LUT_size, 577, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_142)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   /* "_distortion.pyx":616
  *     @cython.boundscheck(False)
@@ -28482,139 +28091,10 @@ static int __Pyx_InitCachedConstants(void) {
  *         cdef int i, j, ms, ml, ns, nl, shape0, shape1, delta0, delta1, buffer_size, i0, i1, size
  *         cdef int offset0, offset1, box_size0, box_size1
  */
-  __pyx_k_tuple_140 = PyTuple_New(43); if (unlikely(!__pyx_k_tuple_140)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_140);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_140, 0, ((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
-  PyTuple_SET_ITEM(__pyx_k_tuple_140, 1, ((PyObject *)__pyx_n_s__i));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
-  PyTuple_SET_ITEM(__pyx_k_tuple_140, 2, ((PyObject *)__pyx_n_s__j));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__ms));
-  PyTuple_SET_ITEM(__pyx_k_tuple_140, 3, ((PyObject *)__pyx_n_s__ms));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ms));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__ml));
-  PyTuple_SET_ITEM(__pyx_k_tuple_140, 4, ((PyObject *)__pyx_n_s__ml));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ml));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__ns));
-  PyTuple_SET_ITEM(__pyx_k_tuple_140, 5, ((PyObject *)__pyx_n_s__ns));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ns));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__nl));
-  PyTuple_SET_ITEM(__pyx_k_tuple_140, 6, ((PyObject *)__pyx_n_s__nl));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nl));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__shape0));
-  PyTuple_SET_ITEM(__pyx_k_tuple_140, 7, ((PyObject *)__pyx_n_s__shape0));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__shape0));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__shape1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_140, 8, ((PyObject *)__pyx_n_s__shape1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__shape1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__delta0));
-  PyTuple_SET_ITEM(__pyx_k_tuple_140, 9, ((PyObject *)__pyx_n_s__delta0));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__delta0));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__delta1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_140, 10, ((PyObject *)__pyx_n_s__delta1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__delta1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__buffer_size));
-  PyTuple_SET_ITEM(__pyx_k_tuple_140, 11, ((PyObject *)__pyx_n_s__buffer_size));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__buffer_size));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__i0));
-  PyTuple_SET_ITEM(__pyx_k_tuple_140, 12, ((PyObject *)__pyx_n_s__i0));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i0));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__i1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_140, 13, ((PyObject *)__pyx_n_s__i1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__size));
-  PyTuple_SET_ITEM(__pyx_k_tuple_140, 14, ((PyObject *)__pyx_n_s__size));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__size));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__offset0));
-  PyTuple_SET_ITEM(__pyx_k_tuple_140, 15, ((PyObject *)__pyx_n_s__offset0));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__offset0));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__offset1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_140, 16, ((PyObject *)__pyx_n_s__offset1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__offset1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__box_size0));
-  PyTuple_SET_ITEM(__pyx_k_tuple_140, 17, ((PyObject *)__pyx_n_s__box_size0));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__box_size0));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__box_size1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_140, 18, ((PyObject *)__pyx_n_s__box_size1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__box_size1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__k));
-  PyTuple_SET_ITEM(__pyx_k_tuple_140, 19, ((PyObject *)__pyx_n_s__k));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
-  PyTuple_SET_ITEM(__pyx_k_tuple_140, 20, ((PyObject *)__pyx_n_s__idx));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__A0));
-  PyTuple_SET_ITEM(__pyx_k_tuple_140, 21, ((PyObject *)__pyx_n_s__A0));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__A0));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__A1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_140, 22, ((PyObject *)__pyx_n_s__A1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__A1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__B0));
-  PyTuple_SET_ITEM(__pyx_k_tuple_140, 23, ((PyObject *)__pyx_n_s__B0));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__B0));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__B1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_140, 24, ((PyObject *)__pyx_n_s__B1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__B1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__C0));
-  PyTuple_SET_ITEM(__pyx_k_tuple_140, 25, ((PyObject *)__pyx_n_s__C0));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__C0));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__C1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_140, 26, ((PyObject *)__pyx_n_s__C1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__C1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__D0));
-  PyTuple_SET_ITEM(__pyx_k_tuple_140, 27, ((PyObject *)__pyx_n_s__D0));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__D0));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__D1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_140, 28, ((PyObject *)__pyx_n_s__D1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__D1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pAB));
-  PyTuple_SET_ITEM(__pyx_k_tuple_140, 29, ((PyObject *)__pyx_n_s__pAB));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pAB));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pBC));
-  PyTuple_SET_ITEM(__pyx_k_tuple_140, 30, ((PyObject *)__pyx_n_s__pBC));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pBC));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pCD));
-  PyTuple_SET_ITEM(__pyx_k_tuple_140, 31, ((PyObject *)__pyx_n_s__pCD));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pCD));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pDA));
-  PyTuple_SET_ITEM(__pyx_k_tuple_140, 32, ((PyObject *)__pyx_n_s__pDA));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pDA));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cAB));
-  PyTuple_SET_ITEM(__pyx_k_tuple_140, 33, ((PyObject *)__pyx_n_s__cAB));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cAB));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cBC));
-  PyTuple_SET_ITEM(__pyx_k_tuple_140, 34, ((PyObject *)__pyx_n_s__cBC));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cBC));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cCD));
-  PyTuple_SET_ITEM(__pyx_k_tuple_140, 35, ((PyObject *)__pyx_n_s__cCD));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cCD));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cDA));
-  PyTuple_SET_ITEM(__pyx_k_tuple_140, 36, ((PyObject *)__pyx_n_s__cDA));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cDA));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__area));
-  PyTuple_SET_ITEM(__pyx_k_tuple_140, 37, ((PyObject *)__pyx_n_s__area));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__area));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__value));
-  PyTuple_SET_ITEM(__pyx_k_tuple_140, 38, ((PyObject *)__pyx_n_s__value));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__value));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos));
-  PyTuple_SET_ITEM(__pyx_k_tuple_140, 39, ((PyObject *)__pyx_n_s__pos));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__lut));
-  PyTuple_SET_ITEM(__pyx_k_tuple_140, 40, ((PyObject *)__pyx_n_s__lut));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lut));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__outMax));
-  PyTuple_SET_ITEM(__pyx_k_tuple_140, 41, ((PyObject *)__pyx_n_s__outMax));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outMax));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__buffer));
-  PyTuple_SET_ITEM(__pyx_k_tuple_140, 42, ((PyObject *)__pyx_n_s__buffer));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__buffer));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_140));
-  __pyx_k_codeobj_141 = (PyObject*)__Pyx_PyCode_New(1, 0, 43, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_140, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_132, __pyx_n_s__calc_LUT, 616, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_141)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_144 = PyTuple_Pack(43, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__j), ((PyObject *)__pyx_n_s__ms), ((PyObject *)__pyx_n_s__ml), ((PyObject *)__pyx_n_s__ns), ((PyObject *)__pyx_n_s__nl), ((PyObject *)__pyx_n_s__shape0), ((PyObject *)__pyx_n_s__shape1), ((PyObject *)__pyx_n_s__delta0), ((PyObject *)__pyx_n_s__delta1), ((PyObject *)__pyx_n_s__buffer_size), ((PyObject *)__pyx_n_s__i0), ((PyObject *)__pyx_n_s__i1), ((PyObject *)__pyx_n_s [...]
+  __Pyx_GOTREF(__pyx_k_tuple_144);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_144));
+  __pyx_k_codeobj_145 = (PyObject*)__Pyx_PyCode_New(1, 0, 43, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_144, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_132, __pyx_n_s__calc_LUT, 616, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_145)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   /* "_distortion.pyx":714
  *     @cython.wraparound(False)
@@ -28623,55 +28103,10 @@ static int __Pyx_InitCachedConstants(void) {
  *         """
  *         Correct an image based on the look-up table calculated ...
  */
-  __pyx_k_tuple_142 = PyTuple_New(15); if (unlikely(!__pyx_k_tuple_142)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_142);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_142, 0, ((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__image));
-  PyTuple_SET_ITEM(__pyx_k_tuple_142, 1, ((PyObject *)__pyx_n_s__image));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__image));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
-  PyTuple_SET_ITEM(__pyx_k_tuple_142, 2, ((PyObject *)__pyx_n_s__i));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
-  PyTuple_SET_ITEM(__pyx_k_tuple_142, 3, ((PyObject *)__pyx_n_s__j));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__lshape0));
-  PyTuple_SET_ITEM(__pyx_k_tuple_142, 4, ((PyObject *)__pyx_n_s__lshape0));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lshape0));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__lshape1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_142, 5, ((PyObject *)__pyx_n_s__lshape1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lshape1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
-  PyTuple_SET_ITEM(__pyx_k_tuple_142, 6, ((PyObject *)__pyx_n_s__idx));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__size));
-  PyTuple_SET_ITEM(__pyx_k_tuple_142, 7, ((PyObject *)__pyx_n_s__size));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__size));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__coef));
-  PyTuple_SET_ITEM(__pyx_k_tuple_142, 8, ((PyObject *)__pyx_n_s__coef));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__coef));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__LUT));
-  PyTuple_SET_ITEM(__pyx_k_tuple_142, 9, ((PyObject *)__pyx_n_s__LUT));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__LUT));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__lout));
-  PyTuple_SET_ITEM(__pyx_k_tuple_142, 10, ((PyObject *)__pyx_n_s__lout));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lout));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__lin));
-  PyTuple_SET_ITEM(__pyx_k_tuple_142, 11, ((PyObject *)__pyx_n_s__lin));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lin));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__img_shape));
-  PyTuple_SET_ITEM(__pyx_k_tuple_142, 12, ((PyObject *)__pyx_n_s__img_shape));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__img_shape));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__new_image));
-  PyTuple_SET_ITEM(__pyx_k_tuple_142, 13, ((PyObject *)__pyx_n_s__new_image));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__new_image));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
-  PyTuple_SET_ITEM(__pyx_k_tuple_142, 14, ((PyObject *)__pyx_n_s__out));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_142));
-  __pyx_k_codeobj_143 = (PyObject*)__Pyx_PyCode_New(2, 0, 15, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_142, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_132, __pyx_n_s__correct, 714, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_143)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_147 = PyTuple_Pack(15, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__image), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__j), ((PyObject *)__pyx_n_s__lshape0), ((PyObject *)__pyx_n_s__lshape1), ((PyObject *)__pyx_n_s__idx), ((PyObject *)__pyx_n_s__size), ((PyObject *)__pyx_n_s__coef), ((PyObject *)__pyx_n_s__LUT), ((PyObject *)__pyx_n_s__lout), ((PyObject *)__pyx_n_s__lin), ((PyObject *)__pyx_n_s__img_shape), ((PyObject *)__pyx_n_s__new_image), ((PyObject  [...]
+  __Pyx_GOTREF(__pyx_k_tuple_147);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_147));
+  __pyx_k_codeobj_148 = (PyObject*)__Pyx_PyCode_New(2, 0, 15, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_147, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_132, __pyx_n_s__correct, 714, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_148)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   /* "_distortion.pyx":755
  * 
@@ -28680,43 +28115,10 @@ static int __Pyx_InitCachedConstants(void) {
  *         """
  *         Take an image which has been corrected and transform it into it's raw (with loose of information)
  */
-  __pyx_k_tuple_144 = PyTuple_New(11); if (unlikely(!__pyx_k_tuple_144)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_144);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_144, 0, ((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__image));
-  PyTuple_SET_ITEM(__pyx_k_tuple_144, 1, ((PyObject *)__pyx_n_s__image));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__image));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
-  PyTuple_SET_ITEM(__pyx_k_tuple_144, 2, ((PyObject *)__pyx_n_s__out));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__mask));
-  PyTuple_SET_ITEM(__pyx_k_tuple_144, 3, ((PyObject *)__pyx_n_s__mask));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mask));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__lmask));
-  PyTuple_SET_ITEM(__pyx_k_tuple_144, 4, ((PyObject *)__pyx_n_s__lmask));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lmask));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__lout));
-  PyTuple_SET_ITEM(__pyx_k_tuple_144, 5, ((PyObject *)__pyx_n_s__lout));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lout));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__lin));
-  PyTuple_SET_ITEM(__pyx_k_tuple_144, 6, ((PyObject *)__pyx_n_s__lin));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lin));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__tot));
-  PyTuple_SET_ITEM(__pyx_k_tuple_144, 7, ((PyObject *)__pyx_n_s__tot));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tot));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
-  PyTuple_SET_ITEM(__pyx_k_tuple_144, 8, ((PyObject *)__pyx_n_s__idx));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__t));
-  PyTuple_SET_ITEM(__pyx_k_tuple_144, 9, ((PyObject *)__pyx_n_s__t));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__t));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
-  PyTuple_SET_ITEM(__pyx_k_tuple_144, 10, ((PyObject *)__pyx_n_s__val));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_144));
-  __pyx_k_codeobj_145 = (PyObject*)__Pyx_PyCode_New(2, 0, 11, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_144, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_132, __pyx_n_s__uncorrect, 755, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_145)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_150 = PyTuple_Pack(11, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__image), ((PyObject *)__pyx_n_s__out), ((PyObject *)__pyx_n_s__mask), ((PyObject *)__pyx_n_s__lmask), ((PyObject *)__pyx_n_s__lout), ((PyObject *)__pyx_n_s__lin), ((PyObject *)__pyx_n_s__tot), ((PyObject *)__pyx_n_s__idx), ((PyObject *)__pyx_n_s__t), ((PyObject *)__pyx_n_s__val)); if (unlikely(!__pyx_k_tuple_150)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __ [...]
+  __Pyx_GOTREF(__pyx_k_tuple_150);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_150));
+  __pyx_k_codeobj_151 = (PyObject*)__Pyx_PyCode_New(2, 0, 11, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_150, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_132, __pyx_n_s__uncorrect, 755, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_151)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   /* "View.MemoryView":282
  *         return self.name
@@ -28725,12 +28127,9 @@ static int __Pyx_InitCachedConstants(void) {
  * cdef strided = Enum("<strided and direct>") # default
  * cdef indirect = Enum("<strided and indirect>")
  */
-  __pyx_k_tuple_149 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_149)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_149);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_148));
-  PyTuple_SET_ITEM(__pyx_k_tuple_149, 0, ((PyObject *)__pyx_kp_s_148));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_148));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_149));
+  __pyx_k_tuple_156 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_155)); if (unlikely(!__pyx_k_tuple_156)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_156);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_156));
 
   /* "View.MemoryView":283
  * 
@@ -28739,12 +28138,9 @@ static int __Pyx_InitCachedConstants(void) {
  * cdef indirect = Enum("<strided and indirect>")
  * 
  */
-  __pyx_k_tuple_151 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_151)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_151);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_150));
-  PyTuple_SET_ITEM(__pyx_k_tuple_151, 0, ((PyObject *)__pyx_kp_s_150));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_150));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_151));
+  __pyx_k_tuple_158 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_157)); if (unlikely(!__pyx_k_tuple_158)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_158);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_158));
 
   /* "View.MemoryView":284
  * cdef generic = Enum("<strided and direct or indirect>")
@@ -28753,12 +28149,9 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  * 
  */
-  __pyx_k_tuple_153 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_153)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_153);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_152));
-  PyTuple_SET_ITEM(__pyx_k_tuple_153, 0, ((PyObject *)__pyx_kp_s_152));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_152));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_153));
+  __pyx_k_tuple_160 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_159)); if (unlikely(!__pyx_k_tuple_160)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_160);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_160));
 
   /* "View.MemoryView":287
  * 
@@ -28767,12 +28160,9 @@ static int __Pyx_InitCachedConstants(void) {
  * cdef indirect_contiguous = Enum("<contiguous and indirect>")
  * 
  */
-  __pyx_k_tuple_155 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_155)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_155);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_154));
-  PyTuple_SET_ITEM(__pyx_k_tuple_155, 0, ((PyObject *)__pyx_kp_s_154));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_154));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_155));
+  __pyx_k_tuple_162 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_161)); if (unlikely(!__pyx_k_tuple_162)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_162);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_162));
 
   /* "View.MemoryView":288
  * 
@@ -28781,12 +28171,9 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  * 
  */
-  __pyx_k_tuple_157 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_157)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_157);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_156));
-  PyTuple_SET_ITEM(__pyx_k_tuple_157, 0, ((PyObject *)__pyx_kp_s_156));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_156));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_157));
+  __pyx_k_tuple_164 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_163)); if (unlikely(!__pyx_k_tuple_164)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_164);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_164));
   __Pyx_RefNannyFinishContext();
   return 0;
   __pyx_L1_error:;
@@ -28795,16 +28182,14 @@ static int __Pyx_InitCachedConstants(void) {
 }
 
 static int __Pyx_InitGlobals(void) {
-  /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and
-   a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is
-   a quiet NaN. */
-    memset(&__PYX_NAN, 0xFF, sizeof(__PYX_NAN));
-
-#ifdef WITH_THREAD
+  /* InitThreads.init */
+  #ifdef WITH_THREAD
 PyEval_InitThreads();
 #endif
 
-if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
   __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
   __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
   __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
@@ -28829,6 +28214,9 @@ PyMODINIT_FUNC PyInit__distortion(void)
   PyObject *__pyx_t_2 = NULL;
   PyObject *__pyx_t_3 = NULL;
   PyObject *__pyx_t_4 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannyDeclarations
   #if CYTHON_REFNANNY
   __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
@@ -28866,6 +28254,16 @@ PyMODINIT_FUNC PyInit__distortion(void)
   __pyx_m = PyModule_Create(&__pyx_moduledef);
   #endif
   if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  Py_INCREF(__pyx_d);
+  #if PY_MAJOR_VERSION >= 3
+  {
+    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (!PyDict_GetItemString(modules, "_distortion")) {
+      if (unlikely(PyDict_SetItemString(modules, "_distortion", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    }
+  }
+  #endif
   __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   #if CYTHON_COMPILING_IN_PYPY
   Py_INCREF(__pyx_b);
@@ -28873,6 +28271,9 @@ PyMODINIT_FUNC PyInit__distortion(void)
   if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
   /*--- Initialize various global constants etc. ---*/
   if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
+  if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  #endif
   if (__pyx_module_is_main__distortion) {
     if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
   }
@@ -28889,6 +28290,21 @@ PyMODINIT_FUNC PyInit__distortion(void)
   /*--- Variable export code ---*/
   /*--- Function export code ---*/
   /*--- Type init code ---*/
+  __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview;
+  __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer;
+  __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice;
+  __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment;
+  __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar;
+  __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed;
+  __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object;
+  __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object;
+  if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_memoryview_type = &__pyx_type___pyx_memoryview;
+  if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
+  if (PyType_Ready(&__pyx_type___pyx_array) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_array_type = &__pyx_type___pyx_array;
   __pyx_vtabptr_11_distortion_Quad = &__pyx_vtable_11_distortion_Quad;
   __pyx_vtable_11_distortion_Quad.get_box = (float (*)(struct __pyx_obj_11_distortion_Quad *, int, int, int __pyx_skip_dispatch))__pyx_f_11_distortion_4Quad_get_box;
   __pyx_vtable_11_distortion_Quad.get_offset0 = (int (*)(struct __pyx_obj_11_distortion_Quad *, int __pyx_skip_dispatch))__pyx_f_11_distortion_4Quad_get_offset0;
@@ -28905,24 +28321,6 @@ PyMODINIT_FUNC PyInit__distortion(void)
   if (__Pyx_SetVtable(__pyx_type_11_distortion_Quad.tp_dict, __pyx_vtabptr_11_distortion_Quad) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__Pyx_SetAttrString(__pyx_m, "Quad", (PyObject *)&__pyx_type_11_distortion_Quad) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_ptype_11_distortion_Quad = &__pyx_type_11_distortion_Quad;
-  if (PyType_Ready(&__pyx_type___pyx_array) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "array", (PyObject *)&__pyx_type___pyx_array) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_array_type = &__pyx_type___pyx_array;
-  if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "Enum", (PyObject *)&__pyx_type___pyx_MemviewEnum) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
-  __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview;
-  __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer;
-  __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice;
-  __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment;
-  __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar;
-  __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed;
-  __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object;
-  __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object;
-  if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "memoryview", (PyObject *)&__pyx_type___pyx_memoryview) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_memoryview_type = &__pyx_type___pyx_memoryview;
   __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice;
   __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview;
   __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object;
@@ -28930,7 +28328,6 @@ PyMODINIT_FUNC PyInit__distortion(void)
   __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type;
   if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "_memoryviewslice", (PyObject *)&__pyx_type___pyx_memoryviewslice) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice;
   /*--- Type import code ---*/
   __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", 
@@ -28958,7 +28355,7 @@ PyMODINIT_FUNC PyInit__distortion(void)
  */
   __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__numpy, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s__numpy, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
   /* "_distortion.pyx":32
@@ -28970,11 +28367,11 @@ PyMODINIT_FUNC PyInit__distortion(void)
  */
   __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__logging), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__logging, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s__logging, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__threading), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__threading, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s__threading, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
   /* "_distortion.pyx":33
@@ -28986,19 +28383,19 @@ PyMODINIT_FUNC PyInit__distortion(void)
  */
   __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__types), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__types, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s__types, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__os), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__os, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s__os, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__sys), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sys, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s__sys, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__time), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__time, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s__time, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
   /* "_distortion.pyx":34
@@ -29008,15 +28405,15 @@ PyMODINIT_FUNC PyInit__distortion(void)
  * from .detectors import detector_factory
  * from .utils import timeit
  */
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__logging); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__logging); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__getLogger); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__getLogger); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_129), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__logger, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s__logger, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
   /* "_distortion.pyx":35
@@ -29034,13 +28431,9 @@ PyMODINIT_FUNC PyInit__distortion(void)
   __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__detectors), ((PyObject *)__pyx_t_1), 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__detector_factory);
-  if (__pyx_t_1 == NULL) {
-    if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__detector_factory);
-    if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  }
+  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s__detector_factory); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__detector_factory, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s__detector_factory, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
@@ -29059,13 +28452,9 @@ PyMODINIT_FUNC PyInit__distortion(void)
   __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__utils), ((PyObject *)__pyx_t_2), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__timeit);
-  if (__pyx_t_2 == NULL) {
-    if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__timeit);
-    if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  }
+  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s__timeit); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__timeit, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s__timeit, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
@@ -29078,7 +28467,7 @@ PyMODINIT_FUNC PyInit__distortion(void)
  */
   __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__fabio), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__fabio, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s__fabio, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
   /* "_distortion.pyx":524
@@ -29098,7 +28487,7 @@ PyMODINIT_FUNC PyInit__distortion(void)
  *         """
  *         @param detector: detector instance or detector name
  */
-  __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_11_distortion_10Distortion_1__init__, 0, NULL, __pyx_n_s___distortion, ((PyObject *)__pyx_k_codeobj_131)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_11_distortion_10Distortion_1__init__, 0, __pyx_n_s_134, NULL, __pyx_n_s___distortion, ((PyObject *)__pyx_k_codeobj_131)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, ((PyObject *)__pyx_k_tuple_133));
   if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____init__, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -29111,7 +28500,7 @@ PyMODINIT_FUNC PyInit__distortion(void)
  *         return os.linesep.join(["Distortion correction for detector:",
  *                                 self.detector.__repr__()])
  */
-  __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_11_distortion_10Distortion_3__repr__, 0, NULL, __pyx_n_s___distortion, ((PyObject *)__pyx_k_codeobj_135)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_11_distortion_10Distortion_3__repr__, 0, __pyx_n_s_137, NULL, __pyx_n_s___distortion, ((PyObject *)__pyx_k_codeobj_136)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____repr__, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
@@ -29123,7 +28512,7 @@ PyMODINIT_FUNC PyInit__distortion(void)
  *         if self.pos is None:
  *             with self._sem:
  */
-  __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_11_distortion_10Distortion_5calc_pos, 0, NULL, __pyx_n_s___distortion, ((PyObject *)__pyx_k_codeobj_137)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_11_distortion_10Distortion_5calc_pos, 0, __pyx_n_s_140, NULL, __pyx_n_s___distortion, ((PyObject *)__pyx_k_codeobj_139)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   if (PyObject_SetItem(__pyx_t_1, __pyx_n_s__calc_pos, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
@@ -29135,7 +28524,7 @@ PyMODINIT_FUNC PyInit__distortion(void)
  *         """
  *         Considering the "half-CCD" spline from ID11 which describes a (1025,2048) detector,
  */
-  __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_11_distortion_10Distortion_7calc_LUT_size, 0, NULL, __pyx_n_s___distortion, ((PyObject *)__pyx_k_codeobj_139)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_11_distortion_10Distortion_7calc_LUT_size, 0, __pyx_n_s_143, NULL, __pyx_n_s___distortion, ((PyObject *)__pyx_k_codeobj_142)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   if (PyObject_SetItem(__pyx_t_1, __pyx_n_s__calc_LUT_size, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
@@ -29147,7 +28536,7 @@ PyMODINIT_FUNC PyInit__distortion(void)
  *         cdef int i, j, ms, ml, ns, nl, shape0, shape1, delta0, delta1, buffer_size, i0, i1, size
  *         cdef int offset0, offset1, box_size0, box_size1
  */
-  __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_11_distortion_10Distortion_9calc_LUT, 0, NULL, __pyx_n_s___distortion, ((PyObject *)__pyx_k_codeobj_141)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_11_distortion_10Distortion_9calc_LUT, 0, __pyx_n_s_146, NULL, __pyx_n_s___distortion, ((PyObject *)__pyx_k_codeobj_145)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   if (PyObject_SetItem(__pyx_t_1, __pyx_n_s__calc_LUT, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
@@ -29159,7 +28548,7 @@ PyMODINIT_FUNC PyInit__distortion(void)
  *         """
  *         Correct an image based on the look-up table calculated ...
  */
-  __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_11_distortion_10Distortion_11correct, 0, NULL, __pyx_n_s___distortion, ((PyObject *)__pyx_k_codeobj_143)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_11_distortion_10Distortion_11correct, 0, __pyx_n_s_149, NULL, __pyx_n_s___distortion, ((PyObject *)__pyx_k_codeobj_148)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   if (PyObject_SetItem(__pyx_t_1, __pyx_n_s__correct, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
@@ -29171,7 +28560,7 @@ PyMODINIT_FUNC PyInit__distortion(void)
  *     def uncorrect(self, image):
  *         """
  */
-  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__timeit); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__timeit); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
 
   /* "_distortion.pyx":755
@@ -29181,7 +28570,7 @@ PyMODINIT_FUNC PyInit__distortion(void)
  *         """
  *         Take an image which has been corrected and transform it into it's raw (with loose of information)
  */
-  __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_11_distortion_10Distortion_13uncorrect, 0, NULL, __pyx_n_s___distortion, ((PyObject *)__pyx_k_codeobj_145)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_11_distortion_10Distortion_13uncorrect, 0, __pyx_n_s_152, NULL, __pyx_n_s___distortion, ((PyObject *)__pyx_k_codeobj_151)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
@@ -29207,11 +28596,11 @@ PyMODINIT_FUNC PyInit__distortion(void)
   __Pyx_INCREF(__pyx_builtin_object);
   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_object);
   __Pyx_GIVEREF(__pyx_builtin_object);
-  if (PyDict_SetItemString(((PyObject *)__pyx_t_1), "__doc__", ((PyObject *)__pyx_kp_s_146)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_4 = __Pyx_CreateClass(((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1), __pyx_n_s__Distortion, __pyx_n_s___distortion); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItemString(((PyObject *)__pyx_t_1), "__doc__", ((PyObject *)__pyx_kp_s_153)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_CreateClass(((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1), __pyx_n_s__Distortion, __pyx_n_s__Distortion, __pyx_n_s___distortion); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__Distortion, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s__Distortion, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
@@ -29222,7 +28611,7 @@ PyMODINIT_FUNC PyInit__distortion(void)
  */
   __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
   /* "View.MemoryView":207
@@ -29232,7 +28621,7 @@ PyMODINIT_FUNC PyInit__distortion(void)
  * 
  *     def __dealloc__(array self):
  */
-  __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), __pyx_k_147); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), __pyx_k_154); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   if (PyDict_SetItem(__pyx_array_type->tp_dict, __pyx_n_s____pyx_getbuffer, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -29245,12 +28634,11 @@ PyMODINIT_FUNC PyInit__distortion(void)
  * cdef strided = Enum("<strided and direct>") # default
  * cdef indirect = Enum("<strided and indirect>")
  */
-  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_149), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_156), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_XGOTREF(generic);
-  __Pyx_DECREF(generic);
+  __Pyx_DECREF_SET(generic, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
-  generic = __pyx_t_1;
   __pyx_t_1 = 0;
 
   /* "View.MemoryView":283
@@ -29260,12 +28648,11 @@ PyMODINIT_FUNC PyInit__distortion(void)
  * cdef indirect = Enum("<strided and indirect>")
  * 
  */
-  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_151), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_158), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_XGOTREF(strided);
-  __Pyx_DECREF(strided);
+  __Pyx_DECREF_SET(strided, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
-  strided = __pyx_t_1;
   __pyx_t_1 = 0;
 
   /* "View.MemoryView":284
@@ -29275,12 +28662,11 @@ PyMODINIT_FUNC PyInit__distortion(void)
  * 
  * 
  */
-  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_153), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_160), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_XGOTREF(indirect);
-  __Pyx_DECREF(indirect);
+  __Pyx_DECREF_SET(indirect, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
-  indirect = __pyx_t_1;
   __pyx_t_1 = 0;
 
   /* "View.MemoryView":287
@@ -29290,12 +28676,11 @@ PyMODINIT_FUNC PyInit__distortion(void)
  * cdef indirect_contiguous = Enum("<contiguous and indirect>")
  * 
  */
-  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_155), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_162), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_XGOTREF(contiguous);
-  __Pyx_DECREF(contiguous);
+  __Pyx_DECREF_SET(contiguous, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
-  contiguous = __pyx_t_1;
   __pyx_t_1 = 0;
 
   /* "View.MemoryView":288
@@ -29305,12 +28690,11 @@ PyMODINIT_FUNC PyInit__distortion(void)
  * 
  * 
  */
-  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_157), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_164), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_XGOTREF(indirect_contiguous);
-  __Pyx_DECREF(indirect_contiguous);
+  __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
-  indirect_contiguous = __pyx_t_1;
   __pyx_t_1 = 0;
 
   /* "View.MemoryView":503
@@ -29320,7 +28704,7 @@ PyMODINIT_FUNC PyInit__distortion(void)
  * 
  * 
  */
-  __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), __pyx_k_147); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), __pyx_k_154); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   if (PyDict_SetItem(__pyx_memoryview_type->tp_dict, __pyx_n_s____pyx_getbuffer, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -29333,7 +28717,7 @@ PyMODINIT_FUNC PyInit__distortion(void)
  * 
  * 
  */
-  __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), __pyx_k_147); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), __pyx_k_154); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   if (PyDict_SetItem(__pyx_memoryviewslice_type->tp_dict, __pyx_n_s____pyx_getbuffer, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -29384,17 +28768,15 @@ end:
 }
 #endif /* CYTHON_REFNANNY */
 
-static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
-    PyObject *result;
-    result = PyObject_GetAttr(dict, name);
-    if (!result) {
-        if (dict != __pyx_b) {
-            PyErr_Clear();
-            result = PyObject_GetAttr(__pyx_b, name);
-        }
-        if (!result) {
-            PyErr_SetObject(PyExc_NameError, name);
-        }
+static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
+    PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
+    if (unlikely(!result)) {
+        PyErr_Format(PyExc_NameError,
+#if PY_MAJOR_VERSION >= 3
+            "name '%U' is not defined", name);
+#else
+            "name '%s' is not defined", PyString_AS_STRING(name));
+#endif
     }
     return result;
 }
@@ -30082,177 +29464,6 @@ static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
 }
 
 static int
-__pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b)
-{
-    int i;
-    if (!a || !b)
-        return 0;
-    if (a == b)
-        return 1;
-    if (a->size != b->size || a->typegroup != b->typegroup ||
-            a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) {
-        if (a->typegroup == 'H' || b->typegroup == 'H') {
-            return a->size == b->size;
-        } else {
-            return 0;
-        }
-    }
-    if (a->ndim) {
-        for (i = 0; i < a->ndim; i++)
-            if (a->arraysize[i] != b->arraysize[i])
-                return 0;
-    }
-    if (a->typegroup == 'S') {
-        if (a->flags != b->flags)
-            return 0;
-        if (a->fields || b->fields) {
-            if (!(a->fields && b->fields))
-                return 0;
-            for (i = 0; a->fields[i].type && b->fields[i].type; i++) {
-                __Pyx_StructField *field_a = a->fields + i;
-                __Pyx_StructField *field_b = b->fields + i;
-                if (field_a->offset != field_b->offset ||
-                    !__pyx_typeinfo_cmp(field_a->type, field_b->type))
-                    return 0;
-            }
-            return !a->fields[i].type && !b->fields[i].type;
-        }
-    }
-    return 1;
-}
-
-static int __Pyx_ValidateAndInit_memviewslice(
-                int *axes_specs,
-                int c_or_f_flag,
-                int buf_flags,
-                int ndim,
-                __Pyx_TypeInfo *dtype,
-                __Pyx_BufFmt_StackElem stack[],
-                __Pyx_memviewslice *memviewslice,
-                PyObject *original_obj)
-{
-    struct __pyx_memoryview_obj *memview, *new_memview;
-    __Pyx_RefNannyDeclarations
-    Py_buffer *buf;
-    int i, spec = 0, retval = -1;
-    __Pyx_BufFmt_Context ctx;
-    int from_memoryview = __pyx_memoryview_check(original_obj);
-    __Pyx_RefNannySetupContext("ValidateAndInit_memviewslice", 0);
-    if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((struct __pyx_memoryview_obj *)
-                                                            original_obj)->typeinfo)) {
-        memview = (struct __pyx_memoryview_obj *) original_obj;
-        new_memview = NULL;
-    } else {
-        memview = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
-                                            original_obj, buf_flags, 0, dtype);
-        new_memview = memview;
-        if (unlikely(!memview))
-            goto fail;
-    }
-    buf = &memview->view;
-    if (buf->ndim != ndim) {
-        PyErr_Format(PyExc_ValueError,
-                "Buffer has wrong number of dimensions (expected %d, got %d)",
-                ndim, buf->ndim);
-        goto fail;
-    }
-    if (new_memview) {
-        __Pyx_BufFmt_Init(&ctx, stack, dtype);
-        if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
-    }
-    if ((unsigned)buf->itemsize != dtype->size) {
-        PyErr_Format(PyExc_ValueError,
-                     "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "u byte%s) "
-                     "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "u byte%s)",
-                     buf->itemsize,
-                     (buf->itemsize > 1) ? "s" : "",
-                     dtype->name,
-                     dtype->size,
-                     (dtype->size > 1) ? "s" : "");
-        goto fail;
-    }
-    if (!buf->strides) {
-        PyErr_SetString(PyExc_ValueError,
-            "buffer does not supply strides necessary for memoryview.");
-        goto fail;
-    }
-    for(i=0; i<ndim; i++) {
-        spec = axes_specs[i];
-        if (spec & __Pyx_MEMVIEW_CONTIG) {
-            if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) {
-                if (buf->strides[i] != sizeof(void *)) {
-                    PyErr_Format(PyExc_ValueError,
-                        "Buffer is not indirectly contiguous in dimension %d.", i);
-                    goto fail;
-                }
-            } else if (buf->strides[i] != buf->itemsize) {
-                PyErr_SetString(PyExc_ValueError,
-                    "Buffer and memoryview are not contiguous in the same dimension.");
-                goto fail;
-            }
-        }
-        if (spec & __Pyx_MEMVIEW_FOLLOW) {
-            Py_ssize_t stride = buf->strides[i];
-            if (stride < 0)
-                stride = -stride;
-            if (stride < buf->itemsize) {
-                PyErr_SetString(PyExc_ValueError,
-                    "Buffer and memoryview are not contiguous in the same dimension.");
-                goto fail;
-            }
-        }
-        /* Todo: without PyBUF_INDIRECT we may not have suboffset information, i.e., the
-           ptr may not be set to NULL but may be uninitialized? */
-        if (spec & __Pyx_MEMVIEW_DIRECT) {
-            if (buf->suboffsets && buf->suboffsets[i] >= 0) {
-                PyErr_Format(PyExc_ValueError,
-                    "Buffer not compatible with direct access in dimension %d.", i);
-                goto fail;
-            }
-        }
-        if (spec & __Pyx_MEMVIEW_PTR) {
-            if (!buf->suboffsets || (buf->suboffsets && buf->suboffsets[i] < 0)) {
-                PyErr_Format(PyExc_ValueError,
-                    "Buffer is not indirectly accessisble in dimension %d.", i);
-                goto fail;
-            }
-        }
-    }
-    if (c_or_f_flag & __Pyx_IS_F_CONTIG) {
-        Py_ssize_t stride = 1;
-        for(i=0; i<ndim; i++) {
-            if(stride * buf->itemsize != buf->strides[i]) {
-                PyErr_SetString(PyExc_ValueError,
-                    "Buffer not fortran contiguous.");
-                goto fail;
-            }
-            stride = stride * buf->shape[i];
-        }
-    } else if (c_or_f_flag & __Pyx_IS_C_CONTIG) {
-        Py_ssize_t stride = 1;
-        for(i=ndim-1; i>-1; i--) {
-            if(stride * buf->itemsize != buf->strides[i]) {
-                PyErr_SetString(PyExc_ValueError,
-                    "Buffer not C contiguous.");
-                goto fail;
-            }
-            stride = stride * buf->shape[i];
-        }
-    }
-    if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice,
-                                         new_memview != NULL) == -1)) {
-        goto fail;
-    }
-    retval = 0;
-    goto no_fail;
-fail:
-    Py_XDECREF(new_memview);
-    retval = -1;
-no_fail:
-    __Pyx_RefNannyFinishContext();
-    return retval;
-}
-static int
 __Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview,
                         int ndim,
                         __Pyx_memviewslice *memviewslice,
@@ -30271,8 +29482,18 @@ __Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview,
             "memviewslice is already initialized!");
         goto fail;
     }
+    if (buf->strides) {
+        for (i = 0; i < ndim; i++) {
+            memviewslice->strides[i] = buf->strides[i];
+        }
+    } else {
+        Py_ssize_t stride = buf->itemsize;
+        for (i = ndim - 1; i >= 0; i--) {
+            memviewslice->strides[i] = stride;
+            stride *= buf->shape[i];
+        }
+    }
     for (i = 0; i < ndim; i++) {
-        memviewslice->strides[i] = buf->strides[i];
         memviewslice->shape[i]   = buf->shape[i];
         if (buf->suboffsets) {
             memviewslice->suboffsets[i] = buf->suboffsets[i];
@@ -30382,6 +29603,23 @@ static void __Pyx_RaiseBufferIndexError(int axis) {
      "Out of bounds on buffer access (axis %d)", axis);
 }
 
+static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
+    PyObject *result;
+#if CYTHON_COMPILING_IN_CPYTHON
+    result = PyDict_GetItem(__pyx_d, name);
+    if (result) {
+        Py_INCREF(result);
+    } else {
+#else
+    result = PyObject_GetItem(__pyx_d, name);
+    if (!result) {
+        PyErr_Clear();
+#endif
+        result = __Pyx_GetBuiltinName(name);
+    }
+    return result;
+}
+
 static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
 #if CYTHON_COMPILING_IN_CPYTHON
     PyObject *tmp_type, *tmp_value, *tmp_tb;
@@ -30413,6 +29651,25 @@ static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyOb
 #endif
 }
 
+static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
+                                  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename) {
+    PyObject *old_exc, *old_val, *old_tb;
+    PyObject *ctx;
+    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
+    #if PY_MAJOR_VERSION < 3
+    ctx = PyString_FromString(name);
+    #else
+    ctx = PyUnicode_FromString(name);
+    #endif
+    __Pyx_ErrRestore(old_exc, old_val, old_tb);
+    if (!ctx) {
+        PyErr_WriteUnraisable(Py_None);
+    } else {
+        PyErr_WriteUnraisable(ctx);
+        Py_DECREF(ctx);
+    }
+}
+
 #if PY_MAJOR_VERSION < 3
 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
                         CYTHON_UNUSED PyObject *cause) {
@@ -30451,25 +29708,24 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
         }
         value = type;
         #if PY_VERSION_HEX < 0x02050000
-            if (PyInstance_Check(type)) {
-                type = (PyObject*) ((PyInstanceObject*)type)->in_class;
-                Py_INCREF(type);
-            }
-            else {
-                type = 0;
-                PyErr_SetString(PyExc_TypeError,
-                    "raise: exception must be an old-style class or instance");
-                goto raise_error;
-            }
-        #else
-            type = (PyObject*) Py_TYPE(type);
+        if (PyInstance_Check(type)) {
+            type = (PyObject*) ((PyInstanceObject*)type)->in_class;
             Py_INCREF(type);
-            if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
-                PyErr_SetString(PyExc_TypeError,
-                    "raise: exception class must be a subclass of BaseException");
-                goto raise_error;
-            }
-        #endif
+        } else {
+            type = 0;
+            PyErr_SetString(PyExc_TypeError,
+                "raise: exception must be an old-style class or instance");
+            goto raise_error;
+        }
+        #else
+        type = (PyObject*) Py_TYPE(type);
+        Py_INCREF(type);
+        if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
+            PyErr_SetString(PyExc_TypeError,
+                "raise: exception class must be a subclass of BaseException");
+            goto raise_error;
+        }
+        #endif
     }
     __Pyx_ErrRestore(type, value, tb);
     return;
@@ -30500,46 +29756,62 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject
         value = type;
         type = (PyObject*) Py_TYPE(value);
     } else if (PyExceptionClass_Check(type)) {
-        PyObject *args;
-        if (!value)
-            args = PyTuple_New(0);
-        else if (PyTuple_Check(value)) {
-            Py_INCREF(value);
-            args = value;
+        PyObject *instance_class = NULL;
+        if (value && PyExceptionInstance_Check(value)) {
+            instance_class = (PyObject*) Py_TYPE(value);
+            if (instance_class != type) {
+                if (PyObject_IsSubclass(instance_class, type)) {
+                    type = instance_class;
+                } else {
+                    instance_class = NULL;
+                }
+            }
         }
-        else
-            args = PyTuple_Pack(1, value);
-        if (!args)
-            goto bad;
-        owned_instance = PyEval_CallObject(type, args);
-        Py_DECREF(args);
-        if (!owned_instance)
-            goto bad;
-        value = owned_instance;
-        if (!PyExceptionInstance_Check(value)) {
-            PyErr_Format(PyExc_TypeError,
-                         "calling %R should have returned an instance of "
-                         "BaseException, not %R",
-                         type, Py_TYPE(value));
-            goto bad;
+        if (!instance_class) {
+            PyObject *args;
+            if (!value)
+                args = PyTuple_New(0);
+            else if (PyTuple_Check(value)) {
+                Py_INCREF(value);
+                args = value;
+            } else
+                args = PyTuple_Pack(1, value);
+            if (!args)
+                goto bad;
+            owned_instance = PyObject_Call(type, args, NULL);
+            Py_DECREF(args);
+            if (!owned_instance)
+                goto bad;
+            value = owned_instance;
+            if (!PyExceptionInstance_Check(value)) {
+                PyErr_Format(PyExc_TypeError,
+                             "calling %R should have returned an instance of "
+                             "BaseException, not %R",
+                             type, Py_TYPE(value));
+                goto bad;
+            }
         }
     } else {
         PyErr_SetString(PyExc_TypeError,
             "raise: exception class must be a subclass of BaseException");
         goto bad;
     }
+#if PY_VERSION_HEX >= 0x03030000
+    if (cause) {
+#else
     if (cause && cause != Py_None) {
+#endif
         PyObject *fixed_cause;
-        if (PyExceptionClass_Check(cause)) {
+        if (cause == Py_None) {
+            fixed_cause = NULL;
+        } else if (PyExceptionClass_Check(cause)) {
             fixed_cause = PyObject_CallObject(cause, NULL);
             if (fixed_cause == NULL)
                 goto bad;
-        }
-        else if (PyExceptionInstance_Check(cause)) {
+        } else if (PyExceptionInstance_Check(cause)) {
             fixed_cause = cause;
             Py_INCREF(fixed_cause);
-        }
-        else {
+        } else {
             PyErr_SetString(PyExc_TypeError,
                             "exception causes must derive from "
                             "BaseException");
@@ -30563,6 +29835,84 @@ bad:
 }
 #endif
 
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
+    PyObject *r;
+    if (!j) return NULL;
+    r = PyObject_GetItem(o, j);
+    Py_DECREF(j);
+    return r;
+}
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
+                                                              int wraparound, int boundscheck) {
+#if CYTHON_COMPILING_IN_CPYTHON
+    if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o);
+    if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
+        PyObject *r = PyList_GET_ITEM(o, i);
+        Py_INCREF(r);
+        return r;
+    }
+    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+#else
+    return PySequence_GetItem(o, i);
+#endif
+}
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
+                                                              int wraparound, int boundscheck) {
+#if CYTHON_COMPILING_IN_CPYTHON
+    if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o);
+    if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
+        PyObject *r = PyTuple_GET_ITEM(o, i);
+        Py_INCREF(r);
+        return r;
+    }
+    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+#else
+    return PySequence_GetItem(o, i);
+#endif
+}
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
+                                                     int is_list, int wraparound, int boundscheck) {
+#if CYTHON_COMPILING_IN_CPYTHON
+    if (is_list || PyList_CheckExact(o)) {
+        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
+        if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) {
+            PyObject *r = PyList_GET_ITEM(o, n);
+            Py_INCREF(r);
+            return r;
+        }
+    }
+    else if (PyTuple_CheckExact(o)) {
+        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
+        if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
+            PyObject *r = PyTuple_GET_ITEM(o, n);
+            Py_INCREF(r);
+            return r;
+        }
+    } else {
+        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
+        if (likely(m && m->sq_item)) {
+            if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
+                Py_ssize_t l = m->sq_length(o);
+                if (likely(l >= 0)) {
+                    i += l;
+                } else {
+                    if (PyErr_ExceptionMatches(PyExc_OverflowError))
+                        PyErr_Clear();
+                    else
+                        return NULL;
+                }
+            }
+            return m->sq_item(o, i);
+        }
+    }
+#else
+    if (is_list || PySequence_Check(o)) {
+        return PySequence_GetItem(o, i);
+    }
+#endif
+    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+}
+
 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
     PyErr_Format(PyExc_ValueError,
                  "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
@@ -30717,8 +30067,20 @@ static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed
     return 0;
 }
 
+static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
+#if CYTHON_COMPILING_IN_CPYTHON
+#if PY_MAJOR_VERSION >= 3
+    if (likely(PyUnicode_Check(n)))
+#else
+    if (likely(PyString_Check(n)))
+#endif
+        return __Pyx_PyObject_GetAttrStr(o, n);
+#endif
+    return PyObject_GetAttr(o, n);
+}
+
 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
-    PyObject *r = PyObject_GetAttr(o, n);
+    PyObject *r = __Pyx_GetAttr(o, n);
     if (!r) {
         if (!PyErr_ExceptionMatches(PyExc_AttributeError))
             goto bad;
@@ -30821,292 +30183,78 @@ static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
     return q;
 }
 
-static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
-#if CYTHON_COMPILING_IN_CPYTHON
-    PyThreadState *tstate = PyThreadState_GET();
-    *type = tstate->exc_type;
-    *value = tstate->exc_value;
-    *tb = tstate->exc_traceback;
-    Py_XINCREF(*type);
-    Py_XINCREF(*value);
-    Py_XINCREF(*tb);
-#else
-    PyErr_GetExcInfo(type, value, tb);
-#endif
-}
-static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) {
-#if CYTHON_COMPILING_IN_CPYTHON
-    PyObject *tmp_type, *tmp_value, *tmp_tb;
-    PyThreadState *tstate = PyThreadState_GET();
-    tmp_type = tstate->exc_type;
-    tmp_value = tstate->exc_value;
-    tmp_tb = tstate->exc_traceback;
-    tstate->exc_type = type;
-    tstate->exc_value = value;
-    tstate->exc_traceback = tb;
-    Py_XDECREF(tmp_type);
-    Py_XDECREF(tmp_value);
-    Py_XDECREF(tmp_tb);
+static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
+#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
+    PyObject *ob = PyCapsule_New(vtable, 0, 0);
 #else
-    PyErr_SetExcInfo(type, value, tb);
-#endif
-}
-
-#if PY_MAJOR_VERSION < 3
-static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
-    CYTHON_UNUSED PyObject *getbuffer_cobj;
-  #if PY_VERSION_HEX >= 0x02060000
-    if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
-  #endif
-        if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags);
-        if (PyObject_TypeCheck(obj, __pyx_array_type)) return __pyx_array_getbuffer(obj, view, flags);
-        if (PyObject_TypeCheck(obj, __pyx_memoryview_type)) return __pyx_memoryview_getbuffer(obj, view, flags);
-  #if PY_VERSION_HEX < 0x02060000
-    if (obj->ob_type->tp_dict &&
-        (getbuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict,
-                                             "__pyx_getbuffer"))) {
-        getbufferproc func;
-      #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0)
-        func = (getbufferproc) PyCapsule_GetPointer(getbuffer_cobj, "getbuffer(obj, view, flags)");
-      #else
-        func = (getbufferproc) PyCObject_AsVoidPtr(getbuffer_cobj);
-      #endif
-        Py_DECREF(getbuffer_cobj);
-        if (!func)
-            goto fail;
-        return func(obj, view, flags);
-    } else {
-        PyErr_Clear();
-    }
-  #endif
-    PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
-#if PY_VERSION_HEX < 0x02060000
-fail:
+    PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
 #endif
+    if (!ob)
+        goto bad;
+    if (PyDict_SetItem(dict, __pyx_n_s____pyx_vtable__, ob) < 0)
+        goto bad;
+    Py_DECREF(ob);
+    return 0;
+bad:
+    Py_XDECREF(ob);
     return -1;
 }
-static void __Pyx_ReleaseBuffer(Py_buffer *view) {
-    PyObject *obj = view->obj;
-    CYTHON_UNUSED PyObject *releasebuffer_cobj;
-    if (!obj) return;
-  #if PY_VERSION_HEX >= 0x02060000
-    if (PyObject_CheckBuffer(obj)) {
-        PyBuffer_Release(view);
-        return;
-    }
-  #endif
-        if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) { __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view); return; }
-  #if PY_VERSION_HEX < 0x02060000
-    if (obj->ob_type->tp_dict &&
-        (releasebuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict,
-                                                      "__pyx_releasebuffer"))) {
-        releasebufferproc func;
-      #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0)
-        func = (releasebufferproc) PyCapsule_GetPointer(releasebuffer_cobj, "releasebuffer(obj, view)");
-      #else
-        func = (releasebufferproc) PyCObject_AsVoidPtr(releasebuffer_cobj);
-      #endif
-        Py_DECREF(releasebuffer_cobj);
-        if (!func)
-            goto fail;
-        func(obj, view);
-        return;
-    } else {
-        PyErr_Clear();
-    }
-  #endif
-    goto nofail;
-#if PY_VERSION_HEX < 0x02060000
-fail:
-#endif
-    PyErr_WriteUnraisable(obj);
-nofail:
-    Py_DECREF(obj);
-    view->obj = NULL;
-}
-#endif /*  PY_MAJOR_VERSION < 3 */
 
-
-      static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) {
-    PyObject *py_import = 0;
-    PyObject *empty_list = 0;
-    PyObject *module = 0;
-    PyObject *global_dict = 0;
-    PyObject *empty_dict = 0;
-    PyObject *list;
-    py_import = __Pyx_GetAttrString(__pyx_b, "__import__");
-    if (!py_import)
-        goto bad;
-    if (from_list)
-        list = from_list;
-    else {
-        empty_list = PyList_New(0);
-        if (!empty_list)
-            goto bad;
-        list = empty_list;
-    }
-    global_dict = PyModule_GetDict(__pyx_m);
-    if (!global_dict)
-        goto bad;
-    empty_dict = PyDict_New();
-    if (!empty_dict)
-        goto bad;
-    #if PY_VERSION_HEX >= 0x02050000
-    {
-        #if PY_MAJOR_VERSION >= 3
-        if (level == -1) {
-            if (strchr(__Pyx_MODULE_NAME, '.')) {
-                /* try package relative import first */
-                PyObject *py_level = PyInt_FromLong(1);
-                if (!py_level)
-                    goto bad;
-                module = PyObject_CallFunctionObjArgs(py_import,
-                    name, global_dict, empty_dict, list, py_level, NULL);
-                Py_DECREF(py_level);
-                if (!module) {
-                    if (!PyErr_ExceptionMatches(PyExc_ImportError))
-                        goto bad;
-                    PyErr_Clear();
-                }
-            }
-            level = 0; /* try absolute import on failure */
-        }
+static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
+    PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
+    if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
+        PyErr_Format(PyExc_ImportError,
+        #if PY_MAJOR_VERSION < 3
+            "cannot import name %.230s", PyString_AS_STRING(name));
+        #else
+            "cannot import name %S", name);
         #endif
-        if (!module) {
-            PyObject *py_level = PyInt_FromLong(level);
-            if (!py_level)
-                goto bad;
-            module = PyObject_CallFunctionObjArgs(py_import,
-                name, global_dict, empty_dict, list, py_level, NULL);
-            Py_DECREF(py_level);
-        }
-    }
-    #else
-    if (level>0) {
-        PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4.");
-        goto bad;
     }
-    module = PyObject_CallFunctionObjArgs(py_import,
-        name, global_dict, empty_dict, list, NULL);
-    #endif
-bad:
-    Py_XDECREF(empty_list);
-    Py_XDECREF(py_import);
-    Py_XDECREF(empty_dict);
-    return module;
+    return value;
 }
 
-static CYTHON_INLINE void __Pyx_RaiseImportError(PyObject *name) {
-#if PY_MAJOR_VERSION < 3
-    PyErr_Format(PyExc_ImportError, "cannot import name %.230s",
-                 PyString_AsString(name));
+static PyObject *
+__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
+{
+    if (unlikely(op->func_doc == NULL)) {
+        if (op->func.m_ml->ml_doc) {
+#if PY_MAJOR_VERSION >= 3
+            op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
 #else
-    PyErr_Format(PyExc_ImportError, "cannot import name %S", name);
+            op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
 #endif
-}
-
-static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_float(PyObject *obj) {
-    __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
-    __Pyx_BufFmt_StackElem stack[1];
-    int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
-    int retcode;
-    if (obj == Py_None) {
-        result.memview = (struct __pyx_memoryview_obj *) Py_None;
-        return result;
-    }
-    retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
-                                                 PyBUF_RECORDS, 2,
-                                                 &__Pyx_TypeInfo_float, stack,
-                                                 &result, obj);
-    if (unlikely(retcode == -1))
-        goto __pyx_fail;
-    return result;
-__pyx_fail:
-    result.memview = NULL;
-    result.data = NULL;
-    return result;
-}
-
-static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases) {
-    PyObject *metaclass;
-#if PY_MAJOR_VERSION < 3
-    if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
-        PyObject *base = PyTuple_GET_ITEM(bases, 0);
-        metaclass = PyObject_GetAttrString(base, (char *)"__class__");
-        if (!metaclass) {
-            PyErr_Clear();
-            metaclass = (PyObject*) Py_TYPE(base);
-        }
-    } else {
-        metaclass = (PyObject *) &PyClass_Type;
-    }
-#else
-    if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
-        PyObject *base = PyTuple_GET_ITEM(bases, 0);
-        metaclass = (PyObject*) Py_TYPE(base);
-    } else {
-        metaclass = (PyObject *) &PyType_Type;
-    }
-#endif
-    Py_INCREF(metaclass);
-    return metaclass;
-}
-
-static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name,
-                                   PyObject *modname) {
-    PyObject *result;
-    PyObject *metaclass;
-    if (PyDict_SetItemString(dict, "__module__", modname) < 0)
-        return NULL;
-    metaclass = PyDict_GetItemString(dict, "__metaclass__");
-    if (metaclass) {
-        Py_INCREF(metaclass);
-    } else {
-        metaclass = __Pyx_FindPy2Metaclass(bases);
-    }
-    result = PyObject_CallFunctionObjArgs(metaclass, name, bases, dict, NULL);
-    Py_DECREF(metaclass);
-    return result;
-}
-
-static PyObject *
-__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
-{
-    if (op->func_doc == NULL && op->func.m_ml->ml_doc) {
-#if PY_MAJOR_VERSION >= 3
-        op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
-#else
-        op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
-#endif
-    }
-    if (op->func_doc == 0) {
-        Py_INCREF(Py_None);
-        return Py_None;
-    }
-    Py_INCREF(op->func_doc);
-    return op->func_doc;
+            if (unlikely(op->func_doc == NULL))
+                return NULL;
+        } else {
+            Py_INCREF(Py_None);
+            return Py_None;
+        }
+    }
+    Py_INCREF(op->func_doc);
+    return op->func_doc;
 }
 static int
 __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value)
 {
     PyObject *tmp = op->func_doc;
     if (value == NULL)
-        op->func_doc = Py_None; /* Mark as deleted */
-    else
-        op->func_doc = value;
-    Py_INCREF(op->func_doc);
+        value = Py_None; /* Mark as deleted */
+    Py_INCREF(value);
+    op->func_doc = value;
     Py_XDECREF(tmp);
     return 0;
 }
 static PyObject *
 __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op)
 {
-    if (op->func_name == NULL) {
+    if (unlikely(op->func_name == NULL)) {
 #if PY_MAJOR_VERSION >= 3
         op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
 #else
         op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
 #endif
+        if (unlikely(op->func_name == NULL))
+            return NULL;
     }
     Py_INCREF(op->func_name);
     return op->func_name;
@@ -31116,9 +30264,9 @@ __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value)
 {
     PyObject *tmp;
 #if PY_MAJOR_VERSION >= 3
-    if (value == NULL || !PyUnicode_Check(value)) {
+    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
 #else
-    if (value == NULL || !PyString_Check(value)) {
+    if (unlikely(value == NULL || !PyString_Check(value))) {
 #endif
         PyErr_SetString(PyExc_TypeError,
                         "__name__ must be set to a string object");
@@ -31131,6 +30279,31 @@ __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value)
     return 0;
 }
 static PyObject *
+__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op)
+{
+    Py_INCREF(op->func_qualname);
+    return op->func_qualname;
+}
+static int
+__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value)
+{
+    PyObject *tmp;
+#if PY_MAJOR_VERSION >= 3
+    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
+#else
+    if (unlikely(value == NULL || !PyString_Check(value))) {
+#endif
+        PyErr_SetString(PyExc_TypeError,
+                        "__qualname__ must be set to a string object");
+        return -1;
+    }
+    tmp = op->func_qualname;
+    Py_INCREF(value);
+    op->func_qualname = value;
+    Py_XDECREF(tmp);
+    return 0;
+}
+static PyObject *
 __Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
 {
     PyObject *self;
@@ -31143,9 +30316,9 @@ __Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure
 static PyObject *
 __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op)
 {
-    if (op->func_dict == NULL) {
+    if (unlikely(op->func_dict == NULL)) {
         op->func_dict = PyDict_New();
-        if (op->func_dict == NULL)
+        if (unlikely(op->func_dict == NULL))
             return NULL;
     }
     Py_INCREF(op->func_dict);
@@ -31155,12 +30328,12 @@ static int
 __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value)
 {
     PyObject *tmp;
-    if (value == NULL) {
+    if (unlikely(value == NULL)) {
         PyErr_SetString(PyExc_TypeError,
                "function's dictionary may not be deleted");
         return -1;
     }
-    if (!PyDict_Check(value)) {
+    if (unlikely(!PyDict_Check(value))) {
         PyErr_SetString(PyExc_TypeError,
                "setting function's dictionary to a non-dict");
         return -1;
@@ -31191,29 +30364,111 @@ __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op)
     Py_INCREF(result);
     return result;
 }
+static int
+__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
+    PyObject *res = op->defaults_getter((PyObject *) op);
+    if (unlikely(!res))
+        return -1;
+    op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
+    Py_INCREF(op->defaults_tuple);
+    op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
+    Py_INCREF(op->defaults_kwdict);
+    Py_DECREF(res);
+    return 0;
+}
+static int
+__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value) {
+    PyObject* tmp;
+    if (!value) {
+        value = Py_None;
+    } else if (value != Py_None && !PyTuple_Check(value)) {
+        PyErr_SetString(PyExc_TypeError,
+                        "__defaults__ must be set to a tuple object");
+        return -1;
+    }
+    Py_INCREF(value);
+    tmp = op->defaults_tuple;
+    op->defaults_tuple = value;
+    Py_XDECREF(tmp);
+    return 0;
+}
+static PyObject *
+__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op) {
+    PyObject* result = op->defaults_tuple;
+    if (unlikely(!result)) {
+        if (op->defaults_getter) {
+            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
+            result = op->defaults_tuple;
+        } else {
+            result = Py_None;
+        }
+    }
+    Py_INCREF(result);
+    return result;
+}
+static int
+__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value) {
+    PyObject* tmp;
+    if (!value) {
+        value = Py_None;
+    } else if (value != Py_None && !PyDict_Check(value)) {
+        PyErr_SetString(PyExc_TypeError,
+                        "__kwdefaults__ must be set to a dict object");
+        return -1;
+    }
+    Py_INCREF(value);
+    tmp = op->defaults_kwdict;
+    op->defaults_kwdict = value;
+    Py_XDECREF(tmp);
+    return 0;
+}
 static PyObject *
-__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op)
-{
-    if (op->defaults_tuple) {
-        Py_INCREF(op->defaults_tuple);
-        return op->defaults_tuple;
-    }
-    if (op->defaults_getter) {
-        PyObject *res = op->defaults_getter((PyObject *) op);
-        if (res) {
-            Py_INCREF(res);
-            op->defaults_tuple = res;
+__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op) {
+    PyObject* result = op->defaults_kwdict;
+    if (unlikely(!result)) {
+        if (op->defaults_getter) {
+            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
+            result = op->defaults_kwdict;
+        } else {
+            result = Py_None;
         }
-        return res;
     }
-    Py_INCREF(Py_None);
-    return Py_None;
+    Py_INCREF(result);
+    return result;
+}
+static int
+__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value) {
+    PyObject* tmp;
+    if (!value || value == Py_None) {
+        value = NULL;
+    } else if (!PyDict_Check(value)) {
+        PyErr_SetString(PyExc_TypeError,
+                        "__annotations__ must be set to a dict object");
+        return -1;
+    }
+    Py_XINCREF(value);
+    tmp = op->func_annotations;
+    op->func_annotations = value;
+    Py_XDECREF(tmp);
+    return 0;
+}
+static PyObject *
+__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op) {
+    PyObject* result = op->func_annotations;
+    if (unlikely(!result)) {
+        result = PyDict_New();
+        if (unlikely(!result)) return NULL;
+        op->func_annotations = result;
+    }
+    Py_INCREF(result);
+    return result;
 }
 static PyGetSetDef __pyx_CyFunction_getsets[] = {
     {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
     {(char *) "__doc__",  (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
     {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
     {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
+    {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
     {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
     {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
     {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
@@ -31223,8 +30478,10 @@ static PyGetSetDef __pyx_CyFunction_getsets[] = {
     {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
     {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
     {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
-    {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, 0, 0, 0},
-    {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, 0, 0, 0},
+    {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
+    {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
+    {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
+    {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
     {0, 0, 0, 0, 0}
 };
 #ifndef PY_WRITE_RESTRICTED /* < Py2.5 */
@@ -31247,7 +30504,7 @@ static PyMethodDef __pyx_CyFunction_methods[] = {
     {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
     {0, 0, 0, 0}
 };
-static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags,
+static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname,
                                       PyObject *closure, PyObject *module, PyObject* code) {
     __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type);
     if (op == NULL)
@@ -31262,6 +30519,8 @@ static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int f
     op->func.m_module = module;
     op->func_dict = NULL;
     op->func_name = NULL;
+    Py_INCREF(qualname);
+    op->func_qualname = qualname;
     op->func_doc = NULL;
     op->func_classobj = NULL;
     Py_XINCREF(code);
@@ -31269,7 +30528,9 @@ static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int f
     op->defaults_pyobjects = 0;
     op->defaults = NULL;
     op->defaults_tuple = NULL;
+    op->defaults_kwdict = NULL;
     op->defaults_getter = NULL;
+    op->func_annotations = NULL;
     PyObject_GC_Track(op);
     return (PyObject *) op;
 }
@@ -31280,10 +30541,13 @@ __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
     Py_CLEAR(m->func.m_module);
     Py_CLEAR(m->func_dict);
     Py_CLEAR(m->func_name);
+    Py_CLEAR(m->func_qualname);
     Py_CLEAR(m->func_doc);
     Py_CLEAR(m->func_code);
     Py_CLEAR(m->func_classobj);
     Py_CLEAR(m->defaults_tuple);
+    Py_CLEAR(m->defaults_kwdict);
+    Py_CLEAR(m->func_annotations);
     if (m->defaults) {
         PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
         int i;
@@ -31308,10 +30572,12 @@ static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit,
     Py_VISIT(m->func.m_module);
     Py_VISIT(m->func_dict);
     Py_VISIT(m->func_name);
+    Py_VISIT(m->func_qualname);
     Py_VISIT(m->func_doc);
     Py_VISIT(m->func_code);
     Py_VISIT(m->func_classobj);
     Py_VISIT(m->defaults_tuple);
+    Py_VISIT(m->defaults_kwdict);
     if (m->defaults) {
         PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
         int i;
@@ -31340,13 +30606,12 @@ static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObj
 static PyObject*
 __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
 {
-    PyObject *func_name = __Pyx_CyFunction_get_name(op);
 #if PY_MAJOR_VERSION >= 3
     return PyUnicode_FromFormat("<cyfunction %U at %p>",
-                                func_name, (void *)op);
+                                op->func_qualname, (void *)op);
 #else
     return PyString_FromFormat("<cyfunction %s at %p>",
-                               PyString_AsString(func_name), (void *)op);
+                               PyString_AsString(op->func_qualname), (void *)op);
 #endif
 }
 #if CYTHON_COMPILING_IN_PYPY
@@ -31398,90 +30663,572 @@ static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject
 static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
 	return PyCFunction_Call(func, arg, kw);
 }
-#endif
-static PyTypeObject __pyx_CyFunctionType_type = {
-    PyVarObject_HEAD_INIT(0, 0)
-    __Pyx_NAMESTR("cython_function_or_method"), /*tp_name*/
-    sizeof(__pyx_CyFunctionObject),   /*tp_basicsize*/
-    0,                                  /*tp_itemsize*/
-    (destructor) __Pyx_CyFunction_dealloc, /*tp_dealloc*/
-    0,                                  /*tp_print*/
-    0,                                  /*tp_getattr*/
-    0,                                  /*tp_setattr*/
+#endif
+static PyTypeObject __pyx_CyFunctionType_type = {
+    PyVarObject_HEAD_INIT(0, 0)
+    __Pyx_NAMESTR("cython_function_or_method"), /*tp_name*/
+    sizeof(__pyx_CyFunctionObject),   /*tp_basicsize*/
+    0,                                  /*tp_itemsize*/
+    (destructor) __Pyx_CyFunction_dealloc, /*tp_dealloc*/
+    0,                                  /*tp_print*/
+    0,                                  /*tp_getattr*/
+    0,                                  /*tp_setattr*/
+#if PY_MAJOR_VERSION < 3
+    0,                                  /*tp_compare*/
+#else
+    0,                                  /*reserved*/
+#endif
+    (reprfunc) __Pyx_CyFunction_repr,   /*tp_repr*/
+    0,                                  /*tp_as_number*/
+    0,                                  /*tp_as_sequence*/
+    0,                                  /*tp_as_mapping*/
+    0,                                  /*tp_hash*/
+    __Pyx_CyFunction_Call,              /*tp_call*/
+    0,                                  /*tp_str*/
+    0,                                  /*tp_getattro*/
+    0,                                  /*tp_setattro*/
+    0,                                  /*tp_as_buffer*/
+    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags*/
+    0,                                  /*tp_doc*/
+    (traverseproc) __Pyx_CyFunction_traverse,   /*tp_traverse*/
+    (inquiry) __Pyx_CyFunction_clear,   /*tp_clear*/
+    0,                                  /*tp_richcompare*/
+    offsetof(__pyx_CyFunctionObject, func_weakreflist), /* tp_weaklistoffse */
+    0,                                  /*tp_iter*/
+    0,                                  /*tp_iternext*/
+    __pyx_CyFunction_methods,           /*tp_methods*/
+    __pyx_CyFunction_members,           /*tp_members*/
+    __pyx_CyFunction_getsets,           /*tp_getset*/
+    0,                                  /*tp_base*/
+    0,                                  /*tp_dict*/
+    __Pyx_CyFunction_descr_get,         /*tp_descr_get*/
+    0,                                  /*tp_descr_set*/
+    offsetof(__pyx_CyFunctionObject, func_dict),/*tp_dictoffset*/
+    0,                                  /*tp_init*/
+    0,                                  /*tp_alloc*/
+    0,                                  /*tp_new*/
+    0,                                  /*tp_free*/
+    0,                                  /*tp_is_gc*/
+    0,                                  /*tp_bases*/
+    0,                                  /*tp_mro*/
+    0,                                  /*tp_cache*/
+    0,                                  /*tp_subclasses*/
+    0,                                  /*tp_weaklist*/
+    0,                                  /*tp_del*/
+#if PY_VERSION_HEX >= 0x02060000
+    0,                                  /*tp_version_tag*/
+#endif
+#if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+    0,                                  /*tp_finalize*/
+#endif
+};
+static int __Pyx_CyFunction_init(void) {
+#if !CYTHON_COMPILING_IN_PYPY
+    __pyx_CyFunctionType_type.tp_call = PyCFunction_Call;
+#endif
+    if (PyType_Ready(&__pyx_CyFunctionType_type) < 0)
+        return -1;
+    __pyx_CyFunctionType = &__pyx_CyFunctionType_type;
+    return 0;
+}
+static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
+    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
+    m->defaults = PyMem_Malloc(size);
+    if (!m->defaults)
+        return PyErr_NoMemory();
+    memset(m->defaults, 0, size);
+    m->defaults_pyobjects = pyobjects;
+    return m->defaults;
+}
+static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
+    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
+    m->defaults_tuple = tuple;
+    Py_INCREF(tuple);
+}
+static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
+    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
+    m->defaults_kwdict = dict;
+    Py_INCREF(dict);
+}
+static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
+    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
+    m->func_annotations = dict;
+    Py_INCREF(dict);
+}
+
+static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
+#if CYTHON_COMPILING_IN_CPYTHON
+    PyThreadState *tstate = PyThreadState_GET();
+    *type = tstate->exc_type;
+    *value = tstate->exc_value;
+    *tb = tstate->exc_traceback;
+    Py_XINCREF(*type);
+    Py_XINCREF(*value);
+    Py_XINCREF(*tb);
+#else
+    PyErr_GetExcInfo(type, value, tb);
+#endif
+}
+static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) {
+#if CYTHON_COMPILING_IN_CPYTHON
+    PyObject *tmp_type, *tmp_value, *tmp_tb;
+    PyThreadState *tstate = PyThreadState_GET();
+    tmp_type = tstate->exc_type;
+    tmp_value = tstate->exc_value;
+    tmp_tb = tstate->exc_traceback;
+    tstate->exc_type = type;
+    tstate->exc_value = value;
+    tstate->exc_traceback = tb;
+    Py_XDECREF(tmp_type);
+    Py_XDECREF(tmp_value);
+    Py_XDECREF(tmp_tb);
+#else
+    PyErr_SetExcInfo(type, value, tb);
+#endif
+}
+
+#if PY_MAJOR_VERSION < 3
+static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
+  #if PY_VERSION_HEX >= 0x02060000
+    if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
+  #endif
+        if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags);
+        if (PyObject_TypeCheck(obj, __pyx_array_type)) return __pyx_array_getbuffer(obj, view, flags);
+        if (PyObject_TypeCheck(obj, __pyx_memoryview_type)) return __pyx_memoryview_getbuffer(obj, view, flags);
+  #if PY_VERSION_HEX < 0x02060000
+    if (obj->ob_type->tp_dict) {
+        PyObject *getbuffer_cobj = PyObject_GetItem(
+            obj->ob_type->tp_dict, __pyx_n_s____pyx_getbuffer);
+        if (getbuffer_cobj) {
+            getbufferproc func = (getbufferproc) PyCObject_AsVoidPtr(getbuffer_cobj);
+            Py_DECREF(getbuffer_cobj);
+            if (!func)
+                goto fail;
+            return func(obj, view, flags);
+        } else {
+            PyErr_Clear();
+        }
+    }
+  #endif
+    PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
+#if PY_VERSION_HEX < 0x02060000
+fail:
+#endif
+    return -1;
+}
+static void __Pyx_ReleaseBuffer(Py_buffer *view) {
+    PyObject *obj = view->obj;
+    if (!obj) return;
+  #if PY_VERSION_HEX >= 0x02060000
+    if (PyObject_CheckBuffer(obj)) {
+        PyBuffer_Release(view);
+        return;
+    }
+  #endif
+        if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) { __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view); return; }
+  #if PY_VERSION_HEX < 0x02060000
+    if (obj->ob_type->tp_dict) {
+        PyObject *releasebuffer_cobj = PyObject_GetItem(
+            obj->ob_type->tp_dict, __pyx_n_s____pyx_releasebuffer);
+        if (releasebuffer_cobj) {
+            releasebufferproc func = (releasebufferproc) PyCObject_AsVoidPtr(releasebuffer_cobj);
+            Py_DECREF(releasebuffer_cobj);
+            if (!func)
+                goto fail;
+            func(obj, view);
+            return;
+        } else {
+            PyErr_Clear();
+        }
+    }
+  #endif
+    goto nofail;
+#if PY_VERSION_HEX < 0x02060000
+fail:
+#endif
+    PyErr_WriteUnraisable(obj);
+nofail:
+    Py_DECREF(obj);
+    view->obj = NULL;
+}
+#endif /*  PY_MAJOR_VERSION < 3 */
+
+
+              static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
+    PyObject *empty_list = 0;
+    PyObject *module = 0;
+    PyObject *global_dict = 0;
+    PyObject *empty_dict = 0;
+    PyObject *list;
+    #if PY_VERSION_HEX < 0x03030000
+    PyObject *py_import;
+    py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s____import__);
+    if (!py_import)
+        goto bad;
+    #endif
+    if (from_list)
+        list = from_list;
+    else {
+        empty_list = PyList_New(0);
+        if (!empty_list)
+            goto bad;
+        list = empty_list;
+    }
+    global_dict = PyModule_GetDict(__pyx_m);
+    if (!global_dict)
+        goto bad;
+    empty_dict = PyDict_New();
+    if (!empty_dict)
+        goto bad;
+    #if PY_VERSION_HEX >= 0x02050000
+    {
+        #if PY_MAJOR_VERSION >= 3
+        if (level == -1) {
+            if (strchr(__Pyx_MODULE_NAME, '.')) {
+                #if PY_VERSION_HEX < 0x03030000
+                PyObject *py_level = PyInt_FromLong(1);
+                if (!py_level)
+                    goto bad;
+                module = PyObject_CallFunctionObjArgs(py_import,
+                    name, global_dict, empty_dict, list, py_level, NULL);
+                Py_DECREF(py_level);
+                #else
+                module = PyImport_ImportModuleLevelObject(
+                    name, global_dict, empty_dict, list, 1);
+                #endif
+                if (!module) {
+                    if (!PyErr_ExceptionMatches(PyExc_ImportError))
+                        goto bad;
+                    PyErr_Clear();
+                }
+            }
+            level = 0; /* try absolute import on failure */
+        }
+        #endif
+        if (!module) {
+            #if PY_VERSION_HEX < 0x03030000
+            PyObject *py_level = PyInt_FromLong(level);
+            if (!py_level)
+                goto bad;
+            module = PyObject_CallFunctionObjArgs(py_import,
+                name, global_dict, empty_dict, list, py_level, NULL);
+            Py_DECREF(py_level);
+            #else
+            module = PyImport_ImportModuleLevelObject(
+                name, global_dict, empty_dict, list, level);
+            #endif
+        }
+    }
+    #else
+    if (level>0) {
+        PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4.");
+        goto bad;
+    }
+    module = PyObject_CallFunctionObjArgs(py_import,
+        name, global_dict, empty_dict, list, NULL);
+    #endif
+bad:
+    #if PY_VERSION_HEX < 0x03030000
+    Py_XDECREF(py_import);
+    #endif
+    Py_XDECREF(empty_list);
+    Py_XDECREF(empty_dict);
+    return module;
+}
+
+static int
+__pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b)
+{
+    int i;
+    if (!a || !b)
+        return 0;
+    if (a == b)
+        return 1;
+    if (a->size != b->size || a->typegroup != b->typegroup ||
+            a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) {
+        if (a->typegroup == 'H' || b->typegroup == 'H') {
+            return a->size == b->size;
+        } else {
+            return 0;
+        }
+    }
+    if (a->ndim) {
+        for (i = 0; i < a->ndim; i++)
+            if (a->arraysize[i] != b->arraysize[i])
+                return 0;
+    }
+    if (a->typegroup == 'S') {
+        if (a->flags != b->flags)
+            return 0;
+        if (a->fields || b->fields) {
+            if (!(a->fields && b->fields))
+                return 0;
+            for (i = 0; a->fields[i].type && b->fields[i].type; i++) {
+                __Pyx_StructField *field_a = a->fields + i;
+                __Pyx_StructField *field_b = b->fields + i;
+                if (field_a->offset != field_b->offset ||
+                    !__pyx_typeinfo_cmp(field_a->type, field_b->type))
+                    return 0;
+            }
+            return !a->fields[i].type && !b->fields[i].type;
+        }
+    }
+    return 1;
+}
+
+static int
+__pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec)
+{
+    if (buf->shape[dim] <= 1)
+        return 1;
+    if (buf->strides) {
+        if (spec & __Pyx_MEMVIEW_CONTIG) {
+            if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) {
+                if (buf->strides[dim] != sizeof(void *)) {
+                    PyErr_Format(PyExc_ValueError,
+                                 "Buffer is not indirectly contiguous "
+                                 "in dimension %d.", dim);
+                    goto fail;
+                }
+            } else if (buf->strides[dim] != buf->itemsize) {
+                PyErr_SetString(PyExc_ValueError,
+                                "Buffer and memoryview are not contiguous "
+                                "in the same dimension.");
+                goto fail;
+            }
+        }
+        if (spec & __Pyx_MEMVIEW_FOLLOW) {
+            Py_ssize_t stride = buf->strides[dim];
+            if (stride < 0)
+                stride = -stride;
+            if (stride < buf->itemsize) {
+                PyErr_SetString(PyExc_ValueError,
+                                "Buffer and memoryview are not contiguous "
+                                "in the same dimension.");
+                goto fail;
+            }
+        }
+    } else {
+        if (spec & __Pyx_MEMVIEW_CONTIG && dim != ndim - 1) {
+            PyErr_Format(PyExc_ValueError,
+                         "C-contiguous buffer is not contiguous in "
+                         "dimension %d", dim);
+            goto fail;
+        } else if (spec & (__Pyx_MEMVIEW_PTR)) {
+            PyErr_Format(PyExc_ValueError,
+                         "C-contiguous buffer is not indirect in "
+                         "dimension %d", dim);
+            goto fail;
+        } else if (buf->suboffsets) {
+            PyErr_SetString(PyExc_ValueError,
+                            "Buffer exposes suboffsets but no strides");
+            goto fail;
+        }
+    }
+    return 1;
+fail:
+    return 0;
+}
+static int
+__pyx_check_suboffsets(Py_buffer *buf, int dim, CYTHON_UNUSED int ndim, int spec)
+{
+    if (spec & __Pyx_MEMVIEW_DIRECT) {
+        if (buf->suboffsets && buf->suboffsets[dim] >= 0) {
+            PyErr_Format(PyExc_ValueError,
+                         "Buffer not compatible with direct access "
+                         "in dimension %d.", dim);
+            goto fail;
+        }
+    }
+    if (spec & __Pyx_MEMVIEW_PTR) {
+        if (!buf->suboffsets || (buf->suboffsets && buf->suboffsets[dim] < 0)) {
+            PyErr_Format(PyExc_ValueError,
+                         "Buffer is not indirectly accessisble "
+                         "in dimension %d.", dim);
+            goto fail;
+        }
+    }
+    return 1;
+fail:
+    return 0;
+}
+static int
+__pyx_verify_contig(Py_buffer *buf, int ndim, int c_or_f_flag)
+{
+    int i;
+    if (c_or_f_flag & __Pyx_IS_F_CONTIG) {
+        Py_ssize_t stride = 1;
+        for (i = 0; i < ndim; i++) {
+            if (stride * buf->itemsize != buf->strides[i] &&
+                    buf->shape[i] > 1)
+            {
+                PyErr_SetString(PyExc_ValueError,
+                    "Buffer not fortran contiguous.");
+                goto fail;
+            }
+            stride = stride * buf->shape[i];
+        }
+    } else if (c_or_f_flag & __Pyx_IS_C_CONTIG) {
+        Py_ssize_t stride = 1;
+        for (i = ndim - 1; i >- 1; i--) {
+            if (stride * buf->itemsize != buf->strides[i] &&
+                    buf->shape[i] > 1) {
+                PyErr_SetString(PyExc_ValueError,
+                    "Buffer not C contiguous.");
+                goto fail;
+            }
+            stride = stride * buf->shape[i];
+        }
+    }
+    return 1;
+fail:
+    return 0;
+}
+static int __Pyx_ValidateAndInit_memviewslice(
+                int *axes_specs,
+                int c_or_f_flag,
+                int buf_flags,
+                int ndim,
+                __Pyx_TypeInfo *dtype,
+                __Pyx_BufFmt_StackElem stack[],
+                __Pyx_memviewslice *memviewslice,
+                PyObject *original_obj)
+{
+    struct __pyx_memoryview_obj *memview, *new_memview;
+    __Pyx_RefNannyDeclarations
+    Py_buffer *buf;
+    int i, spec = 0, retval = -1;
+    __Pyx_BufFmt_Context ctx;
+    int from_memoryview = __pyx_memoryview_check(original_obj);
+    __Pyx_RefNannySetupContext("ValidateAndInit_memviewslice", 0);
+    if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((struct __pyx_memoryview_obj *)
+                                                            original_obj)->typeinfo)) {
+        memview = (struct __pyx_memoryview_obj *) original_obj;
+        new_memview = NULL;
+    } else {
+        memview = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
+                                            original_obj, buf_flags, 0, dtype);
+        new_memview = memview;
+        if (unlikely(!memview))
+            goto fail;
+    }
+    buf = &memview->view;
+    if (buf->ndim != ndim) {
+        PyErr_Format(PyExc_ValueError,
+                "Buffer has wrong number of dimensions (expected %d, got %d)",
+                ndim, buf->ndim);
+        goto fail;
+    }
+    if (new_memview) {
+        __Pyx_BufFmt_Init(&ctx, stack, dtype);
+        if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
+    }
+    if ((unsigned) buf->itemsize != dtype->size) {
+        PyErr_Format(PyExc_ValueError,
+                     "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "u byte%s) "
+                     "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "u byte%s)",
+                     buf->itemsize,
+                     (buf->itemsize > 1) ? "s" : "",
+                     dtype->name,
+                     dtype->size,
+                     (dtype->size > 1) ? "s" : "");
+        goto fail;
+    }
+    for (i = 0; i < ndim; i++) {
+        spec = axes_specs[i];
+        if (!__pyx_check_strides(buf, i, ndim, spec))
+            goto fail;
+        if (!__pyx_check_suboffsets(buf, i, ndim, spec))
+            goto fail;
+    }
+    if (buf->strides && !__pyx_verify_contig(buf, ndim, c_or_f_flag))
+        goto fail;
+    if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice,
+                                         new_memview != NULL) == -1)) {
+        goto fail;
+    }
+    retval = 0;
+    goto no_fail;
+fail:
+    Py_XDECREF(new_memview);
+    retval = -1;
+no_fail:
+    __Pyx_RefNannyFinishContext();
+    return retval;
+}
+
+static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_float(PyObject *obj) {
+    __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
+    __Pyx_BufFmt_StackElem stack[1];
+    int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
+    int retcode;
+    if (obj == Py_None) {
+        result.memview = (struct __pyx_memoryview_obj *) Py_None;
+        return result;
+    }
+    retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
+                                                 PyBUF_RECORDS, 2,
+                                                 &__Pyx_TypeInfo_float, stack,
+                                                 &result, obj);
+    if (unlikely(retcode == -1))
+        goto __pyx_fail;
+    return result;
+__pyx_fail:
+    result.memview = NULL;
+    result.data = NULL;
+    return result;
+}
+
+static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases) {
+    PyObject *metaclass;
 #if PY_MAJOR_VERSION < 3
-    0,                                  /*tp_compare*/
+    if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
+        PyObject *base = PyTuple_GET_ITEM(bases, 0);
+        metaclass = __Pyx_PyObject_GetAttrStr(base, __pyx_n_s____class__);
+        if (!metaclass) {
+            PyErr_Clear();
+            metaclass = (PyObject*) Py_TYPE(base);
+            Py_INCREF(metaclass);
+        }
+    } else {
+        metaclass = (PyObject *) &PyClass_Type;
+        Py_INCREF(metaclass);
+    }
 #else
-    0,                                  /*reserved*/
-#endif
-    (reprfunc) __Pyx_CyFunction_repr,   /*tp_repr*/
-    0,                                  /*tp_as_number*/
-    0,                                  /*tp_as_sequence*/
-    0,                                  /*tp_as_mapping*/
-    0,                                  /*tp_hash*/
-    __Pyx_CyFunction_Call,              /*tp_call*/
-    0,                                  /*tp_str*/
-    0,                                  /*tp_getattro*/
-    0,                                  /*tp_setattro*/
-    0,                                  /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags*/
-    0,                                  /*tp_doc*/
-    (traverseproc) __Pyx_CyFunction_traverse,   /*tp_traverse*/
-    (inquiry) __Pyx_CyFunction_clear,   /*tp_clear*/
-    0,                                  /*tp_richcompare*/
-    offsetof(__pyx_CyFunctionObject, func_weakreflist), /* tp_weaklistoffse */
-    0,                                  /*tp_iter*/
-    0,                                  /*tp_iternext*/
-    __pyx_CyFunction_methods,           /*tp_methods*/
-    __pyx_CyFunction_members,           /*tp_members*/
-    __pyx_CyFunction_getsets,           /*tp_getset*/
-    0,                                  /*tp_base*/
-    0,                                  /*tp_dict*/
-    __Pyx_CyFunction_descr_get,         /*tp_descr_get*/
-    0,                                  /*tp_descr_set*/
-    offsetof(__pyx_CyFunctionObject, func_dict),/*tp_dictoffset*/
-    0,                                  /*tp_init*/
-    0,                                  /*tp_alloc*/
-    0,                                  /*tp_new*/
-    0,                                  /*tp_free*/
-    0,                                  /*tp_is_gc*/
-    0,                                  /*tp_bases*/
-    0,                                  /*tp_mro*/
-    0,                                  /*tp_cache*/
-    0,                                  /*tp_subclasses*/
-    0,                                  /*tp_weaklist*/
-    0,                                  /*tp_del*/
-#if PY_VERSION_HEX >= 0x02060000
-    0,                                  /*tp_version_tag*/
-#endif
-};
-static int __Pyx_CyFunction_init(void) {
-#if !CYTHON_COMPILING_IN_PYPY
-    __pyx_CyFunctionType_type.tp_call = PyCFunction_Call;
+    if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
+        PyObject *base = PyTuple_GET_ITEM(bases, 0);
+        metaclass = (PyObject*) Py_TYPE(base);
+    } else {
+        metaclass = (PyObject *) &PyType_Type;
+    }
+    Py_INCREF(metaclass);
 #endif
-    if (PyType_Ready(&__pyx_CyFunctionType_type) < 0)
-        return -1;
-    __pyx_CyFunctionType = &__pyx_CyFunctionType_type;
-    return 0;
-}
-static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
-    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
-    m->defaults = PyMem_Malloc(size);
-    if (!m->defaults)
-        return PyErr_NoMemory();
-    memset(m->defaults, 0, sizeof(size));
-    m->defaults_pyobjects = pyobjects;
-    return m->defaults;
+    return metaclass;
 }
-static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
-    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
-    m->defaults_tuple = tuple;
-    Py_INCREF(tuple);
+
+static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name,
+                                   PyObject *qualname, PyObject *modname) {
+    PyObject *result;
+    PyObject *metaclass;
+    if (PyDict_SetItem(dict, __pyx_n_s____module__, modname) < 0)
+        return NULL;
+    if (PyDict_SetItem(dict, __pyx_n_s____qualname__, qualname) < 0)
+        return NULL;
+    metaclass = PyDict_GetItem(dict, __pyx_n_s____metaclass__);
+    if (metaclass) {
+        Py_INCREF(metaclass);
+    } else {
+        metaclass = __Pyx_FindPy2Metaclass(bases);
+    }
+    result = PyObject_CallFunctionObjArgs(metaclass, name, bases, dict, NULL);
+    Py_DECREF(metaclass);
+    return result;
 }
 
-PyObject *__pyx_memview_get_float(const char *itemp) {
+static PyObject *__pyx_memview_get_float(const char *itemp) {
     return (PyObject *) PyFloat_FromDouble(*(float *) itemp);
 }
-int __pyx_memview_set_float(const char *itemp, PyObject *obj) {
+static int __pyx_memview_set_float(const char *itemp, PyObject *obj) {
     float value = __pyx_PyFloat_AsFloat(obj);
     if ((value == (float)-1) && PyErr_Occurred())
         return 0;
@@ -31539,7 +31286,7 @@ static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) {
     PyObject* result = 0;
     PyObject* end_string;
     if (unlikely(!__pyx_print)) {
-        __pyx_print = __Pyx_GetAttrString(__pyx_b, "print");
+        __pyx_print = PyObject_GetAttr(__pyx_b, __pyx_n_s__print);
         if (!__pyx_print)
             return -1;
     }
@@ -31547,13 +31294,13 @@ static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) {
         kwargs = PyDict_New();
         if (unlikely(!kwargs))
             return -1;
-        if (unlikely(PyDict_SetItemString(kwargs, "file", stream) < 0))
+        if (unlikely(PyDict_SetItem(kwargs, __pyx_n_s__file, stream) < 0))
             goto bad;
         if (!newline) {
             end_string = PyUnicode_FromStringAndSize(" ", 1);
             if (unlikely(!end_string))
                 goto bad;
-            if (PyDict_SetItemString(kwargs, "end", end_string) < 0) {
+            if (PyDict_SetItem(kwargs, __pyx_n_s__end, end_string) < 0) {
                 Py_DECREF(end_string);
                 goto bad;
             }
@@ -31567,7 +31314,7 @@ static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) {
             end_string = PyUnicode_FromStringAndSize(" ", 1);
             if (unlikely(!end_string))
                 return -1;
-            if (PyDict_SetItemString(__pyx_print_kwargs, "end", end_string) < 0) {
+            if (PyDict_SetItem(__pyx_print_kwargs, __pyx_n_s__end, end_string) < 0) {
                 Py_DECREF(end_string);
                 return -1;
             }
@@ -31976,7 +31723,7 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
     }
     __Pyx_GOTREF(shape_tuple);
     for(i = 0; i < ndim; i++) {
-        temp_int = PyInt_FromLong(from_mvs->shape[i]);
+        temp_int = PyInt_FromSsize_t(from_mvs->shape[i]);
         if(unlikely(!temp_int)) {
             goto fail;
         } else {
@@ -32014,7 +31761,7 @@ no_fail:
 }
 
 static CYTHON_INLINE PyObject *
-__pyx_capsule_create(void *p, const char *sig)
+__pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig)
 {
     PyObject *cobj;
 #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0)
@@ -32215,10 +31962,15 @@ static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) {
     return (int)__Pyx_PyInt_AsLong(x);
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
     const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -32231,6 +31983,16 @@ static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(unsigned long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (unsigned long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to unsigned long");
@@ -32238,6 +32000,17 @@ static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
             }
             return (unsigned long)PyLong_AsUnsignedLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(unsigned long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(unsigned long) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(unsigned long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (unsigned long)PyLong_AsLong(x);
         }
     } else {
@@ -32250,10 +32023,15 @@ static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
     }
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
     const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -32266,6 +32044,16 @@ static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObje
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to unsigned PY_LONG_LONG");
@@ -32273,6 +32061,17 @@ static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObje
             }
             return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x);
         }
     } else {
@@ -32285,10 +32084,15 @@ static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObje
     }
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
     const long neg_one = (long)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -32301,6 +32105,16 @@ static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to long");
@@ -32308,6 +32122,17 @@ static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
             }
             return (long)PyLong_AsUnsignedLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(long) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (long)PyLong_AsLong(x);
         }
     } else {
@@ -32320,10 +32145,15 @@ static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
     }
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
     const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -32336,6 +32166,16 @@ static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to PY_LONG_LONG");
@@ -32343,6 +32183,17 @@ static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
             }
             return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (PY_LONG_LONG)PyLong_AsLongLong(x);
         }
     } else {
@@ -32355,10 +32206,15 @@ static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
     }
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
     const signed long neg_one = (signed long)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -32371,6 +32227,16 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(signed long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (signed long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to signed long");
@@ -32378,6 +32244,17 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
             }
             return (signed long)PyLong_AsUnsignedLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(signed long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(signed long) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(signed long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (signed long)PyLong_AsLong(x);
         }
     } else {
@@ -32390,10 +32267,15 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
     }
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
     const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -32406,6 +32288,16 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject*
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to signed PY_LONG_LONG");
@@ -32413,6 +32305,17 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject*
             }
             return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (signed PY_LONG_LONG)PyLong_AsLongLong(x);
         }
     } else {
@@ -32425,25 +32328,6 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject*
     }
 }
 
-static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
-                                  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename) {
-    PyObject *old_exc, *old_val, *old_tb;
-    PyObject *ctx;
-    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
-    #if PY_MAJOR_VERSION < 3
-    ctx = PyString_FromString(name);
-    #else
-    ctx = PyUnicode_FromString(name);
-    #endif
-    __Pyx_ErrRestore(old_exc, old_val, old_tb);
-    if (!ctx) {
-        PyErr_WriteUnraisable(Py_None);
-    } else {
-        PyErr_WriteUnraisable(ctx);
-        Py_DECREF(ctx);
-    }
-}
-
 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_int(PyObject *obj) {
     __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
     __Pyx_BufFmt_StackElem stack[1];
@@ -32551,23 +32435,6 @@ static int __Pyx_check_binary_version(void) {
     return 0;
 }
 
-static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
-#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
-    PyObject *ob = PyCapsule_New(vtable, 0, 0);
-#else
-    PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
-#endif
-    if (!ob)
-        goto bad;
-    if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0)
-        goto bad;
-    Py_DECREF(ob);
-    return 0;
-bad:
-    Py_XDECREF(ob);
-    return -1;
-}
-
 #ifndef __PYX_HAVE_RT_ImportModule
 #define __PYX_HAVE_RT_ImportModule
 static PyObject *__Pyx_ImportModule(const char *name) {
@@ -32594,6 +32461,10 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class
     PyObject *result = 0;
     PyObject *py_name = 0;
     char warning[200];
+    Py_ssize_t basicsize;
+#ifdef Py_LIMITED_API
+    PyObject *py_basicsize;
+#endif
     py_module = __Pyx_ImportModule(module_name);
     if (!py_module)
         goto bad;
@@ -32613,7 +32484,19 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class
             module_name, class_name);
         goto bad;
     }
-    if (!strict && (size_t)((PyTypeObject *)result)->tp_basicsize > size) {
+#ifndef Py_LIMITED_API
+    basicsize = ((PyTypeObject *)result)->tp_basicsize;
+#else
+    py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
+    if (!py_basicsize)
+        goto bad;
+    basicsize = PyLong_AsSsize_t(py_basicsize);
+    Py_DECREF(py_basicsize);
+    py_basicsize = 0;
+    if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
+        goto bad;
+#endif
+    if (!strict && (size_t)basicsize > size) {
         PyOS_snprintf(warning, sizeof(warning),
             "%s.%s size changed, may indicate binary incompatibility",
             module_name, class_name);
@@ -32623,7 +32506,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class
         if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
         #endif
     }
-    else if ((size_t)((PyTypeObject *)result)->tp_basicsize != size) {
+    else if ((size_t)basicsize != size) {
         PyErr_Format(PyExc_ValueError,
             "%s.%s has the wrong size, try recompiling",
             module_name, class_name);
@@ -32829,27 +32712,82 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
     return 0;
 }
 
-
-/* Type Conversion Functions */
-
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char* c_str) {
+    return __Pyx_PyUnicode_FromStringAndSize(c_str, strlen(c_str));
+}
+static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
+    Py_ssize_t ignore;
+    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
+}
+static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
+    if (
+#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+            __Pyx_sys_getdefaultencoding_not_ascii &&
+#endif
+            PyUnicode_Check(o)) {
+#if PY_VERSION_HEX < 0x03030000
+        char* defenc_c;
+        PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
+        if (!defenc) return NULL;
+        defenc_c = PyBytes_AS_STRING(defenc);
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+        {
+            char* end = defenc_c + PyBytes_GET_SIZE(defenc);
+            char* c;
+            for (c = defenc_c; c < end; c++) {
+                if ((unsigned char) (*c) >= 128) {
+                    PyUnicode_AsASCIIString(o);
+                    return NULL;
+                }
+            }
+        }
+#endif /*__PYX_DEFAULT_STRING_ENCODING_IS_ASCII*/
+        *length = PyBytes_GET_SIZE(defenc);
+        return defenc_c;
+#else /* PY_VERSION_HEX < 0x03030000 */
+        if (PyUnicode_READY(o) == -1) return NULL;
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+        if (PyUnicode_IS_ASCII(o)) {
+            *length = PyUnicode_GET_DATA_SIZE(o);
+            return PyUnicode_AsUTF8(o);
+        } else {
+            PyUnicode_AsASCIIString(o);
+            return NULL;
+        }
+#else /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
+        return PyUnicode_AsUTF8AndSize(o, length);
+#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
+#endif /* PY_VERSION_HEX < 0x03030000 */
+    } else
+#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII  || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT */
+    {
+        char* result;
+        int r = PyBytes_AsStringAndSize(o, &result, length);
+        if (r < 0) {
+            return NULL;
+        } else {
+            return result;
+        }
+    }
+}
 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
    int is_true = x == Py_True;
    if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
    else return PyObject_IsTrue(x);
 }
-
 static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
   PyNumberMethods *m;
   const char *name = NULL;
   PyObject *res = NULL;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
   if (PyInt_Check(x) || PyLong_Check(x))
 #else
   if (PyLong_Check(x))
 #endif
     return Py_INCREF(x), x;
   m = Py_TYPE(x)->tp_as_number;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
   if (m && m->nb_int) {
     name = "int";
     res = PyNumber_Int(x);
@@ -32865,7 +32803,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
   }
 #endif
   if (res) {
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (!PyInt_Check(res) && !PyLong_Check(res)) {
 #else
     if (!PyLong_Check(res)) {
@@ -32883,7 +32821,6 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
   }
   return res;
 }
-
 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
   Py_ssize_t ival;
   PyObject* x = PyNumber_Index(b);
@@ -32892,7 +32829,6 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
   Py_DECREF(x);
   return ival;
 }
-
 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
 #if PY_VERSION_HEX < 0x02050000
    if (ival <= LONG_MAX)
@@ -32906,14 +32842,12 @@ static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
    return PyInt_FromSize_t(ival);
 #endif
 }
-
 static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
    unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
-   if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) {
-       return (size_t)-1;
-   } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
-       PyErr_SetString(PyExc_OverflowError,
-                       "value too large to convert to size_t");
+   if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
+       if ((val != (unsigned PY_LONG_LONG)-1) || !PyErr_Occurred())
+           PyErr_SetString(PyExc_OverflowError,
+                           "value too large to convert to size_t");
        return (size_t)-1;
    }
    return (size_t)val;
diff --git a/src/_geometry.c b/src/_geometry.c
index 07c7d63..6897d5f 100644
--- a/src/_geometry.c
+++ b/src/_geometry.c
@@ -1,6 +1,18 @@
-/* Generated by Cython 0.17.1 on Wed Dec 12 12:20:52 2012 */
+/* Generated by Cython 0.19.2 on Mon Jan  6 15:01:35 2014 */
 
 #define PY_SSIZE_T_CLEAN
+#ifndef CYTHON_USE_PYLONG_INTERNALS
+#ifdef PYLONG_BITS_IN_DIGIT
+#define CYTHON_USE_PYLONG_INTERNALS 0
+#else
+#include "pyconfig.h"
+#ifdef PYLONG_BITS_IN_DIGIT
+#define CYTHON_USE_PYLONG_INTERNALS 1
+#else
+#define CYTHON_USE_PYLONG_INTERNALS 0
+#endif
+#endif
+#endif
 #include "Python.h"
 #ifndef Py_PYTHON_H
     #error Python headers needed to compile C extensions, please install development version of Python.
@@ -53,12 +65,15 @@
                                 (PyErr_Format(PyExc_TypeError, \
                                               "expected index value, got %.200s", Py_TYPE(o)->tp_name), \
                                  (PyObject*)0))
-  #define PyIndex_Check(o)     (PyNumber_Check(o) && !PyFloat_Check(o) && !PyComplex_Check(o))
+  #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \
+                                  !PyComplex_Check(o))
+  #define PyIndex_Check __Pyx_PyIndex_Check
   #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
   #define __PYX_BUILD_PY_SSIZE_T "i"
 #else
   #define __PYX_BUILD_PY_SSIZE_T "n"
   #define CYTHON_FORMAT_SSIZE_T "z"
+  #define __Pyx_PyIndex_Check PyIndex_Check
 #endif
 #if PY_VERSION_HEX < 0x02060000
   #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
@@ -113,6 +128,9 @@
 #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
   #define Py_TPFLAGS_HAVE_NEWBUFFER 0
 #endif
+#if PY_VERSION_HEX < 0x02060000
+  #define Py_TPFLAGS_HAVE_VERSION_TAG 0
+#endif
 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
   #define CYTHON_PEP393_ENABLED 1
   #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ? \
@@ -152,6 +170,14 @@
   #define PyBytes_Concat               PyString_Concat
   #define PyBytes_ConcatAndDel         PyString_ConcatAndDel
 #endif
+#if PY_MAJOR_VERSION >= 3
+  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
+  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
+#else
+  #define __Pyx_PyBaseString_Check(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj) || \
+                                         PyString_Check(obj) || PyUnicode_Check(obj))
+  #define __Pyx_PyBaseString_CheckExact(obj) (Py_TYPE(obj) == &PyBaseString_Type)
+#endif
 #if PY_VERSION_HEX < 0x02060000
   #define PySet_Check(obj)             PyObject_TypeCheck(obj, &PySet_Type)
   #define PyFrozenSet_Check(obj)       PyObject_TypeCheck(obj, &PyFrozenSet_Type)
@@ -224,6 +250,40 @@
   #define __Pyx_NAMESTR(n) (n)
   #define __Pyx_DOCSTR(n)  (n)
 #endif
+#ifndef CYTHON_INLINE
+  #if defined(__GNUC__)
+    #define CYTHON_INLINE __inline__
+  #elif defined(_MSC_VER)
+    #define CYTHON_INLINE __inline
+  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+    #define CYTHON_INLINE inline
+  #else
+    #define CYTHON_INLINE
+  #endif
+#endif
+#ifndef CYTHON_RESTRICT
+  #if defined(__GNUC__)
+    #define CYTHON_RESTRICT __restrict__
+  #elif defined(_MSC_VER) && _MSC_VER >= 1400
+    #define CYTHON_RESTRICT __restrict
+  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+    #define CYTHON_RESTRICT restrict
+  #else
+    #define CYTHON_RESTRICT
+  #endif
+#endif
+#ifdef NAN
+#define __PYX_NAN() ((float) NAN)
+#else
+static CYTHON_INLINE float __PYX_NAN() {
+  /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and
+   a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is
+   a quiet NaN. */
+  float value;
+  memset(&value, 0xFF, sizeof(value));
+  return value;
+}
+#endif
 
 
 #if PY_MAJOR_VERSION >= 3
@@ -248,13 +308,13 @@
 #include <math.h>
 #define __PYX_HAVE___geometry
 #define __PYX_HAVE_API___geometry
+#include "string.h"
 #include "stdio.h"
 #include "stdlib.h"
 #include "numpy/arrayobject.h"
 #include "numpy/ufuncobject.h"
 #include "math.h"
 #include "pythread.h"
-#include "string.h"
 #include "pystate.h"
 #ifdef _OPENMP
 #include <omp.h>
@@ -264,21 +324,6 @@
 #define CYTHON_WITHOUT_ASSERTIONS
 #endif
 
-
-/* inline attribute */
-#ifndef CYTHON_INLINE
-  #if defined(__GNUC__)
-    #define CYTHON_INLINE __inline__
-  #elif defined(_MSC_VER)
-    #define CYTHON_INLINE __inline
-  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
-    #define CYTHON_INLINE inline
-  #else
-    #define CYTHON_INLINE
-  #endif
-#endif
-
-/* unused attribute */
 #ifndef CYTHON_UNUSED
 # if defined(__GNUC__)
 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
@@ -292,30 +337,130 @@
 #   define CYTHON_UNUSED
 # endif
 #endif
-
-typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/
-
-
-/* Type Conversion Predeclarations */
-
-#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
-#define __Pyx_PyBytes_AsUString(s)   ((unsigned char*) PyBytes_AsString(s))
-
+typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding;
+                const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/
+
+#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
+#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
+#define __PYX_DEFAULT_STRING_ENCODING ""
+#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
+#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
+static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
+static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
+#define __Pyx_PyBytes_FromString        PyBytes_FromString
+#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char*);
+#if PY_MAJOR_VERSION < 3
+    #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
+    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
+#else
+    #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
+    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
+#endif
+#define __Pyx_PyObject_AsUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
+#define __Pyx_PyObject_FromUString(s)  __Pyx_PyObject_FromString((char*)s)
+#define __Pyx_PyBytes_FromUString(s)   __Pyx_PyBytes_FromString((char*)s)
+#define __Pyx_PyStr_FromUString(s)     __Pyx_PyStr_FromString((char*)s)
+#define __Pyx_PyUnicode_FromUString(s) __Pyx_PyUnicode_FromString((char*)s)
+#if PY_MAJOR_VERSION < 3
+static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
+{
+    const Py_UNICODE *u_end = u;
+    while (*u_end++) ;
+    return u_end - u - 1;
+}
+#else
+#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
+#endif
+#define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
+#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
+#define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
 #define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
 #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
 static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
-
 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
 static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
-
 #if CYTHON_COMPILING_IN_CPYTHON
 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
 #else
 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
 #endif
 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
+#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+static int __Pyx_sys_getdefaultencoding_not_ascii;
+static int __Pyx_init_sys_getdefaultencoding_params() {
+    PyObject* sys = NULL;
+    PyObject* default_encoding = NULL;
+    PyObject* ascii_chars_u = NULL;
+    PyObject* ascii_chars_b = NULL;
+    sys = PyImport_ImportModule("sys");
+    if (sys == NULL) goto bad;
+    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
+    if (default_encoding == NULL) goto bad;
+    if (strcmp(PyBytes_AsString(default_encoding), "ascii") == 0) {
+        __Pyx_sys_getdefaultencoding_not_ascii = 0;
+    } else {
+        const char* default_encoding_c = PyBytes_AS_STRING(default_encoding);
+        char ascii_chars[128];
+        int c;
+        for (c = 0; c < 128; c++) {
+            ascii_chars[c] = c;
+        }
+        __Pyx_sys_getdefaultencoding_not_ascii = 1;
+        ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
+        if (ascii_chars_u == NULL) goto bad;
+        ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
+        if (ascii_chars_b == NULL || strncmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
+            PyErr_Format(
+                PyExc_ValueError,
+                "This module compiled with c_string_encoding=ascii, but default encoding '%s' is not a superset of ascii.",
+                default_encoding_c);
+            goto bad;
+        }
+    }
+    Py_XDECREF(sys);
+    Py_XDECREF(default_encoding);
+    Py_XDECREF(ascii_chars_u);
+    Py_XDECREF(ascii_chars_b);
+    return 0;
+bad:
+    Py_XDECREF(sys);
+    Py_XDECREF(default_encoding);
+    Py_XDECREF(ascii_chars_u);
+    Py_XDECREF(ascii_chars_b);
+    return -1;
+}
+#endif
+#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
+#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
+#else
+#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
+#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
+static char* __PYX_DEFAULT_STRING_ENCODING;
+static int __Pyx_init_sys_getdefaultencoding_params() {
+    PyObject* sys = NULL;
+    PyObject* default_encoding = NULL;
+    char* default_encoding_c;
+    sys = PyImport_ImportModule("sys");
+    if (sys == NULL) goto bad;
+    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
+    if (default_encoding == NULL) goto bad;
+    default_encoding_c = PyBytes_AS_STRING(default_encoding);
+    __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
+    strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
+    Py_DECREF(sys);
+    Py_DECREF(default_encoding);
+    return 0;
+bad:
+    Py_XDECREF(sys);
+    Py_XDECREF(default_encoding);
+    return -1;
+}
+#endif
+#endif
+
 
 #ifdef __GNUC__
   /* Test for GCC > 2.95 */
@@ -330,8 +475,9 @@ static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
   #define likely(x)   (x)
   #define unlikely(x) (x)
 #endif /* __GNUC__ */
-    
+
 static PyObject *__pyx_m;
+static PyObject *__pyx_d;
 static PyObject *__pyx_b;
 static PyObject *__pyx_empty_tuple;
 static PyObject *__pyx_empty_bytes;
@@ -417,10 +563,9 @@ typedef struct {
     #define CYTHON_ATOMICS 1
 #endif
 #define __pyx_atomic_int_type int
-/* todo: Portland pgcc, maybe OS X's OSAtomicIncrement32,
-   libatomic + autotools-like distutils support? Such a pain... */
-#if CYTHON_ATOMICS && __GNUC__ >= 4 && (__GNUC_MINOR__ > 1 || \
-                    (__GNUC_MINOR__ == 1 && __GNUC_PATHLEVEL >= 2))
+#if CYTHON_ATOMICS && __GNUC__ >= 4 && (__GNUC_MINOR__ > 1 ||           \
+                    (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL >= 2)) && \
+                    !defined(__i386__)
     #define __pyx_atomic_incr_aligned(value, lock) __sync_fetch_and_add(value, 1)
     #define __pyx_atomic_decr_aligned(value, lock) __sync_fetch_and_sub(value, 1)
     #ifdef __PYX_DEBUG_ATOMICS
@@ -873,6 +1018,14 @@ static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice;
   #define __Pyx_XGOTREF(r)
   #define __Pyx_XGIVEREF(r)
 #endif /* CYTHON_REFNANNY */
+#define __Pyx_XDECREF_SET(r, v) do {                            \
+        PyObject *tmp = (PyObject *) r;                         \
+        r = v; __Pyx_XDECREF(tmp);                              \
+    } while (0)
+#define __Pyx_DECREF_SET(r, v) do {                             \
+        PyObject *tmp = (PyObject *) r;                         \
+        r = v; __Pyx_DECREF(tmp);                               \
+    } while (0)
 #define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
 #define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
 
@@ -888,7 +1041,24 @@ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \
 static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
     const char *name, int exact); /*proto*/
 
-static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
+    PyTypeObject* tp = Py_TYPE(obj);
+    if (likely(tp->tp_getattro))
+        return tp->tp_getattro(obj, attr_name);
+#if PY_MAJOR_VERSION < 3
+    if (likely(tp->tp_getattr))
+        return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
+#endif
+    return PyObject_GetAttr(obj, attr_name);
+}
+#else
+#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
+#endif
+
+static PyObject *__Pyx_GetBuiltinName(PyObject *name); /*proto*/
+
+static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); /*proto*/
 
 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/
 
@@ -897,8 +1067,6 @@ static CYTHON_INLINE int  __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* o
 static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);
 
 #define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0)
-static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
-
 #define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d
 #define __Pyx_MEMVIEW_DIRECT   1
 #define __Pyx_MEMVIEW_PTR      2
@@ -908,24 +1076,15 @@ static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
 #define __Pyx_MEMVIEW_FOLLOW   32
 #define __Pyx_IS_C_CONTIG 1
 #define __Pyx_IS_F_CONTIG 2
-static int __Pyx_ValidateAndInit_memviewslice(
-                int *axes_specs,
-                int c_or_f_flag,
-                int buf_flags,
-                int ndim,
-                __Pyx_TypeInfo *dtype,
-                __Pyx_BufFmt_StackElem stack[],
-                __Pyx_memviewslice *memviewslice,
-                PyObject *original_obj);
 static int __Pyx_init_memviewslice(
                 struct __pyx_memoryview_obj *memview,
                 int ndim,
                 __Pyx_memviewslice *memviewslice,
                 int memview_is_new_reference);
-static CYTHON_INLINE int __pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
-                                                            PyThread_type_lock lock);
-static CYTHON_INLINE int __pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
-                                                            PyThread_type_lock lock);
+static CYTHON_INLINE int __pyx_add_acquisition_count_locked(
+    __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
+static CYTHON_INLINE int __pyx_sub_acquisition_count_locked(
+    __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
 #define __pyx_get_slice_count_pointer(memview) (memview->acquisition_count_aligned_p)
 #define __pyx_get_slice_count(memview) (*__pyx_get_slice_count_pointer(memview))
 #define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__)
@@ -948,13 +1107,19 @@ static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/
 
 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/
 
+static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); /*proto*/
+
 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); /*proto*/
 
 static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t); /* proto */
 
+#ifndef __PYX_FORCE_INIT_THREADS
+  #define __PYX_FORCE_INIT_THREADS 0
+#endif
+
 #define UNARY_NEG_WOULD_OVERFLOW(x)            (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))
 
-static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
+static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/
 
 static PyObject *get_memview(PyObject *__pyx_v_self); /*proto*/
@@ -967,98 +1132,32 @@ static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
 
 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
 
-static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
-    PyObject *r;
-    if (!j) return NULL;
-    r = PyObject_GetItem(o, j);
-    Py_DECREF(j);
-    return r;
-}
-#define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
-                                                    __Pyx_GetItemInt_List_Fast(o, i) : \
-                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
-static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) {
-#if CYTHON_COMPILING_IN_CPYTHON
-    if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
-        PyObject *r = PyList_GET_ITEM(o, i);
-        Py_INCREF(r);
-        return r;
-    }
-    else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
-        PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
-        Py_INCREF(r);
-        return r;
-    }
-    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
-#else
-    return PySequence_GetItem(o, i);
-#endif
-}
-#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
-                                                    __Pyx_GetItemInt_Tuple_Fast(o, i) : \
-                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
-static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) {
-#if CYTHON_COMPILING_IN_CPYTHON
-    if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
-        PyObject *r = PyTuple_GET_ITEM(o, i);
-        Py_INCREF(r);
-        return r;
-    }
-    else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
-        PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
-        Py_INCREF(r);
-        return r;
-    }
-    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
-#else
-    return PySequence_GetItem(o, i);
-#endif
-}
-#define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
-                                                    __Pyx_GetItemInt_Fast(o, i) : \
-                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
-static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) {
-#if CYTHON_COMPILING_IN_CPYTHON
-    if (PyList_CheckExact(o)) {
-        Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
-        if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) {
-            PyObject *r = PyList_GET_ITEM(o, n);
-            Py_INCREF(r);
-            return r;
-        }
-    }
-    else if (PyTuple_CheckExact(o)) {
-        Py_ssize_t n = (likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
-        if (likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
-            PyObject *r = PyTuple_GET_ITEM(o, n);
-            Py_INCREF(r);
-            return r;
-        }
-    } else {  /* inlined PySequence_GetItem() */
-        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
-        if (likely(m && m->sq_item)) {
-            if (unlikely(i < 0) && likely(m->sq_length)) {
-                Py_ssize_t l = m->sq_length(o);
-                if (unlikely(l < 0)) return NULL;
-                i += l;
-            }
-            return m->sq_item(o, i);
-        }
-    }
-#else
-    if (PySequence_Check(o)) {
-        return PySequence_GetItem(o, i);
-    }
-#endif
-    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
-}
-
-static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
+#define __Pyx_GetItemInt(o, i, size, to_py_func, is_list, wraparound, boundscheck) \
+    (((size) <= sizeof(Py_ssize_t)) ? \
+    __Pyx_GetItemInt_Fast(o, i, is_list, wraparound, boundscheck) : \
+    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
+#define __Pyx_GetItemInt_List(o, i, size, to_py_func, is_list, wraparound, boundscheck) \
+    (((size) <= sizeof(Py_ssize_t)) ? \
+    __Pyx_GetItemInt_List_Fast(o, i, wraparound, boundscheck) : \
+    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
+                                                              int wraparound, int boundscheck);
+#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func, is_list, wraparound, boundscheck) \
+    (((size) <= sizeof(Py_ssize_t)) ? \
+    __Pyx_GetItemInt_Tuple_Fast(o, i, wraparound, boundscheck) : \
+    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
+                                                              int wraparound, int boundscheck);
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
+                                                     int is_list, int wraparound, int boundscheck);
+
+static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
 static PyObject *__pyx_memoryview_transpose(PyObject *__pyx_v_self); /*proto*/
 static PyObject *__pyx_memoryview__get__base(PyObject *__pyx_v_self); /*proto*/
 static PyObject *__pyx_memoryview_get_shape(PyObject *__pyx_v_self); /*proto*/
 #if CYTHON_COMPILING_IN_CPYTHON
-static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
+static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
     PyListObject* L = (PyListObject*) list;
     Py_ssize_t len = Py_SIZE(list);
     if (likely(L->allocated > len)) {
@@ -1070,7 +1169,7 @@ static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
     return PyList_Append(list, x);
 }
 #else
-#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
+#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
 #endif
 
 static PyObject *__pyx_memoryview_get_strides(PyObject *__pyx_v_self); /*proto*/
@@ -1079,15 +1178,32 @@ static PyObject *__pyx_memoryview_get_ndim(PyObject *__pyx_v_self); /*proto*/
 static PyObject *__pyx_memoryview_get_itemsize(PyObject *__pyx_v_self); /*proto*/
 static PyObject *__pyx_memoryview_get_nbytes(PyObject *__pyx_v_self); /*proto*/
 static PyObject *__pyx_memoryview_get_size(PyObject *__pyx_v_self); /*proto*/
-static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
-
-#ifndef __PYX_FORCE_INIT_THREADS
-  #define __PYX_FORCE_INIT_THREADS 0
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
+    PyListObject* L = (PyListObject*) list;
+    Py_ssize_t len = Py_SIZE(list);
+    if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
+        Py_INCREF(x);
+        PyList_SET_ITEM(list, len, x);
+        Py_SIZE(list) = len+1;
+        return 0;
+    }
+    return PyList_Append(list, x);
+}
+#else
+#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
 #endif
 
+static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
+
 static CYTHON_INLINE long __Pyx_div_long(long, long); /* proto */
 
 static PyObject *__pyx_memoryviewslice__get__base(PyObject *__pyx_v_self); /*proto*/
+static void __Pyx_WriteUnraisable(const char *name, int clineno,
+                                  int lineno, const char *filename); /*proto*/
+
+static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
+
 typedef struct {
   Py_ssize_t shape, strides, suboffsets;
 } __Pyx_Buf_DimInfo;
@@ -1113,7 +1229,7 @@ typedef struct {
 static Py_ssize_t __Pyx_zeros[] = {0, 0, 0, 0, 0, 0, 0, 0};
 static Py_ssize_t __Pyx_minusones[] = {-1, -1, -1, -1, -1, -1, -1, -1};
 
-static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/
+static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /*proto*/
 
 #if CYTHON_CCOMPLEX
   #ifdef __cplusplus
@@ -1263,14 +1379,21 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);
 
 static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);
 
-static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_double(PyObject *);
+static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
 
-static void __Pyx_WriteUnraisable(const char *name, int clineno,
-                                  int lineno, const char *filename); /*proto*/
+static int __Pyx_ValidateAndInit_memviewslice(
+                int *axes_specs,
+                int c_or_f_flag,
+                int buf_flags,
+                int ndim,
+                __Pyx_TypeInfo *dtype,
+                __Pyx_BufFmt_StackElem stack[],
+                __Pyx_memviewslice *memviewslice,
+                PyObject *original_obj);
 
-static int __Pyx_check_binary_version(void);
+static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_double(PyObject *);
 
-static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
+static int __Pyx_check_binary_version(void);
 
 #if !defined(__Pyx_PyIdentifier_FromString)
 #if PY_MAJOR_VERSION < 3
@@ -1312,6 +1435,8 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
 
 /* Module declarations from 'cpython.ref' */
 
+/* Module declarations from 'libc.string' */
+
 /* Module declarations from 'libc.stdio' */
 
 /* Module declarations from 'cpython.object' */
@@ -1336,9 +1461,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, cha
 /* Module declarations from 'libc.math' */
 
 /* Module declarations from '_geometry' */
+static PyTypeObject *__pyx_memoryview_type = 0;
 static PyTypeObject *__pyx_array_type = 0;
 static PyTypeObject *__pyx_MemviewEnum_type = 0;
-static PyTypeObject *__pyx_memoryview_type = 0;
 static PyTypeObject *__pyx_memoryviewslice_type = 0;
 static PyObject *generic = 0;
 static PyObject *strided = 0;
@@ -1352,12 +1477,12 @@ static double __pyx_f_9_geometry_r(double, double, double, double, double, doubl
 static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/
 static void *__pyx_align_pointer(void *, size_t); /*proto*/
 static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo *); /*proto*/
-static int __pyx_memoryview_check(PyObject *); /*proto*/
+static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/
 static PyObject *_unellipsify(PyObject *, int); /*proto*/
 static PyObject *assert_direct_dimensions(Py_ssize_t *, int); /*proto*/
 static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/
 static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int, int); /*proto*/
-static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, int); /*proto*/
+static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/
 static int __pyx_memslice_transpose(__Pyx_memviewslice *); /*proto*/
 static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice, int, PyObject *(*)(char *), int (*)(char *, PyObject *), int); /*proto*/
 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
@@ -1435,6 +1560,10 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_20copy(struct __pyx_me
 static PyObject *__pyx_memoryview_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
 static void __pyx_memoryviewslice_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
 static PyObject *__pyx_memoryviewslice__get__base_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
+static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
 static char __pyx_k_1[] = "ndarray is not C contiguous";
 static char __pyx_k_3[] = "ndarray is not Fortran contiguous";
 static char __pyx_k_5[] = "Non-native byte order not supported";
@@ -1545,13 +1674,16 @@ static char __pyx_k___geometry[] = "_geometry";
 static char __pyx_k__enumerate[] = "enumerate";
 static char __pyx_k__IndexError[] = "IndexError";
 static char __pyx_k__ValueError[] = "ValueError";
+static char __pyx_k____import__[] = "__import__";
 static char __pyx_k__wavelength[] = "wavelength";
 static char __pyx_k__MemoryError[] = "MemoryError";
 static char __pyx_k__RuntimeError[] = "RuntimeError";
+static char __pyx_k____pyx_vtable__[] = "__pyx_vtable__";
 static char __pyx_k____pyx_getbuffer[] = "__pyx_getbuffer";
 static char __pyx_k__allocate_buffer[] = "allocate_buffer";
 static char __pyx_k__dtype_is_object[] = "dtype_is_object";
 static char __pyx_k__ascontiguousarray[] = "ascontiguousarray";
+static char __pyx_k____pyx_releasebuffer[] = "__pyx_releasebuffer";
 static PyObject *__pyx_kp_u_1;
 static PyObject *__pyx_kp_u_11;
 static PyObject *__pyx_kp_s_13;
@@ -1589,9 +1721,12 @@ static PyObject *__pyx_n_s__RuntimeError;
 static PyObject *__pyx_n_s__TypeError;
 static PyObject *__pyx_n_s__ValueError;
 static PyObject *__pyx_n_s____class__;
+static PyObject *__pyx_n_s____import__;
 static PyObject *__pyx_n_s____main__;
 static PyObject *__pyx_n_s____name__;
 static PyObject *__pyx_n_s____pyx_getbuffer;
+static PyObject *__pyx_n_s____pyx_releasebuffer;
+static PyObject *__pyx_n_s____pyx_vtable__;
 static PyObject *__pyx_n_s____test__;
 static PyObject *__pyx_n_s___geometry;
 static PyObject *__pyx_n_s__allocate_buffer;
@@ -1894,6 +2029,9 @@ static PyObject *__pyx_pw_9_geometry_1calc_tth(PyObject *__pyx_self, PyObject *_
   double __pyx_v_rot3;
   PyArrayObject *__pyx_v_pos1 = 0;
   PyArrayObject *__pyx_v_pos2 = 0;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("calc_tth (wrapper)", 0);
@@ -2092,7 +2230,7 @@ static PyObject *__pyx_pf_9_geometry_calc_tth(CYTHON_UNUSED PyObject *__pyx_self
  *     # square array?
  *     assert pos2.size == size
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_pos1), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_pos1), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyInt_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -2107,7 +2245,7 @@ static PyObject *__pyx_pf_9_geometry_calc_tth(CYTHON_UNUSED PyObject *__pyx_self
  *     cdef double[:] c2 = numpy.ascontiguousarray(pos2.ravel(),dtype=numpy.float64)
  */
   #ifndef CYTHON_WITHOUT_ASSERTIONS
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_pos2), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_pos2), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
@@ -2129,12 +2267,12 @@ static PyObject *__pyx_pf_9_geometry_calc_tth(CYTHON_UNUSED PyObject *__pyx_self
  *     cdef double[:] c2 = numpy.ascontiguousarray(pos2.ravel(),dtype=numpy.float64)
  *     cdef numpy.ndarray[numpy.float64_t, ndim = 1] out = numpy.empty(size, dtype=numpy.float64)
  */
-  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_pos1), __pyx_n_s__ravel); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_pos1), __pyx_n_s__ravel); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
@@ -2146,9 +2284,9 @@ static PyObject *__pyx_pf_9_geometry_calc_tth(CYTHON_UNUSED PyObject *__pyx_self
   __pyx_t_1 = 0;
   __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
-  __pyx_t_7 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__float64); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __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 = 112; __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 = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -2172,12 +2310,12 @@ static PyObject *__pyx_pf_9_geometry_calc_tth(CYTHON_UNUSED PyObject *__pyx_self
  *     cdef numpy.ndarray[numpy.float64_t, ndim = 1] out = numpy.empty(size, dtype=numpy.float64)
  *     for i in prange(size, nogil=True, schedule="static"):
  */
-  __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_7);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __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 = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-  __pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_v_pos2), __pyx_n_s__ravel); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_pos2), __pyx_n_s__ravel); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_7);
   __pyx_t_4 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
@@ -2189,9 +2327,9 @@ static PyObject *__pyx_pf_9_geometry_calc_tth(CYTHON_UNUSED PyObject *__pyx_self
   __pyx_t_4 = 0;
   __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_6 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__float64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__float64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -2215,9 +2353,9 @@ static PyObject *__pyx_pf_9_geometry_calc_tth(CYTHON_UNUSED PyObject *__pyx_self
  *     for i in prange(size, nogil=True, schedule="static"):
  *         out[i] = tth(c1[i], c2[i], L, sinRot1, cosRot1, sinRot2, cosRot2, sinRot3, cosRot3)
  */
-  __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__empty); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s__empty); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
   __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_size); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -2229,9 +2367,9 @@ static PyObject *__pyx_pf_9_geometry_calc_tth(CYTHON_UNUSED PyObject *__pyx_self
   __pyx_t_6 = 0;
   __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_6));
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float64); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__float64); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -2264,9 +2402,9 @@ static PyObject *__pyx_pf_9_geometry_calc_tth(CYTHON_UNUSED PyObject *__pyx_self
  */
   {
       #ifdef WITH_THREAD
-      PyThreadState *_save = NULL;
-      #endif
+      PyThreadState *_save;
       Py_UNBLOCK_THREADS
+      #endif
       /*try:*/ {
         __pyx_t_2 = __pyx_v_size;
         if (1 == 0) abort();
@@ -2323,7 +2461,9 @@ static PyObject *__pyx_pf_9_geometry_calc_tth(CYTHON_UNUSED PyObject *__pyx_self
  *     return out
  */
       /*finally:*/ {
+        #ifdef WITH_THREAD
         Py_BLOCK_THREADS
+        #endif
       }
   }
 
@@ -2378,6 +2518,9 @@ static PyObject *__pyx_pw_9_geometry_3calc_chi(PyObject *__pyx_self, PyObject *_
   double __pyx_v_rot3;
   PyArrayObject *__pyx_v_pos1 = 0;
   PyArrayObject *__pyx_v_pos2 = 0;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("calc_chi (wrapper)", 0);
@@ -2576,7 +2719,7 @@ static PyObject *__pyx_pf_9_geometry_2calc_chi(CYTHON_UNUSED PyObject *__pyx_sel
  *     assert pos2.size == size
  *     cdef double[:] c1 = numpy.ascontiguousarray(pos1.ravel(),dtype=numpy.float64)
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_pos1), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_pos1), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyInt_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -2591,7 +2734,7 @@ static PyObject *__pyx_pf_9_geometry_2calc_chi(CYTHON_UNUSED PyObject *__pyx_sel
  *     cdef double[:] c2 = numpy.ascontiguousarray(pos2.ravel(),dtype=numpy.float64)
  */
   #ifndef CYTHON_WITHOUT_ASSERTIONS
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_pos2), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_pos2), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
@@ -2613,12 +2756,12 @@ static PyObject *__pyx_pf_9_geometry_2calc_chi(CYTHON_UNUSED PyObject *__pyx_sel
  *     cdef double[:] c2 = numpy.ascontiguousarray(pos2.ravel(),dtype=numpy.float64)
  *     cdef numpy.ndarray[numpy.float64_t, ndim = 1] out = numpy.empty(size, dtype=numpy.float64)
  */
-  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_pos1), __pyx_n_s__ravel); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_pos1), __pyx_n_s__ravel); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
@@ -2630,9 +2773,9 @@ static PyObject *__pyx_pf_9_geometry_2calc_chi(CYTHON_UNUSED PyObject *__pyx_sel
   __pyx_t_1 = 0;
   __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
-  __pyx_t_7 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__float64); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __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 = 147; __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 = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -2656,12 +2799,12 @@ static PyObject *__pyx_pf_9_geometry_2calc_chi(CYTHON_UNUSED PyObject *__pyx_sel
  *     cdef numpy.ndarray[numpy.float64_t, ndim = 1] out = numpy.empty(size, dtype=numpy.float64)
  *     for i in prange(size, nogil=True, schedule="static"):
  */
-  __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_7);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __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 = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-  __pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_v_pos2), __pyx_n_s__ravel); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_pos2), __pyx_n_s__ravel); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_7);
   __pyx_t_4 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
@@ -2673,9 +2816,9 @@ static PyObject *__pyx_pf_9_geometry_2calc_chi(CYTHON_UNUSED PyObject *__pyx_sel
   __pyx_t_4 = 0;
   __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_6 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__float64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__float64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -2699,9 +2842,9 @@ static PyObject *__pyx_pf_9_geometry_2calc_chi(CYTHON_UNUSED PyObject *__pyx_sel
  *     for i in prange(size, nogil=True, schedule="static"):
  *         out[i] = chi(c1[i], c2[i], L, sinRot1, cosRot1, sinRot2, cosRot2, sinRot3, cosRot3)
  */
-  __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__empty); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s__empty); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
   __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_size); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -2713,9 +2856,9 @@ static PyObject *__pyx_pf_9_geometry_2calc_chi(CYTHON_UNUSED PyObject *__pyx_sel
   __pyx_t_6 = 0;
   __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_6));
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float64); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__float64); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -2748,9 +2891,9 @@ static PyObject *__pyx_pf_9_geometry_2calc_chi(CYTHON_UNUSED PyObject *__pyx_sel
  */
   {
       #ifdef WITH_THREAD
-      PyThreadState *_save = NULL;
-      #endif
+      PyThreadState *_save;
       Py_UNBLOCK_THREADS
+      #endif
       /*try:*/ {
         __pyx_t_2 = __pyx_v_size;
         if (1 == 0) abort();
@@ -2807,7 +2950,9 @@ static PyObject *__pyx_pf_9_geometry_2calc_chi(CYTHON_UNUSED PyObject *__pyx_sel
  *     return out
  */
       /*finally:*/ {
+        #ifdef WITH_THREAD
         Py_BLOCK_THREADS
+        #endif
       }
   }
 
@@ -2863,6 +3008,9 @@ static PyObject *__pyx_pw_9_geometry_5calc_q(PyObject *__pyx_self, PyObject *__p
   PyArrayObject *__pyx_v_pos1 = 0;
   PyArrayObject *__pyx_v_pos2 = 0;
   double __pyx_v_wavelength;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("calc_q (wrapper)", 0);
@@ -3069,7 +3217,7 @@ static PyObject *__pyx_pf_9_geometry_4calc_q(CYTHON_UNUSED PyObject *__pyx_self,
  *     assert pos2.size == size
  *     cdef double[:] c1 = numpy.ascontiguousarray(pos1.ravel(),dtype=numpy.float64)
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_pos1), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_pos1), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyInt_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -3084,7 +3232,7 @@ static PyObject *__pyx_pf_9_geometry_4calc_q(CYTHON_UNUSED PyObject *__pyx_self,
  *     cdef double[:] c2 = numpy.ascontiguousarray(pos2.ravel(),dtype=numpy.float64)
  */
   #ifndef CYTHON_WITHOUT_ASSERTIONS
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_pos2), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_pos2), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
@@ -3106,12 +3254,12 @@ static PyObject *__pyx_pf_9_geometry_4calc_q(CYTHON_UNUSED PyObject *__pyx_self,
  *     cdef double[:] c2 = numpy.ascontiguousarray(pos2.ravel(),dtype=numpy.float64)
  *     cdef numpy.ndarray[numpy.float64_t, ndim = 1] out = numpy.empty(size, dtype=numpy.float64)
  */
-  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_pos1), __pyx_n_s__ravel); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_pos1), __pyx_n_s__ravel); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
@@ -3123,9 +3271,9 @@ static PyObject *__pyx_pf_9_geometry_4calc_q(CYTHON_UNUSED PyObject *__pyx_self,
   __pyx_t_1 = 0;
   __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
-  __pyx_t_7 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__float64); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __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 = 183; __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 = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -3149,12 +3297,12 @@ static PyObject *__pyx_pf_9_geometry_4calc_q(CYTHON_UNUSED PyObject *__pyx_self,
  *     cdef numpy.ndarray[numpy.float64_t, ndim = 1] out = numpy.empty(size, dtype=numpy.float64)
  *     for i in prange(size, nogil=True, schedule="static"):
  */
-  __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_7);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __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 = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-  __pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_v_pos2), __pyx_n_s__ravel); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_pos2), __pyx_n_s__ravel); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_7);
   __pyx_t_4 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
@@ -3166,9 +3314,9 @@ static PyObject *__pyx_pf_9_geometry_4calc_q(CYTHON_UNUSED PyObject *__pyx_self,
   __pyx_t_4 = 0;
   __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_6 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__float64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__float64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -3192,9 +3340,9 @@ static PyObject *__pyx_pf_9_geometry_4calc_q(CYTHON_UNUSED PyObject *__pyx_self,
  *     for i in prange(size, nogil=True, schedule="static"):
  *         out[i] = q(c1[i], c2[i], L, sinRot1, cosRot1, sinRot2, cosRot2, sinRot3, cosRot3, wavelength)
  */
-  __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__empty); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s__empty); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
   __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_size); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -3206,9 +3354,9 @@ static PyObject *__pyx_pf_9_geometry_4calc_q(CYTHON_UNUSED PyObject *__pyx_self,
   __pyx_t_6 = 0;
   __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_6));
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float64); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__float64); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -3241,9 +3389,9 @@ static PyObject *__pyx_pf_9_geometry_4calc_q(CYTHON_UNUSED PyObject *__pyx_self,
  */
   {
       #ifdef WITH_THREAD
-      PyThreadState *_save = NULL;
-      #endif
+      PyThreadState *_save;
       Py_UNBLOCK_THREADS
+      #endif
       /*try:*/ {
         __pyx_t_2 = __pyx_v_size;
         if (1 == 0) abort();
@@ -3300,7 +3448,9 @@ static PyObject *__pyx_pf_9_geometry_4calc_q(CYTHON_UNUSED PyObject *__pyx_self,
  *     return out
  */
       /*finally:*/ {
+        #ifdef WITH_THREAD
         Py_BLOCK_THREADS
+        #endif
       }
   }
 
@@ -3355,6 +3505,9 @@ static PyObject *__pyx_pw_9_geometry_7calc_r(PyObject *__pyx_self, PyObject *__p
   double __pyx_v_rot3;
   PyArrayObject *__pyx_v_pos1 = 0;
   PyArrayObject *__pyx_v_pos2 = 0;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("calc_r (wrapper)", 0);
@@ -3553,7 +3706,7 @@ static PyObject *__pyx_pf_9_geometry_6calc_r(CYTHON_UNUSED PyObject *__pyx_self,
  *     # square array?
  *     assert pos2.size == size
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_pos1), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_pos1), __pyx_n_s__size); 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_t_2 = PyInt_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -3568,7 +3721,7 @@ static PyObject *__pyx_pf_9_geometry_6calc_r(CYTHON_UNUSED PyObject *__pyx_self,
  *     cdef double[:] c2 = numpy.ascontiguousarray(pos2.ravel(),dtype=numpy.float64)
  */
   #ifndef CYTHON_WITHOUT_ASSERTIONS
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_pos2), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_pos2), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
@@ -3590,12 +3743,12 @@ static PyObject *__pyx_pf_9_geometry_6calc_r(CYTHON_UNUSED PyObject *__pyx_self,
  *     cdef double[:] c2 = numpy.ascontiguousarray(pos2.ravel(),dtype=numpy.float64)
  *     cdef numpy.ndarray[numpy.float64_t, ndim = 1] out = numpy.empty(size, dtype=numpy.float64)
  */
-  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__ascontiguousarray); 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_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_pos1), __pyx_n_s__ravel); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_pos1), __pyx_n_s__ravel); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
@@ -3607,9 +3760,9 @@ static PyObject *__pyx_pf_9_geometry_6calc_r(CYTHON_UNUSED PyObject *__pyx_self,
   __pyx_t_1 = 0;
   __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
-  __pyx_t_7 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__float64); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __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 = 213; __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 = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -3633,12 +3786,12 @@ static PyObject *__pyx_pf_9_geometry_6calc_r(CYTHON_UNUSED PyObject *__pyx_self,
  *     cdef numpy.ndarray[numpy.float64_t, ndim = 1] out = numpy.empty(size, dtype=numpy.float64)
  *     for i in prange(size, nogil=True, schedule="static"):
  */
-  __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_7);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __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 = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-  __pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_v_pos2), __pyx_n_s__ravel); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_pos2), __pyx_n_s__ravel); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_7);
   __pyx_t_4 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
@@ -3650,9 +3803,9 @@ static PyObject *__pyx_pf_9_geometry_6calc_r(CYTHON_UNUSED PyObject *__pyx_self,
   __pyx_t_4 = 0;
   __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); 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_t_6 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__float64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__float64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -3676,9 +3829,9 @@ static PyObject *__pyx_pf_9_geometry_6calc_r(CYTHON_UNUSED PyObject *__pyx_self,
  *     for i in prange(size, nogil=True, schedule="static"):
  *         out[i] = r(c1[i], c2[i], L, sinRot1, cosRot1, sinRot2, cosRot2, sinRot3, cosRot3)
  */
-  __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__empty); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s__empty); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
   __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_size); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -3690,9 +3843,9 @@ static PyObject *__pyx_pf_9_geometry_6calc_r(CYTHON_UNUSED PyObject *__pyx_self,
   __pyx_t_6 = 0;
   __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_6));
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); 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_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float64); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__float64); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -3725,9 +3878,9 @@ static PyObject *__pyx_pf_9_geometry_6calc_r(CYTHON_UNUSED PyObject *__pyx_self,
  */
   {
       #ifdef WITH_THREAD
-      PyThreadState *_save = NULL;
-      #endif
+      PyThreadState *_save;
       Py_UNBLOCK_THREADS
+      #endif
       /*try:*/ {
         __pyx_t_2 = __pyx_v_size;
         if (1 == 0) abort();
@@ -3783,7 +3936,9 @@ static PyObject *__pyx_pf_9_geometry_6calc_r(CYTHON_UNUSED PyObject *__pyx_self,
  *     return out
  */
       /*finally:*/ {
+        #ifdef WITH_THREAD
         Py_BLOCK_THREADS
+        #endif
       }
   }
 
@@ -3826,8 +3981,8 @@ static PyObject *__pyx_pf_9_geometry_6calc_r(CYTHON_UNUSED PyObject *__pyx_self,
 }
 
 /* Python wrapper */
-static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
-static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
+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);
@@ -3882,7 +4037,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  * 
  *             cdef int copy_shape, i, ndim
  */
-  __pyx_t_1 = (__pyx_v_info == NULL);
+  __pyx_t_1 = ((__pyx_v_info == NULL) != 0);
   if (__pyx_t_1) {
     __pyx_r = 0;
     goto __pyx_L0;
@@ -3924,7 +4079,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 copy_shape = 1
  *             else:
  */
-  __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t)));
+  __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":209
@@ -3957,7 +4112,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
  *                 raise ValueError(u"ndarray is not C contiguous")
  */
-  __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS);
+  __pyx_t_1 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":214
@@ -3967,7 +4122,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 raise ValueError(u"ndarray is not C contiguous")
  * 
  */
-    __pyx_t_2 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS));
+    __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS) != 0)) != 0);
     __pyx_t_3 = __pyx_t_2;
   } else {
     __pyx_t_3 = __pyx_t_1;
@@ -3997,7 +4152,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
  *                 raise ValueError(u"ndarray is not Fortran contiguous")
  */
-  __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS);
+  __pyx_t_3 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0);
   if (__pyx_t_3) {
 
     /* "numpy.pxd":218
@@ -4007,7 +4162,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 raise ValueError(u"ndarray is not Fortran contiguous")
  * 
  */
-    __pyx_t_1 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS));
+    __pyx_t_1 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS) != 0)) != 0);
     __pyx_t_2 = __pyx_t_1;
   } else {
     __pyx_t_2 = __pyx_t_3;
@@ -4055,7 +4210,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 # Allocate new buffer for strides and shape info.
  *                 # This is allocated as one block, strides first.
  */
-  if (__pyx_v_copy_shape) {
+  __pyx_t_2 = (__pyx_v_copy_shape != 0);
+  if (__pyx_t_2) {
 
     /* "numpy.pxd":226
  *                 # Allocate new buffer for strides and shape info.
@@ -4153,7 +4309,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  * 
  *             cdef int t
  */
-  __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self));
+  __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0));
 
   /* "numpy.pxd":239
  * 
@@ -4171,8 +4327,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *             cdef list stack
  *             cdef int offset
  */
-  __Pyx_INCREF(((PyObject *)__pyx_v_self->descr));
-  __pyx_v_descr = __pyx_v_self->descr;
+  __pyx_t_4 = ((PyObject *)__pyx_v_self->descr);
+  __Pyx_INCREF(__pyx_t_4);
+  __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4);
+  __pyx_t_4 = 0;
 
   /* "numpy.pxd":244
  *             cdef int offset
@@ -4190,9 +4348,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 # do not call releasebuffer
  *                 info.obj = None
  */
-  __pyx_t_2 = (!__pyx_v_hasfields);
+  __pyx_t_2 = ((!(__pyx_v_hasfields != 0)) != 0);
   if (__pyx_t_2) {
-    __pyx_t_3 = (!__pyx_v_copy_shape);
+    __pyx_t_3 = ((!(__pyx_v_copy_shape != 0)) != 0);
     __pyx_t_1 = __pyx_t_3;
   } else {
     __pyx_t_1 = __pyx_t_2;
@@ -4237,7 +4395,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 t = descr.type_num
  *                 if ((descr.byteorder == c'>' and little_endian) or
  */
-  __pyx_t_1 = (!__pyx_v_hasfields);
+  __pyx_t_1 = ((!(__pyx_v_hasfields != 0)) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":254
@@ -4247,7 +4405,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 if ((descr.byteorder == c'>' and little_endian) or
  *                     (descr.byteorder == c'<' and not little_endian)):
  */
-    __pyx_v_t = __pyx_v_descr->type_num;
+    __pyx_t_5 = __pyx_v_descr->type_num;
+    __pyx_v_t = __pyx_t_5;
 
     /* "numpy.pxd":255
  *             if not hasfields:
@@ -4256,9 +4415,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                     (descr.byteorder == c'<' and not little_endian)):
  *                     raise ValueError(u"Non-native byte order not supported")
  */
-    __pyx_t_1 = (__pyx_v_descr->byteorder == '>');
+    __pyx_t_1 = ((__pyx_v_descr->byteorder == '>') != 0);
     if (__pyx_t_1) {
-      __pyx_t_2 = __pyx_v_little_endian;
+      __pyx_t_2 = (__pyx_v_little_endian != 0);
     } else {
       __pyx_t_2 = __pyx_t_1;
     }
@@ -4271,9 +4430,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                     raise ValueError(u"Non-native byte order not supported")
  *                 if   t == NPY_BYTE:        f = "b"
  */
-      __pyx_t_1 = (__pyx_v_descr->byteorder == '<');
+      __pyx_t_1 = ((__pyx_v_descr->byteorder == '<') != 0);
       if (__pyx_t_1) {
-        __pyx_t_3 = (!__pyx_v_little_endian);
+        __pyx_t_3 = ((!(__pyx_v_little_endian != 0)) != 0);
         __pyx_t_7 = __pyx_t_3;
       } else {
         __pyx_t_7 = __pyx_t_1;
@@ -4300,227 +4459,202 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
     }
     __pyx_L12:;
 
-    /* "numpy.pxd":258
+    /* "numpy.pxd":274
+ *                 elif t == NPY_CDOUBLE:     f = "Zd"
+ *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
+ *                 elif t == NPY_OBJECT:      f = "O"             # <<<<<<<<<<<<<<
+ *                 else:
+ *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
+ */
+    switch (__pyx_v_t) {
+
+      /* "numpy.pxd":258
  *                     (descr.byteorder == c'<' and not little_endian)):
  *                     raise ValueError(u"Non-native byte order not supported")
  *                 if   t == NPY_BYTE:        f = "b"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_UBYTE:       f = "B"
  *                 elif t == NPY_SHORT:       f = "h"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_BYTE);
-    if (__pyx_t_1) {
+      case NPY_BYTE:
       __pyx_v_f = __pyx_k__b;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":259
+      /* "numpy.pxd":259
  *                     raise ValueError(u"Non-native byte order not supported")
  *                 if   t == NPY_BYTE:        f = "b"
  *                 elif t == NPY_UBYTE:       f = "B"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_SHORT:       f = "h"
  *                 elif t == NPY_USHORT:      f = "H"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_UBYTE);
-    if (__pyx_t_1) {
+      case NPY_UBYTE:
       __pyx_v_f = __pyx_k__B;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":260
+      /* "numpy.pxd":260
  *                 if   t == NPY_BYTE:        f = "b"
  *                 elif t == NPY_UBYTE:       f = "B"
  *                 elif t == NPY_SHORT:       f = "h"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_USHORT:      f = "H"
  *                 elif t == NPY_INT:         f = "i"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_SHORT);
-    if (__pyx_t_1) {
+      case NPY_SHORT:
       __pyx_v_f = __pyx_k__h;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":261
+      /* "numpy.pxd":261
  *                 elif t == NPY_UBYTE:       f = "B"
  *                 elif t == NPY_SHORT:       f = "h"
  *                 elif t == NPY_USHORT:      f = "H"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_INT:         f = "i"
  *                 elif t == NPY_UINT:        f = "I"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_USHORT);
-    if (__pyx_t_1) {
+      case NPY_USHORT:
       __pyx_v_f = __pyx_k__H;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":262
+      /* "numpy.pxd":262
  *                 elif t == NPY_SHORT:       f = "h"
  *                 elif t == NPY_USHORT:      f = "H"
  *                 elif t == NPY_INT:         f = "i"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_UINT:        f = "I"
  *                 elif t == NPY_LONG:        f = "l"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_INT);
-    if (__pyx_t_1) {
+      case NPY_INT:
       __pyx_v_f = __pyx_k__i;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":263
+      /* "numpy.pxd":263
  *                 elif t == NPY_USHORT:      f = "H"
  *                 elif t == NPY_INT:         f = "i"
  *                 elif t == NPY_UINT:        f = "I"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_LONG:        f = "l"
  *                 elif t == NPY_ULONG:       f = "L"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_UINT);
-    if (__pyx_t_1) {
+      case NPY_UINT:
       __pyx_v_f = __pyx_k__I;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":264
+      /* "numpy.pxd":264
  *                 elif t == NPY_INT:         f = "i"
  *                 elif t == NPY_UINT:        f = "I"
  *                 elif t == NPY_LONG:        f = "l"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_ULONG:       f = "L"
  *                 elif t == NPY_LONGLONG:    f = "q"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_LONG);
-    if (__pyx_t_1) {
+      case NPY_LONG:
       __pyx_v_f = __pyx_k__l;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":265
+      /* "numpy.pxd":265
  *                 elif t == NPY_UINT:        f = "I"
  *                 elif t == NPY_LONG:        f = "l"
  *                 elif t == NPY_ULONG:       f = "L"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_LONGLONG:    f = "q"
  *                 elif t == NPY_ULONGLONG:   f = "Q"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_ULONG);
-    if (__pyx_t_1) {
+      case NPY_ULONG:
       __pyx_v_f = __pyx_k__L;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":266
+      /* "numpy.pxd":266
  *                 elif t == NPY_LONG:        f = "l"
  *                 elif t == NPY_ULONG:       f = "L"
  *                 elif t == NPY_LONGLONG:    f = "q"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_ULONGLONG:   f = "Q"
  *                 elif t == NPY_FLOAT:       f = "f"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG);
-    if (__pyx_t_1) {
+      case NPY_LONGLONG:
       __pyx_v_f = __pyx_k__q;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":267
+      /* "numpy.pxd":267
  *                 elif t == NPY_ULONG:       f = "L"
  *                 elif t == NPY_LONGLONG:    f = "q"
  *                 elif t == NPY_ULONGLONG:   f = "Q"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_FLOAT:       f = "f"
  *                 elif t == NPY_DOUBLE:      f = "d"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG);
-    if (__pyx_t_1) {
+      case NPY_ULONGLONG:
       __pyx_v_f = __pyx_k__Q;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":268
+      /* "numpy.pxd":268
  *                 elif t == NPY_LONGLONG:    f = "q"
  *                 elif t == NPY_ULONGLONG:   f = "Q"
  *                 elif t == NPY_FLOAT:       f = "f"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_DOUBLE:      f = "d"
  *                 elif t == NPY_LONGDOUBLE:  f = "g"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_FLOAT);
-    if (__pyx_t_1) {
+      case NPY_FLOAT:
       __pyx_v_f = __pyx_k__f;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":269
+      /* "numpy.pxd":269
  *                 elif t == NPY_ULONGLONG:   f = "Q"
  *                 elif t == NPY_FLOAT:       f = "f"
  *                 elif t == NPY_DOUBLE:      f = "d"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_LONGDOUBLE:  f = "g"
  *                 elif t == NPY_CFLOAT:      f = "Zf"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE);
-    if (__pyx_t_1) {
+      case NPY_DOUBLE:
       __pyx_v_f = __pyx_k__d;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":270
+      /* "numpy.pxd":270
  *                 elif t == NPY_FLOAT:       f = "f"
  *                 elif t == NPY_DOUBLE:      f = "d"
  *                 elif t == NPY_LONGDOUBLE:  f = "g"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_CFLOAT:      f = "Zf"
  *                 elif t == NPY_CDOUBLE:     f = "Zd"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE);
-    if (__pyx_t_1) {
+      case NPY_LONGDOUBLE:
       __pyx_v_f = __pyx_k__g;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":271
+      /* "numpy.pxd":271
  *                 elif t == NPY_DOUBLE:      f = "d"
  *                 elif t == NPY_LONGDOUBLE:  f = "g"
  *                 elif t == NPY_CFLOAT:      f = "Zf"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_CDOUBLE:     f = "Zd"
  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT);
-    if (__pyx_t_1) {
+      case NPY_CFLOAT:
       __pyx_v_f = __pyx_k__Zf;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":272
+      /* "numpy.pxd":272
  *                 elif t == NPY_LONGDOUBLE:  f = "g"
  *                 elif t == NPY_CFLOAT:      f = "Zf"
  *                 elif t == NPY_CDOUBLE:     f = "Zd"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
  *                 elif t == NPY_OBJECT:      f = "O"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE);
-    if (__pyx_t_1) {
+      case NPY_CDOUBLE:
       __pyx_v_f = __pyx_k__Zd;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":273
+      /* "numpy.pxd":273
  *                 elif t == NPY_CFLOAT:      f = "Zf"
  *                 elif t == NPY_CDOUBLE:     f = "Zd"
  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_OBJECT:      f = "O"
  *                 else:
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE);
-    if (__pyx_t_1) {
+      case NPY_CLONGDOUBLE:
       __pyx_v_f = __pyx_k__Zg;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":274
+      /* "numpy.pxd":274
  *                 elif t == NPY_CDOUBLE:     f = "Zd"
  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
  *                 elif t == NPY_OBJECT:      f = "O"             # <<<<<<<<<<<<<<
  *                 else:
  *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_OBJECT);
-    if (__pyx_t_1) {
+      case NPY_OBJECT:
       __pyx_v_f = __pyx_k__O;
-      goto __pyx_L13;
-    }
-    /*else*/ {
+      break;
+      default:
 
       /* "numpy.pxd":276
  *                 elif t == NPY_OBJECT:      f = "O"
@@ -4545,8 +4679,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
       {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      break;
     }
-    __pyx_L13:;
 
     /* "numpy.pxd":277
  *                 else:
@@ -4642,8 +4776,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
 }
 
 /* Python wrapper */
-static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
-static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
+static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
+static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
   __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));
@@ -4670,7 +4804,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s
  *                 stdlib.free(info.format)
  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
  */
-  __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self);
+  __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":290
@@ -4692,7 +4826,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s
  *                 stdlib.free(info.strides)
  *                 # info.shape was stored after info.strides in the same block
  */
-  __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t)));
+  __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":292
@@ -4997,8 +5131,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
     #else
     __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     #endif
-    __Pyx_XDECREF(__pyx_v_childname);
-    __pyx_v_childname = __pyx_t_3;
+    __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3);
     __pyx_t_3 = 0;
 
     /* "numpy.pxd":795
@@ -5011,8 +5144,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
     __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_XDECREF(((PyObject *)__pyx_v_fields));
-    __pyx_v_fields = ((PyObject*)__pyx_t_3);
+    __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3));
     __pyx_t_3 = 0;
 
     /* "numpy.pxd":796
@@ -5041,7 +5173,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
       __Pyx_INCREF(__pyx_t_4);
       #else
       __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
       __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_4);
       #endif
     } else if (1) {
       __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -5067,11 +5201,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
       __pyx_L6_unpacking_done:;
     }
     if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_XDECREF(((PyObject *)__pyx_v_child));
-    __pyx_v_child = ((PyArray_Descr *)__pyx_t_3);
+    __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3));
     __pyx_t_3 = 0;
-    __Pyx_XDECREF(__pyx_v_new_offset);
-    __pyx_v_new_offset = __pyx_t_4;
+    __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4);
     __pyx_t_4 = 0;
 
     /* "numpy.pxd":798
@@ -5121,9 +5253,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  *             (child.byteorder == c'<' and not little_endian)):
  *             raise ValueError(u"Non-native byte order not supported")
  */
-    __pyx_t_7 = (__pyx_v_child->byteorder == '>');
+    __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0);
     if (__pyx_t_7) {
-      __pyx_t_8 = __pyx_v_little_endian;
+      __pyx_t_8 = (__pyx_v_little_endian != 0);
     } else {
       __pyx_t_8 = __pyx_t_7;
     }
@@ -5136,9 +5268,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  *             raise ValueError(u"Non-native byte order not supported")
  *             # One could encode it in the format string and have Cython
  */
-      __pyx_t_7 = (__pyx_v_child->byteorder == '<');
+      __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0);
       if (__pyx_t_7) {
-        __pyx_t_9 = (!__pyx_v_little_endian);
+        __pyx_t_9 = ((!(__pyx_v_little_endian != 0)) != 0);
         __pyx_t_10 = __pyx_t_9;
       } else {
         __pyx_t_10 = __pyx_t_7;
@@ -5227,7 +5359,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  *             t = child.type_num
  *             if end - f < 5:
  */
-    __pyx_t_7 = (!PyDataType_HASFIELDS(__pyx_v_child));
+    __pyx_t_7 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0);
     if (__pyx_t_7) {
 
       /* "numpy.pxd":821
@@ -5239,8 +5371,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  */
       __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
-      __Pyx_XDECREF(__pyx_v_t);
-      __pyx_v_t = __pyx_t_3;
+      __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_3);
       __pyx_t_3 = 0;
 
       /* "numpy.pxd":822
@@ -5250,7 +5381,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  *                 raise RuntimeError(u"Format string allocated too short.")
  * 
  */
-      __pyx_t_7 = ((__pyx_v_end - __pyx_v_f) < 5);
+      __pyx_t_7 = (((__pyx_v_end - __pyx_v_f) < 5) != 0);
       if (__pyx_t_7) {
 
         /* "numpy.pxd":823
@@ -5672,6 +5803,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a
   PyObject *__pyx_v_baseptr;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
+  int __pyx_t_2;
   __Pyx_RefNannySetupContext("set_array_base", 0);
 
   /* "numpy.pxd":967
@@ -5682,7 +5814,8 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a
  *      else:
  */
   __pyx_t_1 = (__pyx_v_base == Py_None);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
     /* "numpy.pxd":968
  *      cdef PyObject* baseptr
@@ -5758,7 +5891,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py
  *         return None
  *     else:
  */
-  __pyx_t_1 = (__pyx_v_arr->base == NULL);
+  __pyx_t_1 = ((__pyx_v_arr->base == NULL) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":977
@@ -5803,6 +5936,9 @@ static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, P
   PyObject *__pyx_v_format = 0;
   PyObject *__pyx_v_mode = 0;
   int __pyx_v_allocate_buffer;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
@@ -5922,12 +6058,12 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
   Py_ssize_t __pyx_t_1;
   int __pyx_t_2;
   PyObject *__pyx_t_3 = NULL;
-  PyObject *__pyx_t_4 = NULL;
-  PyObject *__pyx_t_5 = NULL;
-  char *__pyx_t_6;
+  char *__pyx_t_4;
+  int __pyx_t_5;
+  int __pyx_t_6;
   int __pyx_t_7;
-  int __pyx_t_8;
-  int __pyx_t_9;
+  PyObject *__pyx_t_8 = NULL;
+  PyObject *__pyx_t_9 = NULL;
   Py_ssize_t __pyx_t_10;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
@@ -5939,7 +6075,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
   /* "View.MemoryView":120
  *         cdef PyObject **p
  * 
- *         self.ndim = len(shape)             # <<<<<<<<<<<<<<
+ *         self.ndim = <int> len(shape)             # <<<<<<<<<<<<<<
  *         self.itemsize = itemsize
  * 
  */
@@ -5948,11 +6084,11 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   __pyx_t_1 = PyTuple_GET_SIZE(((PyObject *)__pyx_v_shape)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_self->ndim = __pyx_t_1;
+  __pyx_v_self->ndim = ((int)__pyx_t_1);
 
   /* "View.MemoryView":121
  * 
- *         self.ndim = len(shape)
+ *         self.ndim = <int> len(shape)
  *         self.itemsize = itemsize             # <<<<<<<<<<<<<<
  * 
  *         if not self.ndim:
@@ -5966,7 +6102,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             raise ValueError("Empty shape tuple for cython.array")
  * 
  */
-  __pyx_t_2 = (!__pyx_v_self->ndim);
+  __pyx_t_2 = ((!(__pyx_v_self->ndim != 0)) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":124
@@ -5992,7 +6128,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             raise ValueError("itemsize <= 0 for cython.array")
  * 
  */
-  __pyx_t_2 = (__pyx_v_self->itemsize <= 0);
+  __pyx_t_2 = ((__pyx_v_self->itemsize <= 0) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":127
@@ -6018,16 +6154,10 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *         if encode:
  *             format = encode('ASCII')
  */
-  __pyx_t_3 = ((PyObject *)__pyx_n_s__encode);
-  __Pyx_INCREF(__pyx_t_3);
-  __pyx_t_4 = Py_None;
-  __Pyx_INCREF(__pyx_t_4);
-  __pyx_t_5 = __Pyx_GetAttr3(__pyx_v_format, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_v_encode = __pyx_t_5;
-  __pyx_t_5 = 0;
+  __pyx_t_3 = __Pyx_GetAttr3(__pyx_v_format, ((PyObject *)__pyx_n_s__encode), Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_v_encode = __pyx_t_3;
+  __pyx_t_3 = 0;
 
   /* "View.MemoryView":130
  * 
@@ -6046,11 +6176,10 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *         self._format = format
  *         self.format = self._format
  */
-    __pyx_t_5 = PyObject_Call(__pyx_v_encode, ((PyObject *)__pyx_k_tuple_17), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_v_format);
-    __pyx_v_format = __pyx_t_5;
-    __pyx_t_5 = 0;
+    __pyx_t_3 = PyObject_Call(__pyx_v_encode, ((PyObject *)__pyx_k_tuple_17), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_3);
+    __pyx_t_3 = 0;
     goto __pyx_L5;
   }
   __pyx_L5:;
@@ -6076,8 +6205,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  *         self._shape = <Py_ssize_t *> malloc(sizeof(Py_ssize_t)*self.ndim)
  */
-  __pyx_t_6 = PyBytes_AsString(((PyObject *)__pyx_v_self->_format)); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_self->format = __pyx_t_6;
+  __pyx_t_4 = __Pyx_PyObject_AsString(((PyObject *)__pyx_v_self->_format)); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_v_self->format = __pyx_t_4;
 
   /* "View.MemoryView":135
  *         self.format = self._format
@@ -6104,14 +6233,14 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             free(self._shape)
  *             free(self._strides)
  */
-  __pyx_t_2 = (!(__pyx_v_self->_shape != 0));
+  __pyx_t_2 = ((!(__pyx_v_self->_shape != 0)) != 0);
   if (!__pyx_t_2) {
-    __pyx_t_7 = (!(__pyx_v_self->_strides != 0));
-    __pyx_t_8 = __pyx_t_7;
+    __pyx_t_5 = ((!(__pyx_v_self->_strides != 0)) != 0);
+    __pyx_t_6 = __pyx_t_5;
   } else {
-    __pyx_t_8 = __pyx_t_2;
+    __pyx_t_6 = __pyx_t_2;
   }
-  if (__pyx_t_8) {
+  if (__pyx_t_6) {
 
     /* "View.MemoryView":139
  * 
@@ -6138,10 +6267,10 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  * 
  */
-    __pyx_t_5 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_19), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_19), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L6;
   }
@@ -6163,20 +6292,19 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             if dim <= 0:
  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
  */
-  __pyx_t_9 = 0;
-  __pyx_t_5 = ((PyObject *)__pyx_v_shape); __Pyx_INCREF(__pyx_t_5); __pyx_t_1 = 0;
+  __pyx_t_7 = 0;
+  __pyx_t_3 = ((PyObject *)__pyx_v_shape); __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
   for (;;) {
-    if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
+    if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
     #if CYTHON_COMPILING_IN_CPYTHON
-    __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_1); __Pyx_INCREF(__pyx_t_4); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_8); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     #else
-    __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_8 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     #endif
-    __Pyx_XDECREF(__pyx_v_dim);
-    __pyx_v_dim = __pyx_t_4;
-    __pyx_t_4 = 0;
-    __pyx_v_idx = __pyx_t_9;
-    __pyx_t_9 = (__pyx_t_9 + 1);
+    __Pyx_XDECREF_SET(__pyx_v_dim, __pyx_t_8);
+    __pyx_t_8 = 0;
+    __pyx_v_idx = __pyx_t_7;
+    __pyx_t_7 = (__pyx_t_7 + 1);
 
     /* "View.MemoryView":146
  *         idx = 0
@@ -6185,10 +6313,10 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
  * 
  */
-    __pyx_t_4 = PyObject_RichCompare(__pyx_v_dim, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    if (__pyx_t_8) {
+    __pyx_t_8 = PyObject_RichCompare(__pyx_v_dim, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    if (__pyx_t_6) {
 
       /* "View.MemoryView":147
  *         for idx, dim in enumerate(shape):
@@ -6197,29 +6325,29 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  *             self._shape[idx] = dim
  */
-      __pyx_t_4 = PyInt_FromLong(__pyx_v_idx); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
-      __Pyx_GIVEREF(__pyx_t_4);
+      __pyx_t_8 = PyInt_FromLong(__pyx_v_idx); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_8);
+      __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
+      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8);
+      __Pyx_GIVEREF(__pyx_t_8);
       __Pyx_INCREF(__pyx_v_dim);
-      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_dim);
+      PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_dim);
       __Pyx_GIVEREF(__pyx_v_dim);
-      __pyx_t_4 = 0;
-      __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_20), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
-      __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
-      __pyx_t_4 = 0;
-      __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+      __pyx_t_8 = 0;
+      __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_20), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_8));
+      __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
+      __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
+      PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_t_8));
+      __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
+      __pyx_t_8 = 0;
+      __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_8);
+      __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
+      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
+      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
       {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L9;
     }
@@ -6244,7 +6372,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  */
     __pyx_v_idx = (__pyx_v_idx + 1);
   }
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
   /* "View.MemoryView":152
  *             idx += 1
@@ -6254,21 +6382,21 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  */
   __Pyx_INCREF(__pyx_v_mode);
-  __pyx_t_5 = __pyx_v_mode;
-  __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, ((PyObject *)__pyx_n_s__fortran), Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (((int)__pyx_t_8)) {
-    __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, ((PyObject *)__pyx_n_s__c), Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_7 = ((int)__pyx_t_2);
+  __pyx_t_3 = __pyx_v_mode;
+  __pyx_t_8 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__fortran), Py_NE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+  if (((int)__pyx_t_6)) {
+    __pyx_t_8 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__c), Py_NE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    __pyx_t_5 = ((int)__pyx_t_2);
   } else {
-    __pyx_t_7 = ((int)__pyx_t_8);
+    __pyx_t_5 = ((int)__pyx_t_6);
   }
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __pyx_t_8 = __pyx_t_7;
-  if (__pyx_t_8) {
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_6 = (__pyx_t_5 != 0);
+  if (__pyx_t_6) {
 
     /* "View.MemoryView":153
  * 
@@ -6277,18 +6405,18 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  *         cdef char order
  */
-    __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_21), __pyx_v_mode); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
-    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_5));
-    __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
-    __pyx_t_5 = 0;
-    __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_21), __pyx_v_mode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+    __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_8);
+    PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_3));
+    __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
+    __pyx_t_3 = 0;
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
+    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L10;
   }
@@ -6301,10 +6429,10 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             order = 'F'
  *         else:
  */
-  __pyx_t_5 = PyObject_RichCompare(__pyx_v_mode, ((PyObject *)__pyx_n_s__fortran), Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  if (__pyx_t_8) {
+  __pyx_t_3 = PyObject_RichCompare(__pyx_v_mode, ((PyObject *)__pyx_n_s__fortran), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  if (__pyx_t_6) {
 
     /* "View.MemoryView":157
  *         cdef char order
@@ -6345,14 +6473,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *         if decode:
  *             mode = decode('ASCII')
  */
-  __pyx_t_5 = ((PyObject *)__pyx_n_s__decode);
-  __Pyx_INCREF(__pyx_t_5);
-  __pyx_t_4 = Py_None;
-  __Pyx_INCREF(__pyx_t_4);
-  __pyx_t_3 = __Pyx_GetAttr3(__pyx_v_mode, __pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_GetAttr3(__pyx_v_mode, ((PyObject *)__pyx_n_s__decode), Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   __pyx_v_decode = __pyx_t_3;
   __pyx_t_3 = 0;
 
@@ -6363,8 +6485,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             mode = decode('ASCII')
  *         self.mode = mode
  */
-  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_decode); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__pyx_t_8) {
+  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_decode); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__pyx_t_6) {
 
     /* "View.MemoryView":166
  *         decode = getattr(mode, 'decode', None)
@@ -6375,8 +6497,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  */
     __pyx_t_3 = PyObject_Call(__pyx_v_decode, ((PyObject *)__pyx_k_tuple_22), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_v_mode);
-    __pyx_v_mode = __pyx_t_3;
+    __Pyx_DECREF_SET(__pyx_v_mode, __pyx_t_3);
     __pyx_t_3 = 0;
     goto __pyx_L12;
   }
@@ -6413,9 +6534,9 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             self.data = <char *>malloc(self.len)
  */
   __pyx_t_3 = PyObject_RichCompare(__pyx_v_format, ((PyObject *)__pyx_n_b__O), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_v_self->dtype_is_object = __pyx_t_8;
+  __pyx_v_self->dtype_is_object = __pyx_t_6;
 
   /* "View.MemoryView":171
  *         self.free_data = allocate_buffer
@@ -6424,7 +6545,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             self.data = <char *>malloc(self.len)
  *             if not self.data:
  */
-  if (__pyx_v_allocate_buffer) {
+  __pyx_t_6 = (__pyx_v_allocate_buffer != 0);
+  if (__pyx_t_6) {
 
     /* "View.MemoryView":172
  *         self.dtype_is_object = format == b'O'
@@ -6442,8 +6564,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *                 raise MemoryError("unable to allocate array data.")
  * 
  */
-    __pyx_t_8 = (!(__pyx_v_self->data != 0));
-    if (__pyx_t_8) {
+    __pyx_t_6 = ((!(__pyx_v_self->data != 0)) != 0);
+    if (__pyx_t_6) {
 
       /* "View.MemoryView":174
  *             self.data = <char *>malloc(self.len)
@@ -6468,7 +6590,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *                 p = <PyObject **> self.data
  *                 for i in range(self.len / itemsize):
  */
-    if (__pyx_v_self->dtype_is_object) {
+    __pyx_t_6 = (__pyx_v_self->dtype_is_object != 0);
+    if (__pyx_t_6) {
 
       /* "View.MemoryView":177
  * 
@@ -6487,11 +6610,23 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *                     Py_INCREF(Py_None)
  */
       if (unlikely(__pyx_v_itemsize == 0)) {
+        #ifdef WITH_THREAD
+        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+        #endif
         PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero");
+        #ifdef WITH_THREAD
+        PyGILState_Release(__pyx_gilstate_save);
+        #endif
         {__pyx_filename = __pyx_f[2]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       }
       else if (sizeof(Py_ssize_t) == sizeof(long) && unlikely(__pyx_v_itemsize == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) {
+        #ifdef WITH_THREAD
+        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+        #endif
         PyErr_Format(PyExc_OverflowError, "value too large to perform division");
+        #ifdef WITH_THREAD
+        PyGILState_Release(__pyx_gilstate_save);
+        #endif
         {__pyx_filename = __pyx_f[2]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       }
       __pyx_t_1 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_itemsize);
@@ -6527,8 +6662,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_XDECREF(__pyx_t_4);
-  __Pyx_XDECREF(__pyx_t_5);
+  __Pyx_XDECREF(__pyx_t_8);
+  __Pyx_XDECREF(__pyx_t_9);
   __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
@@ -6542,8 +6677,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
 }
 
 /* Python wrapper */
-static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
-static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
+static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
+static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
@@ -6565,8 +6700,12 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
-  PyObject *__pyx_t_2 = NULL;
-  int __pyx_t_3;
+  int __pyx_t_2;
+  PyObject *__pyx_t_3 = NULL;
+  char *__pyx_t_4;
+  Py_ssize_t __pyx_t_5;
+  int __pyx_t_6;
+  Py_ssize_t *__pyx_t_7;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -6593,7 +6732,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         elif self.mode == b"fortran":
  */
   __pyx_t_1 = (__Pyx_PyUnicode_Equals(((PyObject *)__pyx_v_self->mode), ((PyObject *)__pyx_n_b__c), Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":186
  *         cdef int bufmode = -1
@@ -6613,7 +6753,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
  *         if not (flags & bufmode):
  */
-  __pyx_t_1 = (__Pyx_PyUnicode_Equals(((PyObject *)__pyx_v_self->mode), ((PyObject *)__pyx_n_b__fortran), Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = (__Pyx_PyUnicode_Equals(((PyObject *)__pyx_v_self->mode), ((PyObject *)__pyx_n_b__fortran), Py_EQ)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = (__pyx_t_2 != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":188
@@ -6635,7 +6776,7 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
  *         info.buf = self.data
  */
-  __pyx_t_1 = (!(__pyx_v_flags & __pyx_v_bufmode));
+  __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":190
@@ -6645,10 +6786,10 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.buf = self.data
  *         info.len = self.len
  */
-    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_26), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_26), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L4;
   }
@@ -6661,7 +6802,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.len = self.len
  *         info.ndim = self.ndim
  */
-  __pyx_v_info->buf = __pyx_v_self->data;
+  __pyx_t_4 = __pyx_v_self->data;
+  __pyx_v_info->buf = __pyx_t_4;
 
   /* "View.MemoryView":192
  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
@@ -6670,7 +6812,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.ndim = self.ndim
  *         info.shape = self._shape
  */
-  __pyx_v_info->len = __pyx_v_self->len;
+  __pyx_t_5 = __pyx_v_self->len;
+  __pyx_v_info->len = __pyx_t_5;
 
   /* "View.MemoryView":193
  *         info.buf = self.data
@@ -6679,7 +6822,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.shape = self._shape
  *         info.strides = self._strides
  */
-  __pyx_v_info->ndim = __pyx_v_self->ndim;
+  __pyx_t_6 = __pyx_v_self->ndim;
+  __pyx_v_info->ndim = __pyx_t_6;
 
   /* "View.MemoryView":194
  *         info.len = self.len
@@ -6688,7 +6832,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.strides = self._strides
  *         info.suboffsets = NULL
  */
-  __pyx_v_info->shape = __pyx_v_self->_shape;
+  __pyx_t_7 = __pyx_v_self->_shape;
+  __pyx_v_info->shape = __pyx_t_7;
 
   /* "View.MemoryView":195
  *         info.ndim = self.ndim
@@ -6697,7 +6842,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.suboffsets = NULL
  *         info.itemsize = self.itemsize
  */
-  __pyx_v_info->strides = __pyx_v_self->_strides;
+  __pyx_t_7 = __pyx_v_self->_strides;
+  __pyx_v_info->strides = __pyx_t_7;
 
   /* "View.MemoryView":196
  *         info.shape = self._shape
@@ -6715,7 +6861,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.readonly = 0
  * 
  */
-  __pyx_v_info->itemsize = __pyx_v_self->itemsize;
+  __pyx_t_5 = __pyx_v_self->itemsize;
+  __pyx_v_info->itemsize = __pyx_t_5;
 
   /* "View.MemoryView":198
  *         info.suboffsets = NULL
@@ -6733,8 +6880,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *             info.format = self.format
  *         else:
  */
-  __pyx_t_3 = (__pyx_v_flags & PyBUF_FORMAT);
-  if (__pyx_t_3) {
+  __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
+  if (__pyx_t_1) {
 
     /* "View.MemoryView":201
  * 
@@ -6743,7 +6890,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         else:
  *             info.format = NULL
  */
-    __pyx_v_info->format = __pyx_v_self->format;
+    __pyx_t_4 = __pyx_v_self->format;
+    __pyx_v_info->format = __pyx_t_4;
     goto __pyx_L5;
   }
   /*else*/ {
@@ -6775,7 +6923,7 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
   __pyx_r = 0;
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_2);
+  __Pyx_XDECREF(__pyx_t_3);
   __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) {
@@ -6822,7 +6970,7 @@ static void __pyx_array_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *_
  *             self.callback_free_data(self.data)
  *         elif self.free_data:
  */
-  __pyx_t_1 = (__pyx_v_self->callback_free_data != NULL);
+  __pyx_t_1 = ((__pyx_v_self->callback_free_data != NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":211
@@ -6843,7 +6991,8 @@ static void __pyx_array_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *_
  *             if self.dtype_is_object:
  *                 refcount_objects_in_slice(self.data, self._shape,
  */
-  if (__pyx_v_self->free_data) {
+  __pyx_t_1 = (__pyx_v_self->free_data != 0);
+  if (__pyx_t_1) {
 
     /* "View.MemoryView":213
  *             self.callback_free_data(self.data)
@@ -6852,7 +7001,8 @@ static void __pyx_array_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *_
  *                 refcount_objects_in_slice(self.data, self._shape,
  *                                           self._strides, self.ndim, False)
  */
-    if (__pyx_v_self->dtype_is_object) {
+    __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
+    if (__pyx_t_1) {
 
       /* "View.MemoryView":215
  *             if self.dtype_is_object:
@@ -7020,9 +7170,9 @@ static PyObject *__pyx_array_MemoryView_5array_6__getattr__(struct __pyx_array_o
  *     def __getitem__(self, item):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __pyx_r = __pyx_t_2;
@@ -7079,7 +7229,7 @@ static PyObject *__pyx_array_MemoryView_5array_8__getitem__(struct __pyx_array_o
  *     def __setitem__(self, item, value):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (!__pyx_t_2) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
@@ -7136,7 +7286,7 @@ static int __pyx_array_MemoryView_5array_10__setitem__(struct __pyx_array_obj *_
  * 
  * 
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   if (PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -7181,7 +7331,7 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize
  *         result = array(shape, itemsize, format, mode.decode('ASCII'))
  *     else:
  */
-  __pyx_t_1 = (__pyx_v_buf == NULL);
+  __pyx_t_1 = ((__pyx_v_buf == NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":245
@@ -7193,7 +7343,7 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize
  */
     __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_3 = PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_3));
     __pyx_t_4 = ((PyObject *)__Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_4));
@@ -7229,7 +7379,7 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize
  */
     __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_5 = PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_5));
     __pyx_t_3 = ((PyObject *)__Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_3));
@@ -7311,6 +7461,9 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize
 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_name = 0;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
@@ -7467,7 +7620,7 @@ static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment)
  *         aligned_p += alignment - offset
  * 
  */
-  __pyx_t_1 = (__pyx_v_offset > 0);
+  __pyx_t_1 = ((__pyx_v_offset > 0) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":303
@@ -7503,6 +7656,9 @@ static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_ar
   PyObject *__pyx_v_obj = 0;
   int __pyx_v_flags;
   int __pyx_v_dtype_is_object;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
@@ -7620,11 +7776,11 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor
  *             if <PyObject *> self.view.obj == NULL:
  */
   __pyx_t_1 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)((PyObject *)__pyx_memoryview_type)));
-  if (!__pyx_t_1) {
+  if (!(__pyx_t_1 != 0)) {
     __pyx_t_2 = (__pyx_v_obj != Py_None);
-    __pyx_t_3 = __pyx_t_2;
+    __pyx_t_3 = (__pyx_t_2 != 0);
   } else {
-    __pyx_t_3 = __pyx_t_1;
+    __pyx_t_3 = (__pyx_t_1 != 0);
   }
   if (__pyx_t_3) {
 
@@ -7644,7 +7800,7 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor
  *                 (<__pyx_buffer *> &self.view).obj = Py_None
  *                 Py_INCREF(Py_None)
  */
-    __pyx_t_3 = (((PyObject *)__pyx_v_self->view.obj) == NULL);
+    __pyx_t_3 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0);
     if (__pyx_t_3) {
 
       /* "View.MemoryView":329
@@ -7687,7 +7843,7 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor
  *             raise MemoryError
  * 
  */
-  __pyx_t_3 = (__pyx_v_self->lock == NULL);
+  __pyx_t_3 = ((__pyx_v_self->lock == NULL) != 0);
   if (__pyx_t_3) {
 
     /* "View.MemoryView":334
@@ -7709,8 +7865,8 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor
  *             self.dtype_is_object = self.view.format == b'O'
  *         else:
  */
-  __pyx_t_4 = (__pyx_v_flags & PyBUF_FORMAT);
-  if (__pyx_t_4) {
+  __pyx_t_3 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
+  if (__pyx_t_3) {
 
     /* "View.MemoryView":337
  * 
@@ -7719,7 +7875,7 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor
  *         else:
  *             self.dtype_is_object = dtype_is_object
  */
-    __pyx_t_5 = PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_5));
     __pyx_t_6 = PyObject_RichCompare(((PyObject *)__pyx_t_5), ((PyObject *)__pyx_n_b__O), Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
@@ -7791,6 +7947,7 @@ static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) {
 static void __pyx_memoryview_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) {
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
+  int __pyx_t_2;
   __Pyx_RefNannySetupContext("__dealloc__", 0);
 
   /* "View.MemoryView":346
@@ -7801,7 +7958,8 @@ static void __pyx_memoryview_MemoryView_10memoryview_2__dealloc__(struct __pyx_m
  * 
  */
   __pyx_t_1 = (__pyx_v_self->obj != Py_None);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":347
  *     def __dealloc__(memoryview self):
@@ -7822,8 +7980,8 @@ static void __pyx_memoryview_MemoryView_10memoryview_2__dealloc__(struct __pyx_m
  *             PyThread_free_lock(self.lock)
  * 
  */
-  __pyx_t_1 = (__pyx_v_self->lock != NULL);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((__pyx_v_self->lock != NULL) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":350
  * 
@@ -7917,8 +8075,7 @@ static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__py
       }
       __Pyx_GOTREF(__pyx_t_5);
     }
-    __Pyx_XDECREF(__pyx_v_idx);
-    __pyx_v_idx = __pyx_t_5;
+    __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5);
     __pyx_t_5 = 0;
     __pyx_v_dim = __pyx_t_1;
     __pyx_t_1 = (__pyx_t_1 + 1);
@@ -7985,12 +8142,13 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
-  PyObject *__pyx_t_2 = NULL;
+  int __pyx_t_2;
   PyObject *__pyx_t_3 = NULL;
   PyObject *__pyx_t_4 = NULL;
   PyObject *__pyx_t_5 = NULL;
-  PyObject *(*__pyx_t_6)(PyObject *);
-  char *__pyx_t_7;
+  PyObject *__pyx_t_6 = NULL;
+  PyObject *(*__pyx_t_7)(PyObject *);
+  char *__pyx_t_8;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -8004,7 +8162,8 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  * 
  */
   __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":364
  *     def __getitem__(memoryview self, object index):
@@ -8028,10 +8187,10 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  * 
  *         cdef char *itemp
  */
-  __pyx_t_2 = ((PyObject *)_unellipsify(__pyx_v_index, __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  if (likely(PyTuple_CheckExact(__pyx_t_2))) {
-    PyObject* sequence = __pyx_t_2;
+  __pyx_t_3 = ((PyObject *)_unellipsify(__pyx_v_index, __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  if (likely(PyTuple_CheckExact(__pyx_t_3))) {
+    PyObject* sequence = __pyx_t_3;
     #if CYTHON_COMPILING_IN_CPYTHON
     Py_ssize_t size = Py_SIZE(sequence);
     #else
@@ -8043,43 +8202,45 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
       {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     #if CYTHON_COMPILING_IN_CPYTHON
-    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
-    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
-    __Pyx_INCREF(__pyx_t_3);
+    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
+    __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
     __Pyx_INCREF(__pyx_t_4);
+    __Pyx_INCREF(__pyx_t_5);
     #else
-    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
     #endif
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   } else if (1) {
     __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   } else
   {
     Py_ssize_t index = -1;
-    __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
-    index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L4_unpacking_failed;
-    __Pyx_GOTREF(__pyx_t_3);
-    index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed;
+    __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
+    index = 0; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed;
     __Pyx_GOTREF(__pyx_t_4);
-    if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_6 = NULL;
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L4_unpacking_failed;
+    __Pyx_GOTREF(__pyx_t_5);
+    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = NULL;
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
     goto __pyx_L5_unpacking_done;
     __pyx_L4_unpacking_failed:;
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_6 = NULL;
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __pyx_t_7 = NULL;
     if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_L5_unpacking_done:;
   }
-  __pyx_v_have_slices = __pyx_t_3;
-  __pyx_t_3 = 0;
-  __pyx_v_indices = __pyx_t_4;
+  __pyx_v_have_slices = __pyx_t_4;
   __pyx_t_4 = 0;
+  __pyx_v_indices = __pyx_t_5;
+  __pyx_t_5 = 0;
 
   /* "View.MemoryView":369
  * 
@@ -8088,8 +8249,8 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  *             return memview_slice(self, indices)
  *         else:
  */
-  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__pyx_t_1) {
+  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":370
  *         cdef char *itemp
@@ -8099,10 +8260,10 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  *             itemp = self.get_item_pointer(indices)
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_2 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_r = __pyx_t_2;
-    __pyx_t_2 = 0;
+    __pyx_t_3 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_r = __pyx_t_3;
+    __pyx_t_3 = 0;
     goto __pyx_L0;
     goto __pyx_L6;
   }
@@ -8115,8 +8276,8 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  *             return self.convert_item_to_object(itemp)
  * 
  */
-    __pyx_t_7 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_v_itemp = __pyx_t_7;
+    __pyx_t_8 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_8 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_v_itemp = __pyx_t_8;
 
     /* "View.MemoryView":373
  *         else:
@@ -8126,10 +8287,10 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  *     def __setitem__(memoryview self, object index, object value):
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_r = __pyx_t_2;
-    __pyx_t_2 = 0;
+    __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_r = __pyx_t_3;
+    __pyx_t_3 = 0;
     goto __pyx_L0;
   }
   __pyx_L6:;
@@ -8137,10 +8298,10 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_5);
+  __Pyx_XDECREF(__pyx_t_6);
   __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
@@ -8215,7 +8376,9 @@ static int __pyx_memoryview_MemoryView_10memoryview_6__setitem__(struct __pyx_me
     __Pyx_INCREF(__pyx_t_3);
     #else
     __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
     __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
     #endif
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   } else if (1) {
@@ -8244,8 +8407,7 @@ static int __pyx_memoryview_MemoryView_10memoryview_6__setitem__(struct __pyx_me
   }
   __pyx_v_have_slices = __pyx_t_2;
   __pyx_t_2 = 0;
-  __Pyx_DECREF(__pyx_v_index);
-  __pyx_v_index = __pyx_t_3;
+  __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_3);
   __pyx_t_3 = 0;
 
   /* "View.MemoryView":378
@@ -8358,9 +8520,9 @@ static int __pyx_memoryview_MemoryView_10memoryview_6__setitem__(struct __pyx_me
 static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
+  int __pyx_t_1;
   int __pyx_t_2;
-  int __pyx_t_3;
+  PyObject *__pyx_t_3 = NULL;
   PyObject *__pyx_t_4 = NULL;
   PyObject *__pyx_t_5 = NULL;
   PyObject *__pyx_t_6 = NULL;
@@ -8380,12 +8542,9 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
  *             try:
  *                 obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS,
  */
-  __pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryview_type));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = (!__pyx_t_2);
-  if (__pyx_t_3) {
+  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, ((PyObject *)__pyx_memoryview_type)); 
+  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":389
  *     cdef is_slice(self, obj):
@@ -8395,10 +8554,10 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
  *                                  self.dtype_is_object)
  */
     {
-      __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
+      __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
+      __Pyx_XGOTREF(__pyx_t_3);
       __Pyx_XGOTREF(__pyx_t_4);
       __Pyx_XGOTREF(__pyx_t_5);
-      __Pyx_XGOTREF(__pyx_t_6);
       /*try:*/ {
 
         /* "View.MemoryView":390
@@ -8408,8 +8567,8 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
  *                                  self.dtype_is_object)
  *             except TypeError:
  */
-        __pyx_t_1 = PyInt_FromLong((__pyx_v_self->flags | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
-        __Pyx_GOTREF(__pyx_t_1);
+        __pyx_t_6 = PyInt_FromLong((__pyx_v_self->flags | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+        __Pyx_GOTREF(__pyx_t_6);
 
         /* "View.MemoryView":391
  *             try:
@@ -8425,25 +8584,24 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
         __Pyx_INCREF(__pyx_v_obj);
         PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj);
         __Pyx_GIVEREF(__pyx_v_obj);
-        PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_1);
-        __Pyx_GIVEREF(__pyx_t_1);
+        PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
+        __Pyx_GIVEREF(__pyx_t_6);
         PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
         __Pyx_GIVEREF(__pyx_t_7);
-        __pyx_t_1 = 0;
+        __pyx_t_6 = 0;
         __pyx_t_7 = 0;
         __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject *)__pyx_memoryview_type)), ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
         __Pyx_GOTREF(__pyx_t_7);
         __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
-        __Pyx_DECREF(__pyx_v_obj);
-        __pyx_v_obj = __pyx_t_7;
+        __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7);
         __pyx_t_7 = 0;
       }
+      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
       goto __pyx_L11_try_end;
       __pyx_L4_error:;
-      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
       __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
 
@@ -8457,10 +8615,10 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
       __pyx_t_9 = PyErr_ExceptionMatches(__pyx_builtin_TypeError);
       if (__pyx_t_9) {
         __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
-        if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
+        if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
         __Pyx_GOTREF(__pyx_t_7);
         __Pyx_GOTREF(__pyx_t_8);
-        __Pyx_GOTREF(__pyx_t_1);
+        __Pyx_GOTREF(__pyx_t_6);
 
         /* "View.MemoryView":393
  *                                  self.dtype_is_object)
@@ -8472,32 +8630,32 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
         __Pyx_XDECREF(__pyx_r);
         __Pyx_INCREF(Py_None);
         __pyx_r = Py_None;
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
         goto __pyx_L7_except_return;
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
         goto __pyx_L5_exception_handled;
       }
       __pyx_L6_except_error:;
+      __Pyx_XGIVEREF(__pyx_t_3);
       __Pyx_XGIVEREF(__pyx_t_4);
       __Pyx_XGIVEREF(__pyx_t_5);
-      __Pyx_XGIVEREF(__pyx_t_6);
-      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
+      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
       goto __pyx_L1_error;
       __pyx_L7_except_return:;
+      __Pyx_XGIVEREF(__pyx_t_3);
       __Pyx_XGIVEREF(__pyx_t_4);
       __Pyx_XGIVEREF(__pyx_t_5);
-      __Pyx_XGIVEREF(__pyx_t_6);
-      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
+      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
       goto __pyx_L0;
       __pyx_L5_exception_handled:;
+      __Pyx_XGIVEREF(__pyx_t_3);
       __Pyx_XGIVEREF(__pyx_t_4);
       __Pyx_XGIVEREF(__pyx_t_5);
-      __Pyx_XGIVEREF(__pyx_t_6);
-      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
+      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
       __pyx_L11_try_end:;
     }
     goto __pyx_L3;
@@ -8519,7 +8677,7 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_XDECREF(__pyx_t_6);
   __Pyx_XDECREF(__pyx_t_7);
   __Pyx_XDECREF(__pyx_t_8);
   __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -8545,11 +8703,9 @@ static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryvi
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
-  PyObject *__pyx_t_2 = NULL;
-  PyObject *__pyx_t_3 = NULL;
+  int __pyx_t_2;
+  int __pyx_t_3;
   int __pyx_t_4;
-  int __pyx_t_5;
-  int __pyx_t_6;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -8563,8 +8719,6 @@ static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryvi
  *                                  src.ndim, dst.ndim, self.dtype_is_object)
  */
   if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_1 = __pyx_v_src;
-  __Pyx_INCREF(__pyx_t_1);
 
   /* "View.MemoryView":402
  * 
@@ -8574,8 +8728,6 @@ static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryvi
  * 
  */
   if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_2 = __pyx_v_dst;
-  __Pyx_INCREF(__pyx_t_2);
 
   /* "View.MemoryView":403
  *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
@@ -8584,24 +8736,20 @@ static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryvi
  * 
  *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):
  */
-  __pyx_t_3 = PyObject_GetAttr(__pyx_v_src, __pyx_n_s__ndim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = PyObject_GetAttr(__pyx_v_dst, __pyx_n_s__ndim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_6 = __pyx_memoryview_copy_contents((__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_t_1), (&__pyx_v_src_slice))[0]), (__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_t_2), (&__pyx_v_dst_slice))[0]), __pyx_t_4, __pyx_t_5, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s__ndim); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __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_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s__ndim); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_4 = __pyx_memoryview_copy_contents((__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice))[0]), (__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice))[0]), __pyx_t_2, __pyx_t_3, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_XDECREF(__pyx_t_3);
   __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
@@ -8663,7 +8811,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor
  *             tmp = malloc(self.view.itemsize)
  *             if tmp == NULL:
  */
-  __pyx_t_1 = (((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array)));
+  __pyx_t_1 = ((((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":414
@@ -8682,7 +8830,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor
  *                 raise MemoryError
  *             item = tmp
  */
-    __pyx_t_1 = (__pyx_v_tmp == NULL);
+    __pyx_t_1 = ((__pyx_v_tmp == NULL) != 0);
     if (__pyx_t_1) {
 
       /* "View.MemoryView":416
@@ -8727,7 +8875,8 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor
  *             (<PyObject **> item)[0] = <PyObject *> value
  *         else:
  */
-  if (__pyx_v_self->dtype_is_object) {
+  __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
+  if (__pyx_t_1) {
 
     /* "View.MemoryView":422
  * 
@@ -8837,7 +8986,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor
  *             assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
  *         slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
  */
-  __pyx_t_1 = (__pyx_v_self->view.suboffsets != NULL);
+  __pyx_t_1 = ((__pyx_v_self->view.suboffsets != NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":433
@@ -8986,9 +9135,9 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview
  *         try:
  *             result = struct.unpack(self.view.format, bytesitem)
  */
-  __pyx_t_1 = PyBytes_FromStringAndSize(((const char*)__pyx_v_itemp) + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  __pyx_v_bytesitem = __pyx_t_1;
+  __pyx_v_bytesitem = ((PyObject*)__pyx_t_1);
   __pyx_t_1 = 0;
 
   /* "View.MemoryView":449
@@ -9012,9 +9161,9 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview
  *         except struct.error:
  *             raise ValueError("Unable to convert item to object")
  */
-      __pyx_t_1 = PyObject_GetAttr(__pyx_v_struct, __pyx_n_s__unpack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s__unpack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_5 = PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_5));
       __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       __Pyx_GOTREF(__pyx_t_6);
@@ -9041,7 +9190,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview
  *             return result
  */
       __pyx_t_7 = strlen(__pyx_v_self->view.format); 
-      __pyx_t_8 = (__pyx_t_7 == 1);
+      __pyx_t_8 = ((__pyx_t_7 == 1) != 0);
       if (__pyx_t_8) {
 
         /* "View.MemoryView":455
@@ -9052,7 +9201,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview
  * 
  */
         __Pyx_XDECREF(__pyx_r);
-        __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_result, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
+        __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_result, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_5) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
         __Pyx_GOTREF(__pyx_t_5);
         __pyx_r = __pyx_t_5;
         __pyx_t_5 = 0;
@@ -9089,7 +9238,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview
  *             raise ValueError("Unable to convert item to object")
  *         else:
  */
-    __pyx_t_5 = PyObject_GetAttr(__pyx_v_struct, __pyx_n_s__error); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
+    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s__error); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __pyx_t_9 = PyErr_ExceptionMatches(__pyx_t_5);
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
@@ -9172,15 +9321,16 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
   int __pyx_t_2;
-  PyObject *__pyx_t_3 = NULL;
+  int __pyx_t_3;
   PyObject *__pyx_t_4 = NULL;
   PyObject *__pyx_t_5 = NULL;
-  Py_ssize_t __pyx_t_6;
-  PyObject *__pyx_t_7 = NULL;
-  char *__pyx_t_8;
+  PyObject *__pyx_t_6 = NULL;
+  Py_ssize_t __pyx_t_7;
+  PyObject *__pyx_t_8 = NULL;
   char *__pyx_t_9;
   char *__pyx_t_10;
   char *__pyx_t_11;
+  char *__pyx_t_12;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -9205,11 +9355,9 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  *             bytesvalue = struct.pack(self.view.format, *value)
  *         else:
  */
-  __pyx_t_1 = ((PyObject *)((PyObject*)(&PyTuple_Type)));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_value, __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (__pyx_t_2) {
+  __pyx_t_2 = PyTuple_Check(__pyx_v_value); 
+  __pyx_t_3 = (__pyx_t_2 != 0);
+  if (__pyx_t_3) {
 
     /* "View.MemoryView":467
  * 
@@ -9218,28 +9366,28 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  *         else:
  *             bytesvalue = struct.pack(self.view.format, value)
  */
-    __pyx_t_1 = PyObject_GetAttr(__pyx_v_struct, __pyx_n_s__pack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s__pack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_3 = PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
-    __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
-    __pyx_t_3 = 0;
-    __pyx_t_3 = PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-    __pyx_t_5 = PyNumber_Add(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+    __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4));
+    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
+    __pyx_t_4 = 0;
+    __pyx_t_4 = PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+    __pyx_t_6 = PyNumber_Add(((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
+    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-    __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
-    if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_v_bytesvalue = ((PyObject*)__pyx_t_3);
-    __pyx_t_3 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+    if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_4)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
+    __pyx_t_4 = 0;
     goto __pyx_L3;
   }
   /*else*/ {
@@ -9251,25 +9399,25 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  * 
  *         for i, c in enumerate(bytesvalue):
  */
-    __pyx_t_3 = PyObject_GetAttr(__pyx_v_struct, __pyx_n_s__pack); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_5 = PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s__pack); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
     __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_5));
-    __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
+    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_6));
+    __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
     __Pyx_INCREF(__pyx_v_value);
     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_value);
     __Pyx_GIVEREF(__pyx_v_value);
-    __pyx_t_5 = 0;
-    __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __pyx_t_6 = 0;
+    __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-    if (!(likely(PyBytes_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_5)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_v_bytesvalue = ((PyObject*)__pyx_t_5);
-    __pyx_t_5 = 0;
+    if (!(likely(PyBytes_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_6)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_v_bytesvalue = ((PyObject*)__pyx_t_6);
+    __pyx_t_6 = 0;
   }
   __pyx_L3:;
 
@@ -9280,18 +9428,18 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  *             itemp[i] = c
  * 
  */
-  __pyx_t_6 = 0;
+  __pyx_t_7 = 0;
   if (unlikely(((PyObject *)__pyx_v_bytesvalue) == Py_None)) {
     PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   __Pyx_INCREF(((PyObject *)__pyx_v_bytesvalue));
-  __pyx_t_7 = __pyx_v_bytesvalue;
-  __pyx_t_9 = PyBytes_AS_STRING(__pyx_t_7);
-  __pyx_t_10 = (__pyx_t_9 + PyBytes_GET_SIZE(__pyx_t_7));
-  for (__pyx_t_11 = __pyx_t_9; __pyx_t_11 < __pyx_t_10; __pyx_t_11++) {
-    __pyx_t_8 = __pyx_t_11;
-    __pyx_v_c = (__pyx_t_8[0]);
+  __pyx_t_8 = __pyx_v_bytesvalue;
+  __pyx_t_10 = PyBytes_AS_STRING(__pyx_t_8);
+  __pyx_t_11 = (__pyx_t_10 + PyBytes_GET_SIZE(__pyx_t_8));
+  for (__pyx_t_12 = __pyx_t_10; __pyx_t_12 < __pyx_t_11; __pyx_t_12++) {
+    __pyx_t_9 = __pyx_t_12;
+    __pyx_v_c = (__pyx_t_9[0]);
 
     /* "View.MemoryView":472
  * 
@@ -9300,7 +9448,7 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  * 
  *     @cname('getbuffer')
  */
-    __pyx_v_i = __pyx_t_6;
+    __pyx_v_i = __pyx_t_7;
 
     /* "View.MemoryView":471
  *             bytesvalue = struct.pack(self.view.format, value)
@@ -9309,7 +9457,7 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  *             itemp[i] = c
  * 
  */
-    __pyx_t_6 = (__pyx_t_6 + 1);
+    __pyx_t_7 = (__pyx_t_7 + 1);
 
     /* "View.MemoryView":472
  * 
@@ -9320,16 +9468,16 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  */
     (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c;
   }
-  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_5);
-  __Pyx_XDECREF(((PyObject *)__pyx_t_7));
+  __Pyx_XDECREF(__pyx_t_6);
+  __Pyx_XDECREF(((PyObject *)__pyx_t_8));
   __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
@@ -9341,8 +9489,8 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
 }
 
 /* Python wrapper */
-static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
-static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
+static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
+static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
@@ -9363,6 +9511,11 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
+  Py_ssize_t *__pyx_t_2;
+  char *__pyx_t_3;
+  void *__pyx_t_4;
+  int __pyx_t_5;
+  Py_ssize_t __pyx_t_6;
   __Pyx_RefNannySetupContext("__getbuffer__", 0);
   if (__pyx_v_info != NULL) {
     __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
@@ -9376,7 +9529,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *             info.shape = self.view.shape
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_flags & PyBUF_STRIDES);
+  __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":477
@@ -9386,7 +9539,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         else:
  *             info.shape = NULL
  */
-    __pyx_v_info->shape = __pyx_v_self->view.shape;
+    __pyx_t_2 = __pyx_v_self->view.shape;
+    __pyx_v_info->shape = __pyx_t_2;
     goto __pyx_L3;
   }
   /*else*/ {
@@ -9409,7 +9563,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *             info.strides = self.view.strides
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_flags & PyBUF_STRIDES);
+  __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":482
@@ -9419,7 +9573,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         else:
  *             info.strides = NULL
  */
-    __pyx_v_info->strides = __pyx_v_self->view.strides;
+    __pyx_t_2 = __pyx_v_self->view.strides;
+    __pyx_v_info->strides = __pyx_t_2;
     goto __pyx_L4;
   }
   /*else*/ {
@@ -9442,7 +9597,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *             info.suboffsets = self.view.suboffsets
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_flags & PyBUF_INDIRECT);
+  __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":487
@@ -9452,7 +9607,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         else:
  *             info.suboffsets = NULL
  */
-    __pyx_v_info->suboffsets = __pyx_v_self->view.suboffsets;
+    __pyx_t_2 = __pyx_v_self->view.suboffsets;
+    __pyx_v_info->suboffsets = __pyx_t_2;
     goto __pyx_L5;
   }
   /*else*/ {
@@ -9475,7 +9631,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *             info.format = self.view.format
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_flags & PyBUF_FORMAT);
+  __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":492
@@ -9485,7 +9641,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         else:
  *             info.format = NULL
  */
-    __pyx_v_info->format = __pyx_v_self->view.format;
+    __pyx_t_3 = __pyx_v_self->view.format;
+    __pyx_v_info->format = __pyx_t_3;
     goto __pyx_L6;
   }
   /*else*/ {
@@ -9508,7 +9665,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         info.ndim = self.view.ndim
  *         info.itemsize = self.view.itemsize
  */
-  __pyx_v_info->buf = __pyx_v_self->view.buf;
+  __pyx_t_4 = __pyx_v_self->view.buf;
+  __pyx_v_info->buf = __pyx_t_4;
 
   /* "View.MemoryView":497
  * 
@@ -9517,7 +9675,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         info.itemsize = self.view.itemsize
  *         info.len = self.view.len
  */
-  __pyx_v_info->ndim = __pyx_v_self->view.ndim;
+  __pyx_t_5 = __pyx_v_self->view.ndim;
+  __pyx_v_info->ndim = __pyx_t_5;
 
   /* "View.MemoryView":498
  *         info.buf = self.view.buf
@@ -9526,7 +9685,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         info.len = self.view.len
  *         info.readonly = 0
  */
-  __pyx_v_info->itemsize = __pyx_v_self->view.itemsize;
+  __pyx_t_6 = __pyx_v_self->view.itemsize;
+  __pyx_v_info->itemsize = __pyx_t_6;
 
   /* "View.MemoryView":499
  *         info.ndim = self.view.ndim
@@ -9535,7 +9695,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         info.readonly = 0
  *         info.obj = self
  */
-  __pyx_v_info->len = __pyx_v_self->view.len;
+  __pyx_t_6 = __pyx_v_self->view.len;
+  __pyx_v_info->len = __pyx_t_6;
 
   /* "View.MemoryView":500
  *         info.itemsize = self.view.itemsize
@@ -9735,10 +9896,10 @@ static PyObject *__pyx_memoryview_get_shape_MemoryView_10memoryview_5shape___get
     __pyx_v_i = __pyx_t_3;
     __pyx_t_4 = PyInt_FromSsize_t((__pyx_v_self->view.shape[__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    if (unlikely(__Pyx_PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   }
-  __pyx_t_4 = ((PyObject *)PyList_AsTuple(__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = ((PyObject *)PyList_AsTuple(((PyObject*)__pyx_t_1))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_4));
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   __pyx_r = ((PyObject *)__pyx_t_4);
@@ -9798,7 +9959,7 @@ static PyObject *__pyx_memoryview_get_strides_MemoryView_10memoryview_7strides__
  * 
  *                 raise ValueError("Buffer view does not expose strides")
  */
-  __pyx_t_1 = (__pyx_v_self->view.strides == NULL);
+  __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":528
@@ -9832,10 +9993,10 @@ static PyObject *__pyx_memoryview_get_strides_MemoryView_10memoryview_7strides__
     __pyx_v_i = __pyx_t_4;
     __pyx_t_5 = PyInt_FromSsize_t((__pyx_v_self->view.strides[__pyx_v_i])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    if (unlikely(__Pyx_PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
   }
-  __pyx_t_5 = ((PyObject *)PyList_AsTuple(__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = ((PyObject *)PyList_AsTuple(((PyObject*)__pyx_t_2))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_5));
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __pyx_r = ((PyObject *)__pyx_t_5);
@@ -9895,7 +10056,7 @@ static PyObject *__pyx_memoryview_get_suboffsets_MemoryView_10memoryview_10subof
  *                 return [-1] * self.view.ndim
  * 
  */
-  __pyx_t_1 = (__pyx_v_self->view.suboffsets == NULL);
+  __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":536
@@ -9937,10 +10098,10 @@ static PyObject *__pyx_memoryview_get_suboffsets_MemoryView_10memoryview_10subof
     __pyx_v_i = __pyx_t_4;
     __pyx_t_5 = PyInt_FromSsize_t((__pyx_v_self->view.suboffsets[__pyx_v_i])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    if (unlikely(__Pyx_PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
   }
-  __pyx_t_5 = ((PyObject *)PyList_AsTuple(__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = ((PyObject *)PyList_AsTuple(((PyObject*)__pyx_t_2))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_5));
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __pyx_r = ((PyObject *)__pyx_t_5);
@@ -10106,7 +10267,7 @@ static PyObject *__pyx_memoryview_get_nbytes_MemoryView_10memoryview_6nbytes___g
  *     property size:
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
@@ -10157,10 +10318,11 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
-  PyObject *__pyx_t_2 = NULL;
+  int __pyx_t_2;
   PyObject *__pyx_t_3 = NULL;
-  Py_ssize_t __pyx_t_4;
-  PyObject *(*__pyx_t_5)(PyObject *);
+  PyObject *__pyx_t_4 = NULL;
+  Py_ssize_t __pyx_t_5;
+  PyObject *(*__pyx_t_6)(PyObject *);
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -10174,7 +10336,8 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__
  * 
  */
   __pyx_t_1 = (__pyx_v_self->_size == Py_None);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":559
  *         def __get__(self):
@@ -10193,46 +10356,45 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__
  *                     result *= length
  * 
  */
-    __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
-      __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
-      __pyx_t_5 = NULL;
+    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) {
+      __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
+      __pyx_t_6 = NULL;
     } else {
-      __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext;
+      __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_4);
+      __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext;
     }
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     for (;;) {
-      if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_3)) {
-        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
+      if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_4)) {
+        if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
         #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         #else
-        __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         #endif
-      } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_3)) {
-        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
+      } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_4)) {
+        if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
         #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         #else
-        __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         #endif
       } else {
-        __pyx_t_2 = __pyx_t_5(__pyx_t_3);
-        if (unlikely(!__pyx_t_2)) {
+        __pyx_t_3 = __pyx_t_6(__pyx_t_4);
+        if (unlikely(!__pyx_t_3)) {
           if (PyErr_Occurred()) {
             if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
             else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           }
           break;
         }
-        __Pyx_GOTREF(__pyx_t_2);
+        __Pyx_GOTREF(__pyx_t_3);
       }
-      __Pyx_XDECREF(__pyx_v_length);
-      __pyx_v_length = __pyx_t_2;
-      __pyx_t_2 = 0;
+      __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_3);
+      __pyx_t_3 = 0;
 
       /* "View.MemoryView":562
  * 
@@ -10241,13 +10403,12 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__
  * 
  *                 self._size = result
  */
-      __pyx_t_2 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(__pyx_v_result);
-      __pyx_v_result = __pyx_t_2;
-      __pyx_t_2 = 0;
+      __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_3);
+      __pyx_t_3 = 0;
     }
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
     /* "View.MemoryView":564
  *                     result *= length
@@ -10280,8 +10441,8 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
+  __Pyx_XDECREF(__pyx_t_4);
   __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
@@ -10324,7 +10485,7 @@ static Py_ssize_t __pyx_memoryview_MemoryView_10memoryview_10__len__(struct __py
  *             return self.view.shape[0]
  * 
  */
-  __pyx_t_1 = (__pyx_v_self->view.ndim >= 1);
+  __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":570
@@ -10394,12 +10555,12 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_12__repr__(struct __py
  * 
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__base); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__base); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____name__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s____name__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
@@ -10484,12 +10645,12 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_14__str__(struct __pyx
  * 
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__base); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__base); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____name__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s____name__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -10905,30 +11066,26 @@ static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, in
 /* "View.MemoryView":624
  * 
  * @cname('__pyx_memoryview_check')
- * cdef bint memoryview_check(object o):             # <<<<<<<<<<<<<<
+ * cdef inline bint memoryview_check(object o):             # <<<<<<<<<<<<<<
  *     return isinstance(o, memoryview)
  * 
  */
 
-static int __pyx_memoryview_check(PyObject *__pyx_v_o) {
+static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
-  int __pyx_t_2;
+  int __pyx_t_1;
   __Pyx_RefNannySetupContext("memoryview_check", 0);
 
   /* "View.MemoryView":625
  * @cname('__pyx_memoryview_check')
- * cdef bint memoryview_check(object o):
+ * cdef inline bint memoryview_check(object o):
  *     return isinstance(o, memoryview)             # <<<<<<<<<<<<<<
  * 
  * cdef tuple _unellipsify(object index, int ndim):
  */
-  __pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryview_type));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_o, __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_r = __pyx_t_2;
+  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, ((PyObject *)__pyx_memoryview_type)); 
+  __pyx_r = __pyx_t_1;
   goto __pyx_L0;
 
   __pyx_r = 0;
@@ -10955,9 +11112,9 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
   PyObject *__pyx_v_nslices = NULL;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
+  int __pyx_t_1;
   int __pyx_t_2;
-  int __pyx_t_3;
+  PyObject *__pyx_t_3 = NULL;
   PyObject *__pyx_t_4 = NULL;
   Py_ssize_t __pyx_t_5;
   PyObject *(*__pyx_t_6)(PyObject *);
@@ -10979,12 +11136,9 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *         tup = (index,)
  *     else:
  */
-  __pyx_t_1 = ((PyObject *)((PyObject*)(&PyTuple_Type)));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_index, __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = (!__pyx_t_2);
-  if (__pyx_t_3) {
+  __pyx_t_1 = PyTuple_Check(__pyx_v_index); 
+  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":633
  *     """
@@ -10993,13 +11147,13 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *     else:
  *         tup = index
  */
-    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
     __Pyx_INCREF(__pyx_v_index);
-    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_index);
+    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index);
     __Pyx_GIVEREF(__pyx_v_index);
-    __pyx_v_tup = ((PyObject *)__pyx_t_1);
-    __pyx_t_1 = 0;
+    __pyx_v_tup = ((PyObject *)__pyx_t_3);
+    __pyx_t_3 = 0;
     goto __pyx_L3;
   }
   /*else*/ {
@@ -11023,10 +11177,10 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *     have_slices = False
  *     seen_ellipsis = False
  */
-  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_v_result = __pyx_t_1;
-  __pyx_t_1 = 0;
+  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_v_result = ((PyObject*)__pyx_t_3);
+  __pyx_t_3 = 0;
 
   /* "View.MemoryView":638
  * 
@@ -11035,10 +11189,10 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *     seen_ellipsis = False
  *     for idx, item in enumerate(tup):
  */
-  __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_v_have_slices = __pyx_t_1;
-  __pyx_t_1 = 0;
+  __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_v_have_slices = __pyx_t_3;
+  __pyx_t_3 = 0;
 
   /* "View.MemoryView":639
  *     result = []
@@ -11057,7 +11211,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *             if not seen_ellipsis:
  */
   __Pyx_INCREF(__pyx_int_0);
-  __pyx_t_1 = __pyx_int_0;
+  __pyx_t_3 = __pyx_int_0;
   if (PyList_CheckExact(__pyx_v_tup) || PyTuple_CheckExact(__pyx_v_tup)) {
     __pyx_t_4 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
     __pyx_t_6 = NULL;
@@ -11092,16 +11246,14 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
       }
       __Pyx_GOTREF(__pyx_t_7);
     }
-    __Pyx_XDECREF(__pyx_v_item);
-    __pyx_v_item = __pyx_t_7;
+    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7);
     __pyx_t_7 = 0;
-    __Pyx_INCREF(__pyx_t_1);
-    __Pyx_XDECREF(__pyx_v_idx);
-    __pyx_v_idx = __pyx_t_1;
-    __pyx_t_7 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_INCREF(__pyx_t_3);
+    __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3);
+    __pyx_t_7 = PyNumber_Add(__pyx_t_3, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
-    __Pyx_DECREF(__pyx_t_1);
-    __pyx_t_1 = __pyx_t_7;
+    __Pyx_DECREF(__pyx_t_3);
+    __pyx_t_3 = __pyx_t_7;
     __pyx_t_7 = 0;
 
     /* "View.MemoryView":641
@@ -11111,8 +11263,9 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *             if not seen_ellipsis:
  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
  */
-    __pyx_t_3 = (__pyx_v_item == __pyx_builtin_Ellipsis);
-    if (__pyx_t_3) {
+    __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis);
+    __pyx_t_1 = (__pyx_t_2 != 0);
+    if (__pyx_t_1) {
 
       /* "View.MemoryView":642
  *     for idx, item in enumerate(tup):
@@ -11121,8 +11274,8 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
  *                 seen_ellipsis = True
  */
-      __pyx_t_3 = (!__pyx_v_seen_ellipsis);
-      if (__pyx_t_3) {
+      __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0);
+      if (__pyx_t_1) {
 
         /* "View.MemoryView":643
  *         if item is Ellipsis:
@@ -11131,7 +11284,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *                 seen_ellipsis = True
  *             else:
  */
-        __pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_v_result), __pyx_n_s__extend); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_result), __pyx_n_s__extend); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_7);
         __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_33), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_8);
@@ -11178,7 +11331,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  */
         __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_34), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_10);
-        __pyx_t_11 = PyList_Append(__pyx_v_result, __pyx_t_10); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_10); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
       }
       __pyx_L7:;
@@ -11192,8 +11345,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  */
       __pyx_t_10 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_10);
-      __Pyx_DECREF(__pyx_v_have_slices);
-      __pyx_v_have_slices = __pyx_t_10;
+      __Pyx_DECREF_SET(__pyx_v_have_slices, __pyx_t_10);
       __pyx_t_10 = 0;
       goto __pyx_L6;
     }
@@ -11206,14 +11358,11 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *                 raise TypeError("Cannot index with type '%s'" % type(item))
  * 
  */
-      __pyx_t_10 = ((PyObject *)((PyObject*)(&PySlice_Type)));
-      __Pyx_INCREF(__pyx_t_10);
-      __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_item, __pyx_t_10); 
-      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-      __pyx_t_2 = (!__pyx_t_3);
+      __pyx_t_1 = PySlice_Check(__pyx_v_item); 
+      __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
       if (__pyx_t_2) {
-        __pyx_t_3 = (!PyIndex_Check(__pyx_v_item));
-        __pyx_t_12 = __pyx_t_3;
+        __pyx_t_1 = ((!(__Pyx_PyIndex_Check(__pyx_v_item) != 0)) != 0);
+        __pyx_t_12 = __pyx_t_1;
       } else {
         __pyx_t_12 = __pyx_t_2;
       }
@@ -11252,10 +11401,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  */
       __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       if (!__pyx_t_12) {
-        __pyx_t_10 = ((PyObject *)((PyObject*)(&PySlice_Type)));
-        __Pyx_INCREF(__pyx_t_10);
-        __pyx_t_12 = __Pyx_TypeCheck(__pyx_v_item, __pyx_t_10); 
-        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+        __pyx_t_12 = PySlice_Check(__pyx_v_item); 
         __pyx_t_10 = __Pyx_PyBool_FromLong(__pyx_t_12); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_10);
         __pyx_t_8 = __pyx_t_10;
@@ -11264,8 +11410,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
         __Pyx_INCREF(__pyx_v_have_slices);
         __pyx_t_8 = __pyx_v_have_slices;
       }
-      __Pyx_DECREF(__pyx_v_have_slices);
-      __pyx_v_have_slices = __pyx_t_8;
+      __Pyx_DECREF_SET(__pyx_v_have_slices, __pyx_t_8);
       __pyx_t_8 = 0;
 
       /* "View.MemoryView":653
@@ -11275,12 +11420,12 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  * 
  *     nslices = ndim - len(result)
  */
-      __pyx_t_11 = PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     __pyx_L6:;
   }
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
   /* "View.MemoryView":655
  *             result.append(item)
@@ -11290,10 +11435,10 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *         result.extend([slice(None)] * nslices)
  */
   __pyx_t_5 = PyList_GET_SIZE(((PyObject *)__pyx_v_result)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_1 = PyInt_FromSsize_t((__pyx_v_ndim - __pyx_t_5)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_v_nslices = __pyx_t_1;
-  __pyx_t_1 = 0;
+  __pyx_t_3 = PyInt_FromSsize_t((__pyx_v_ndim - __pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_v_nslices = __pyx_t_3;
+  __pyx_t_3 = 0;
 
   /* "View.MemoryView":656
  * 
@@ -11312,8 +11457,8 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  * 
  *     return have_slices or nslices, tuple(result)
  */
-    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_result), __pyx_n_s__extend); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_result), __pyx_n_s__extend); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
     __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_36), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -11331,9 +11476,9 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
     PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
     __pyx_t_8 = 0;
-    __pyx_t_8 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_8 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_8);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
     goto __pyx_L9;
@@ -11358,22 +11503,22 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
   }
   __pyx_t_4 = ((PyObject *)PyList_AsTuple(__pyx_v_result)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8);
+  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_8);
   __Pyx_GIVEREF(__pyx_t_8);
-  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_t_4));
+  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_t_4));
   __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
   __pyx_t_8 = 0;
   __pyx_t_4 = 0;
-  __pyx_r = __pyx_t_1;
-  __pyx_t_1 = 0;
+  __pyx_r = ((PyObject*)__pyx_t_3);
+  __pyx_t_3 = 0;
   goto __pyx_L0;
 
   __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_7);
   __Pyx_XDECREF(__pyx_t_8);
@@ -11431,7 +11576,7 @@ static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __
  *             raise ValueError("Indirect dimensions not supported")
  * 
  */
-    __pyx_t_3 = ((__pyx_v_suboffsets[__pyx_v_i]) >= 0);
+    __pyx_t_3 = (((__pyx_v_suboffsets[__pyx_v_i]) >= 0) != 0);
     if (__pyx_t_3) {
 
       /* "View.MemoryView":665
@@ -11490,15 +11635,18 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
   PyObject *__pyx_v_index = NULL;
   struct __pyx_memoryview_obj *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
+  int __pyx_t_1;
   int __pyx_t_2;
-  int __pyx_t_3;
-  Py_ssize_t __pyx_t_4;
-  PyObject *(*__pyx_t_5)(PyObject *);
+  struct __pyx_memoryview_obj *__pyx_t_3;
+  char *__pyx_t_4;
+  int __pyx_t_5;
   PyObject *__pyx_t_6 = NULL;
-  int __pyx_t_7;
-  Py_ssize_t __pyx_t_8;
+  Py_ssize_t __pyx_t_7;
+  PyObject *(*__pyx_t_8)(PyObject *);
   PyObject *__pyx_t_9 = NULL;
+  Py_ssize_t __pyx_t_10;
+  int __pyx_t_11;
+  PyObject *__pyx_t_12 = NULL;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -11531,7 +11679,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *     if isinstance(memview, _memoryviewslice):
  */
   #ifndef CYTHON_WITHOUT_ASSERTIONS
-  if (unlikely(!(__pyx_v_memview->view.ndim > 0))) {
+  if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) {
     PyErr_SetNone(PyExc_AssertionError);
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
@@ -11544,10 +11692,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *         memviewsliceobj = memview
  *         p_src = &memviewsliceobj.from_slice
  */
-  __pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryviewslice_type));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), ((PyObject *)__pyx_memoryviewslice_type)); 
+  __pyx_t_2 = (__pyx_t_1 != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":687
@@ -11600,7 +11746,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *     dst.data = p_src.data
  * 
  */
-  __pyx_v_dst.memview = __pyx_v_p_src->memview;
+  __pyx_t_3 = __pyx_v_p_src->memview;
+  __pyx_v_dst.memview = __pyx_t_3;
 
   /* "View.MemoryView":698
  * 
@@ -11609,7 +11756,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  * 
  * 
  */
-  __pyx_v_dst.data = __pyx_v_p_src->data;
+  __pyx_t_4 = __pyx_v_p_src->data;
+  __pyx_v_dst.data = __pyx_t_4;
 
   /* "View.MemoryView":703
  * 
@@ -11636,46 +11784,45 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *         if PyIndex_Check(index):
  *             slice_memviewslice(
  */
-  __pyx_t_3 = 0;
+  __pyx_t_5 = 0;
   if (PyList_CheckExact(__pyx_v_indices) || PyTuple_CheckExact(__pyx_v_indices)) {
-    __pyx_t_1 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0;
-    __pyx_t_5 = NULL;
+    __pyx_t_6 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_6); __pyx_t_7 = 0;
+    __pyx_t_8 = NULL;
   } else {
-    __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext;
+    __pyx_t_7 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __pyx_t_8 = Py_TYPE(__pyx_t_6)->tp_iternext;
   }
   for (;;) {
-    if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_1)) {
-      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
+    if (!__pyx_t_8 && PyList_CheckExact(__pyx_t_6)) {
+      if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_6)) break;
       #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       #else
-      __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       #endif
-    } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_1)) {
-      if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+    } else if (!__pyx_t_8 && PyTuple_CheckExact(__pyx_t_6)) {
+      if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
       #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       #else
-      __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       #endif
     } else {
-      __pyx_t_6 = __pyx_t_5(__pyx_t_1);
-      if (unlikely(!__pyx_t_6)) {
+      __pyx_t_9 = __pyx_t_8(__pyx_t_6);
+      if (unlikely(!__pyx_t_9)) {
         if (PyErr_Occurred()) {
           if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
           else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         }
         break;
       }
-      __Pyx_GOTREF(__pyx_t_6);
+      __Pyx_GOTREF(__pyx_t_9);
     }
-    __Pyx_XDECREF(__pyx_v_index);
-    __pyx_v_index = __pyx_t_6;
-    __pyx_t_6 = 0;
-    __pyx_v_dim = __pyx_t_3;
-    __pyx_t_3 = (__pyx_t_3 + 1);
+    __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9);
+    __pyx_t_9 = 0;
+    __pyx_v_dim = __pyx_t_5;
+    __pyx_t_5 = (__pyx_t_5 + 1);
 
     /* "View.MemoryView":709
  * 
@@ -11684,8 +11831,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             slice_memviewslice(
  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
  */
-    __pyx_t_7 = PyIndex_Check(__pyx_v_index);
-    if (__pyx_t_7) {
+    __pyx_t_2 = (__Pyx_PyIndex_Check(__pyx_v_index) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":713
  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
@@ -11694,7 +11841,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *                 0, 0, 0, # have_{start,stop,step}
  *                 False)
  */
-      __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
       /* "View.MemoryView":715
  *                 index, 0, 0, # start, stop, step
@@ -11703,7 +11850,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *         elif index is None:
  *             p_dst.shape[new_ndim] = 1
  */
-      __pyx_t_7 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_8, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_10, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L6;
     }
 
@@ -11715,7 +11862,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             p_dst.strides[new_ndim] = 0
  */
     __pyx_t_2 = (__pyx_v_index == Py_None);
-    if (__pyx_t_2) {
+    __pyx_t_1 = (__pyx_t_2 != 0);
+    if (__pyx_t_1) {
 
       /* "View.MemoryView":717
  *                 False)
@@ -11763,20 +11911,20 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             stop = index.stop or 0
  *             step = index.step or 0
  */
-      __pyx_t_6 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_6);
-      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      if (!__pyx_t_2) {
-        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
+      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      if (!__pyx_t_1) {
+        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
         __Pyx_INCREF(__pyx_int_0);
-        __pyx_t_9 = __pyx_int_0;
+        __pyx_t_12 = __pyx_int_0;
       } else {
-        __pyx_t_9 = __pyx_t_6;
-        __pyx_t_6 = 0;
+        __pyx_t_12 = __pyx_t_9;
+        __pyx_t_9 = 0;
       }
-      __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_v_start = __pyx_t_8;
+      __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_12); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+      __pyx_v_start = __pyx_t_10;
 
       /* "View.MemoryView":723
  *         else:
@@ -11785,20 +11933,20 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             step = index.step or 0
  * 
  */
-      __pyx_t_9 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__stop); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      if (!__pyx_t_2) {
-        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__stop); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_12);
+      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      if (!__pyx_t_1) {
+        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
         __Pyx_INCREF(__pyx_int_0);
-        __pyx_t_6 = __pyx_int_0;
+        __pyx_t_9 = __pyx_int_0;
       } else {
-        __pyx_t_6 = __pyx_t_9;
-        __pyx_t_9 = 0;
+        __pyx_t_9 = __pyx_t_12;
+        __pyx_t_12 = 0;
       }
-      __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-      __pyx_v_stop = __pyx_t_8;
+      __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_v_stop = __pyx_t_10;
 
       /* "View.MemoryView":724
  *             start = index.start or 0
@@ -11807,20 +11955,20 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  * 
  *             have_start = index.start is not None
  */
-      __pyx_t_6 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_6);
-      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      if (!__pyx_t_2) {
-        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
+      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      if (!__pyx_t_1) {
+        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
         __Pyx_INCREF(__pyx_int_0);
-        __pyx_t_9 = __pyx_int_0;
+        __pyx_t_12 = __pyx_int_0;
       } else {
-        __pyx_t_9 = __pyx_t_6;
-        __pyx_t_6 = 0;
+        __pyx_t_12 = __pyx_t_9;
+        __pyx_t_9 = 0;
       }
-      __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_v_step = __pyx_t_8;
+      __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_12); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+      __pyx_v_step = __pyx_t_10;
 
       /* "View.MemoryView":726
  *             step = index.step or 0
@@ -11829,11 +11977,11 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             have_stop = index.stop is not None
  *             have_step = index.step is not None
  */
-      __pyx_t_9 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_2 = (__pyx_t_9 != Py_None);
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_v_have_start = __pyx_t_2;
+      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_12);
+      __pyx_t_1 = (__pyx_t_12 != Py_None);
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+      __pyx_v_have_start = __pyx_t_1;
 
       /* "View.MemoryView":727
  * 
@@ -11842,11 +11990,11 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             have_step = index.step is not None
  * 
  */
-      __pyx_t_9 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__stop); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_2 = (__pyx_t_9 != Py_None);
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_v_have_stop = __pyx_t_2;
+      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__stop); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_12);
+      __pyx_t_1 = (__pyx_t_12 != Py_None);
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+      __pyx_v_have_stop = __pyx_t_1;
 
       /* "View.MemoryView":728
  *             have_start = index.start is not None
@@ -11855,11 +12003,11 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  * 
  *             slice_memviewslice(
  */
-      __pyx_t_9 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_2 = (__pyx_t_9 != Py_None);
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_v_have_step = __pyx_t_2;
+      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_12);
+      __pyx_t_1 = (__pyx_t_12 != Py_None);
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+      __pyx_v_have_step = __pyx_t_1;
 
       /* "View.MemoryView":735
  *                 start, stop, step,
@@ -11868,7 +12016,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             new_ndim += 1
  * 
  */
-      __pyx_t_7 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
       /* "View.MemoryView":736
  *                 have_start, have_stop, have_step,
@@ -11881,7 +12029,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
     }
     __pyx_L6:;
   }
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
 
   /* "View.MemoryView":738
  *             new_ndim += 1
@@ -11890,10 +12038,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *         return memoryview_fromslice(dst, new_ndim,
  *                                     memviewsliceobj.to_object_func,
  */
-  __pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryviewslice_type));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), ((PyObject *)__pyx_memoryviewslice_type)); 
+  __pyx_t_2 = (__pyx_t_1 != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":739
@@ -11921,11 +12067,11 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *     else:
  *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,
  */
-    __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_1);
-    __pyx_t_1 = 0;
+    __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_6);
+    __pyx_t_6 = 0;
     goto __pyx_L0;
     goto __pyx_L7;
   }
@@ -11947,11 +12093,11 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  * 
  * 
  */
-    __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_1);
-    __pyx_t_1 = 0;
+    __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_6);
+    __pyx_t_6 = 0;
     goto __pyx_L0;
   }
   __pyx_L7:;
@@ -11959,9 +12105,9 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
   __pyx_r = ((struct __pyx_memoryview_obj *)Py_None); __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_6);
   __Pyx_XDECREF(__pyx_t_9);
+  __Pyx_XDECREF(__pyx_t_12);
   __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
@@ -11988,7 +12134,6 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
   int __pyx_t_2;
   int __pyx_t_3;
   int __pyx_t_4;
-  Py_ssize_t __pyx_t_5;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -12000,7 +12145,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  * 
  *         if start < 0:
  */
-  __pyx_t_1 = (!__pyx_v_is_slice);
+  __pyx_t_1 = ((!(__pyx_v_is_slice != 0)) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":791
@@ -12010,7 +12155,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             start += shape
  *         if not 0 <= start < shape:
  */
-    __pyx_t_1 = (__pyx_v_start < 0);
+    __pyx_t_1 = ((__pyx_v_start < 0) != 0);
     if (__pyx_t_1) {
 
       /* "View.MemoryView":792
@@ -12036,7 +12181,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
     if (__pyx_t_1) {
       __pyx_t_1 = (__pyx_v_start < __pyx_v_shape);
     }
-    __pyx_t_2 = (!__pyx_t_1);
+    __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":794
@@ -12077,11 +12222,11 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
  * 
  */
-    if (__pyx_v_have_step) {
+    if ((__pyx_v_have_step != 0)) {
       __pyx_t_4 = (__pyx_v_step == 0);
       __pyx_t_2 = __pyx_t_4;
     } else {
-      __pyx_t_2 = __pyx_v_have_step;
+      __pyx_t_2 = (__pyx_v_have_step != 0);
     }
     if (__pyx_t_2) {
 
@@ -12104,7 +12249,8 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             if start < 0:
  *                 start += shape
  */
-    if (__pyx_v_have_start) {
+    __pyx_t_2 = (__pyx_v_have_start != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":804
  * 
@@ -12113,7 +12259,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 start += shape
  *                 if start < 0:
  */
-      __pyx_t_2 = (__pyx_v_start < 0);
+      __pyx_t_2 = ((__pyx_v_start < 0) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":805
@@ -12132,7 +12278,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                     start = 0
  *             elif start >= shape:
  */
-        __pyx_t_2 = (__pyx_v_start < 0);
+        __pyx_t_2 = ((__pyx_v_start < 0) != 0);
         if (__pyx_t_2) {
 
           /* "View.MemoryView":807
@@ -12156,7 +12302,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 if negative_step:
  *                     start = shape - 1
  */
-      __pyx_t_2 = (__pyx_v_start >= __pyx_v_shape);
+      __pyx_t_2 = ((__pyx_v_start >= __pyx_v_shape) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":809
@@ -12166,7 +12312,8 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                     start = shape - 1
  *                 else:
  */
-        if (__pyx_v_negative_step) {
+        __pyx_t_2 = (__pyx_v_negative_step != 0);
+        if (__pyx_t_2) {
 
           /* "View.MemoryView":810
  *             elif start >= shape:
@@ -12204,7 +12351,8 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 start = shape - 1
  *             else:
  */
-      if (__pyx_v_negative_step) {
+      __pyx_t_2 = (__pyx_v_negative_step != 0);
+      if (__pyx_t_2) {
 
         /* "View.MemoryView":815
  *         else:
@@ -12238,7 +12386,8 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             if stop < 0:
  *                 stop += shape
  */
-    if (__pyx_v_have_stop) {
+    __pyx_t_2 = (__pyx_v_have_stop != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":820
  * 
@@ -12247,7 +12396,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 stop += shape
  *                 if stop < 0:
  */
-      __pyx_t_2 = (__pyx_v_stop < 0);
+      __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":821
@@ -12266,7 +12415,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                     stop = 0
  *             elif stop > shape:
  */
-        __pyx_t_2 = (__pyx_v_stop < 0);
+        __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
         if (__pyx_t_2) {
 
           /* "View.MemoryView":823
@@ -12290,7 +12439,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 stop = shape
  *         else:
  */
-      __pyx_t_2 = (__pyx_v_stop > __pyx_v_shape);
+      __pyx_t_2 = ((__pyx_v_stop > __pyx_v_shape) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":825
@@ -12315,7 +12464,8 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 stop = -1
  *             else:
  */
-      if (__pyx_v_negative_step) {
+      __pyx_t_2 = (__pyx_v_negative_step != 0);
+      if (__pyx_t_2) {
 
         /* "View.MemoryView":828
  *         else:
@@ -12349,7 +12499,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             step = 1
  * 
  */
-    __pyx_t_2 = (!__pyx_v_have_step);
+    __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":833
@@ -12369,23 +12519,23 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *         with cython.cdivision(True):
  *             new_shape = (stop - start) // step             # <<<<<<<<<<<<<<
  * 
- *             if (stop - start) % step:
+ *             if (stop - start) - step * new_shape:
  */
     __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step);
 
     /* "View.MemoryView":839
  *             new_shape = (stop - start) // step
  * 
- *             if (stop - start) % step:             # <<<<<<<<<<<<<<
+ *             if (stop - start) - step * new_shape:             # <<<<<<<<<<<<<<
  *                 new_shape += 1
  * 
  */
-    __pyx_t_5 = ((__pyx_v_stop - __pyx_v_start) % __pyx_v_step);
-    if (__pyx_t_5) {
+    __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":840
  * 
- *             if (stop - start) % step:
+ *             if (stop - start) - step * new_shape:
  *                 new_shape += 1             # <<<<<<<<<<<<<<
  * 
  *         if new_shape < 0:
@@ -12402,7 +12552,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             new_shape = 0
  * 
  */
-    __pyx_t_2 = (__pyx_v_new_shape < 0);
+    __pyx_t_2 = ((__pyx_v_new_shape < 0) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":843
@@ -12453,7 +12603,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *         dst.data += start * stride
  *     else:
  */
-  __pyx_t_2 = ((__pyx_v_suboffset_dim[0]) < 0);
+  __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":852
@@ -12487,7 +12637,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *         if not is_slice:
  *             if new_ndim == 0:
  */
-  __pyx_t_2 = (__pyx_v_suboffset >= 0);
+  __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":857
@@ -12497,7 +12647,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             if new_ndim == 0:
  *                 dst.data = (<char **> dst.data)[0] + suboffset
  */
-    __pyx_t_2 = (!__pyx_v_is_slice);
+    __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":858
@@ -12507,7 +12657,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 dst.data = (<char **> dst.data)[0] + suboffset
  *             else:
  */
-      __pyx_t_2 = (__pyx_v_new_ndim == 0);
+      __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":859
@@ -12581,11 +12731,11 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  * 
  * @cname('__pyx_pybuffer_index')
  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,             # <<<<<<<<<<<<<<
- *                           int dim) except NULL:
+ *                           Py_ssize_t dim) except NULL:
  *     cdef Py_ssize_t shape, stride, suboffset = -1
  */
 
-static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, int __pyx_v_dim) {
+static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) {
   Py_ssize_t __pyx_v_shape;
   Py_ssize_t __pyx_v_stride;
   Py_ssize_t __pyx_v_suboffset;
@@ -12593,9 +12743,10 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
   char *__pyx_v_resultp;
   char *__pyx_r;
   __Pyx_RefNannyDeclarations
-  int __pyx_t_1;
-  PyObject *__pyx_t_2 = NULL;
+  Py_ssize_t __pyx_t_1;
+  int __pyx_t_2;
   PyObject *__pyx_t_3 = NULL;
+  PyObject *__pyx_t_4 = NULL;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -12603,7 +12754,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
 
   /* "View.MemoryView":874
  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,
- *                           int dim) except NULL:
+ *                           Py_ssize_t dim) except NULL:
  *     cdef Py_ssize_t shape, stride, suboffset = -1             # <<<<<<<<<<<<<<
  *     cdef Py_ssize_t itemsize = view.itemsize
  *     cdef char *resultp
@@ -12611,13 +12762,14 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
   __pyx_v_suboffset = -1;
 
   /* "View.MemoryView":875
- *                           int dim) except NULL:
+ *                           Py_ssize_t dim) except NULL:
  *     cdef Py_ssize_t shape, stride, suboffset = -1
  *     cdef Py_ssize_t itemsize = view.itemsize             # <<<<<<<<<<<<<<
  *     cdef char *resultp
  * 
  */
-  __pyx_v_itemsize = __pyx_v_view->itemsize;
+  __pyx_t_1 = __pyx_v_view->itemsize;
+  __pyx_v_itemsize = __pyx_t_1;
 
   /* "View.MemoryView":878
  *     cdef char *resultp
@@ -12626,8 +12778,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *         shape = view.len / itemsize
  *         stride = itemsize
  */
-  __pyx_t_1 = (__pyx_v_view->ndim == 0);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":879
  * 
@@ -12637,11 +12789,23 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *     else:
  */
     if (unlikely(__pyx_v_itemsize == 0)) {
+      #ifdef WITH_THREAD
+      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+      #endif
       PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero");
+      #ifdef WITH_THREAD
+      PyGILState_Release(__pyx_gilstate_save);
+      #endif
       {__pyx_filename = __pyx_f[2]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     else if (sizeof(Py_ssize_t) == sizeof(long) && unlikely(__pyx_v_itemsize == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) {
+      #ifdef WITH_THREAD
+      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+      #endif
       PyErr_Format(PyExc_OverflowError, "value too large to perform division");
+      #ifdef WITH_THREAD
+      PyGILState_Release(__pyx_gilstate_save);
+      #endif
       {__pyx_filename = __pyx_f[2]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize);
@@ -12683,8 +12847,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *             suboffset = view.suboffsets[dim]
  * 
  */
-    __pyx_t_1 = (__pyx_v_view->suboffsets != NULL);
-    if (__pyx_t_1) {
+    __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":885
  *         stride = view.strides[dim]
@@ -12707,8 +12871,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *         index += view.shape[dim]
  *         if index < 0:
  */
-  __pyx_t_1 = (__pyx_v_index < 0);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((__pyx_v_index < 0) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":888
  * 
@@ -12726,8 +12890,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
  * 
  */
-    __pyx_t_1 = (__pyx_v_index < 0);
-    if (__pyx_t_1) {
+    __pyx_t_2 = ((__pyx_v_index < 0) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":890
  *         index += view.shape[dim]
@@ -12736,21 +12900,21 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  * 
  *     if index >= shape:
  */
-      __pyx_t_2 = PyInt_FromLong(__pyx_v_dim); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_42), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3));
-      __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
-      __pyx_t_3 = 0;
-      __pyx_t_3 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
-      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+      __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_42), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
+      __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
+      __pyx_t_4 = 0;
+      __pyx_t_4 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_4);
+      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
+      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
       {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L6;
     }
@@ -12766,8 +12930,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
  * 
  */
-  __pyx_t_1 = (__pyx_v_index >= __pyx_v_shape);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":893
  * 
@@ -12776,21 +12940,21 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  * 
  *     resultp = bufp + index * stride
  */
-    __pyx_t_3 = PyInt_FromLong(__pyx_v_dim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_42), __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
+    __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
+    __pyx_t_3 = 0;
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_42), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
-    __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
-    __pyx_t_2 = 0;
-    __pyx_t_2 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L7;
   }
@@ -12812,8 +12976,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *         resultp = (<char **> resultp)[0] + suboffset
  * 
  */
-  __pyx_t_1 = (__pyx_v_suboffset >= 0);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":897
  *     resultp = bufp + index * stride
@@ -12840,8 +13004,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
   __pyx_r = 0;
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
+  __Pyx_XDECREF(__pyx_t_4);
   __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
@@ -12864,14 +13028,15 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
   int __pyx_v_i;
   int __pyx_v_j;
   int __pyx_r;
-  long __pyx_t_1;
-  int __pyx_t_2;
-  Py_ssize_t __pyx_t_3;
+  int __pyx_t_1;
+  Py_ssize_t *__pyx_t_2;
+  long __pyx_t_3;
   Py_ssize_t __pyx_t_4;
-  int __pyx_t_5;
+  Py_ssize_t __pyx_t_5;
   int __pyx_t_6;
   int __pyx_t_7;
   int __pyx_t_8;
+  int __pyx_t_9;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -12883,7 +13048,8 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  * 
  *     cdef Py_ssize_t *shape = memslice.shape
  */
-  __pyx_v_ndim = __pyx_v_memslice->memview->view.ndim;
+  __pyx_t_1 = __pyx_v_memslice->memview->view.ndim;
+  __pyx_v_ndim = __pyx_t_1;
 
   /* "View.MemoryView":908
  *     cdef int ndim = memslice.memview.view.ndim
@@ -12892,7 +13058,8 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  *     cdef Py_ssize_t *strides = memslice.strides
  * 
  */
-  __pyx_v_shape = __pyx_v_memslice->shape;
+  __pyx_t_2 = __pyx_v_memslice->shape;
+  __pyx_v_shape = __pyx_t_2;
 
   /* "View.MemoryView":909
  * 
@@ -12901,7 +13068,8 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  * 
  * 
  */
-  __pyx_v_strides = __pyx_v_memslice->strides;
+  __pyx_t_2 = __pyx_v_memslice->strides;
+  __pyx_v_strides = __pyx_t_2;
 
   /* "View.MemoryView":913
  * 
@@ -12910,9 +13078,9 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  *         j = ndim - 1 - i
  *         strides[i], strides[j] = strides[j], strides[i]
  */
-  __pyx_t_1 = __Pyx_div_long(__pyx_v_ndim, 2);
-  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
-    __pyx_v_i = __pyx_t_2;
+  __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2);
+  for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_3; __pyx_t_1+=1) {
+    __pyx_v_i = __pyx_t_1;
 
     /* "View.MemoryView":914
  *     cdef int i, j
@@ -12930,10 +13098,10 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  *         shape[i], shape[j] = shape[j], shape[i]
  * 
  */
-    __pyx_t_3 = (__pyx_v_strides[__pyx_v_j]);
-    __pyx_t_4 = (__pyx_v_strides[__pyx_v_i]);
-    (__pyx_v_strides[__pyx_v_i]) = __pyx_t_3;
-    (__pyx_v_strides[__pyx_v_j]) = __pyx_t_4;
+    __pyx_t_4 = (__pyx_v_strides[__pyx_v_j]);
+    __pyx_t_5 = (__pyx_v_strides[__pyx_v_i]);
+    (__pyx_v_strides[__pyx_v_i]) = __pyx_t_4;
+    (__pyx_v_strides[__pyx_v_j]) = __pyx_t_5;
 
     /* "View.MemoryView":916
  *         j = ndim - 1 - i
@@ -12942,10 +13110,10 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  * 
  *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
  */
-    __pyx_t_4 = (__pyx_v_shape[__pyx_v_j]);
-    __pyx_t_3 = (__pyx_v_shape[__pyx_v_i]);
-    (__pyx_v_shape[__pyx_v_i]) = __pyx_t_4;
-    (__pyx_v_shape[__pyx_v_j]) = __pyx_t_3;
+    __pyx_t_5 = (__pyx_v_shape[__pyx_v_j]);
+    __pyx_t_4 = (__pyx_v_shape[__pyx_v_i]);
+    (__pyx_v_shape[__pyx_v_i]) = __pyx_t_5;
+    (__pyx_v_shape[__pyx_v_j]) = __pyx_t_4;
 
     /* "View.MemoryView":918
  *         shape[i], shape[j] = shape[j], shape[i]
@@ -12954,14 +13122,14 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
  * 
  */
-    __pyx_t_5 = ((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0);
-    if (!__pyx_t_5) {
-      __pyx_t_6 = ((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0);
-      __pyx_t_7 = __pyx_t_6;
+    __pyx_t_6 = (((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0) != 0);
+    if (!__pyx_t_6) {
+      __pyx_t_7 = (((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0) != 0);
+      __pyx_t_8 = __pyx_t_7;
     } else {
-      __pyx_t_7 = __pyx_t_5;
+      __pyx_t_8 = __pyx_t_6;
     }
-    if (__pyx_t_7) {
+    if (__pyx_t_8) {
 
       /* "View.MemoryView":919
  * 
@@ -12970,7 +13138,7 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  * 
  *     return 1
  */
-      __pyx_t_8 = __pyx_memoryview_err(__pyx_builtin_ValueError, __pyx_k_43); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = __pyx_memoryview_err(__pyx_builtin_ValueError, __pyx_k_43); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L5;
     }
     __pyx_L5:;
@@ -13061,7 +13229,7 @@ static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memor
  *             return self.to_object_func(itemp)
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_self->to_object_func != NULL);
+  __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":943
@@ -13135,7 +13303,7 @@ static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memo
  *             self.to_dtype_func(itemp, value)
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_self->to_dtype_func != NULL);
+  __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":949
@@ -13234,8 +13402,11 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
   int __pyx_t_1;
   PyObject *__pyx_t_2 = NULL;
   PyObject *__pyx_t_3 = NULL;
-  int __pyx_t_4;
-  int __pyx_t_5;
+  __Pyx_TypeInfo *__pyx_t_4;
+  Py_buffer __pyx_t_5;
+  Py_ssize_t __pyx_t_6;
+  int __pyx_t_7;
+  int __pyx_t_8;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -13248,7 +13419,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
  *         return None
  * 
  */
-  __pyx_t_1 = (((PyObject *)__pyx_v_memviewslice.memview) == Py_None);
+  __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":972
@@ -13317,7 +13488,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
  *     result.typeinfo = memviewslice.memview.typeinfo
  * 
  */
-  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s__base); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s__base); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_GIVEREF(__pyx_t_2);
   __Pyx_GOTREF(__pyx_v_result->from_object);
@@ -13332,7 +13503,8 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
  * 
  *     result.view = memviewslice.memview.view
  */
-  __pyx_v_result->__pyx_base.typeinfo = __pyx_v_memviewslice.memview->typeinfo;
+  __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo;
+  __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4;
 
   /* "View.MemoryView":985
  *     result.typeinfo = memviewslice.memview.typeinfo
@@ -13341,7 +13513,8 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
  *     result.view.buf = <void *> memviewslice.data
  *     result.view.ndim = ndim
  */
-  __pyx_v_result->__pyx_base.view = __pyx_v_memviewslice.memview->view;
+  __pyx_t_5 = __pyx_v_memviewslice.memview->view;
+  __pyx_v_result->__pyx_base.view = __pyx_t_5;
 
   /* "View.MemoryView":986
  * 
@@ -13422,7 +13595,8 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
  *     for i in range(ndim):
  *         result.view.len *= result.view.shape[i]
  */
-  __pyx_v_result->__pyx_base.view.len = __pyx_v_result->__pyx_base.view.itemsize;
+  __pyx_t_6 = __pyx_v_result->__pyx_base.view.itemsize;
+  __pyx_v_result->__pyx_base.view.len = __pyx_t_6;
 
   /* "View.MemoryView":998
  * 
@@ -13431,9 +13605,9 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
  *         result.view.len *= result.view.shape[i]
  * 
  */
-  __pyx_t_4 = __pyx_v_ndim;
-  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
-    __pyx_v_i = __pyx_t_5;
+  __pyx_t_7 = __pyx_v_ndim;
+  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
+    __pyx_v_i = __pyx_t_8;
 
     /* "View.MemoryView":999
  *     result.view.len = result.view.itemsize
@@ -13501,7 +13675,7 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p
   struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0;
   __Pyx_memviewslice *__pyx_r;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
+  int __pyx_t_1;
   int __pyx_t_2;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
@@ -13515,10 +13689,8 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p
  *         obj = memview
  *         return &obj.from_slice
  */
-  __pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryviewslice_type));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), ((PyObject *)__pyx_memoryviewslice_type)); 
+  __pyx_t_2 = (__pyx_t_1 != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":1011
@@ -13569,7 +13741,6 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p
   __pyx_r = 0;
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
   __Pyx_WriteUnraisable("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
@@ -13592,9 +13763,10 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem
   Py_ssize_t *__pyx_v_strides;
   Py_ssize_t *__pyx_v_suboffsets;
   __Pyx_RefNannyDeclarations
-  int __pyx_t_1;
+  Py_ssize_t *__pyx_t_1;
   int __pyx_t_2;
   int __pyx_t_3;
+  int __pyx_t_4;
   __Pyx_RefNannySetupContext("slice_copy", 0);
 
   /* "View.MemoryView":1022
@@ -13604,7 +13776,8 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem
  *     strides = memview.view.strides
  *     suboffsets = memview.view.suboffsets
  */
-  __pyx_v_shape = __pyx_v_memview->view.shape;
+  __pyx_t_1 = __pyx_v_memview->view.shape;
+  __pyx_v_shape = __pyx_t_1;
 
   /* "View.MemoryView":1023
  * 
@@ -13613,7 +13786,8 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem
  *     suboffsets = memview.view.suboffsets
  * 
  */
-  __pyx_v_strides = __pyx_v_memview->view.strides;
+  __pyx_t_1 = __pyx_v_memview->view.strides;
+  __pyx_v_strides = __pyx_t_1;
 
   /* "View.MemoryView":1024
  *     shape = memview.view.shape
@@ -13622,7 +13796,8 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem
  * 
  *     dst.memview = <__pyx_memoryview *> memview
  */
-  __pyx_v_suboffsets = __pyx_v_memview->view.suboffsets;
+  __pyx_t_1 = __pyx_v_memview->view.suboffsets;
+  __pyx_v_suboffsets = __pyx_t_1;
 
   /* "View.MemoryView":1026
  *     suboffsets = memview.view.suboffsets
@@ -13649,9 +13824,9 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem
  *         dst.shape[dim] = shape[dim]
  *         dst.strides[dim] = strides[dim]
  */
-  __pyx_t_1 = __pyx_v_memview->view.ndim;
-  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
-    __pyx_v_dim = __pyx_t_2;
+  __pyx_t_2 = __pyx_v_memview->view.ndim;
+  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
+    __pyx_v_dim = __pyx_t_3;
 
     /* "View.MemoryView":1030
  * 
@@ -13678,8 +13853,8 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem
  *             dst.suboffsets[dim] = -1
  *         else:
  */
-    __pyx_t_3 = (__pyx_v_suboffsets == NULL);
-    if (__pyx_t_3) {
+    __pyx_t_4 = ((__pyx_v_suboffsets == NULL) != 0);
+    if (__pyx_t_4) {
 
       /* "View.MemoryView":1033
  *         dst.strides[dim] = strides[dim]
@@ -13774,8 +13949,11 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview
   int (*__pyx_v_to_dtype_func)(char *, PyObject *);
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
+  int __pyx_t_1;
   int __pyx_t_2;
+  PyObject *(*__pyx_t_3)(char *);
+  int (*__pyx_t_4)(char *, PyObject *);
+  PyObject *__pyx_t_5 = NULL;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -13788,10 +13966,8 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview
  *         to_object_func = (<_memoryviewslice> memview).to_object_func
  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
  */
-  __pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryviewslice_type));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), ((PyObject *)__pyx_memoryviewslice_type)); 
+  __pyx_t_2 = (__pyx_t_1 != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":1053
@@ -13801,7 +13977,8 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview
  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
  *     else:
  */
-    __pyx_v_to_object_func = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
+    __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
+    __pyx_v_to_object_func = __pyx_t_3;
 
     /* "View.MemoryView":1054
  *     if isinstance(memview, _memoryviewslice):
@@ -13810,7 +13987,8 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview
  *     else:
  *         to_object_func = NULL
  */
-    __pyx_v_to_dtype_func = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
+    __pyx_t_4 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
+    __pyx_v_to_dtype_func = __pyx_t_4;
     goto __pyx_L3;
   }
   /*else*/ {
@@ -13851,16 +14029,16 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview
  * 
  * 
  */
-  __pyx_t_1 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_r = __pyx_t_1;
-  __pyx_t_1 = 0;
+  __pyx_t_5 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
+  __pyx_r = __pyx_t_5;
+  __pyx_t_5 = 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_5);
   __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
@@ -13888,7 +14066,7 @@ static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) {
  *         return -arg
  *     else:
  */
-  __pyx_t_1 = (__pyx_v_arg < 0);
+  __pyx_t_1 = ((__pyx_v_arg < 0) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":1069
@@ -13973,7 +14151,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _
  *             c_stride = mslice.strides[i]
  *             break
  */
-    __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1);
+    __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":1084
@@ -14017,7 +14195,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _
  *             f_stride = mslice.strides[i]
  *             break
  */
-    __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1);
+    __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":1089
@@ -14050,7 +14228,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _
  *         return 'C'
  *     else:
  */
-  __pyx_t_2 = (abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride));
+  __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":1093
@@ -14147,7 +14325,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v
  *        if (src_stride > 0 and dst_stride > 0 and
  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
  */
-  __pyx_t_1 = (__pyx_v_ndim == 1);
+  __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":1111
@@ -14157,9 +14335,9 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v
  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
  *            memcpy(dst_data, src_data, itemsize * dst_extent)
  */
-    __pyx_t_1 = (__pyx_v_src_stride > 0);
+    __pyx_t_1 = ((__pyx_v_src_stride > 0) != 0);
     if (__pyx_t_1) {
-      __pyx_t_2 = (__pyx_v_dst_stride > 0);
+      __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":1112
@@ -14173,7 +14351,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v
         if (__pyx_t_3) {
           __pyx_t_3 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride));
         }
-        __pyx_t_4 = __pyx_t_3;
+        __pyx_t_4 = (__pyx_t_3 != 0);
       } else {
         __pyx_t_4 = __pyx_t_2;
       }
@@ -14315,8 +14493,9 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_sr
   int __pyx_v_i;
   Py_ssize_t __pyx_v_size;
   Py_ssize_t __pyx_r;
-  int __pyx_t_1;
+  Py_ssize_t __pyx_t_1;
   int __pyx_t_2;
+  int __pyx_t_3;
 
   /* "View.MemoryView":1138
  *     "Return the size of the memory occupied by the slice in number of bytes"
@@ -14325,7 +14504,8 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_sr
  * 
  *     for i in range(ndim):
  */
-  __pyx_v_size = __pyx_v_src->memview->view.itemsize;
+  __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
+  __pyx_v_size = __pyx_t_1;
 
   /* "View.MemoryView":1140
  *     cdef Py_ssize_t size = src.memview.view.itemsize
@@ -14334,9 +14514,9 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_sr
  *         size *= src.shape[i]
  * 
  */
-  __pyx_t_1 = __pyx_v_ndim;
-  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
-    __pyx_v_i = __pyx_t_2;
+  __pyx_t_2 = __pyx_v_ndim;
+  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
+    __pyx_v_i = __pyx_t_3;
 
     /* "View.MemoryView":1141
  * 
@@ -14385,7 +14565,7 @@ static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_
  *         for idx in range(ndim):
  *             strides[idx] = stride
  */
-  __pyx_t_1 = (__pyx_v_order == 'F');
+  __pyx_t_1 = ((__pyx_v_order == 'F') != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":1156
@@ -14481,9 +14661,11 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
   size_t __pyx_v_itemsize;
   size_t __pyx_v_size;
   void *__pyx_r;
-  int __pyx_t_1;
+  Py_ssize_t __pyx_t_1;
   int __pyx_t_2;
   int __pyx_t_3;
+  struct __pyx_memoryview_obj *__pyx_t_4;
+  int __pyx_t_5;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -14495,7 +14677,8 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *     cdef size_t size = slice_get_size(src, ndim)
  * 
  */
-  __pyx_v_itemsize = __pyx_v_src->memview->view.itemsize;
+  __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
+  __pyx_v_itemsize = __pyx_t_1;
 
   /* "View.MemoryView":1179
  * 
@@ -14522,8 +14705,8 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *         _err(MemoryError, NULL)
  * 
  */
-  __pyx_t_1 = (!(__pyx_v_result != 0));
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":1183
  *     result = malloc(size)
@@ -14532,7 +14715,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  * 
  * 
  */
-    __pyx_t_2 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L3;
   }
   __pyx_L3:;
@@ -14553,7 +14736,8 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *     for i in range(ndim):
  *         tmpslice.shape[i] = src.shape[i]
  */
-  __pyx_v_tmpslice->memview = __pyx_v_src->memview;
+  __pyx_t_4 = __pyx_v_src->memview;
+  __pyx_v_tmpslice->memview = __pyx_t_4;
 
   /* "View.MemoryView":1188
  *     tmpslice.data = <char *> result
@@ -14562,9 +14746,9 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *         tmpslice.shape[i] = src.shape[i]
  *         tmpslice.suboffsets[i] = -1
  */
-  __pyx_t_2 = __pyx_v_ndim;
-  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
-    __pyx_v_i = __pyx_t_3;
+  __pyx_t_3 = __pyx_v_ndim;
+  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_3; __pyx_t_5+=1) {
+    __pyx_v_i = __pyx_t_5;
 
     /* "View.MemoryView":1189
  *     tmpslice.memview = src.memview
@@ -14601,9 +14785,9 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *         if tmpslice.shape[i] == 1:
  *             tmpslice.strides[i] = 0
  */
-  __pyx_t_2 = __pyx_v_ndim;
-  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
-    __pyx_v_i = __pyx_t_3;
+  __pyx_t_3 = __pyx_v_ndim;
+  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_3; __pyx_t_5+=1) {
+    __pyx_v_i = __pyx_t_5;
 
     /* "View.MemoryView":1197
  * 
@@ -14612,8 +14796,8 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *             tmpslice.strides[i] = 0
  * 
  */
-    __pyx_t_1 = ((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1);
-    if (__pyx_t_1) {
+    __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1198
  *     for i in range(ndim):
@@ -14635,8 +14819,8 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *         memcpy(result, src.data, size)
  *     else:
  */
-  __pyx_t_1 = __pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":1201
  * 
@@ -14864,7 +15048,7 @@ static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) {
  *         raise error(msg.decode('ascii'))
  *     else:
  */
-  __pyx_t_1 = (__pyx_v_msg != NULL);
+  __pyx_t_1 = ((__pyx_v_msg != NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":1222
@@ -14937,11 +15121,13 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
   __Pyx_memviewslice __pyx_v_tmp;
   int __pyx_v_ndim;
   int __pyx_r;
-  int __pyx_t_1;
+  Py_ssize_t __pyx_t_1;
   int __pyx_t_2;
   int __pyx_t_3;
   int __pyx_t_4;
-  void *__pyx_t_5;
+  int __pyx_t_5;
+  void *__pyx_t_6;
+  int __pyx_t_7;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -14962,7 +15148,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *     cdef int i
  *     cdef char order = get_best_order(&src, src_ndim)
  */
-  __pyx_v_itemsize = __pyx_v_src.memview->view.itemsize;
+  __pyx_t_1 = __pyx_v_src.memview->view.itemsize;
+  __pyx_v_itemsize = __pyx_t_1;
 
   /* "View.MemoryView":1238
  *     cdef size_t itemsize = src.memview.view.itemsize
@@ -14998,8 +15185,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *         broadcast_leading(&src, src_ndim, dst_ndim)
  *     elif dst_ndim < src_ndim:
  */
-  __pyx_t_1 = (__pyx_v_src_ndim < __pyx_v_dst_ndim);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":1244
  * 
@@ -15019,8 +15206,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *         broadcast_leading(&dst, dst_ndim, src_ndim)
  * 
  */
-  __pyx_t_1 = (__pyx_v_dst_ndim < __pyx_v_src_ndim);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":1246
  *         broadcast_leading(&src, src_ndim, dst_ndim)
@@ -15041,14 +15228,14 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  *     for i in range(ndim):
  */
-  __pyx_t_2 = __pyx_v_dst_ndim;
-  __pyx_t_3 = __pyx_v_src_ndim;
-  if ((__pyx_t_2 > __pyx_t_3)) {
-    __pyx_t_4 = __pyx_t_2;
+  __pyx_t_3 = __pyx_v_dst_ndim;
+  __pyx_t_4 = __pyx_v_src_ndim;
+  if (((__pyx_t_3 > __pyx_t_4) != 0)) {
+    __pyx_t_5 = __pyx_t_3;
   } else {
-    __pyx_t_4 = __pyx_t_3;
+    __pyx_t_5 = __pyx_t_4;
   }
-  __pyx_v_ndim = __pyx_t_4;
+  __pyx_v_ndim = __pyx_t_5;
 
   /* "View.MemoryView":1250
  *     cdef int ndim = max(src_ndim, dst_ndim)
@@ -15057,9 +15244,9 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *         if src.shape[i] != dst.shape[i]:
  *             if src.shape[i] == 1:
  */
-  __pyx_t_4 = __pyx_v_ndim;
-  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_4; __pyx_t_2+=1) {
-    __pyx_v_i = __pyx_t_2;
+  __pyx_t_5 = __pyx_v_ndim;
+  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_5; __pyx_t_3+=1) {
+    __pyx_v_i = __pyx_t_3;
 
     /* "View.MemoryView":1251
  * 
@@ -15068,8 +15255,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *             if src.shape[i] == 1:
  *                 broadcasting = True
  */
-    __pyx_t_1 = ((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i]));
-    if (__pyx_t_1) {
+    __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1252
  *     for i in range(ndim):
@@ -15078,8 +15265,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *                 broadcasting = True
  *                 src.strides[i] = 0
  */
-      __pyx_t_1 = ((__pyx_v_src.shape[__pyx_v_i]) == 1);
-      if (__pyx_t_1) {
+      __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0);
+      if (__pyx_t_2) {
 
         /* "View.MemoryView":1253
  *         if src.shape[i] != dst.shape[i]:
@@ -15109,7 +15296,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  *         if src.suboffsets[i] >= 0:
  */
-        __pyx_t_3 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_4 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       }
       __pyx_L7:;
       goto __pyx_L6;
@@ -15123,8 +15310,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *             _err_dim(ValueError, "Dimension %d is not direct", i)
  * 
  */
-    __pyx_t_1 = ((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0);
-    if (__pyx_t_1) {
+    __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1259
  * 
@@ -15133,7 +15320,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  *     if slices_overlap(&src, &dst, ndim, itemsize):
  */
-      __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, __pyx_k_45, __pyx_v_i); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, __pyx_k_45, __pyx_v_i); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L8;
     }
     __pyx_L8:;
@@ -15146,8 +15333,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  *         if not slice_is_contig(&src, order, ndim):
  */
-  __pyx_t_1 = __pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":1263
  *     if slices_overlap(&src, &dst, ndim, itemsize):
@@ -15156,8 +15343,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *             order = get_best_order(&dst, ndim)
  * 
  */
-    __pyx_t_1 = (!__pyx_memviewslice_is_contig((&__pyx_v_src), __pyx_v_order, __pyx_v_ndim));
-    if (__pyx_t_1) {
+    __pyx_t_2 = ((!(__pyx_memviewslice_is_contig((&__pyx_v_src), __pyx_v_order, __pyx_v_ndim) != 0)) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1264
  * 
@@ -15178,8 +15365,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *         src = tmp
  * 
  */
-    __pyx_t_5 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_v_tmpdata = __pyx_t_5;
+    __pyx_t_6 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_v_tmpdata = __pyx_t_6;
 
     /* "View.MemoryView":1267
  * 
@@ -15200,8 +15387,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  * 
  */
-  __pyx_t_1 = (!__pyx_v_broadcasting);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":1272
  * 
@@ -15210,8 +15397,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *             direct_copy = slice_is_contig(&dst, 'C', ndim)
  *         elif slice_is_contig(&src, 'F', ndim):
  */
-    __pyx_t_1 = __pyx_memviewslice_is_contig((&__pyx_v_src), 'C', __pyx_v_ndim);
-    if (__pyx_t_1) {
+    __pyx_t_2 = (__pyx_memviewslice_is_contig((&__pyx_v_src), 'C', __pyx_v_ndim) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1273
  * 
@@ -15231,8 +15418,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *             direct_copy = slice_is_contig(&dst, 'F', ndim)
  * 
  */
-    __pyx_t_1 = __pyx_memviewslice_is_contig((&__pyx_v_src), 'F', __pyx_v_ndim);
-    if (__pyx_t_1) {
+    __pyx_t_2 = (__pyx_memviewslice_is_contig((&__pyx_v_src), 'F', __pyx_v_ndim) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1275
  *             direct_copy = slice_is_contig(&dst, 'C', ndim)
@@ -15253,7 +15440,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  *             refcount_copying(&dst, dtype_is_object, ndim, False)
  */
-    if (__pyx_v_direct_copy) {
+    __pyx_t_2 = (__pyx_v_direct_copy != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1279
  *         if direct_copy:
@@ -15305,11 +15493,12 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  * 
  */
-  __pyx_t_1 = (__pyx_v_order == 'F');
-  if (__pyx_t_1) {
-    __pyx_t_1 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
+  __pyx_t_2 = (__pyx_v_order == 'F');
+  if (__pyx_t_2) {
+    __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
   }
-  if (__pyx_t_1) {
+  __pyx_t_7 = (__pyx_t_2 != 0);
+  if (__pyx_t_7) {
 
     /* "View.MemoryView":1287
  * 
@@ -15318,7 +15507,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *         transpose_memslice(&dst)
  * 
  */
-    __pyx_t_4 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_4 == 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
     /* "View.MemoryView":1288
  * 
@@ -15327,7 +15516,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  *     refcount_copying(&dst, dtype_is_object, ndim, False)
  */
-    __pyx_t_4 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_4 == 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L14;
   }
   __pyx_L14:;
@@ -15506,6 +15695,7 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_slice
  */
 
 static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) {
+  int __pyx_t_1;
 
   /* "View.MemoryView":1324
  * 
@@ -15514,7 +15704,8 @@ static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, i
  *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,
  *                                            dst.strides, ndim, inc)
  */
-  if (__pyx_v_dtype_is_object) {
+  __pyx_t_1 = (__pyx_v_dtype_is_object != 0);
+  if (__pyx_t_1) {
 
     /* "View.MemoryView":1326
  *     if dtype_is_object:
@@ -15594,7 +15785,7 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss
  *             if inc:
  *                 Py_INCREF((<PyObject **> data)[0])
  */
-    __pyx_t_3 = (__pyx_v_ndim == 1);
+    __pyx_t_3 = ((__pyx_v_ndim == 1) != 0);
     if (__pyx_t_3) {
 
       /* "View.MemoryView":1341
@@ -15604,7 +15795,8 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss
  *                 Py_INCREF((<PyObject **> data)[0])
  *             else:
  */
-      if (__pyx_v_inc) {
+      __pyx_t_3 = (__pyx_v_inc != 0);
+      if (__pyx_t_3) {
 
         /* "View.MemoryView":1342
  *         if ndim == 1:
@@ -15736,7 +15928,7 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t
  *         for i in range(extent):
  *             memcpy(data, item, itemsize)
  */
-  __pyx_t_1 = (__pyx_v_ndim == 1);
+  __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":1373
@@ -15805,60 +15997,77 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t
   __pyx_L3:;
 
 }
+static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;
 
-static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
-  struct __pyx_array_obj *p;
-  PyObject *o = (*t->tp_alloc)(t, 0);
-  if (!o) return 0;
-  p = ((struct __pyx_array_obj *)o);
-  p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
-  p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
-  if (__pyx_array___cinit__(o, a, k) < 0) {
+static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
+  struct __pyx_memoryview_obj *p;
+  PyObject *o;
+  o = (*t->tp_alloc)(t, 0);
+  if (unlikely(!o)) return 0;
+  p = ((struct __pyx_memoryview_obj *)o);
+  p->__pyx_vtab = __pyx_vtabptr_memoryview;
+  p->obj = Py_None; Py_INCREF(Py_None);
+  p->_size = Py_None; Py_INCREF(Py_None);
+  p->_array_interface = Py_None; Py_INCREF(Py_None);
+  p->view.obj = NULL;
+  if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) {
     Py_DECREF(o); o = 0;
   }
   return o;
 }
 
-static void __pyx_tp_dealloc_array(PyObject *o) {
-  struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
+static void __pyx_tp_dealloc_memoryview(PyObject *o) {
+  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
+  PyObject_GC_UnTrack(o);
   {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
     ++Py_REFCNT(o);
-    __pyx_array___dealloc__(o);
+    __pyx_memoryview___dealloc__(o);
     if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
     --Py_REFCNT(o);
     PyErr_Restore(etype, eval, etb);
   }
-  Py_CLEAR(p->mode);
-  Py_CLEAR(p->_format);
+  Py_CLEAR(p->obj);
+  Py_CLEAR(p->_size);
+  Py_CLEAR(p->_array_interface);
   (*Py_TYPE(o)->tp_free)(o);
 }
 
-static int __pyx_tp_traverse_array(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) {
   int e;
-  struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
-  if (p->mode) {
-    e = (*v)(p->mode, a); if (e) return e;
+  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
+  if (p->obj) {
+    e = (*v)(p->obj, a); if (e) return e;
   }
-  if (p->_format) {
-    e = (*v)(p->_format, a); if (e) return e;
+  if (p->_size) {
+    e = (*v)(p->_size, a); if (e) return e;
+  }
+  if (p->_array_interface) {
+    e = (*v)(p->_array_interface, a); if (e) return e;
+  }
+  if (p->view.obj) {
+    e = (*v)(p->view.obj, a); if (e) return e;
   }
   return 0;
 }
 
-static int __pyx_tp_clear_array(PyObject *o) {
-  struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
+static int __pyx_tp_clear_memoryview(PyObject *o) {
+  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
   PyObject* tmp;
-  tmp = ((PyObject*)p->mode);
-  p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
+  tmp = ((PyObject*)p->obj);
+  p->obj = Py_None; Py_INCREF(Py_None);
   Py_XDECREF(tmp);
-  tmp = ((PyObject*)p->_format);
-  p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
+  tmp = ((PyObject*)p->_size);
+  p->_size = Py_None; Py_INCREF(Py_None);
+  Py_XDECREF(tmp);
+  tmp = ((PyObject*)p->_array_interface);
+  p->_array_interface = Py_None; Py_INCREF(Py_None);
   Py_XDECREF(tmp);
+  Py_CLEAR(p->view.obj);
   return 0;
 }
-static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
+static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
   PyObject *r;
   PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
   r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
@@ -15866,9 +16075,9 @@ static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
   return r;
 }
 
-static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) {
+static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) {
   if (v) {
-    return __pyx_array___setitem__(o, i, v);
+    return __pyx_memoryview___setitem__(o, i, v);
   }
   else {
     PyErr_Format(PyExc_NotImplementedError,
@@ -15877,92 +16086,68 @@ static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) {
   }
 }
 
-static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) {
-  PyObject *v = PyObject_GenericGetAttr(o, n);
-  if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
-    PyErr_Clear();
-    v = __pyx_array___getattr__(o, n);
-  }
-  return v;
+static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_transpose(o);
 }
 
-static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) {
-  return get_memview(o);
+static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview__get__base(o);
 }
 
-static PyMethodDef __pyx_methods_array[] = {
-  {__Pyx_NAMESTR("__getattr__"), (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, __Pyx_DOCSTR(0)},
+static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_shape(o);
+}
+
+static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_strides(o);
+}
+
+static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_suboffsets(o);
+}
+
+static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_ndim(o);
+}
+
+static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_itemsize(o);
+}
+
+static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_nbytes(o);
+}
+
+static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_size(o);
+}
+
+static PyMethodDef __pyx_methods_memoryview[] = {
+  {__Pyx_NAMESTR("is_c_contig"), (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, __Pyx_DOCSTR(0)},
+  {__Pyx_NAMESTR("is_f_contig"), (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, __Pyx_DOCSTR(0)},
+  {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, __Pyx_DOCSTR(0)},
+  {__Pyx_NAMESTR("copy_fortran"), (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, __Pyx_DOCSTR(0)},
   {0, 0, 0, 0}
 };
 
-static struct PyGetSetDef __pyx_getsets_array[] = {
-  {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, 0, 0},
+static struct PyGetSetDef __pyx_getsets_memoryview[] = {
+  {(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, 0, 0},
+  {(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, 0, 0},
+  {(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, 0, 0},
+  {(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, 0, 0},
+  {(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, 0, 0},
+  {(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, 0, 0},
+  {(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, 0, 0},
+  {(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, 0, 0},
+  {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, 0, 0},
   {0, 0, 0, 0, 0}
 };
 
-static PyNumberMethods __pyx_tp_as_number_array = {
-  0, /*nb_add*/
-  0, /*nb_subtract*/
-  0, /*nb_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_divide*/
-  #endif
-  0, /*nb_remainder*/
-  0, /*nb_divmod*/
-  0, /*nb_power*/
-  0, /*nb_negative*/
-  0, /*nb_positive*/
-  0, /*nb_absolute*/
-  0, /*nb_nonzero*/
-  0, /*nb_invert*/
-  0, /*nb_lshift*/
-  0, /*nb_rshift*/
-  0, /*nb_and*/
-  0, /*nb_xor*/
-  0, /*nb_or*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_coerce*/
-  #endif
-  0, /*nb_int*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_long*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*nb_float*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_oct*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_hex*/
-  #endif
-  0, /*nb_inplace_add*/
-  0, /*nb_inplace_subtract*/
-  0, /*nb_inplace_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_inplace_divide*/
-  #endif
-  0, /*nb_inplace_remainder*/
-  0, /*nb_inplace_power*/
-  0, /*nb_inplace_lshift*/
-  0, /*nb_inplace_rshift*/
-  0, /*nb_inplace_and*/
-  0, /*nb_inplace_xor*/
-  0, /*nb_inplace_or*/
-  0, /*nb_floor_divide*/
-  0, /*nb_true_divide*/
-  0, /*nb_inplace_floor_divide*/
-  0, /*nb_inplace_true_divide*/
-  #if PY_VERSION_HEX >= 0x02050000
-  0, /*nb_index*/
-  #endif
-};
-
-static PySequenceMethods __pyx_tp_as_sequence_array = {
-  0, /*sq_length*/
+static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
+  __pyx_memoryview___len__, /*sq_length*/
   0, /*sq_concat*/
   0, /*sq_repeat*/
-  __pyx_sq_item_array, /*sq_item*/
+  __pyx_sq_item_memoryview, /*sq_item*/
   0, /*sq_slice*/
   0, /*sq_ass_item*/
   0, /*sq_ass_slice*/
@@ -15971,13 +16156,13 @@ static PySequenceMethods __pyx_tp_as_sequence_array = {
   0, /*sq_inplace_repeat*/
 };
 
-static PyMappingMethods __pyx_tp_as_mapping_array = {
-  0, /*mp_length*/
-  __pyx_array___getitem__, /*mp_subscript*/
-  __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/
+static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
+  __pyx_memoryview___len__, /*mp_length*/
+  __pyx_memoryview___getitem__, /*mp_subscript*/
+  __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/
 };
 
-static PyBufferProcs __pyx_tp_as_buffer_array = {
+static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
   #if PY_MAJOR_VERSION < 3
   0, /*bf_getreadbuffer*/
   #endif
@@ -15991,19 +16176,19 @@ static PyBufferProcs __pyx_tp_as_buffer_array = {
   0, /*bf_getcharbuffer*/
   #endif
   #if PY_VERSION_HEX >= 0x02060000
-  __pyx_array_getbuffer, /*bf_getbuffer*/
+  __pyx_memoryview_getbuffer, /*bf_getbuffer*/
   #endif
   #if PY_VERSION_HEX >= 0x02060000
   0, /*bf_releasebuffer*/
   #endif
 };
 
-static PyTypeObject __pyx_type___pyx_array = {
+static PyTypeObject __pyx_type___pyx_memoryview = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("_geometry.array"), /*tp_name*/
-  sizeof(struct __pyx_array_obj), /*tp_basicsize*/
+  __Pyx_NAMESTR("_geometry.memoryview"), /*tp_name*/
+  sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_array, /*tp_dealloc*/
+  __pyx_tp_dealloc_memoryview, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -16012,27 +16197,27 @@ static PyTypeObject __pyx_type___pyx_array = {
   #else
   0, /*reserved*/
   #endif
-  0, /*tp_repr*/
-  &__pyx_tp_as_number_array, /*tp_as_number*/
-  &__pyx_tp_as_sequence_array, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping_array, /*tp_as_mapping*/
+  __pyx_memoryview___repr__, /*tp_repr*/
+  0, /*tp_as_number*/
+  &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/
+  &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/
   0, /*tp_hash*/
   0, /*tp_call*/
-  0, /*tp_str*/
-  __pyx_tp_getattro_array, /*tp_getattro*/
+  __pyx_memoryview___str__, /*tp_str*/
+  0, /*tp_getattro*/
   0, /*tp_setattro*/
-  &__pyx_tp_as_buffer_array, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+  &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
   0, /*tp_doc*/
-  __pyx_tp_traverse_array, /*tp_traverse*/
-  __pyx_tp_clear_array, /*tp_clear*/
+  __pyx_tp_traverse_memoryview, /*tp_traverse*/
+  __pyx_tp_clear_memoryview, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
   0, /*tp_iter*/
   0, /*tp_iternext*/
-  __pyx_methods_array, /*tp_methods*/
+  __pyx_methods_memoryview, /*tp_methods*/
   0, /*tp_members*/
-  __pyx_getsets_array, /*tp_getset*/
+  __pyx_getsets_memoryview, /*tp_getset*/
   0, /*tp_base*/
   0, /*tp_dict*/
   0, /*tp_descr_get*/
@@ -16040,7 +16225,7 @@ static PyTypeObject __pyx_type___pyx_array = {
   0, /*tp_dictoffset*/
   0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_array, /*tp_new*/
+  __pyx_tp_new_memoryview, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -16052,108 +16237,112 @@ static PyTypeObject __pyx_type___pyx_array = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
-static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
-  struct __pyx_MemviewEnum_obj *p;
-  PyObject *o = (*t->tp_alloc)(t, 0);
-  if (!o) return 0;
-  p = ((struct __pyx_MemviewEnum_obj *)o);
-  p->name = Py_None; Py_INCREF(Py_None);
+static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
+  struct __pyx_array_obj *p;
+  PyObject *o;
+  o = (*t->tp_alloc)(t, 0);
+  if (unlikely(!o)) return 0;
+  p = ((struct __pyx_array_obj *)o);
+  p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
+  p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
+  if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) {
+    Py_DECREF(o); o = 0;
+  }
   return o;
 }
 
-static void __pyx_tp_dealloc_Enum(PyObject *o) {
-  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
-  Py_CLEAR(p->name);
+static void __pyx_tp_dealloc_array(PyObject *o) {
+  struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
+  PyObject_GC_UnTrack(o);
+  {
+    PyObject *etype, *eval, *etb;
+    PyErr_Fetch(&etype, &eval, &etb);
+    ++Py_REFCNT(o);
+    __pyx_array___dealloc__(o);
+    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
+    --Py_REFCNT(o);
+    PyErr_Restore(etype, eval, etb);
+  }
+  Py_CLEAR(p->mode);
+  Py_CLEAR(p->_format);
   (*Py_TYPE(o)->tp_free)(o);
 }
 
-static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_array(PyObject *o, visitproc v, void *a) {
   int e;
-  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
-  if (p->name) {
-    e = (*v)(p->name, a); if (e) return e;
+  struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
+  if (p->mode) {
+    e = (*v)(p->mode, a); if (e) return e;
+  }
+  if (p->_format) {
+    e = (*v)(p->_format, a); if (e) return e;
   }
   return 0;
 }
 
-static int __pyx_tp_clear_Enum(PyObject *o) {
-  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
+static int __pyx_tp_clear_array(PyObject *o) {
+  struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
   PyObject* tmp;
-  tmp = ((PyObject*)p->name);
-  p->name = Py_None; Py_INCREF(Py_None);
+  tmp = ((PyObject*)p->mode);
+  p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
+  Py_XDECREF(tmp);
+  tmp = ((PyObject*)p->_format);
+  p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
   Py_XDECREF(tmp);
   return 0;
 }
+static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
+  PyObject *r;
+  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
+  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
+  Py_DECREF(x);
+  return r;
+}
 
-static PyMethodDef __pyx_methods_Enum[] = {
+static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) {
+  if (v) {
+    return __pyx_array___setitem__(o, i, v);
+  }
+  else {
+    PyErr_Format(PyExc_NotImplementedError,
+      "Subscript deletion not supported by %s", Py_TYPE(o)->tp_name);
+    return -1;
+  }
+}
+
+static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) {
+  PyObject *v = PyObject_GenericGetAttr(o, n);
+  if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
+    PyErr_Clear();
+    v = __pyx_array___getattr__(o, n);
+  }
+  return v;
+}
+
+static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) {
+  return get_memview(o);
+}
+
+static PyMethodDef __pyx_methods_array[] = {
+  {__Pyx_NAMESTR("__getattr__"), (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, __Pyx_DOCSTR(0)},
   {0, 0, 0, 0}
 };
 
-static PyNumberMethods __pyx_tp_as_number_Enum = {
-  0, /*nb_add*/
-  0, /*nb_subtract*/
-  0, /*nb_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_divide*/
-  #endif
-  0, /*nb_remainder*/
-  0, /*nb_divmod*/
-  0, /*nb_power*/
-  0, /*nb_negative*/
-  0, /*nb_positive*/
-  0, /*nb_absolute*/
-  0, /*nb_nonzero*/
-  0, /*nb_invert*/
-  0, /*nb_lshift*/
-  0, /*nb_rshift*/
-  0, /*nb_and*/
-  0, /*nb_xor*/
-  0, /*nb_or*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_coerce*/
-  #endif
-  0, /*nb_int*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_long*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*nb_float*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_oct*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_hex*/
-  #endif
-  0, /*nb_inplace_add*/
-  0, /*nb_inplace_subtract*/
-  0, /*nb_inplace_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_inplace_divide*/
-  #endif
-  0, /*nb_inplace_remainder*/
-  0, /*nb_inplace_power*/
-  0, /*nb_inplace_lshift*/
-  0, /*nb_inplace_rshift*/
-  0, /*nb_inplace_and*/
-  0, /*nb_inplace_xor*/
-  0, /*nb_inplace_or*/
-  0, /*nb_floor_divide*/
-  0, /*nb_true_divide*/
-  0, /*nb_inplace_floor_divide*/
-  0, /*nb_inplace_true_divide*/
-  #if PY_VERSION_HEX >= 0x02050000
-  0, /*nb_index*/
-  #endif
+static struct PyGetSetDef __pyx_getsets_array[] = {
+  {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, 0, 0},
+  {0, 0, 0, 0, 0}
 };
 
-static PySequenceMethods __pyx_tp_as_sequence_Enum = {
+static PySequenceMethods __pyx_tp_as_sequence_array = {
   0, /*sq_length*/
   0, /*sq_concat*/
   0, /*sq_repeat*/
-  0, /*sq_item*/
+  __pyx_sq_item_array, /*sq_item*/
   0, /*sq_slice*/
   0, /*sq_ass_item*/
   0, /*sq_ass_slice*/
@@ -16162,13 +16351,13 @@ static PySequenceMethods __pyx_tp_as_sequence_Enum = {
   0, /*sq_inplace_repeat*/
 };
 
-static PyMappingMethods __pyx_tp_as_mapping_Enum = {
+static PyMappingMethods __pyx_tp_as_mapping_array = {
   0, /*mp_length*/
-  0, /*mp_subscript*/
-  0, /*mp_ass_subscript*/
+  __pyx_array___getitem__, /*mp_subscript*/
+  __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/
 };
 
-static PyBufferProcs __pyx_tp_as_buffer_Enum = {
+static PyBufferProcs __pyx_tp_as_buffer_array = {
   #if PY_MAJOR_VERSION < 3
   0, /*bf_getreadbuffer*/
   #endif
@@ -16182,19 +16371,19 @@ static PyBufferProcs __pyx_tp_as_buffer_Enum = {
   0, /*bf_getcharbuffer*/
   #endif
   #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_getbuffer*/
+  __pyx_array_getbuffer, /*bf_getbuffer*/
   #endif
   #if PY_VERSION_HEX >= 0x02060000
   0, /*bf_releasebuffer*/
   #endif
 };
 
-static PyTypeObject __pyx_type___pyx_MemviewEnum = {
+static PyTypeObject __pyx_type___pyx_array = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("_geometry.Enum"), /*tp_name*/
-  sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/
+  __Pyx_NAMESTR("_geometry.array"), /*tp_name*/
+  sizeof(struct __pyx_array_obj), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_Enum, /*tp_dealloc*/
+  __pyx_tp_dealloc_array, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -16203,35 +16392,35 @@ static PyTypeObject __pyx_type___pyx_MemviewEnum = {
   #else
   0, /*reserved*/
   #endif
-  __pyx_MemviewEnum___repr__, /*tp_repr*/
-  &__pyx_tp_as_number_Enum, /*tp_as_number*/
-  &__pyx_tp_as_sequence_Enum, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping_Enum, /*tp_as_mapping*/
+  0, /*tp_repr*/
+  0, /*tp_as_number*/
+  &__pyx_tp_as_sequence_array, /*tp_as_sequence*/
+  &__pyx_tp_as_mapping_array, /*tp_as_mapping*/
   0, /*tp_hash*/
   0, /*tp_call*/
   0, /*tp_str*/
-  0, /*tp_getattro*/
+  __pyx_tp_getattro_array, /*tp_getattro*/
   0, /*tp_setattro*/
-  &__pyx_tp_as_buffer_Enum, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+  &__pyx_tp_as_buffer_array, /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
   0, /*tp_doc*/
-  __pyx_tp_traverse_Enum, /*tp_traverse*/
-  __pyx_tp_clear_Enum, /*tp_clear*/
+  __pyx_tp_traverse_array, /*tp_traverse*/
+  __pyx_tp_clear_array, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
   0, /*tp_iter*/
   0, /*tp_iternext*/
-  __pyx_methods_Enum, /*tp_methods*/
+  __pyx_methods_array, /*tp_methods*/
   0, /*tp_members*/
-  0, /*tp_getset*/
+  __pyx_getsets_array, /*tp_getset*/
   0, /*tp_base*/
   0, /*tp_dict*/
   0, /*tp_descr_get*/
   0, /*tp_descr_set*/
   0, /*tp_dictoffset*/
-  __pyx_MemviewEnum___init__, /*tp_init*/
+  0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_Enum, /*tp_new*/
+  __pyx_tp_new_array, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -16243,255 +16432,56 @@ static PyTypeObject __pyx_type___pyx_MemviewEnum = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
-static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;
 
-static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
-  struct __pyx_memoryview_obj *p;
-  PyObject *o = (*t->tp_alloc)(t, 0);
-  if (!o) return 0;
-  p = ((struct __pyx_memoryview_obj *)o);
-  p->__pyx_vtab = __pyx_vtabptr_memoryview;
-  p->obj = Py_None; Py_INCREF(Py_None);
-  p->_size = Py_None; Py_INCREF(Py_None);
-  p->_array_interface = Py_None; Py_INCREF(Py_None);
-  p->view.obj = NULL;
-  if (__pyx_memoryview___cinit__(o, a, k) < 0) {
-    Py_DECREF(o); o = 0;
-  }
+static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+  struct __pyx_MemviewEnum_obj *p;
+  PyObject *o;
+  o = (*t->tp_alloc)(t, 0);
+  if (unlikely(!o)) return 0;
+  p = ((struct __pyx_MemviewEnum_obj *)o);
+  p->name = Py_None; Py_INCREF(Py_None);
   return o;
 }
 
-static void __pyx_tp_dealloc_memoryview(PyObject *o) {
-  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
-  {
-    PyObject *etype, *eval, *etb;
-    PyErr_Fetch(&etype, &eval, &etb);
-    ++Py_REFCNT(o);
-    __pyx_memoryview___dealloc__(o);
-    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
-    --Py_REFCNT(o);
-    PyErr_Restore(etype, eval, etb);
-  }
-  Py_CLEAR(p->obj);
-  Py_CLEAR(p->_size);
-  Py_CLEAR(p->_array_interface);
+static void __pyx_tp_dealloc_Enum(PyObject *o) {
+  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
+  PyObject_GC_UnTrack(o);
+  Py_CLEAR(p->name);
   (*Py_TYPE(o)->tp_free)(o);
 }
 
-static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) {
   int e;
-  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
-  if (p->obj) {
-    e = (*v)(p->obj, a); if (e) return e;
-  }
-  if (p->_size) {
-    e = (*v)(p->_size, a); if (e) return e;
-  }
-  if (p->_array_interface) {
-    e = (*v)(p->_array_interface, a); if (e) return e;
-  }
-  if (p->view.obj) {
-    e = (*v)(p->view.obj, a); if (e) return e;
+  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
+  if (p->name) {
+    e = (*v)(p->name, a); if (e) return e;
   }
   return 0;
 }
 
-static int __pyx_tp_clear_memoryview(PyObject *o) {
-  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
+static int __pyx_tp_clear_Enum(PyObject *o) {
+  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
   PyObject* tmp;
-  tmp = ((PyObject*)p->obj);
-  p->obj = Py_None; Py_INCREF(Py_None);
-  Py_XDECREF(tmp);
-  tmp = ((PyObject*)p->_size);
-  p->_size = Py_None; Py_INCREF(Py_None);
-  Py_XDECREF(tmp);
-  tmp = ((PyObject*)p->_array_interface);
-  p->_array_interface = Py_None; Py_INCREF(Py_None);
+  tmp = ((PyObject*)p->name);
+  p->name = Py_None; Py_INCREF(Py_None);
   Py_XDECREF(tmp);
-  Py_CLEAR(p->view.obj);
   return 0;
 }
-static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
-  PyObject *r;
-  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
-  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
-  Py_DECREF(x);
-  return r;
-}
-
-static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) {
-  if (v) {
-    return __pyx_memoryview___setitem__(o, i, v);
-  }
-  else {
-    PyErr_Format(PyExc_NotImplementedError,
-      "Subscript deletion not supported by %s", Py_TYPE(o)->tp_name);
-    return -1;
-  }
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_transpose(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview__get__base(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_shape(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_strides(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_suboffsets(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_ndim(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_itemsize(o);
-}
 
-static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_nbytes(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_size(o);
-}
-
-static PyMethodDef __pyx_methods_memoryview[] = {
-  {__Pyx_NAMESTR("is_c_contig"), (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, __Pyx_DOCSTR(0)},
-  {__Pyx_NAMESTR("is_f_contig"), (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, __Pyx_DOCSTR(0)},
-  {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, __Pyx_DOCSTR(0)},
-  {__Pyx_NAMESTR("copy_fortran"), (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, __Pyx_DOCSTR(0)},
+static PyMethodDef __pyx_methods_Enum[] = {
   {0, 0, 0, 0}
 };
 
-static struct PyGetSetDef __pyx_getsets_memoryview[] = {
-  {(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, 0, 0},
-  {(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, 0, 0},
-  {(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, 0, 0},
-  {(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, 0, 0},
-  {(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, 0, 0},
-  {(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, 0, 0},
-  {(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, 0, 0},
-  {(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, 0, 0},
-  {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, 0, 0},
-  {0, 0, 0, 0, 0}
-};
-
-static PyNumberMethods __pyx_tp_as_number_memoryview = {
-  0, /*nb_add*/
-  0, /*nb_subtract*/
-  0, /*nb_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_divide*/
-  #endif
-  0, /*nb_remainder*/
-  0, /*nb_divmod*/
-  0, /*nb_power*/
-  0, /*nb_negative*/
-  0, /*nb_positive*/
-  0, /*nb_absolute*/
-  0, /*nb_nonzero*/
-  0, /*nb_invert*/
-  0, /*nb_lshift*/
-  0, /*nb_rshift*/
-  0, /*nb_and*/
-  0, /*nb_xor*/
-  0, /*nb_or*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_coerce*/
-  #endif
-  0, /*nb_int*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_long*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*nb_float*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_oct*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_hex*/
-  #endif
-  0, /*nb_inplace_add*/
-  0, /*nb_inplace_subtract*/
-  0, /*nb_inplace_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_inplace_divide*/
-  #endif
-  0, /*nb_inplace_remainder*/
-  0, /*nb_inplace_power*/
-  0, /*nb_inplace_lshift*/
-  0, /*nb_inplace_rshift*/
-  0, /*nb_inplace_and*/
-  0, /*nb_inplace_xor*/
-  0, /*nb_inplace_or*/
-  0, /*nb_floor_divide*/
-  0, /*nb_true_divide*/
-  0, /*nb_inplace_floor_divide*/
-  0, /*nb_inplace_true_divide*/
-  #if PY_VERSION_HEX >= 0x02050000
-  0, /*nb_index*/
-  #endif
-};
-
-static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
-  __pyx_memoryview___len__, /*sq_length*/
-  0, /*sq_concat*/
-  0, /*sq_repeat*/
-  __pyx_sq_item_memoryview, /*sq_item*/
-  0, /*sq_slice*/
-  0, /*sq_ass_item*/
-  0, /*sq_ass_slice*/
-  0, /*sq_contains*/
-  0, /*sq_inplace_concat*/
-  0, /*sq_inplace_repeat*/
-};
-
-static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
-  __pyx_memoryview___len__, /*mp_length*/
-  __pyx_memoryview___getitem__, /*mp_subscript*/
-  __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/
-};
-
-static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getreadbuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getwritebuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getsegcount*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getcharbuffer*/
-  #endif
-  #if PY_VERSION_HEX >= 0x02060000
-  __pyx_memoryview_getbuffer, /*bf_getbuffer*/
-  #endif
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_releasebuffer*/
-  #endif
-};
-
-static PyTypeObject __pyx_type___pyx_memoryview = {
+static PyTypeObject __pyx_type___pyx_MemviewEnum = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("_geometry.memoryview"), /*tp_name*/
-  sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/
+  __Pyx_NAMESTR("_geometry.Enum"), /*tp_name*/
+  sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_memoryview, /*tp_dealloc*/
+  __pyx_tp_dealloc_Enum, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -16500,35 +16490,35 @@ static PyTypeObject __pyx_type___pyx_memoryview = {
   #else
   0, /*reserved*/
   #endif
-  __pyx_memoryview___repr__, /*tp_repr*/
-  &__pyx_tp_as_number_memoryview, /*tp_as_number*/
-  &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/
+  __pyx_MemviewEnum___repr__, /*tp_repr*/
+  0, /*tp_as_number*/
+  0, /*tp_as_sequence*/
+  0, /*tp_as_mapping*/
   0, /*tp_hash*/
   0, /*tp_call*/
-  __pyx_memoryview___str__, /*tp_str*/
+  0, /*tp_str*/
   0, /*tp_getattro*/
   0, /*tp_setattro*/
-  &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+  0, /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
   0, /*tp_doc*/
-  __pyx_tp_traverse_memoryview, /*tp_traverse*/
-  __pyx_tp_clear_memoryview, /*tp_clear*/
+  __pyx_tp_traverse_Enum, /*tp_traverse*/
+  __pyx_tp_clear_Enum, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
   0, /*tp_iter*/
   0, /*tp_iternext*/
-  __pyx_methods_memoryview, /*tp_methods*/
+  __pyx_methods_Enum, /*tp_methods*/
   0, /*tp_members*/
-  __pyx_getsets_memoryview, /*tp_getset*/
+  0, /*tp_getset*/
   0, /*tp_base*/
   0, /*tp_dict*/
   0, /*tp_descr_get*/
   0, /*tp_descr_set*/
   0, /*tp_dictoffset*/
-  0, /*tp_init*/
+  __pyx_MemviewEnum___init__, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_memoryview, /*tp_new*/
+  __pyx_tp_new_Enum, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -16540,13 +16530,16 @@ static PyTypeObject __pyx_type___pyx_memoryview = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice;
 
 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) {
   struct __pyx_memoryviewslice_obj *p;
   PyObject *o = __pyx_tp_new_memoryview(t, a, k);
-  if (!o) return 0;
+  if (unlikely(!o)) return 0;
   p = ((struct __pyx_memoryviewslice_obj *)o);
   p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice;
   p->from_object = Py_None; Py_INCREF(Py_None);
@@ -16556,6 +16549,7 @@ static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyO
 
 static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) {
   struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
+  PyObject_GC_UnTrack(o);
   {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
@@ -16566,6 +16560,7 @@ static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) {
     PyErr_Restore(etype, eval, etb);
   }
   Py_CLEAR(p->from_object);
+  PyObject_GC_Track(o);
   __pyx_tp_dealloc_memoryview(o);
 }
 
@@ -16586,135 +16581,21 @@ static int __pyx_tp_clear__memoryviewslice(PyObject *o) {
   tmp = ((PyObject*)p->from_object);
   p->from_object = Py_None; Py_INCREF(Py_None);
   Py_XDECREF(tmp);
-  __PYX_XDEC_MEMVIEW(&p->from_slice, 1);
-  return 0;
-}
-
-static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryviewslice__get__base(o);
-}
-
-static PyMethodDef __pyx_methods__memoryviewslice[] = {
-  {0, 0, 0, 0}
-};
-
-static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = {
-  {(char *)"base", __pyx_getprop___pyx_memoryviewslice_base, 0, 0, 0},
-  {0, 0, 0, 0, 0}
-};
-
-static PyNumberMethods __pyx_tp_as_number__memoryviewslice = {
-  0, /*nb_add*/
-  0, /*nb_subtract*/
-  0, /*nb_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_divide*/
-  #endif
-  0, /*nb_remainder*/
-  0, /*nb_divmod*/
-  0, /*nb_power*/
-  0, /*nb_negative*/
-  0, /*nb_positive*/
-  0, /*nb_absolute*/
-  0, /*nb_nonzero*/
-  0, /*nb_invert*/
-  0, /*nb_lshift*/
-  0, /*nb_rshift*/
-  0, /*nb_and*/
-  0, /*nb_xor*/
-  0, /*nb_or*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_coerce*/
-  #endif
-  0, /*nb_int*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_long*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*nb_float*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_oct*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_hex*/
-  #endif
-  0, /*nb_inplace_add*/
-  0, /*nb_inplace_subtract*/
-  0, /*nb_inplace_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_inplace_divide*/
-  #endif
-  0, /*nb_inplace_remainder*/
-  0, /*nb_inplace_power*/
-  0, /*nb_inplace_lshift*/
-  0, /*nb_inplace_rshift*/
-  0, /*nb_inplace_and*/
-  0, /*nb_inplace_xor*/
-  0, /*nb_inplace_or*/
-  0, /*nb_floor_divide*/
-  0, /*nb_true_divide*/
-  0, /*nb_inplace_floor_divide*/
-  0, /*nb_inplace_true_divide*/
-  #if PY_VERSION_HEX >= 0x02050000
-  0, /*nb_index*/
-  #endif
-};
-
-static PySequenceMethods __pyx_tp_as_sequence__memoryviewslice = {
-  #if CYTHON_COMPILING_IN_PYPY
-  __pyx_memoryview___len__, /*sq_length*/
-  #else
-  0, /*sq_length*/
-  #endif
-  0, /*sq_concat*/
-  0, /*sq_repeat*/
-  0, /*sq_item*/
-  0, /*sq_slice*/
-  0, /*sq_ass_item*/
-  0, /*sq_ass_slice*/
-  0, /*sq_contains*/
-  0, /*sq_inplace_concat*/
-  0, /*sq_inplace_repeat*/
-};
+  __PYX_XDEC_MEMVIEW(&p->from_slice, 1);
+  return 0;
+}
 
-static PyMappingMethods __pyx_tp_as_mapping__memoryviewslice = {
-  #if CYTHON_COMPILING_IN_PYPY
-  __pyx_memoryview___len__, /*mp_length*/
-  #else
-  0, /*mp_length*/
-  #endif
-  #if CYTHON_COMPILING_IN_PYPY
-  __pyx_memoryview___getitem__, /*mp_subscript*/
-  #else
-  0, /*mp_subscript*/
-  #endif
-  0, /*mp_ass_subscript*/
+static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryviewslice__get__base(o);
+}
+
+static PyMethodDef __pyx_methods__memoryviewslice[] = {
+  {0, 0, 0, 0}
 };
 
-static PyBufferProcs __pyx_tp_as_buffer__memoryviewslice = {
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getreadbuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getwritebuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getsegcount*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getcharbuffer*/
-  #endif
-  #if CYTHON_COMPILING_IN_PYPY
-  __pyx_memoryview_getbuffer, /*bf_getbuffer*/
-  #else
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_getbuffer*/
-  #endif
-  #endif
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_releasebuffer*/
-  #endif
+static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = {
+  {(char *)"base", __pyx_getprop___pyx_memoryviewslice_base, 0, 0, 0},
+  {0, 0, 0, 0, 0}
 };
 
 static PyTypeObject __pyx_type___pyx_memoryviewslice = {
@@ -16736,9 +16617,9 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = {
   #else
   0, /*tp_repr*/
   #endif
-  &__pyx_tp_as_number__memoryviewslice, /*tp_as_number*/
-  &__pyx_tp_as_sequence__memoryviewslice, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping__memoryviewslice, /*tp_as_mapping*/
+  0, /*tp_as_number*/
+  0, /*tp_as_sequence*/
+  0, /*tp_as_mapping*/
   0, /*tp_hash*/
   0, /*tp_call*/
   #if CYTHON_COMPILING_IN_PYPY
@@ -16748,8 +16629,8 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = {
   #endif
   0, /*tp_getattro*/
   0, /*tp_setattro*/
-  &__pyx_tp_as_buffer__memoryviewslice, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+  0, /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
   __Pyx_DOCSTR("Internal class for passing memoryview slices to Python"), /*tp_doc*/
   __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/
   __pyx_tp_clear__memoryviewslice, /*tp_clear*/
@@ -16779,6 +16660,9 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
 static PyMethodDef __pyx_methods[] = {
@@ -16787,7 +16671,11 @@ static PyMethodDef __pyx_methods[] = {
 
 #if PY_MAJOR_VERSION >= 3
 static struct PyModuleDef __pyx_moduledef = {
+  #if PY_VERSION_HEX < 0x03020000
+    { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
+  #else
     PyModuleDef_HEAD_INIT,
+  #endif
     __Pyx_NAMESTR("_geometry"),
     0, /* m_doc */
     -1, /* m_size */
@@ -16837,9 +16725,12 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s__TypeError, __pyx_k__TypeError, sizeof(__pyx_k__TypeError), 0, 0, 1, 1},
   {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1},
   {&__pyx_n_s____class__, __pyx_k____class__, sizeof(__pyx_k____class__), 0, 0, 1, 1},
+  {&__pyx_n_s____import__, __pyx_k____import__, sizeof(__pyx_k____import__), 0, 0, 1, 1},
   {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
   {&__pyx_n_s____name__, __pyx_k____name__, sizeof(__pyx_k____name__), 0, 0, 1, 1},
   {&__pyx_n_s____pyx_getbuffer, __pyx_k____pyx_getbuffer, sizeof(__pyx_k____pyx_getbuffer), 0, 0, 1, 1},
+  {&__pyx_n_s____pyx_releasebuffer, __pyx_k____pyx_releasebuffer, sizeof(__pyx_k____pyx_releasebuffer), 0, 0, 1, 1},
+  {&__pyx_n_s____pyx_vtable__, __pyx_k____pyx_vtable__, sizeof(__pyx_k____pyx_vtable__), 0, 0, 1, 1},
   {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
   {&__pyx_n_s___geometry, __pyx_k___geometry, sizeof(__pyx_k___geometry), 0, 0, 1, 1},
   {&__pyx_n_s__allocate_buffer, __pyx_k__allocate_buffer, sizeof(__pyx_k__allocate_buffer), 0, 0, 1, 1},
@@ -16903,20 +16794,20 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {0, 0, 0, 0, 0, 0, 0}
 };
 static int __Pyx_InitCachedBuiltins(void) {
-  __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_MemoryError = __Pyx_GetName(__pyx_b, __pyx_n_s__MemoryError); if (!__pyx_builtin_MemoryError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_enumerate = __Pyx_GetName(__pyx_b, __pyx_n_s__enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_Ellipsis = __Pyx_GetName(__pyx_b, __pyx_n_s__Ellipsis); if (!__pyx_builtin_Ellipsis) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s__MemoryError); if (!__pyx_builtin_MemoryError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s__enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s__Ellipsis); if (!__pyx_builtin_Ellipsis) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   #if PY_MAJOR_VERSION >= 3
-  __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   #else
-  __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__xrange); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s__xrange); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   #endif
-  __pyx_builtin_id = __Pyx_GetName(__pyx_b, __pyx_n_s__id); if (!__pyx_builtin_id) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_IndexError = __Pyx_GetName(__pyx_b, __pyx_n_s__IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s__id); if (!__pyx_builtin_id) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s__IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   return 0;
   __pyx_L1_error:;
   return -1;
@@ -16933,11 +16824,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
  */
-  __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_2 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_1)); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_2);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_kp_u_1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_1));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2));
 
   /* "numpy.pxd":219
@@ -16947,11 +16835,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *             info.buf = PyArray_DATA(self)
  */
-  __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_4 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_3)); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_4);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_3));
-  PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_kp_u_3));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4));
 
   /* "numpy.pxd":257
@@ -16961,11 +16846,8 @@ static int __Pyx_InitCachedConstants(void) {
  *                 if   t == NPY_BYTE:        f = "b"
  *                 elif t == NPY_UBYTE:       f = "B"
  */
-  __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_6 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_5)); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_6);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_5));
-  PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_kp_u_5));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6));
 
   /* "numpy.pxd":799
@@ -16975,11 +16857,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *         if ((child.byteorder == c'>' and little_endian) or
  */
-  __pyx_k_tuple_9 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_9 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_8)); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_9);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_8));
-  PyTuple_SET_ITEM(__pyx_k_tuple_9, 0, ((PyObject *)__pyx_kp_u_8));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_8));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9));
 
   /* "numpy.pxd":803
@@ -16989,11 +16868,8 @@ static int __Pyx_InitCachedConstants(void) {
  *             # One could encode it in the format string and have Cython
  *             # complain instead, BUT: < and > in format strings also imply
  */
-  __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_10 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_5)); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_10);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_5));
-  PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_kp_u_5));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10));
 
   /* "numpy.pxd":823
@@ -17003,11 +16879,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *             # Until ticket #99 is fixed, use integers to avoid warnings
  */
-  __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_12 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_11)); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_12);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_11));
-  PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_u_11));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_11));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12));
 
   /* "View.MemoryView":124
@@ -17017,11 +16890,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *         if self.itemsize <= 0:
  */
-  __pyx_k_tuple_14 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_14 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_13)); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_14);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_13));
-  PyTuple_SET_ITEM(__pyx_k_tuple_14, 0, ((PyObject *)__pyx_kp_s_13));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_13));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14));
 
   /* "View.MemoryView":127
@@ -17031,11 +16901,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *         encode = getattr(format, 'encode', None)
  */
-  __pyx_k_tuple_16 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_16 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_15)); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_16);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_15));
-  PyTuple_SET_ITEM(__pyx_k_tuple_16, 0, ((PyObject *)__pyx_kp_s_15));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_15));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16));
 
   /* "View.MemoryView":131
@@ -17045,11 +16912,8 @@ static int __Pyx_InitCachedConstants(void) {
  *         self._format = format
  *         self.format = self._format
  */
-  __pyx_k_tuple_17 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_17 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__ASCII)); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_17);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__ASCII));
-  PyTuple_SET_ITEM(__pyx_k_tuple_17, 0, ((PyObject *)__pyx_n_s__ASCII));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ASCII));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17));
 
   /* "View.MemoryView":141
@@ -17059,11 +16923,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  * 
  */
-  __pyx_k_tuple_19 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_19 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_18)); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_19);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_18));
-  PyTuple_SET_ITEM(__pyx_k_tuple_19, 0, ((PyObject *)__pyx_kp_s_18));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_18));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_19));
 
   /* "View.MemoryView":166
@@ -17073,11 +16934,8 @@ static int __Pyx_InitCachedConstants(void) {
  *         self.mode = mode
  * 
  */
-  __pyx_k_tuple_22 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_22)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_22 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__ASCII)); if (unlikely(!__pyx_k_tuple_22)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_22);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__ASCII));
-  PyTuple_SET_ITEM(__pyx_k_tuple_22, 0, ((PyObject *)__pyx_n_s__ASCII));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ASCII));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_22));
 
   /* "View.MemoryView":174
@@ -17087,11 +16945,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *             if self.dtype_is_object:
  */
-  __pyx_k_tuple_24 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_24)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_24 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_23)); if (unlikely(!__pyx_k_tuple_24)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_24);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_23));
-  PyTuple_SET_ITEM(__pyx_k_tuple_24, 0, ((PyObject *)__pyx_kp_s_23));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_23));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_24));
 
   /* "View.MemoryView":190
@@ -17101,11 +16956,8 @@ static int __Pyx_InitCachedConstants(void) {
  *         info.buf = self.data
  *         info.len = self.len
  */
-  __pyx_k_tuple_26 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_26)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_26 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_25)); if (unlikely(!__pyx_k_tuple_26)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_26);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_25));
-  PyTuple_SET_ITEM(__pyx_k_tuple_26, 0, ((PyObject *)__pyx_kp_s_25));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_25));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_26));
 
   /* "View.MemoryView":452
@@ -17115,11 +16967,8 @@ static int __Pyx_InitCachedConstants(void) {
  *         else:
  *             if len(self.view.format) == 1:
  */
-  __pyx_k_tuple_28 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_28)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_28 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_27)); if (unlikely(!__pyx_k_tuple_28)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_28);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_27));
-  PyTuple_SET_ITEM(__pyx_k_tuple_28, 0, ((PyObject *)__pyx_kp_s_27));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_27));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_28));
 
   /* "View.MemoryView":528
@@ -17129,11 +16978,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *             return tuple([self.view.strides[i] for i in xrange(self.view.ndim)])
  */
-  __pyx_k_tuple_30 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_30)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_30 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_29)); if (unlikely(!__pyx_k_tuple_30)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_30);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_29));
-  PyTuple_SET_ITEM(__pyx_k_tuple_30, 0, ((PyObject *)__pyx_kp_s_29));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_29));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_30));
 
   /* "View.MemoryView":643
@@ -17143,11 +16989,8 @@ static int __Pyx_InitCachedConstants(void) {
  *                 seen_ellipsis = True
  *             else:
  */
-  __pyx_k_tuple_33 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_33)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_33 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_k_tuple_33)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_33);
-  __Pyx_INCREF(Py_None);
-  PyTuple_SET_ITEM(__pyx_k_tuple_33, 0, Py_None);
-  __Pyx_GIVEREF(Py_None);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_33));
 
   /* "View.MemoryView":646
@@ -17157,11 +17000,8 @@ static int __Pyx_InitCachedConstants(void) {
  *             have_slices = True
  *         else:
  */
-  __pyx_k_tuple_34 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_34)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_34 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_k_tuple_34)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_34);
-  __Pyx_INCREF(Py_None);
-  PyTuple_SET_ITEM(__pyx_k_tuple_34, 0, Py_None);
-  __Pyx_GIVEREF(Py_None);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_34));
 
   /* "View.MemoryView":657
@@ -17171,11 +17011,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *     return have_slices or nslices, tuple(result)
  */
-  __pyx_k_tuple_36 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_36)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_36 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_k_tuple_36)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_36);
-  __Pyx_INCREF(Py_None);
-  PyTuple_SET_ITEM(__pyx_k_tuple_36, 0, Py_None);
-  __Pyx_GIVEREF(Py_None);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_36));
 
   /* "View.MemoryView":665
@@ -17185,11 +17022,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  * 
  */
-  __pyx_k_tuple_38 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_38)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_38 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_37)); if (unlikely(!__pyx_k_tuple_38)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_38);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_37));
-  PyTuple_SET_ITEM(__pyx_k_tuple_38, 0, ((PyObject *)__pyx_kp_s_37));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_37));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_38));
 
   /* "_geometry.pyx":91
@@ -17199,59 +17033,8 @@ static int __Pyx_InitCachedConstants(void) {
  *              numpy.ndarray pos1 not None, numpy.ndarray pos2 not None):
  *     """
  */
-  __pyx_k_tuple_46 = PyTuple_New(17); if (unlikely(!__pyx_k_tuple_46)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_46 = PyTuple_Pack(17, ((PyObject *)__pyx_n_s__L), ((PyObject *)__pyx_n_s__rot1), ((PyObject *)__pyx_n_s__rot2), ((PyObject *)__pyx_n_s__rot3), ((PyObject *)__pyx_n_s__pos1), ((PyObject *)__pyx_n_s__pos2), ((PyObject *)__pyx_n_s__sinRot1), ((PyObject *)__pyx_n_s__cosRot1), ((PyObject *)__pyx_n_s__sinRot2), ((PyObject *)__pyx_n_s__cosRot2), ((PyObject *)__pyx_n_s__sinRot3), ((PyObject *)__pyx_n_s__cosRot3), ((PyObject *)__pyx_n_s__size), ((PyObject *)__pyx_n_s__i), ((PyObje [...]
   __Pyx_GOTREF(__pyx_k_tuple_46);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__L));
-  PyTuple_SET_ITEM(__pyx_k_tuple_46, 0, ((PyObject *)__pyx_n_s__L));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__L));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__rot1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_46, 1, ((PyObject *)__pyx_n_s__rot1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rot1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__rot2));
-  PyTuple_SET_ITEM(__pyx_k_tuple_46, 2, ((PyObject *)__pyx_n_s__rot2));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rot2));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__rot3));
-  PyTuple_SET_ITEM(__pyx_k_tuple_46, 3, ((PyObject *)__pyx_n_s__rot3));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rot3));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_46, 4, ((PyObject *)__pyx_n_s__pos1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos2));
-  PyTuple_SET_ITEM(__pyx_k_tuple_46, 5, ((PyObject *)__pyx_n_s__pos2));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos2));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__sinRot1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_46, 6, ((PyObject *)__pyx_n_s__sinRot1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sinRot1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cosRot1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_46, 7, ((PyObject *)__pyx_n_s__cosRot1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cosRot1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__sinRot2));
-  PyTuple_SET_ITEM(__pyx_k_tuple_46, 8, ((PyObject *)__pyx_n_s__sinRot2));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sinRot2));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cosRot2));
-  PyTuple_SET_ITEM(__pyx_k_tuple_46, 9, ((PyObject *)__pyx_n_s__cosRot2));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cosRot2));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__sinRot3));
-  PyTuple_SET_ITEM(__pyx_k_tuple_46, 10, ((PyObject *)__pyx_n_s__sinRot3));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sinRot3));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cosRot3));
-  PyTuple_SET_ITEM(__pyx_k_tuple_46, 11, ((PyObject *)__pyx_n_s__cosRot3));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cosRot3));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__size));
-  PyTuple_SET_ITEM(__pyx_k_tuple_46, 12, ((PyObject *)__pyx_n_s__size));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__size));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
-  PyTuple_SET_ITEM(__pyx_k_tuple_46, 13, ((PyObject *)__pyx_n_s__i));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__c1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_46, 14, ((PyObject *)__pyx_n_s__c1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__c1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__c2));
-  PyTuple_SET_ITEM(__pyx_k_tuple_46, 15, ((PyObject *)__pyx_n_s__c2));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__c2));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
-  PyTuple_SET_ITEM(__pyx_k_tuple_46, 16, ((PyObject *)__pyx_n_s__out));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_46));
   __pyx_k_codeobj_47 = (PyObject*)__Pyx_PyCode_New(6, 0, 17, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_48, __pyx_n_s__calc_tth, 91, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_47)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
@@ -17262,59 +17045,8 @@ static int __Pyx_InitCachedConstants(void) {
  *              numpy.ndarray pos1 not None, numpy.ndarray pos2 not None):
  *     """
  */
-  __pyx_k_tuple_49 = PyTuple_New(17); if (unlikely(!__pyx_k_tuple_49)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_49 = PyTuple_Pack(17, ((PyObject *)__pyx_n_s__L), ((PyObject *)__pyx_n_s__rot1), ((PyObject *)__pyx_n_s__rot2), ((PyObject *)__pyx_n_s__rot3), ((PyObject *)__pyx_n_s__pos1), ((PyObject *)__pyx_n_s__pos2), ((PyObject *)__pyx_n_s__sinRot1), ((PyObject *)__pyx_n_s__cosRot1), ((PyObject *)__pyx_n_s__sinRot2), ((PyObject *)__pyx_n_s__cosRot2), ((PyObject *)__pyx_n_s__sinRot3), ((PyObject *)__pyx_n_s__cosRot3), ((PyObject *)__pyx_n_s__size), ((PyObject *)__pyx_n_s__i), ((PyObje [...]
   __Pyx_GOTREF(__pyx_k_tuple_49);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__L));
-  PyTuple_SET_ITEM(__pyx_k_tuple_49, 0, ((PyObject *)__pyx_n_s__L));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__L));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__rot1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_49, 1, ((PyObject *)__pyx_n_s__rot1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rot1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__rot2));
-  PyTuple_SET_ITEM(__pyx_k_tuple_49, 2, ((PyObject *)__pyx_n_s__rot2));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rot2));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__rot3));
-  PyTuple_SET_ITEM(__pyx_k_tuple_49, 3, ((PyObject *)__pyx_n_s__rot3));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rot3));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_49, 4, ((PyObject *)__pyx_n_s__pos1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos2));
-  PyTuple_SET_ITEM(__pyx_k_tuple_49, 5, ((PyObject *)__pyx_n_s__pos2));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos2));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__sinRot1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_49, 6, ((PyObject *)__pyx_n_s__sinRot1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sinRot1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cosRot1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_49, 7, ((PyObject *)__pyx_n_s__cosRot1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cosRot1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__sinRot2));
-  PyTuple_SET_ITEM(__pyx_k_tuple_49, 8, ((PyObject *)__pyx_n_s__sinRot2));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sinRot2));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cosRot2));
-  PyTuple_SET_ITEM(__pyx_k_tuple_49, 9, ((PyObject *)__pyx_n_s__cosRot2));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cosRot2));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__sinRot3));
-  PyTuple_SET_ITEM(__pyx_k_tuple_49, 10, ((PyObject *)__pyx_n_s__sinRot3));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sinRot3));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cosRot3));
-  PyTuple_SET_ITEM(__pyx_k_tuple_49, 11, ((PyObject *)__pyx_n_s__cosRot3));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cosRot3));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__size));
-  PyTuple_SET_ITEM(__pyx_k_tuple_49, 12, ((PyObject *)__pyx_n_s__size));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__size));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
-  PyTuple_SET_ITEM(__pyx_k_tuple_49, 13, ((PyObject *)__pyx_n_s__i));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__c1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_49, 14, ((PyObject *)__pyx_n_s__c1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__c1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__c2));
-  PyTuple_SET_ITEM(__pyx_k_tuple_49, 15, ((PyObject *)__pyx_n_s__c2));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__c2));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
-  PyTuple_SET_ITEM(__pyx_k_tuple_49, 16, ((PyObject *)__pyx_n_s__out));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_49));
   __pyx_k_codeobj_50 = (PyObject*)__Pyx_PyCode_New(6, 0, 17, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_49, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_48, __pyx_n_s__calc_chi, 121, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_50)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
@@ -17325,62 +17057,8 @@ static int __Pyx_InitCachedConstants(void) {
  *              numpy.ndarray pos1 not None, numpy.ndarray pos2 not None, double wavelength):
  *     """
  */
-  __pyx_k_tuple_51 = PyTuple_New(18); if (unlikely(!__pyx_k_tuple_51)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_51 = PyTuple_Pack(18, ((PyObject *)__pyx_n_s__L), ((PyObject *)__pyx_n_s__rot1), ((PyObject *)__pyx_n_s__rot2), ((PyObject *)__pyx_n_s__rot3), ((PyObject *)__pyx_n_s__pos1), ((PyObject *)__pyx_n_s__pos2), ((PyObject *)__pyx_n_s__wavelength), ((PyObject *)__pyx_n_s__sinRot1), ((PyObject *)__pyx_n_s__cosRot1), ((PyObject *)__pyx_n_s__sinRot2), ((PyObject *)__pyx_n_s__cosRot2), ((PyObject *)__pyx_n_s__sinRot3), ((PyObject *)__pyx_n_s__cosRot3), ((PyObject *)__pyx_n_s__size), [...]
   __Pyx_GOTREF(__pyx_k_tuple_51);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__L));
-  PyTuple_SET_ITEM(__pyx_k_tuple_51, 0, ((PyObject *)__pyx_n_s__L));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__L));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__rot1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_51, 1, ((PyObject *)__pyx_n_s__rot1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rot1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__rot2));
-  PyTuple_SET_ITEM(__pyx_k_tuple_51, 2, ((PyObject *)__pyx_n_s__rot2));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rot2));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__rot3));
-  PyTuple_SET_ITEM(__pyx_k_tuple_51, 3, ((PyObject *)__pyx_n_s__rot3));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rot3));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_51, 4, ((PyObject *)__pyx_n_s__pos1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos2));
-  PyTuple_SET_ITEM(__pyx_k_tuple_51, 5, ((PyObject *)__pyx_n_s__pos2));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos2));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__wavelength));
-  PyTuple_SET_ITEM(__pyx_k_tuple_51, 6, ((PyObject *)__pyx_n_s__wavelength));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__wavelength));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__sinRot1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_51, 7, ((PyObject *)__pyx_n_s__sinRot1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sinRot1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cosRot1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_51, 8, ((PyObject *)__pyx_n_s__cosRot1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cosRot1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__sinRot2));
-  PyTuple_SET_ITEM(__pyx_k_tuple_51, 9, ((PyObject *)__pyx_n_s__sinRot2));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sinRot2));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cosRot2));
-  PyTuple_SET_ITEM(__pyx_k_tuple_51, 10, ((PyObject *)__pyx_n_s__cosRot2));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cosRot2));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__sinRot3));
-  PyTuple_SET_ITEM(__pyx_k_tuple_51, 11, ((PyObject *)__pyx_n_s__sinRot3));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sinRot3));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cosRot3));
-  PyTuple_SET_ITEM(__pyx_k_tuple_51, 12, ((PyObject *)__pyx_n_s__cosRot3));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cosRot3));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__size));
-  PyTuple_SET_ITEM(__pyx_k_tuple_51, 13, ((PyObject *)__pyx_n_s__size));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__size));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
-  PyTuple_SET_ITEM(__pyx_k_tuple_51, 14, ((PyObject *)__pyx_n_s__i));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__c1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_51, 15, ((PyObject *)__pyx_n_s__c1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__c1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__c2));
-  PyTuple_SET_ITEM(__pyx_k_tuple_51, 16, ((PyObject *)__pyx_n_s__c2));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__c2));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
-  PyTuple_SET_ITEM(__pyx_k_tuple_51, 17, ((PyObject *)__pyx_n_s__out));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_51));
   __pyx_k_codeobj_52 = (PyObject*)__Pyx_PyCode_New(7, 0, 18, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_51, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_48, __pyx_n_s__calc_q, 156, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_52)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
@@ -17391,59 +17069,8 @@ static int __Pyx_InitCachedConstants(void) {
  *              numpy.ndarray pos1 not None, numpy.ndarray pos2 not None):
  *     """
  */
-  __pyx_k_tuple_53 = PyTuple_New(17); if (unlikely(!__pyx_k_tuple_53)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_53 = PyTuple_Pack(17, ((PyObject *)__pyx_n_s__L), ((PyObject *)__pyx_n_s__rot1), ((PyObject *)__pyx_n_s__rot2), ((PyObject *)__pyx_n_s__rot3), ((PyObject *)__pyx_n_s__pos1), ((PyObject *)__pyx_n_s__pos2), ((PyObject *)__pyx_n_s__sinRot1), ((PyObject *)__pyx_n_s__cosRot1), ((PyObject *)__pyx_n_s__sinRot2), ((PyObject *)__pyx_n_s__cosRot2), ((PyObject *)__pyx_n_s__sinRot3), ((PyObject *)__pyx_n_s__cosRot3), ((PyObject *)__pyx_n_s__size), ((PyObject *)__pyx_n_s__i), ((PyObje [...]
   __Pyx_GOTREF(__pyx_k_tuple_53);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__L));
-  PyTuple_SET_ITEM(__pyx_k_tuple_53, 0, ((PyObject *)__pyx_n_s__L));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__L));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__rot1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_53, 1, ((PyObject *)__pyx_n_s__rot1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rot1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__rot2));
-  PyTuple_SET_ITEM(__pyx_k_tuple_53, 2, ((PyObject *)__pyx_n_s__rot2));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rot2));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__rot3));
-  PyTuple_SET_ITEM(__pyx_k_tuple_53, 3, ((PyObject *)__pyx_n_s__rot3));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rot3));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_53, 4, ((PyObject *)__pyx_n_s__pos1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos2));
-  PyTuple_SET_ITEM(__pyx_k_tuple_53, 5, ((PyObject *)__pyx_n_s__pos2));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos2));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__sinRot1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_53, 6, ((PyObject *)__pyx_n_s__sinRot1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sinRot1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cosRot1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_53, 7, ((PyObject *)__pyx_n_s__cosRot1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cosRot1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__sinRot2));
-  PyTuple_SET_ITEM(__pyx_k_tuple_53, 8, ((PyObject *)__pyx_n_s__sinRot2));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sinRot2));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cosRot2));
-  PyTuple_SET_ITEM(__pyx_k_tuple_53, 9, ((PyObject *)__pyx_n_s__cosRot2));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cosRot2));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__sinRot3));
-  PyTuple_SET_ITEM(__pyx_k_tuple_53, 10, ((PyObject *)__pyx_n_s__sinRot3));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sinRot3));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cosRot3));
-  PyTuple_SET_ITEM(__pyx_k_tuple_53, 11, ((PyObject *)__pyx_n_s__cosRot3));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cosRot3));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__size));
-  PyTuple_SET_ITEM(__pyx_k_tuple_53, 12, ((PyObject *)__pyx_n_s__size));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__size));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
-  PyTuple_SET_ITEM(__pyx_k_tuple_53, 13, ((PyObject *)__pyx_n_s__i));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__c1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_53, 14, ((PyObject *)__pyx_n_s__c1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__c1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__c2));
-  PyTuple_SET_ITEM(__pyx_k_tuple_53, 15, ((PyObject *)__pyx_n_s__c2));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__c2));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
-  PyTuple_SET_ITEM(__pyx_k_tuple_53, 16, ((PyObject *)__pyx_n_s__out));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_53));
   __pyx_k_codeobj_54 = (PyObject*)__Pyx_PyCode_New(6, 0, 17, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_53, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_48, __pyx_n_s__calc_r, 192, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_54)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
@@ -17454,11 +17081,8 @@ static int __Pyx_InitCachedConstants(void) {
  * cdef strided = Enum("<strided and direct>") # default
  * cdef indirect = Enum("<strided and indirect>")
  */
-  __pyx_k_tuple_57 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_57)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_57 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_56)); if (unlikely(!__pyx_k_tuple_57)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_57);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_56));
-  PyTuple_SET_ITEM(__pyx_k_tuple_57, 0, ((PyObject *)__pyx_kp_s_56));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_56));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_57));
 
   /* "View.MemoryView":283
@@ -17468,11 +17092,8 @@ static int __Pyx_InitCachedConstants(void) {
  * cdef indirect = Enum("<strided and indirect>")
  * 
  */
-  __pyx_k_tuple_59 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_59)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_59 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_58)); if (unlikely(!__pyx_k_tuple_59)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_59);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_58));
-  PyTuple_SET_ITEM(__pyx_k_tuple_59, 0, ((PyObject *)__pyx_kp_s_58));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_58));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_59));
 
   /* "View.MemoryView":284
@@ -17482,11 +17103,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  * 
  */
-  __pyx_k_tuple_61 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_61)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_61 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_60)); if (unlikely(!__pyx_k_tuple_61)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_61);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_60));
-  PyTuple_SET_ITEM(__pyx_k_tuple_61, 0, ((PyObject *)__pyx_kp_s_60));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_60));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_61));
 
   /* "View.MemoryView":287
@@ -17496,11 +17114,8 @@ static int __Pyx_InitCachedConstants(void) {
  * cdef indirect_contiguous = Enum("<contiguous and indirect>")
  * 
  */
-  __pyx_k_tuple_63 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_63)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_63 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_62)); if (unlikely(!__pyx_k_tuple_63)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_63);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_62));
-  PyTuple_SET_ITEM(__pyx_k_tuple_63, 0, ((PyObject *)__pyx_kp_s_62));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_62));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_63));
 
   /* "View.MemoryView":288
@@ -17510,11 +17125,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  * 
  */
-  __pyx_k_tuple_65 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_65)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_65 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_64)); if (unlikely(!__pyx_k_tuple_65)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_65);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_64));
-  PyTuple_SET_ITEM(__pyx_k_tuple_65, 0, ((PyObject *)__pyx_kp_s_64));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_64));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_65));
   __Pyx_RefNannyFinishContext();
   return 0;
@@ -17524,11 +17136,14 @@ static int __Pyx_InitCachedConstants(void) {
 }
 
 static int __Pyx_InitGlobals(void) {
+  /* InitThreads.init */
   #ifdef WITH_THREAD
 PyEval_InitThreads();
 #endif
 
-if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
   __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
   __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
   __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
@@ -17547,6 +17162,9 @@ PyMODINIT_FUNC PyInit__geometry(void)
 #endif
 {
   PyObject *__pyx_t_1 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannyDeclarations
   #if CYTHON_REFNANNY
   __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
@@ -17584,6 +17202,16 @@ PyMODINIT_FUNC PyInit__geometry(void)
   __pyx_m = PyModule_Create(&__pyx_moduledef);
   #endif
   if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  Py_INCREF(__pyx_d);
+  #if PY_MAJOR_VERSION >= 3
+  {
+    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (!PyDict_GetItemString(modules, "_geometry")) {
+      if (unlikely(PyDict_SetItemString(modules, "_geometry", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    }
+  }
+  #endif
   __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   #if CYTHON_COMPILING_IN_PYPY
   Py_INCREF(__pyx_b);
@@ -17591,6 +17219,9 @@ PyMODINIT_FUNC PyInit__geometry(void)
   if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
   /*--- Initialize various global constants etc. ---*/
   if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
+  if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  #endif
   if (__pyx_module_is_main__geometry) {
     if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
   }
@@ -17607,12 +17238,6 @@ PyMODINIT_FUNC PyInit__geometry(void)
   /*--- Variable export code ---*/
   /*--- Function export code ---*/
   /*--- Type init code ---*/
-  if (PyType_Ready(&__pyx_type___pyx_array) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "array", (PyObject *)&__pyx_type___pyx_array) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_array_type = &__pyx_type___pyx_array;
-  if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "Enum", (PyObject *)&__pyx_type___pyx_MemviewEnum) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
   __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview;
   __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer;
   __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice;
@@ -17623,8 +17248,11 @@ PyMODINIT_FUNC PyInit__geometry(void)
   __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object;
   if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "memoryview", (PyObject *)&__pyx_type___pyx_memoryview) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_memoryview_type = &__pyx_type___pyx_memoryview;
+  if (PyType_Ready(&__pyx_type___pyx_array) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_array_type = &__pyx_type___pyx_array;
+  if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
   __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice;
   __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview;
   __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object;
@@ -17632,7 +17260,6 @@ PyMODINIT_FUNC PyInit__geometry(void)
   __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type;
   if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "_memoryviewslice", (PyObject *)&__pyx_type___pyx_memoryviewslice) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice;
   /*--- Type import code ---*/
   __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", 
@@ -17660,7 +17287,7 @@ PyMODINIT_FUNC PyInit__geometry(void)
  */
   __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__numpy, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s__numpy, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
   /* "_geometry.pyx":91
@@ -17672,7 +17299,7 @@ PyMODINIT_FUNC PyInit__geometry(void)
  */
   __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9_geometry_1calc_tth, NULL, __pyx_n_s___geometry); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__calc_tth, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s__calc_tth, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
   /* "_geometry.pyx":121
@@ -17684,7 +17311,7 @@ PyMODINIT_FUNC PyInit__geometry(void)
  */
   __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9_geometry_3calc_chi, NULL, __pyx_n_s___geometry); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__calc_chi, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s__calc_chi, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
   /* "_geometry.pyx":156
@@ -17696,7 +17323,7 @@ PyMODINIT_FUNC PyInit__geometry(void)
  */
   __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9_geometry_5calc_q, NULL, __pyx_n_s___geometry); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__calc_q, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s__calc_q, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
   /* "_geometry.pyx":192
@@ -17708,7 +17335,7 @@ PyMODINIT_FUNC PyInit__geometry(void)
  */
   __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9_geometry_7calc_r, NULL, __pyx_n_s___geometry); 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);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__calc_r, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s__calc_r, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
   /* "_geometry.pyx":1
@@ -17718,7 +17345,7 @@ PyMODINIT_FUNC PyInit__geometry(void)
  */
   __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
   /* "View.MemoryView":207
@@ -17744,9 +17371,8 @@ PyMODINIT_FUNC PyInit__geometry(void)
   __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_57), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_XGOTREF(generic);
-  __Pyx_DECREF(generic);
+  __Pyx_DECREF_SET(generic, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
-  generic = __pyx_t_1;
   __pyx_t_1 = 0;
 
   /* "View.MemoryView":283
@@ -17759,9 +17385,8 @@ PyMODINIT_FUNC PyInit__geometry(void)
   __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_59), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_XGOTREF(strided);
-  __Pyx_DECREF(strided);
+  __Pyx_DECREF_SET(strided, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
-  strided = __pyx_t_1;
   __pyx_t_1 = 0;
 
   /* "View.MemoryView":284
@@ -17774,9 +17399,8 @@ PyMODINIT_FUNC PyInit__geometry(void)
   __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_61), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_XGOTREF(indirect);
-  __Pyx_DECREF(indirect);
+  __Pyx_DECREF_SET(indirect, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
-  indirect = __pyx_t_1;
   __pyx_t_1 = 0;
 
   /* "View.MemoryView":287
@@ -17789,9 +17413,8 @@ PyMODINIT_FUNC PyInit__geometry(void)
   __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_63), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_XGOTREF(contiguous);
-  __Pyx_DECREF(contiguous);
+  __Pyx_DECREF_SET(contiguous, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
-  contiguous = __pyx_t_1;
   __pyx_t_1 = 0;
 
   /* "View.MemoryView":288
@@ -17804,9 +17427,8 @@ PyMODINIT_FUNC PyInit__geometry(void)
   __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_65), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_XGOTREF(indirect_contiguous);
-  __Pyx_DECREF(indirect_contiguous);
+  __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
-  indirect_contiguous = __pyx_t_1;
   __pyx_t_1 = 0;
 
   /* "View.MemoryView":503
@@ -18036,17 +17658,32 @@ static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed
     return 0;
 }
 
-static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
+static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
+    PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
+    if (unlikely(!result)) {
+        PyErr_Format(PyExc_NameError,
+#if PY_MAJOR_VERSION >= 3
+            "name '%U' is not defined", name);
+#else
+            "name '%s' is not defined", PyString_AS_STRING(name));
+#endif
+    }
+    return result;
+}
+
+static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
     PyObject *result;
-    result = PyObject_GetAttr(dict, name);
+#if CYTHON_COMPILING_IN_CPYTHON
+    result = PyDict_GetItem(__pyx_d, name);
+    if (result) {
+        Py_INCREF(result);
+    } else {
+#else
+    result = PyObject_GetItem(__pyx_d, name);
     if (!result) {
-        if (dict != __pyx_b) {
-            PyErr_Clear();
-            result = PyObject_GetAttr(__pyx_b, name);
-        }
-        if (!result) {
-            PyErr_SetObject(PyExc_NameError, name);
-        }
+        PyErr_Clear();
+#endif
+        result = __Pyx_GetBuiltinName(name);
     }
     return result;
 }
@@ -18553,245 +18190,59 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha
       default:
         {
           int number = __Pyx_BufFmt_ExpectNumber(&ts);
-          if (number == -1) return NULL;
-          ctx->new_count = (size_t)number;
-        }
-    }
-  }
-}
-static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) {
-  buf->buf = NULL;
-  buf->obj = NULL;
-  buf->strides = __Pyx_zeros;
-  buf->shape = __Pyx_zeros;
-  buf->suboffsets = __Pyx_minusones;
-}
-static CYTHON_INLINE int __Pyx_GetBufferAndValidate(
-        Py_buffer* buf, PyObject* obj,  __Pyx_TypeInfo* dtype, int flags,
-        int nd, int cast, __Pyx_BufFmt_StackElem* stack)
-{
-  if (obj == Py_None || obj == NULL) {
-    __Pyx_ZeroBuffer(buf);
-    return 0;
-  }
-  buf->buf = NULL;
-  if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail;
-  if (buf->ndim != nd) {
-    PyErr_Format(PyExc_ValueError,
-                 "Buffer has wrong number of dimensions (expected %d, got %d)",
-                 nd, buf->ndim);
-    goto fail;
-  }
-  if (!cast) {
-    __Pyx_BufFmt_Context ctx;
-    __Pyx_BufFmt_Init(&ctx, stack, dtype);
-    if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
-  }
-  if ((unsigned)buf->itemsize != dtype->size) {
-    PyErr_Format(PyExc_ValueError,
-      "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)",
-      buf->itemsize, (buf->itemsize > 1) ? "s" : "",
-      dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : "");
-    goto fail;
-  }
-  if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
-  return 0;
-fail:;
-  __Pyx_ZeroBuffer(buf);
-  return -1;
-}
-static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
-  if (info->buf == NULL) return;
-  if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
-  __Pyx_ReleaseBuffer(info);
-}
-
-static int
-__pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b)
-{
-    int i;
-    if (!a || !b)
-        return 0;
-    if (a == b)
-        return 1;
-    if (a->size != b->size || a->typegroup != b->typegroup ||
-            a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) {
-        if (a->typegroup == 'H' || b->typegroup == 'H') {
-            return a->size == b->size;
-        } else {
-            return 0;
-        }
-    }
-    if (a->ndim) {
-        for (i = 0; i < a->ndim; i++)
-            if (a->arraysize[i] != b->arraysize[i])
-                return 0;
-    }
-    if (a->typegroup == 'S') {
-        if (a->flags != b->flags)
-            return 0;
-        if (a->fields || b->fields) {
-            if (!(a->fields && b->fields))
-                return 0;
-            for (i = 0; a->fields[i].type && b->fields[i].type; i++) {
-                __Pyx_StructField *field_a = a->fields + i;
-                __Pyx_StructField *field_b = b->fields + i;
-                if (field_a->offset != field_b->offset ||
-                    !__pyx_typeinfo_cmp(field_a->type, field_b->type))
-                    return 0;
-            }
-            return !a->fields[i].type && !b->fields[i].type;
-        }
-    }
-    return 1;
-}
-
-static int __Pyx_ValidateAndInit_memviewslice(
-                int *axes_specs,
-                int c_or_f_flag,
-                int buf_flags,
-                int ndim,
-                __Pyx_TypeInfo *dtype,
-                __Pyx_BufFmt_StackElem stack[],
-                __Pyx_memviewslice *memviewslice,
-                PyObject *original_obj)
-{
-    struct __pyx_memoryview_obj *memview, *new_memview;
-    __Pyx_RefNannyDeclarations
-    Py_buffer *buf;
-    int i, spec = 0, retval = -1;
-    __Pyx_BufFmt_Context ctx;
-    int from_memoryview = __pyx_memoryview_check(original_obj);
-    __Pyx_RefNannySetupContext("ValidateAndInit_memviewslice", 0);
-    if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((struct __pyx_memoryview_obj *)
-                                                            original_obj)->typeinfo)) {
-        memview = (struct __pyx_memoryview_obj *) original_obj;
-        new_memview = NULL;
-    } else {
-        memview = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
-                                            original_obj, buf_flags, 0, dtype);
-        new_memview = memview;
-        if (unlikely(!memview))
-            goto fail;
-    }
-    buf = &memview->view;
-    if (buf->ndim != ndim) {
-        PyErr_Format(PyExc_ValueError,
-                "Buffer has wrong number of dimensions (expected %d, got %d)",
-                ndim, buf->ndim);
-        goto fail;
-    }
-    if (new_memview) {
-        __Pyx_BufFmt_Init(&ctx, stack, dtype);
-        if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
-    }
-    if ((unsigned)buf->itemsize != dtype->size) {
-        PyErr_Format(PyExc_ValueError,
-                     "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "u byte%s) "
-                     "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "u byte%s)",
-                     buf->itemsize,
-                     (buf->itemsize > 1) ? "s" : "",
-                     dtype->name,
-                     dtype->size,
-                     (dtype->size > 1) ? "s" : "");
-        goto fail;
-    }
-    for (i = 0; i < ndim; i++) {
-        spec = axes_specs[i];
-        if (buf->strides) {
-            if (spec & __Pyx_MEMVIEW_CONTIG) {
-                if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) {
-                    if (buf->strides[i] != sizeof(void *)) {
-                        PyErr_Format(PyExc_ValueError,
-                            "Buffer is not indirectly contiguous in dimension %d.", i);
-                        goto fail;
-                    }
-                } else if (buf->strides[i] != buf->itemsize) {
-                    PyErr_SetString(PyExc_ValueError,
-                        "Buffer and memoryview are not contiguous in the same dimension.");
-                    goto fail;
-                }
-            }
-            if (spec & __Pyx_MEMVIEW_FOLLOW) {
-                Py_ssize_t stride = buf->strides[i];
-                if (stride < 0)
-                    stride = -stride;
-                if (stride < buf->itemsize) {
-                    PyErr_SetString(PyExc_ValueError,
-                        "Buffer and memoryview are not contiguous in the same dimension.");
-                    goto fail;
-                }
-            }
-        } else {
-            if (spec & __Pyx_MEMVIEW_CONTIG && i != ndim - 1) {
-                PyErr_Format(PyExc_ValueError,
-                             "C-contiguous buffer is not contiguous in "
-                             "dimension %d", i);
-                goto fail;
-            } else if (spec & (__Pyx_MEMVIEW_PTR)) {
-                PyErr_Format(PyExc_ValueError,
-                             "C-contiguous buffer is not indirect in "
-                             "dimension %d", i);
-                goto fail;
-            } else if (buf->suboffsets) {
-                PyErr_SetString(PyExc_ValueError,
-                                "Buffer exposes suboffsets but no strides");
-                goto fail;
-            }
-        }
-        /* Todo: without PyBUF_INDIRECT we may not have suboffset information, i.e., the
-           ptr may not be set to NULL but may be uninitialized? */
-        if (spec & __Pyx_MEMVIEW_DIRECT) {
-            if (buf->suboffsets && buf->suboffsets[i] >= 0) {
-                PyErr_Format(PyExc_ValueError,
-                    "Buffer not compatible with direct access in dimension %d.", i);
-                goto fail;
-            }
-        }
-        if (spec & __Pyx_MEMVIEW_PTR) {
-            if (!buf->suboffsets || (buf->suboffsets && buf->suboffsets[i] < 0)) {
-                PyErr_Format(PyExc_ValueError,
-                    "Buffer is not indirectly accessisble in dimension %d.", i);
-                goto fail;
-            }
-        }
-    }
-    if (buf->strides) {
-        if (c_or_f_flag & __Pyx_IS_F_CONTIG) {
-            Py_ssize_t stride = 1;
-            for (i=0; i<ndim; i++) {
-                if (stride * buf->itemsize != buf->strides[i]) {
-                    PyErr_SetString(PyExc_ValueError,
-                        "Buffer not fortran contiguous.");
-                    goto fail;
-                }
-                stride = stride * buf->shape[i];
-            }
-        } else if (c_or_f_flag & __Pyx_IS_C_CONTIG) {
-            Py_ssize_t stride = 1;
-            for (i = ndim-1; i>-1; i--) {
-                if(stride * buf->itemsize != buf->strides[i]) {
-                    PyErr_SetString(PyExc_ValueError,
-                        "Buffer not C contiguous.");
-                    goto fail;
-                }
-                stride = stride * buf->shape[i];
-            }
+          if (number == -1) return NULL;
+          ctx->new_count = (size_t)number;
         }
     }
-    if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice,
-                                         new_memview != NULL) == -1)) {
-        goto fail;
-    }
-    retval = 0;
-    goto no_fail;
-fail:
-    Py_XDECREF(new_memview);
-    retval = -1;
-no_fail:
-    __Pyx_RefNannyFinishContext();
-    return retval;
+  }
+}
+static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) {
+  buf->buf = NULL;
+  buf->obj = NULL;
+  buf->strides = __Pyx_zeros;
+  buf->shape = __Pyx_zeros;
+  buf->suboffsets = __Pyx_minusones;
+}
+static CYTHON_INLINE int __Pyx_GetBufferAndValidate(
+        Py_buffer* buf, PyObject* obj,  __Pyx_TypeInfo* dtype, int flags,
+        int nd, int cast, __Pyx_BufFmt_StackElem* stack)
+{
+  if (obj == Py_None || obj == NULL) {
+    __Pyx_ZeroBuffer(buf);
+    return 0;
+  }
+  buf->buf = NULL;
+  if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail;
+  if (buf->ndim != nd) {
+    PyErr_Format(PyExc_ValueError,
+                 "Buffer has wrong number of dimensions (expected %d, got %d)",
+                 nd, buf->ndim);
+    goto fail;
+  }
+  if (!cast) {
+    __Pyx_BufFmt_Context ctx;
+    __Pyx_BufFmt_Init(&ctx, stack, dtype);
+    if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
+  }
+  if ((unsigned)buf->itemsize != dtype->size) {
+    PyErr_Format(PyExc_ValueError,
+      "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)",
+      buf->itemsize, (buf->itemsize > 1) ? "s" : "",
+      dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : "");
+    goto fail;
+  }
+  if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
+  return 0;
+fail:;
+  __Pyx_ZeroBuffer(buf);
+  return -1;
 }
+static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
+  if (info->buf == NULL) return;
+  if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
+  __Pyx_ReleaseBuffer(info);
+}
+
 static int
 __Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview,
                         int ndim,
@@ -18996,24 +18447,23 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
         }
         value = type;
         #if PY_VERSION_HEX < 0x02050000
-            if (PyInstance_Check(type)) {
-                type = (PyObject*) ((PyInstanceObject*)type)->in_class;
-                Py_INCREF(type);
-            }
-            else {
-                type = 0;
-                PyErr_SetString(PyExc_TypeError,
-                    "raise: exception must be an old-style class or instance");
-                goto raise_error;
-            }
-        #else
-            type = (PyObject*) Py_TYPE(type);
+        if (PyInstance_Check(type)) {
+            type = (PyObject*) ((PyInstanceObject*)type)->in_class;
             Py_INCREF(type);
-            if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
-                PyErr_SetString(PyExc_TypeError,
-                    "raise: exception class must be a subclass of BaseException");
-                goto raise_error;
-            }
+        } else {
+            type = 0;
+            PyErr_SetString(PyExc_TypeError,
+                "raise: exception must be an old-style class or instance");
+            goto raise_error;
+        }
+        #else
+        type = (PyObject*) Py_TYPE(type);
+        Py_INCREF(type);
+        if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
+            PyErr_SetString(PyExc_TypeError,
+                "raise: exception class must be a subclass of BaseException");
+            goto raise_error;
+        }
         #endif
     }
     __Pyx_ErrRestore(type, value, tb);
@@ -19045,46 +18495,62 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject
         value = type;
         type = (PyObject*) Py_TYPE(value);
     } else if (PyExceptionClass_Check(type)) {
-        PyObject *args;
-        if (!value)
-            args = PyTuple_New(0);
-        else if (PyTuple_Check(value)) {
-            Py_INCREF(value);
-            args = value;
+        PyObject *instance_class = NULL;
+        if (value && PyExceptionInstance_Check(value)) {
+            instance_class = (PyObject*) Py_TYPE(value);
+            if (instance_class != type) {
+                if (PyObject_IsSubclass(instance_class, type)) {
+                    type = instance_class;
+                } else {
+                    instance_class = NULL;
+                }
+            }
         }
-        else
-            args = PyTuple_Pack(1, value);
-        if (!args)
-            goto bad;
-        owned_instance = PyEval_CallObject(type, args);
-        Py_DECREF(args);
-        if (!owned_instance)
-            goto bad;
-        value = owned_instance;
-        if (!PyExceptionInstance_Check(value)) {
-            PyErr_Format(PyExc_TypeError,
-                         "calling %R should have returned an instance of "
-                         "BaseException, not %R",
-                         type, Py_TYPE(value));
-            goto bad;
+        if (!instance_class) {
+            PyObject *args;
+            if (!value)
+                args = PyTuple_New(0);
+            else if (PyTuple_Check(value)) {
+                Py_INCREF(value);
+                args = value;
+            } else
+                args = PyTuple_Pack(1, value);
+            if (!args)
+                goto bad;
+            owned_instance = PyObject_Call(type, args, NULL);
+            Py_DECREF(args);
+            if (!owned_instance)
+                goto bad;
+            value = owned_instance;
+            if (!PyExceptionInstance_Check(value)) {
+                PyErr_Format(PyExc_TypeError,
+                             "calling %R should have returned an instance of "
+                             "BaseException, not %R",
+                             type, Py_TYPE(value));
+                goto bad;
+            }
         }
     } else {
         PyErr_SetString(PyExc_TypeError,
             "raise: exception class must be a subclass of BaseException");
         goto bad;
     }
+#if PY_VERSION_HEX >= 0x03030000
+    if (cause) {
+#else
     if (cause && cause != Py_None) {
+#endif
         PyObject *fixed_cause;
-        if (PyExceptionClass_Check(cause)) {
+        if (cause == Py_None) {
+            fixed_cause = NULL;
+        } else if (PyExceptionClass_Check(cause)) {
             fixed_cause = PyObject_CallObject(cause, NULL);
             if (fixed_cause == NULL)
                 goto bad;
-        }
-        else if (PyExceptionInstance_Check(cause)) {
+        } else if (PyExceptionInstance_Check(cause)) {
             fixed_cause = cause;
             Py_INCREF(fixed_cause);
-        }
-        else {
+        } else {
             PyErr_SetString(PyExc_TypeError,
                             "exception causes must derive from "
                             "BaseException");
@@ -19168,8 +18634,20 @@ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
     return 0;
 }
 
+static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
+#if CYTHON_COMPILING_IN_CPYTHON
+#if PY_MAJOR_VERSION >= 3
+    if (likely(PyUnicode_Check(n)))
+#else
+    if (likely(PyString_Check(n)))
+#endif
+        return __Pyx_PyObject_GetAttrStr(o, n);
+#endif
+    return PyObject_GetAttr(o, n);
+}
+
 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
-    PyObject *r = PyObject_GetAttr(o, n);
+    PyObject *r = __Pyx_GetAttr(o, n);
     if (!r) {
         if (!PyErr_ExceptionMatches(PyExc_AttributeError))
             goto bad;
@@ -19318,6 +18796,84 @@ bad:
     return -1;
 }
 
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
+    PyObject *r;
+    if (!j) return NULL;
+    r = PyObject_GetItem(o, j);
+    Py_DECREF(j);
+    return r;
+}
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
+                                                              int wraparound, int boundscheck) {
+#if CYTHON_COMPILING_IN_CPYTHON
+    if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o);
+    if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
+        PyObject *r = PyList_GET_ITEM(o, i);
+        Py_INCREF(r);
+        return r;
+    }
+    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+#else
+    return PySequence_GetItem(o, i);
+#endif
+}
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
+                                                              int wraparound, int boundscheck) {
+#if CYTHON_COMPILING_IN_CPYTHON
+    if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o);
+    if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
+        PyObject *r = PyTuple_GET_ITEM(o, i);
+        Py_INCREF(r);
+        return r;
+    }
+    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+#else
+    return PySequence_GetItem(o, i);
+#endif
+}
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
+                                                     int is_list, int wraparound, int boundscheck) {
+#if CYTHON_COMPILING_IN_CPYTHON
+    if (is_list || PyList_CheckExact(o)) {
+        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
+        if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) {
+            PyObject *r = PyList_GET_ITEM(o, n);
+            Py_INCREF(r);
+            return r;
+        }
+    }
+    else if (PyTuple_CheckExact(o)) {
+        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
+        if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
+            PyObject *r = PyTuple_GET_ITEM(o, n);
+            Py_INCREF(r);
+            return r;
+        }
+    } else {
+        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
+        if (likely(m && m->sq_item)) {
+            if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
+                Py_ssize_t l = m->sq_length(o);
+                if (likely(l >= 0)) {
+                    i += l;
+                } else {
+                    if (PyErr_ExceptionMatches(PyExc_OverflowError))
+                        PyErr_Clear();
+                    else
+                        return NULL;
+                }
+            }
+            return m->sq_item(o, i);
+        }
+    }
+#else
+    if (is_list || PySequence_Check(o)) {
+        return PySequence_GetItem(o, i);
+    }
+#endif
+    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+}
+
 static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
     PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
 }
@@ -19329,9 +18885,44 @@ static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
     return q;
 }
 
+static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
+                                  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename) {
+    PyObject *old_exc, *old_val, *old_tb;
+    PyObject *ctx;
+    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
+    #if PY_MAJOR_VERSION < 3
+    ctx = PyString_FromString(name);
+    #else
+    ctx = PyUnicode_FromString(name);
+    #endif
+    __Pyx_ErrRestore(old_exc, old_val, old_tb);
+    if (!ctx) {
+        PyErr_WriteUnraisable(Py_None);
+    } else {
+        PyErr_WriteUnraisable(ctx);
+        Py_DECREF(ctx);
+    }
+}
+
+static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
+#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
+    PyObject *ob = PyCapsule_New(vtable, 0, 0);
+#else
+    PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
+#endif
+    if (!ob)
+        goto bad;
+    if (PyDict_SetItem(dict, __pyx_n_s____pyx_vtable__, ob) < 0)
+        goto bad;
+    Py_DECREF(ob);
+    return 0;
+bad:
+    Py_XDECREF(ob);
+    return -1;
+}
+
 #if PY_MAJOR_VERSION < 3
 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
-    CYTHON_UNUSED PyObject *getbuffer_cobj;
   #if PY_VERSION_HEX >= 0x02060000
     if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
   #endif
@@ -19339,21 +18930,18 @@ static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
         if (PyObject_TypeCheck(obj, __pyx_array_type)) return __pyx_array_getbuffer(obj, view, flags);
         if (PyObject_TypeCheck(obj, __pyx_memoryview_type)) return __pyx_memoryview_getbuffer(obj, view, flags);
   #if PY_VERSION_HEX < 0x02060000
-    if (obj->ob_type->tp_dict &&
-        (getbuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict,
-                                             "__pyx_getbuffer"))) {
-        getbufferproc func;
-      #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0)
-        func = (getbufferproc) PyCapsule_GetPointer(getbuffer_cobj, "getbuffer(obj, view, flags)");
-      #else
-        func = (getbufferproc) PyCObject_AsVoidPtr(getbuffer_cobj);
-      #endif
-        Py_DECREF(getbuffer_cobj);
-        if (!func)
-            goto fail;
-        return func(obj, view, flags);
-    } else {
-        PyErr_Clear();
+    if (obj->ob_type->tp_dict) {
+        PyObject *getbuffer_cobj = PyObject_GetItem(
+            obj->ob_type->tp_dict, __pyx_n_s____pyx_getbuffer);
+        if (getbuffer_cobj) {
+            getbufferproc func = (getbufferproc) PyCObject_AsVoidPtr(getbuffer_cobj);
+            Py_DECREF(getbuffer_cobj);
+            if (!func)
+                goto fail;
+            return func(obj, view, flags);
+        } else {
+            PyErr_Clear();
+        }
     }
   #endif
     PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
@@ -19364,7 +18952,6 @@ fail:
 }
 static void __Pyx_ReleaseBuffer(Py_buffer *view) {
     PyObject *obj = view->obj;
-    CYTHON_UNUSED PyObject *releasebuffer_cobj;
     if (!obj) return;
   #if PY_VERSION_HEX >= 0x02060000
     if (PyObject_CheckBuffer(obj)) {
@@ -19374,22 +18961,19 @@ static void __Pyx_ReleaseBuffer(Py_buffer *view) {
   #endif
         if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) { __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view); return; }
   #if PY_VERSION_HEX < 0x02060000
-    if (obj->ob_type->tp_dict &&
-        (releasebuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict,
-                                                      "__pyx_releasebuffer"))) {
-        releasebufferproc func;
-      #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0)
-        func = (releasebufferproc) PyCapsule_GetPointer(releasebuffer_cobj, "releasebuffer(obj, view)");
-      #else
-        func = (releasebufferproc) PyCObject_AsVoidPtr(releasebuffer_cobj);
-      #endif
-        Py_DECREF(releasebuffer_cobj);
-        if (!func)
-            goto fail;
-        func(obj, view);
-        return;
-    } else {
-        PyErr_Clear();
+    if (obj->ob_type->tp_dict) {
+        PyObject *releasebuffer_cobj = PyObject_GetItem(
+            obj->ob_type->tp_dict, __pyx_n_s____pyx_releasebuffer);
+        if (releasebuffer_cobj) {
+            releasebufferproc func = (releasebufferproc) PyCObject_AsVoidPtr(releasebuffer_cobj);
+            Py_DECREF(releasebuffer_cobj);
+            if (!func)
+                goto fail;
+            func(obj, view);
+            return;
+        } else {
+            PyErr_Clear();
+        }
     }
   #endif
     goto nofail;
@@ -19404,16 +18988,18 @@ nofail:
 #endif /*  PY_MAJOR_VERSION < 3 */
 
 
-      static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) {
-    PyObject *py_import = 0;
+          static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
     PyObject *empty_list = 0;
     PyObject *module = 0;
     PyObject *global_dict = 0;
     PyObject *empty_dict = 0;
     PyObject *list;
-    py_import = __Pyx_GetAttrString(__pyx_b, "__import__");
+    #if PY_VERSION_HEX < 0x03030000
+    PyObject *py_import;
+    py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s____import__);
     if (!py_import)
         goto bad;
+    #endif
     if (from_list)
         list = from_list;
     else {
@@ -19433,13 +19019,17 @@ nofail:
         #if PY_MAJOR_VERSION >= 3
         if (level == -1) {
             if (strchr(__Pyx_MODULE_NAME, '.')) {
-                /* try package relative import first */
+                #if PY_VERSION_HEX < 0x03030000
                 PyObject *py_level = PyInt_FromLong(1);
                 if (!py_level)
                     goto bad;
                 module = PyObject_CallFunctionObjArgs(py_import,
                     name, global_dict, empty_dict, list, py_level, NULL);
                 Py_DECREF(py_level);
+                #else
+                module = PyImport_ImportModuleLevelObject(
+                    name, global_dict, empty_dict, list, 1);
+                #endif
                 if (!module) {
                     if (!PyErr_ExceptionMatches(PyExc_ImportError))
                         goto bad;
@@ -19450,12 +19040,17 @@ nofail:
         }
         #endif
         if (!module) {
+            #if PY_VERSION_HEX < 0x03030000
             PyObject *py_level = PyInt_FromLong(level);
             if (!py_level)
                 goto bad;
             module = PyObject_CallFunctionObjArgs(py_import,
                 name, global_dict, empty_dict, list, py_level, NULL);
             Py_DECREF(py_level);
+            #else
+            module = PyImport_ImportModuleLevelObject(
+                name, global_dict, empty_dict, list, level);
+            #endif
         }
     }
     #else
@@ -19467,8 +19062,10 @@ nofail:
         name, global_dict, empty_dict, list, NULL);
     #endif
 bad:
-    Py_XDECREF(empty_list);
+    #if PY_VERSION_HEX < 0x03030000
     Py_XDECREF(py_import);
+    #endif
+    Py_XDECREF(empty_list);
     Py_XDECREF(empty_dict);
     return module;
 }
@@ -19799,7 +19396,7 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
     }
     __Pyx_GOTREF(shape_tuple);
     for(i = 0; i < ndim; i++) {
-        temp_int = PyInt_FromLong(from_mvs->shape[i]);
+        temp_int = PyInt_FromSsize_t(from_mvs->shape[i]);
         if(unlikely(!temp_int)) {
             goto fail;
         } else {
@@ -19837,7 +19434,7 @@ no_fail:
 }
 
 static CYTHON_INLINE PyObject *
-__pyx_capsule_create(void *p, const char *sig)
+__pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig)
 {
     PyObject *cobj;
 #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0)
@@ -20069,10 +19666,15 @@ static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) {
     return (int)__Pyx_PyInt_AsLong(x);
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
     const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -20085,6 +19687,16 @@ static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(unsigned long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (unsigned long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to unsigned long");
@@ -20092,6 +19704,17 @@ static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
             }
             return (unsigned long)PyLong_AsUnsignedLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(unsigned long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(unsigned long) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(unsigned long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (unsigned long)PyLong_AsLong(x);
         }
     } else {
@@ -20104,10 +19727,15 @@ static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
     }
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
     const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -20120,6 +19748,16 @@ static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObje
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to unsigned PY_LONG_LONG");
@@ -20127,6 +19765,17 @@ static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObje
             }
             return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x);
         }
     } else {
@@ -20139,10 +19788,15 @@ static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObje
     }
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
     const long neg_one = (long)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -20155,6 +19809,16 @@ static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to long");
@@ -20162,6 +19826,17 @@ static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
             }
             return (long)PyLong_AsUnsignedLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(long) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (long)PyLong_AsLong(x);
         }
     } else {
@@ -20174,10 +19849,15 @@ static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
     }
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
     const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -20190,6 +19870,16 @@ static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to PY_LONG_LONG");
@@ -20197,6 +19887,17 @@ static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
             }
             return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (PY_LONG_LONG)PyLong_AsLongLong(x);
         }
     } else {
@@ -20209,10 +19910,15 @@ static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
     }
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
     const signed long neg_one = (signed long)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -20225,6 +19931,16 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(signed long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (signed long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to signed long");
@@ -20232,6 +19948,17 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
             }
             return (signed long)PyLong_AsUnsignedLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(signed long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(signed long) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(signed long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (signed long)PyLong_AsLong(x);
         }
     } else {
@@ -20244,10 +19971,15 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
     }
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
     const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -20260,6 +19992,16 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject*
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to signed PY_LONG_LONG");
@@ -20267,6 +20009,17 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject*
             }
             return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (signed PY_LONG_LONG)PyLong_AsLongLong(x);
         }
     } else {
@@ -20279,6 +20032,227 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject*
     }
 }
 
+static int
+__pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b)
+{
+    int i;
+    if (!a || !b)
+        return 0;
+    if (a == b)
+        return 1;
+    if (a->size != b->size || a->typegroup != b->typegroup ||
+            a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) {
+        if (a->typegroup == 'H' || b->typegroup == 'H') {
+            return a->size == b->size;
+        } else {
+            return 0;
+        }
+    }
+    if (a->ndim) {
+        for (i = 0; i < a->ndim; i++)
+            if (a->arraysize[i] != b->arraysize[i])
+                return 0;
+    }
+    if (a->typegroup == 'S') {
+        if (a->flags != b->flags)
+            return 0;
+        if (a->fields || b->fields) {
+            if (!(a->fields && b->fields))
+                return 0;
+            for (i = 0; a->fields[i].type && b->fields[i].type; i++) {
+                __Pyx_StructField *field_a = a->fields + i;
+                __Pyx_StructField *field_b = b->fields + i;
+                if (field_a->offset != field_b->offset ||
+                    !__pyx_typeinfo_cmp(field_a->type, field_b->type))
+                    return 0;
+            }
+            return !a->fields[i].type && !b->fields[i].type;
+        }
+    }
+    return 1;
+}
+
+static int
+__pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec)
+{
+    if (buf->shape[dim] <= 1)
+        return 1;
+    if (buf->strides) {
+        if (spec & __Pyx_MEMVIEW_CONTIG) {
+            if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) {
+                if (buf->strides[dim] != sizeof(void *)) {
+                    PyErr_Format(PyExc_ValueError,
+                                 "Buffer is not indirectly contiguous "
+                                 "in dimension %d.", dim);
+                    goto fail;
+                }
+            } else if (buf->strides[dim] != buf->itemsize) {
+                PyErr_SetString(PyExc_ValueError,
+                                "Buffer and memoryview are not contiguous "
+                                "in the same dimension.");
+                goto fail;
+            }
+        }
+        if (spec & __Pyx_MEMVIEW_FOLLOW) {
+            Py_ssize_t stride = buf->strides[dim];
+            if (stride < 0)
+                stride = -stride;
+            if (stride < buf->itemsize) {
+                PyErr_SetString(PyExc_ValueError,
+                                "Buffer and memoryview are not contiguous "
+                                "in the same dimension.");
+                goto fail;
+            }
+        }
+    } else {
+        if (spec & __Pyx_MEMVIEW_CONTIG && dim != ndim - 1) {
+            PyErr_Format(PyExc_ValueError,
+                         "C-contiguous buffer is not contiguous in "
+                         "dimension %d", dim);
+            goto fail;
+        } else if (spec & (__Pyx_MEMVIEW_PTR)) {
+            PyErr_Format(PyExc_ValueError,
+                         "C-contiguous buffer is not indirect in "
+                         "dimension %d", dim);
+            goto fail;
+        } else if (buf->suboffsets) {
+            PyErr_SetString(PyExc_ValueError,
+                            "Buffer exposes suboffsets but no strides");
+            goto fail;
+        }
+    }
+    return 1;
+fail:
+    return 0;
+}
+static int
+__pyx_check_suboffsets(Py_buffer *buf, int dim, CYTHON_UNUSED int ndim, int spec)
+{
+    if (spec & __Pyx_MEMVIEW_DIRECT) {
+        if (buf->suboffsets && buf->suboffsets[dim] >= 0) {
+            PyErr_Format(PyExc_ValueError,
+                         "Buffer not compatible with direct access "
+                         "in dimension %d.", dim);
+            goto fail;
+        }
+    }
+    if (spec & __Pyx_MEMVIEW_PTR) {
+        if (!buf->suboffsets || (buf->suboffsets && buf->suboffsets[dim] < 0)) {
+            PyErr_Format(PyExc_ValueError,
+                         "Buffer is not indirectly accessisble "
+                         "in dimension %d.", dim);
+            goto fail;
+        }
+    }
+    return 1;
+fail:
+    return 0;
+}
+static int
+__pyx_verify_contig(Py_buffer *buf, int ndim, int c_or_f_flag)
+{
+    int i;
+    if (c_or_f_flag & __Pyx_IS_F_CONTIG) {
+        Py_ssize_t stride = 1;
+        for (i = 0; i < ndim; i++) {
+            if (stride * buf->itemsize != buf->strides[i] &&
+                    buf->shape[i] > 1)
+            {
+                PyErr_SetString(PyExc_ValueError,
+                    "Buffer not fortran contiguous.");
+                goto fail;
+            }
+            stride = stride * buf->shape[i];
+        }
+    } else if (c_or_f_flag & __Pyx_IS_C_CONTIG) {
+        Py_ssize_t stride = 1;
+        for (i = ndim - 1; i >- 1; i--) {
+            if (stride * buf->itemsize != buf->strides[i] &&
+                    buf->shape[i] > 1) {
+                PyErr_SetString(PyExc_ValueError,
+                    "Buffer not C contiguous.");
+                goto fail;
+            }
+            stride = stride * buf->shape[i];
+        }
+    }
+    return 1;
+fail:
+    return 0;
+}
+static int __Pyx_ValidateAndInit_memviewslice(
+                int *axes_specs,
+                int c_or_f_flag,
+                int buf_flags,
+                int ndim,
+                __Pyx_TypeInfo *dtype,
+                __Pyx_BufFmt_StackElem stack[],
+                __Pyx_memviewslice *memviewslice,
+                PyObject *original_obj)
+{
+    struct __pyx_memoryview_obj *memview, *new_memview;
+    __Pyx_RefNannyDeclarations
+    Py_buffer *buf;
+    int i, spec = 0, retval = -1;
+    __Pyx_BufFmt_Context ctx;
+    int from_memoryview = __pyx_memoryview_check(original_obj);
+    __Pyx_RefNannySetupContext("ValidateAndInit_memviewslice", 0);
+    if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((struct __pyx_memoryview_obj *)
+                                                            original_obj)->typeinfo)) {
+        memview = (struct __pyx_memoryview_obj *) original_obj;
+        new_memview = NULL;
+    } else {
+        memview = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
+                                            original_obj, buf_flags, 0, dtype);
+        new_memview = memview;
+        if (unlikely(!memview))
+            goto fail;
+    }
+    buf = &memview->view;
+    if (buf->ndim != ndim) {
+        PyErr_Format(PyExc_ValueError,
+                "Buffer has wrong number of dimensions (expected %d, got %d)",
+                ndim, buf->ndim);
+        goto fail;
+    }
+    if (new_memview) {
+        __Pyx_BufFmt_Init(&ctx, stack, dtype);
+        if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
+    }
+    if ((unsigned) buf->itemsize != dtype->size) {
+        PyErr_Format(PyExc_ValueError,
+                     "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "u byte%s) "
+                     "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "u byte%s)",
+                     buf->itemsize,
+                     (buf->itemsize > 1) ? "s" : "",
+                     dtype->name,
+                     dtype->size,
+                     (dtype->size > 1) ? "s" : "");
+        goto fail;
+    }
+    for (i = 0; i < ndim; i++) {
+        spec = axes_specs[i];
+        if (!__pyx_check_strides(buf, i, ndim, spec))
+            goto fail;
+        if (!__pyx_check_suboffsets(buf, i, ndim, spec))
+            goto fail;
+    }
+    if (buf->strides && !__pyx_verify_contig(buf, ndim, c_or_f_flag))
+        goto fail;
+    if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice,
+                                         new_memview != NULL) == -1)) {
+        goto fail;
+    }
+    retval = 0;
+    goto no_fail;
+fail:
+    Py_XDECREF(new_memview);
+    retval = -1;
+no_fail:
+    __Pyx_RefNannyFinishContext();
+    return retval;
+}
+
 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_double(PyObject *obj) {
     __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
     __Pyx_BufFmt_StackElem stack[1];
@@ -20301,25 +20275,6 @@ __pyx_fail:
     return result;
 }
 
-static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
-                                  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename) {
-    PyObject *old_exc, *old_val, *old_tb;
-    PyObject *ctx;
-    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
-    #if PY_MAJOR_VERSION < 3
-    ctx = PyString_FromString(name);
-    #else
-    ctx = PyUnicode_FromString(name);
-    #endif
-    __Pyx_ErrRestore(old_exc, old_val, old_tb);
-    if (!ctx) {
-        PyErr_WriteUnraisable(Py_None);
-    } else {
-        PyErr_WriteUnraisable(ctx);
-        Py_DECREF(ctx);
-    }
-}
-
 static int __Pyx_check_binary_version(void) {
     char ctversion[4], rtversion[4];
     PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
@@ -20339,23 +20294,6 @@ static int __Pyx_check_binary_version(void) {
     return 0;
 }
 
-static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
-#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
-    PyObject *ob = PyCapsule_New(vtable, 0, 0);
-#else
-    PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
-#endif
-    if (!ob)
-        goto bad;
-    if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0)
-        goto bad;
-    Py_DECREF(ob);
-    return 0;
-bad:
-    Py_XDECREF(ob);
-    return -1;
-}
-
 #ifndef __PYX_HAVE_RT_ImportModule
 #define __PYX_HAVE_RT_ImportModule
 static PyObject *__Pyx_ImportModule(const char *name) {
@@ -20382,6 +20320,10 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class
     PyObject *result = 0;
     PyObject *py_name = 0;
     char warning[200];
+    Py_ssize_t basicsize;
+#ifdef Py_LIMITED_API
+    PyObject *py_basicsize;
+#endif
     py_module = __Pyx_ImportModule(module_name);
     if (!py_module)
         goto bad;
@@ -20401,7 +20343,19 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class
             module_name, class_name);
         goto bad;
     }
-    if (!strict && (size_t)((PyTypeObject *)result)->tp_basicsize > size) {
+#ifndef Py_LIMITED_API
+    basicsize = ((PyTypeObject *)result)->tp_basicsize;
+#else
+    py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
+    if (!py_basicsize)
+        goto bad;
+    basicsize = PyLong_AsSsize_t(py_basicsize);
+    Py_DECREF(py_basicsize);
+    py_basicsize = 0;
+    if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
+        goto bad;
+#endif
+    if (!strict && (size_t)basicsize > size) {
         PyOS_snprintf(warning, sizeof(warning),
             "%s.%s size changed, may indicate binary incompatibility",
             module_name, class_name);
@@ -20411,7 +20365,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class
         if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
         #endif
     }
-    else if ((size_t)((PyTypeObject *)result)->tp_basicsize != size) {
+    else if ((size_t)basicsize != size) {
         PyErr_Format(PyExc_ValueError,
             "%s.%s has the wrong size, try recompiling",
             module_name, class_name);
@@ -20617,27 +20571,82 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
     return 0;
 }
 
-
-/* Type Conversion Functions */
-
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char* c_str) {
+    return __Pyx_PyUnicode_FromStringAndSize(c_str, strlen(c_str));
+}
+static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
+    Py_ssize_t ignore;
+    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
+}
+static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
+    if (
+#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+            __Pyx_sys_getdefaultencoding_not_ascii &&
+#endif
+            PyUnicode_Check(o)) {
+#if PY_VERSION_HEX < 0x03030000
+        char* defenc_c;
+        PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
+        if (!defenc) return NULL;
+        defenc_c = PyBytes_AS_STRING(defenc);
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+        {
+            char* end = defenc_c + PyBytes_GET_SIZE(defenc);
+            char* c;
+            for (c = defenc_c; c < end; c++) {
+                if ((unsigned char) (*c) >= 128) {
+                    PyUnicode_AsASCIIString(o);
+                    return NULL;
+                }
+            }
+        }
+#endif /*__PYX_DEFAULT_STRING_ENCODING_IS_ASCII*/
+        *length = PyBytes_GET_SIZE(defenc);
+        return defenc_c;
+#else /* PY_VERSION_HEX < 0x03030000 */
+        if (PyUnicode_READY(o) == -1) return NULL;
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+        if (PyUnicode_IS_ASCII(o)) {
+            *length = PyUnicode_GET_DATA_SIZE(o);
+            return PyUnicode_AsUTF8(o);
+        } else {
+            PyUnicode_AsASCIIString(o);
+            return NULL;
+        }
+#else /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
+        return PyUnicode_AsUTF8AndSize(o, length);
+#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
+#endif /* PY_VERSION_HEX < 0x03030000 */
+    } else
+#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII  || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT */
+    {
+        char* result;
+        int r = PyBytes_AsStringAndSize(o, &result, length);
+        if (r < 0) {
+            return NULL;
+        } else {
+            return result;
+        }
+    }
+}
 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
    int is_true = x == Py_True;
    if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
    else return PyObject_IsTrue(x);
 }
-
 static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
   PyNumberMethods *m;
   const char *name = NULL;
   PyObject *res = NULL;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
   if (PyInt_Check(x) || PyLong_Check(x))
 #else
   if (PyLong_Check(x))
 #endif
     return Py_INCREF(x), x;
   m = Py_TYPE(x)->tp_as_number;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
   if (m && m->nb_int) {
     name = "int";
     res = PyNumber_Int(x);
@@ -20653,7 +20662,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
   }
 #endif
   if (res) {
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (!PyInt_Check(res) && !PyLong_Check(res)) {
 #else
     if (!PyLong_Check(res)) {
@@ -20671,7 +20680,6 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
   }
   return res;
 }
-
 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
   Py_ssize_t ival;
   PyObject* x = PyNumber_Index(b);
@@ -20680,7 +20688,6 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
   Py_DECREF(x);
   return ival;
 }
-
 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
 #if PY_VERSION_HEX < 0x02050000
    if (ival <= LONG_MAX)
@@ -20694,14 +20701,12 @@ static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
    return PyInt_FromSize_t(ival);
 #endif
 }
-
 static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
    unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
-   if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) {
-       return (size_t)-1;
-   } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
-       PyErr_SetString(PyExc_OverflowError,
-                       "value too large to convert to size_t");
+   if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
+       if ((val != (unsigned PY_LONG_LONG)-1) || !PyErr_Occurred())
+           PyErr_SetString(PyExc_OverflowError,
+                           "value too large to convert to size_t");
        return (size_t)-1;
    }
    return (size_t)val;
diff --git a/src/bilinear.c b/src/bilinear.c
index c4fb3ec..3108895 100644
--- a/src/bilinear.c
+++ b/src/bilinear.c
@@ -1,6 +1,18 @@
-/* Generated by Cython 0.17.1 on Thu Jan 31 15:03:42 2013 */
+/* Generated by Cython 0.19.2 on Thu Jan  9 14:51:14 2014 */
 
 #define PY_SSIZE_T_CLEAN
+#ifndef CYTHON_USE_PYLONG_INTERNALS
+#ifdef PYLONG_BITS_IN_DIGIT
+#define CYTHON_USE_PYLONG_INTERNALS 0
+#else
+#include "pyconfig.h"
+#ifdef PYLONG_BITS_IN_DIGIT
+#define CYTHON_USE_PYLONG_INTERNALS 1
+#else
+#define CYTHON_USE_PYLONG_INTERNALS 0
+#endif
+#endif
+#endif
 #include "Python.h"
 #ifndef Py_PYTHON_H
     #error Python headers needed to compile C extensions, please install development version of Python.
@@ -53,12 +65,15 @@
                                 (PyErr_Format(PyExc_TypeError, \
                                               "expected index value, got %.200s", Py_TYPE(o)->tp_name), \
                                  (PyObject*)0))
-  #define PyIndex_Check(o)     (PyNumber_Check(o) && !PyFloat_Check(o) && !PyComplex_Check(o))
+  #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \
+                                  !PyComplex_Check(o))
+  #define PyIndex_Check __Pyx_PyIndex_Check
   #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
   #define __PYX_BUILD_PY_SSIZE_T "i"
 #else
   #define __PYX_BUILD_PY_SSIZE_T "n"
   #define CYTHON_FORMAT_SSIZE_T "z"
+  #define __Pyx_PyIndex_Check PyIndex_Check
 #endif
 #if PY_VERSION_HEX < 0x02060000
   #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
@@ -113,6 +128,9 @@
 #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
   #define Py_TPFLAGS_HAVE_NEWBUFFER 0
 #endif
+#if PY_VERSION_HEX < 0x02060000
+  #define Py_TPFLAGS_HAVE_VERSION_TAG 0
+#endif
 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
   #define CYTHON_PEP393_ENABLED 1
   #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ? \
@@ -152,6 +170,14 @@
   #define PyBytes_Concat               PyString_Concat
   #define PyBytes_ConcatAndDel         PyString_ConcatAndDel
 #endif
+#if PY_MAJOR_VERSION >= 3
+  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
+  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
+#else
+  #define __Pyx_PyBaseString_Check(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj) || \
+                                         PyString_Check(obj) || PyUnicode_Check(obj))
+  #define __Pyx_PyBaseString_CheckExact(obj) (Py_TYPE(obj) == &PyBaseString_Type)
+#endif
 #if PY_VERSION_HEX < 0x02060000
   #define PySet_Check(obj)             PyObject_TypeCheck(obj, &PySet_Type)
   #define PyFrozenSet_Check(obj)       PyObject_TypeCheck(obj, &PyFrozenSet_Type)
@@ -224,6 +250,40 @@
   #define __Pyx_NAMESTR(n) (n)
   #define __Pyx_DOCSTR(n)  (n)
 #endif
+#ifndef CYTHON_INLINE
+  #if defined(__GNUC__)
+    #define CYTHON_INLINE __inline__
+  #elif defined(_MSC_VER)
+    #define CYTHON_INLINE __inline
+  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+    #define CYTHON_INLINE inline
+  #else
+    #define CYTHON_INLINE
+  #endif
+#endif
+#ifndef CYTHON_RESTRICT
+  #if defined(__GNUC__)
+    #define CYTHON_RESTRICT __restrict__
+  #elif defined(_MSC_VER) && _MSC_VER >= 1400
+    #define CYTHON_RESTRICT __restrict
+  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+    #define CYTHON_RESTRICT restrict
+  #else
+    #define CYTHON_RESTRICT
+  #endif
+#endif
+#ifdef NAN
+#define __PYX_NAN() ((float) NAN)
+#else
+static CYTHON_INLINE float __PYX_NAN() {
+  /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and
+   a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is
+   a quiet NaN. */
+  float value;
+  memset(&value, 0xFF, sizeof(value));
+  return value;
+}
+#endif
 
 
 #if PY_MAJOR_VERSION >= 3
@@ -248,13 +308,13 @@
 #include <math.h>
 #define __PYX_HAVE__bilinear
 #define __PYX_HAVE_API__bilinear
+#include "string.h"
 #include "stdio.h"
 #include "stdlib.h"
 #include "numpy/arrayobject.h"
 #include "numpy/ufuncobject.h"
 #include "math.h"
 #include "pythread.h"
-#include "string.h"
 #include "pystate.h"
 #ifdef _OPENMP
 #include <omp.h>
@@ -264,21 +324,6 @@
 #define CYTHON_WITHOUT_ASSERTIONS
 #endif
 
-
-/* inline attribute */
-#ifndef CYTHON_INLINE
-  #if defined(__GNUC__)
-    #define CYTHON_INLINE __inline__
-  #elif defined(_MSC_VER)
-    #define CYTHON_INLINE __inline
-  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
-    #define CYTHON_INLINE inline
-  #else
-    #define CYTHON_INLINE
-  #endif
-#endif
-
-/* unused attribute */
 #ifndef CYTHON_UNUSED
 # if defined(__GNUC__)
 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
@@ -292,30 +337,130 @@
 #   define CYTHON_UNUSED
 # endif
 #endif
-
-typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/
-
-
-/* Type Conversion Predeclarations */
-
-#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
-#define __Pyx_PyBytes_AsUString(s)   ((unsigned char*) PyBytes_AsString(s))
-
+typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding;
+                const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/
+
+#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
+#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
+#define __PYX_DEFAULT_STRING_ENCODING ""
+#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
+#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
+static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
+static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
+#define __Pyx_PyBytes_FromString        PyBytes_FromString
+#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char*);
+#if PY_MAJOR_VERSION < 3
+    #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
+    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
+#else
+    #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
+    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
+#endif
+#define __Pyx_PyObject_AsUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
+#define __Pyx_PyObject_FromUString(s)  __Pyx_PyObject_FromString((char*)s)
+#define __Pyx_PyBytes_FromUString(s)   __Pyx_PyBytes_FromString((char*)s)
+#define __Pyx_PyStr_FromUString(s)     __Pyx_PyStr_FromString((char*)s)
+#define __Pyx_PyUnicode_FromUString(s) __Pyx_PyUnicode_FromString((char*)s)
+#if PY_MAJOR_VERSION < 3
+static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
+{
+    const Py_UNICODE *u_end = u;
+    while (*u_end++) ;
+    return u_end - u - 1;
+}
+#else
+#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
+#endif
+#define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
+#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
+#define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
 #define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
 #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
 static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
-
 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
 static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
-
 #if CYTHON_COMPILING_IN_CPYTHON
 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
 #else
 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
 #endif
 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
+#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+static int __Pyx_sys_getdefaultencoding_not_ascii;
+static int __Pyx_init_sys_getdefaultencoding_params() {
+    PyObject* sys = NULL;
+    PyObject* default_encoding = NULL;
+    PyObject* ascii_chars_u = NULL;
+    PyObject* ascii_chars_b = NULL;
+    sys = PyImport_ImportModule("sys");
+    if (sys == NULL) goto bad;
+    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
+    if (default_encoding == NULL) goto bad;
+    if (strcmp(PyBytes_AsString(default_encoding), "ascii") == 0) {
+        __Pyx_sys_getdefaultencoding_not_ascii = 0;
+    } else {
+        const char* default_encoding_c = PyBytes_AS_STRING(default_encoding);
+        char ascii_chars[128];
+        int c;
+        for (c = 0; c < 128; c++) {
+            ascii_chars[c] = c;
+        }
+        __Pyx_sys_getdefaultencoding_not_ascii = 1;
+        ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
+        if (ascii_chars_u == NULL) goto bad;
+        ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
+        if (ascii_chars_b == NULL || strncmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
+            PyErr_Format(
+                PyExc_ValueError,
+                "This module compiled with c_string_encoding=ascii, but default encoding '%s' is not a superset of ascii.",
+                default_encoding_c);
+            goto bad;
+        }
+    }
+    Py_XDECREF(sys);
+    Py_XDECREF(default_encoding);
+    Py_XDECREF(ascii_chars_u);
+    Py_XDECREF(ascii_chars_b);
+    return 0;
+bad:
+    Py_XDECREF(sys);
+    Py_XDECREF(default_encoding);
+    Py_XDECREF(ascii_chars_u);
+    Py_XDECREF(ascii_chars_b);
+    return -1;
+}
+#endif
+#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
+#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
+#else
+#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
+#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
+static char* __PYX_DEFAULT_STRING_ENCODING;
+static int __Pyx_init_sys_getdefaultencoding_params() {
+    PyObject* sys = NULL;
+    PyObject* default_encoding = NULL;
+    char* default_encoding_c;
+    sys = PyImport_ImportModule("sys");
+    if (sys == NULL) goto bad;
+    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
+    if (default_encoding == NULL) goto bad;
+    default_encoding_c = PyBytes_AS_STRING(default_encoding);
+    __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
+    strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
+    Py_DECREF(sys);
+    Py_DECREF(default_encoding);
+    return 0;
+bad:
+    Py_XDECREF(sys);
+    Py_XDECREF(default_encoding);
+    return -1;
+}
+#endif
+#endif
+
 
 #ifdef __GNUC__
   /* Test for GCC > 2.95 */
@@ -330,8 +475,9 @@ static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
   #define likely(x)   (x)
   #define unlikely(x) (x)
 #endif /* __GNUC__ */
-    
+
 static PyObject *__pyx_m;
+static PyObject *__pyx_d;
 static PyObject *__pyx_b;
 static PyObject *__pyx_empty_tuple;
 static PyObject *__pyx_empty_bytes;
@@ -417,10 +563,9 @@ typedef struct {
     #define CYTHON_ATOMICS 1
 #endif
 #define __pyx_atomic_int_type int
-/* todo: Portland pgcc, maybe OS X's OSAtomicIncrement32,
-   libatomic + autotools-like distutils support? Such a pain... */
-#if CYTHON_ATOMICS && __GNUC__ >= 4 && (__GNUC_MINOR__ > 1 || \
-                    (__GNUC_MINOR__ == 1 && __GNUC_PATHLEVEL >= 2))
+#if CYTHON_ATOMICS && __GNUC__ >= 4 && (__GNUC_MINOR__ > 1 ||           \
+                    (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL >= 2)) && \
+                    !defined(__i386__)
     #define __pyx_atomic_incr_aligned(value, lock) __sync_fetch_and_add(value, 1)
     #define __pyx_atomic_decr_aligned(value, lock) __sync_fetch_and_sub(value, 1)
     #ifdef __PYX_DEBUG_ATOMICS
@@ -773,8 +918,8 @@ struct __pyx_MemviewEnum_obj {
 };
 
 
-/* "bilinear.pyx":39
- * 
+/* "bilinear.pyx":41
+ * logger = logging.getLogger("pyFAI.bilinear")
  * 
  * cdef class Bilinear:             # <<<<<<<<<<<<<<
  *     """Bilinear interpolator for finding max"""
@@ -892,10 +1037,33 @@ static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice;
   #define __Pyx_XGOTREF(r)
   #define __Pyx_XGIVEREF(r)
 #endif /* CYTHON_REFNANNY */
+#define __Pyx_XDECREF_SET(r, v) do {                            \
+        PyObject *tmp = (PyObject *) r;                         \
+        r = v; __Pyx_XDECREF(tmp);                              \
+    } while (0)
+#define __Pyx_DECREF_SET(r, v) do {                             \
+        PyObject *tmp = (PyObject *) r;                         \
+        r = v; __Pyx_DECREF(tmp);                               \
+    } while (0)
 #define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
 #define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
 
-static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
+    PyTypeObject* tp = Py_TYPE(obj);
+    if (likely(tp->tp_getattro))
+        return tp->tp_getattro(obj, attr_name);
+#if PY_MAJOR_VERSION < 3
+    if (likely(tp->tp_getattr))
+        return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
+#endif
+    return PyObject_GetAttr(obj, attr_name);
+}
+#else
+#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
+#endif
+
+static PyObject *__Pyx_GetBuiltinName(PyObject *name); /*proto*/
 
 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/
 
@@ -906,98 +1074,32 @@ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \
 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
     Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/
 
-static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
-    PyObject *r;
-    if (!j) return NULL;
-    r = PyObject_GetItem(o, j);
-    Py_DECREF(j);
-    return r;
-}
-#define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
-                                                    __Pyx_GetItemInt_List_Fast(o, i) : \
-                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
-static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) {
-#if CYTHON_COMPILING_IN_CPYTHON
-    if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
-        PyObject *r = PyList_GET_ITEM(o, i);
-        Py_INCREF(r);
-        return r;
-    }
-    else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
-        PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
-        Py_INCREF(r);
-        return r;
-    }
-    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
-#else
-    return PySequence_GetItem(o, i);
-#endif
-}
-#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
-                                                    __Pyx_GetItemInt_Tuple_Fast(o, i) : \
-                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
-static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) {
-#if CYTHON_COMPILING_IN_CPYTHON
-    if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
-        PyObject *r = PyTuple_GET_ITEM(o, i);
-        Py_INCREF(r);
-        return r;
-    }
-    else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
-        PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
-        Py_INCREF(r);
-        return r;
-    }
-    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
-#else
-    return PySequence_GetItem(o, i);
-#endif
-}
-#define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
-                                                    __Pyx_GetItemInt_Fast(o, i) : \
-                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
-static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) {
-#if CYTHON_COMPILING_IN_CPYTHON
-    if (PyList_CheckExact(o)) {
-        Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
-        if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) {
-            PyObject *r = PyList_GET_ITEM(o, n);
-            Py_INCREF(r);
-            return r;
-        }
-    }
-    else if (PyTuple_CheckExact(o)) {
-        Py_ssize_t n = (likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
-        if (likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
-            PyObject *r = PyTuple_GET_ITEM(o, n);
-            Py_INCREF(r);
-            return r;
-        }
-    } else {  /* inlined PySequence_GetItem() */
-        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
-        if (likely(m && m->sq_item)) {
-            if (unlikely(i < 0) && likely(m->sq_length)) {
-                Py_ssize_t l = m->sq_length(o);
-                if (unlikely(l < 0)) return NULL;
-                i += l;
-            }
-            return m->sq_item(o, i);
-        }
-    }
-#else
-    if (PySequence_Check(o)) {
-        return PySequence_GetItem(o, i);
-    }
-#endif
-    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
-}
+#define __Pyx_GetItemInt(o, i, size, to_py_func, is_list, wraparound, boundscheck) \
+    (((size) <= sizeof(Py_ssize_t)) ? \
+    __Pyx_GetItemInt_Fast(o, i, is_list, wraparound, boundscheck) : \
+    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
+#define __Pyx_GetItemInt_List(o, i, size, to_py_func, is_list, wraparound, boundscheck) \
+    (((size) <= sizeof(Py_ssize_t)) ? \
+    __Pyx_GetItemInt_List_Fast(o, i, wraparound, boundscheck) : \
+    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
+                                                              int wraparound, int boundscheck);
+#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func, is_list, wraparound, boundscheck) \
+    (((size) <= sizeof(Py_ssize_t)) ? \
+    __Pyx_GetItemInt_Tuple_Fast(o, i, wraparound, boundscheck) : \
+    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
+                                                              int wraparound, int boundscheck);
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
+                                                     int is_list, int wraparound, int boundscheck);
+
+static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); /*proto*/
 
 static CYTHON_INLINE int  __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj,
     __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack);
 static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);
 
-static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
-
 #define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d
 #define __Pyx_MEMVIEW_DIRECT   1
 #define __Pyx_MEMVIEW_PTR      2
@@ -1007,24 +1109,15 @@ static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
 #define __Pyx_MEMVIEW_FOLLOW   32
 #define __Pyx_IS_C_CONTIG 1
 #define __Pyx_IS_F_CONTIG 2
-static int __Pyx_ValidateAndInit_memviewslice(
-                int *axes_specs,
-                int c_or_f_flag,
-                int buf_flags,
-                int ndim,
-                __Pyx_TypeInfo *dtype,
-                __Pyx_BufFmt_StackElem stack[],
-                __Pyx_memviewslice *memviewslice,
-                PyObject *original_obj);
 static int __Pyx_init_memviewslice(
                 struct __pyx_memoryview_obj *memview,
                 int ndim,
                 __Pyx_memviewslice *memviewslice,
                 int memview_is_new_reference);
-static CYTHON_INLINE int __pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
-                                                            PyThread_type_lock lock);
-static CYTHON_INLINE int __pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
-                                                            PyThread_type_lock lock);
+static CYTHON_INLINE int __pyx_add_acquisition_count_locked(
+    __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
+static CYTHON_INLINE int __pyx_sub_acquisition_count_locked(
+    __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
 #define __pyx_get_slice_count_pointer(memview) (memview->acquisition_count_aligned_p)
 #define __pyx_get_slice_count(memview) (*__pyx_get_slice_count_pointer(memview))
 #define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__)
@@ -1052,13 +1145,19 @@ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*pr
 static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
     const char *name, int exact); /*proto*/
 
+static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); /*proto*/
+
 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); /*proto*/
 
 static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t); /* proto */
 
+#ifndef __PYX_FORCE_INIT_THREADS
+  #define __PYX_FORCE_INIT_THREADS 0
+#endif
+
 #define UNARY_NEG_WOULD_OVERFLOW(x)            (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))
 
-static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
+static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/
 
 static PyObject *get_memview(PyObject *__pyx_v_self); /*proto*/
@@ -1071,12 +1170,12 @@ static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
 
 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
 
-static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
+static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
 static PyObject *__pyx_memoryview_transpose(PyObject *__pyx_v_self); /*proto*/
 static PyObject *__pyx_memoryview__get__base(PyObject *__pyx_v_self); /*proto*/
 static PyObject *__pyx_memoryview_get_shape(PyObject *__pyx_v_self); /*proto*/
 #if CYTHON_COMPILING_IN_CPYTHON
-static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
+static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
     PyListObject* L = (PyListObject*) list;
     Py_ssize_t len = Py_SIZE(list);
     if (likely(L->allocated > len)) {
@@ -1088,7 +1187,7 @@ static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
     return PyList_Append(list, x);
 }
 #else
-#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
+#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
 #endif
 
 static PyObject *__pyx_memoryview_get_strides(PyObject *__pyx_v_self); /*proto*/
@@ -1097,16 +1196,33 @@ static PyObject *__pyx_memoryview_get_ndim(PyObject *__pyx_v_self); /*proto*/
 static PyObject *__pyx_memoryview_get_itemsize(PyObject *__pyx_v_self); /*proto*/
 static PyObject *__pyx_memoryview_get_nbytes(PyObject *__pyx_v_self); /*proto*/
 static PyObject *__pyx_memoryview_get_size(PyObject *__pyx_v_self); /*proto*/
-static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
-
-#ifndef __PYX_FORCE_INIT_THREADS
-  #define __PYX_FORCE_INIT_THREADS 0
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
+    PyListObject* L = (PyListObject*) list;
+    Py_ssize_t len = Py_SIZE(list);
+    if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
+        Py_INCREF(x);
+        PyList_SET_ITEM(list, len, x);
+        Py_SIZE(list) = len+1;
+        return 0;
+    }
+    return PyList_Append(list, x);
+}
+#else
+#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
 #endif
 
+static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
+
 static CYTHON_INLINE long __Pyx_div_long(long, long); /* proto */
 
 static PyObject *__pyx_memoryviewslice__get__base(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/
+static void __Pyx_WriteUnraisable(const char *name, int clineno,
+                                  int lineno, const char *filename); /*proto*/
+
+static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
+
+static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /*proto*/
 
 #if CYTHON_CCOMPLEX
   #ifdef __cplusplus
@@ -1281,14 +1397,21 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);
 
 static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);
 
-static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_float(PyObject *);
+static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
 
-static void __Pyx_WriteUnraisable(const char *name, int clineno,
-                                  int lineno, const char *filename); /*proto*/
+static int __Pyx_ValidateAndInit_memviewslice(
+                int *axes_specs,
+                int c_or_f_flag,
+                int buf_flags,
+                int ndim,
+                __Pyx_TypeInfo *dtype,
+                __Pyx_BufFmt_StackElem stack[],
+                __Pyx_memviewslice *memviewslice,
+                PyObject *original_obj);
 
-static int __Pyx_check_binary_version(void);
+static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_float(PyObject *);
 
-static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
+static int __Pyx_check_binary_version(void);
 
 #if !defined(__Pyx_PyIdentifier_FromString)
 #if PY_MAJOR_VERSION < 3
@@ -1330,6 +1453,8 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
 
 /* Module declarations from 'cpython.ref' */
 
+/* Module declarations from 'libc.string' */
+
 /* Module declarations from 'libc.stdio' */
 
 /* Module declarations from 'cpython.object' */
@@ -1354,10 +1479,10 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, cha
 /* Module declarations from 'libc.math' */
 
 /* Module declarations from 'bilinear' */
-static PyTypeObject *__pyx_ptype_8bilinear_Bilinear = 0;
+static PyTypeObject *__pyx_memoryview_type = 0;
 static PyTypeObject *__pyx_array_type = 0;
 static PyTypeObject *__pyx_MemviewEnum_type = 0;
-static PyTypeObject *__pyx_memoryview_type = 0;
+static PyTypeObject *__pyx_ptype_8bilinear_Bilinear = 0;
 static PyTypeObject *__pyx_memoryviewslice_type = 0;
 static PyObject *generic = 0;
 static PyObject *strided = 0;
@@ -1367,12 +1492,12 @@ static PyObject *indirect_contiguous = 0;
 static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/
 static void *__pyx_align_pointer(void *, size_t); /*proto*/
 static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo *); /*proto*/
-static int __pyx_memoryview_check(PyObject *); /*proto*/
+static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/
 static PyObject *_unellipsify(PyObject *, int); /*proto*/
 static PyObject *assert_direct_dimensions(Py_ssize_t *, int); /*proto*/
 static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/
 static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int, int); /*proto*/
-static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, int); /*proto*/
+static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/
 static int __pyx_memslice_transpose(__Pyx_memviewslice *); /*proto*/
 static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice, int, PyObject *(*)(char *), int (*)(char *, PyObject *), int); /*proto*/
 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
@@ -1448,42 +1573,50 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_20copy(struct __pyx_me
 static PyObject *__pyx_memoryview_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
 static void __pyx_memoryviewslice_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
 static PyObject *__pyx_memoryviewslice__get__base_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
-static char __pyx_k_1[] = "ndarray is not C contiguous";
-static char __pyx_k_3[] = "ndarray is not Fortran contiguous";
-static char __pyx_k_5[] = "Non-native byte order not supported";
-static char __pyx_k_7[] = "unknown dtype code in numpy.pxd (%d)";
-static char __pyx_k_8[] = "Format string allocated too short, see comment in numpy.pxd";
-static char __pyx_k_11[] = "Format string allocated too short.";
-static char __pyx_k_13[] = "Empty shape tuple for cython.array";
-static char __pyx_k_15[] = "itemsize <= 0 for cython.array";
-static char __pyx_k_18[] = "unable to allocate shape or strides.";
-static char __pyx_k_20[] = "Invalid shape in axis %d: %d.";
-static char __pyx_k_21[] = "Invalid mode, expected 'c' or 'fortran', got %s";
-static char __pyx_k_23[] = "unable to allocate array data.";
-static char __pyx_k_25[] = "Can only create a buffer that is contiguous in memory.";
-static char __pyx_k_27[] = "Unable to convert item to object";
-static char __pyx_k_29[] = "Buffer view does not expose strides";
-static char __pyx_k_31[] = "<MemoryView of %r at 0x%x>";
-static char __pyx_k_32[] = "<MemoryView of %r object>";
-static char __pyx_k_35[] = "Cannot index with type '%s'";
-static char __pyx_k_37[] = "Indirect dimensions not supported";
-static char __pyx_k_39[] = "Index out of bounds (axis %d)";
-static char __pyx_k_40[] = "Step may not be zero (axis %d)";
-static char __pyx_k_41[] = "All dimensions preceding dimension %d must be indexed and not sliced";
-static char __pyx_k_42[] = "Out of bounds on buffer access (axis %d)";
-static char __pyx_k_43[] = "Cannot transpose memoryview with indirect dimensions";
-static char __pyx_k_44[] = "got differing extents in dimension %d (got %d and %d)";
-static char __pyx_k_45[] = "Dimension %d is not direct";
-static char __pyx_k_46[] = "Jerome Kieffer";
-static char __pyx_k_47[] = "31/01/2013";
-static char __pyx_k_48[] = "2011-2013, ESRF";
-static char __pyx_k_49[] = "jerome.kieffer at esrf.fr";
-static char __pyx_k_50[] = "getbuffer(obj, view, flags)";
-static char __pyx_k_51[] = "<strided and direct or indirect>";
-static char __pyx_k_53[] = "<strided and direct>";
-static char __pyx_k_55[] = "<strided and indirect>";
-static char __pyx_k_57[] = "<contiguous and direct>";
-static char __pyx_k_59[] = "<contiguous and indirect>";
+static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_8bilinear_Bilinear(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static char __pyx_k_1[] = "Singular determinant, Hessian undefined";
+static char __pyx_k_3[] = "Failed to find root using second order expansion";
+static char __pyx_k_5[] = "ndarray is not C contiguous";
+static char __pyx_k_7[] = "ndarray is not Fortran contiguous";
+static char __pyx_k_9[] = "Non-native byte order not supported";
+static char __pyx_k_11[] = "unknown dtype code in numpy.pxd (%d)";
+static char __pyx_k_12[] = "Format string allocated too short, see comment in numpy.pxd";
+static char __pyx_k_15[] = "Format string allocated too short.";
+static char __pyx_k_17[] = "Empty shape tuple for cython.array";
+static char __pyx_k_19[] = "itemsize <= 0 for cython.array";
+static char __pyx_k_22[] = "unable to allocate shape or strides.";
+static char __pyx_k_24[] = "Invalid shape in axis %d: %d.";
+static char __pyx_k_25[] = "Invalid mode, expected 'c' or 'fortran', got %s";
+static char __pyx_k_27[] = "unable to allocate array data.";
+static char __pyx_k_29[] = "Can only create a buffer that is contiguous in memory.";
+static char __pyx_k_31[] = "Unable to convert item to object";
+static char __pyx_k_33[] = "Buffer view does not expose strides";
+static char __pyx_k_35[] = "<MemoryView of %r at 0x%x>";
+static char __pyx_k_36[] = "<MemoryView of %r object>";
+static char __pyx_k_39[] = "Cannot index with type '%s'";
+static char __pyx_k_41[] = "Indirect dimensions not supported";
+static char __pyx_k_43[] = "Index out of bounds (axis %d)";
+static char __pyx_k_44[] = "Step may not be zero (axis %d)";
+static char __pyx_k_45[] = "All dimensions preceding dimension %d must be indexed and not sliced";
+static char __pyx_k_46[] = "Out of bounds on buffer access (axis %d)";
+static char __pyx_k_47[] = "Cannot transpose memoryview with indirect dimensions";
+static char __pyx_k_48[] = "got differing extents in dimension %d (got %d and %d)";
+static char __pyx_k_49[] = "Dimension %d is not direct";
+static char __pyx_k_50[] = "Jerome Kieffer";
+static char __pyx_k_51[] = "31/01/2013";
+static char __pyx_k_52[] = "2011-2013, ESRF";
+static char __pyx_k_53[] = "jerome.kieffer at esrf.fr";
+static char __pyx_k_54[] = "pyFAI.bilinear";
+static char __pyx_k_56[] = "getbuffer(obj, view, flags)";
+static char __pyx_k_57[] = "<strided and direct or indirect>";
+static char __pyx_k_59[] = "<strided and direct>";
+static char __pyx_k_61[] = "<strided and indirect>";
+static char __pyx_k_63[] = "<contiguous and direct>";
+static char __pyx_k_65[] = "<contiguous and indirect>";
 static char __pyx_k__B[] = "B";
 static char __pyx_k__H[] = "H";
 static char __pyx_k__I[] = "I";
@@ -1519,6 +1652,7 @@ static char __pyx_k__step[] = "step";
 static char __pyx_k__stop[] = "stop";
 static char __pyx_k__ASCII[] = "ASCII";
 static char __pyx_k__GPLv3[] = "GPLv3";
+static char __pyx_k__debug[] = "debug";
 static char __pyx_k__dtype[] = "dtype";
 static char __pyx_k__error[] = "error";
 static char __pyx_k__flags[] = "flags";
@@ -1530,11 +1664,13 @@ static char __pyx_k__decode[] = "decode";
 static char __pyx_k__encode[] = "encode";
 static char __pyx_k__extend[] = "extend";
 static char __pyx_k__format[] = "format";
+static char __pyx_k__logger[] = "logger";
 static char __pyx_k__struct[] = "struct";
 static char __pyx_k__unpack[] = "unpack";
 static char __pyx_k__xrange[] = "xrange";
 static char __pyx_k__float32[] = "float32";
 static char __pyx_k__fortran[] = "fortran";
+static char __pyx_k__logging[] = "logging";
 static char __pyx_k__memview[] = "memview";
 static char __pyx_k__Ellipsis[] = "Ellipsis";
 static char __pyx_k____date__[] = "__date__";
@@ -1545,48 +1681,55 @@ static char __pyx_k__itemsize[] = "itemsize";
 static char __pyx_k__TypeError[] = "TypeError";
 static char __pyx_k____class__[] = "__class__";
 static char __pyx_k__enumerate[] = "enumerate";
+static char __pyx_k__getLogger[] = "getLogger";
 static char __pyx_k__IndexError[] = "IndexError";
 static char __pyx_k__ValueError[] = "ValueError";
 static char __pyx_k____author__[] = "__author__";
+static char __pyx_k____import__[] = "__import__";
 static char __pyx_k__MemoryError[] = "MemoryError";
 static char __pyx_k____contact__[] = "__contact__";
 static char __pyx_k____license__[] = "__license__";
 static char __pyx_k__RuntimeError[] = "RuntimeError";
 static char __pyx_k____copyright__[] = "__copyright__";
+static char __pyx_k____pyx_vtable__[] = "__pyx_vtable__";
 static char __pyx_k____pyx_getbuffer[] = "__pyx_getbuffer";
 static char __pyx_k__allocate_buffer[] = "allocate_buffer";
 static char __pyx_k__dtype_is_object[] = "dtype_is_object";
 static char __pyx_k__ascontiguousarray[] = "ascontiguousarray";
-static PyObject *__pyx_kp_u_1;
+static char __pyx_k____pyx_releasebuffer[] = "__pyx_releasebuffer";
+static PyObject *__pyx_kp_s_1;
 static PyObject *__pyx_kp_u_11;
-static PyObject *__pyx_kp_s_13;
-static PyObject *__pyx_kp_s_15;
-static PyObject *__pyx_kp_s_18;
-static PyObject *__pyx_kp_s_20;
-static PyObject *__pyx_kp_s_21;
-static PyObject *__pyx_kp_s_23;
+static PyObject *__pyx_kp_u_12;
+static PyObject *__pyx_kp_u_15;
+static PyObject *__pyx_kp_s_17;
+static PyObject *__pyx_kp_s_19;
+static PyObject *__pyx_kp_s_22;
+static PyObject *__pyx_kp_s_24;
 static PyObject *__pyx_kp_s_25;
 static PyObject *__pyx_kp_s_27;
 static PyObject *__pyx_kp_s_29;
-static PyObject *__pyx_kp_u_3;
+static PyObject *__pyx_kp_s_3;
 static PyObject *__pyx_kp_s_31;
-static PyObject *__pyx_kp_s_32;
+static PyObject *__pyx_kp_s_33;
 static PyObject *__pyx_kp_s_35;
-static PyObject *__pyx_kp_s_37;
-static PyObject *__pyx_kp_s_42;
-static PyObject *__pyx_kp_s_44;
+static PyObject *__pyx_kp_s_36;
+static PyObject *__pyx_kp_s_39;
+static PyObject *__pyx_kp_s_41;
 static PyObject *__pyx_kp_s_46;
-static PyObject *__pyx_kp_s_47;
 static PyObject *__pyx_kp_s_48;
-static PyObject *__pyx_kp_s_49;
 static PyObject *__pyx_kp_u_5;
+static PyObject *__pyx_kp_s_50;
 static PyObject *__pyx_kp_s_51;
+static PyObject *__pyx_kp_s_52;
 static PyObject *__pyx_kp_s_53;
-static PyObject *__pyx_kp_s_55;
+static PyObject *__pyx_kp_s_54;
 static PyObject *__pyx_kp_s_57;
 static PyObject *__pyx_kp_s_59;
+static PyObject *__pyx_kp_s_61;
+static PyObject *__pyx_kp_s_63;
+static PyObject *__pyx_kp_s_65;
 static PyObject *__pyx_kp_u_7;
-static PyObject *__pyx_kp_u_8;
+static PyObject *__pyx_kp_u_9;
 static PyObject *__pyx_n_s__ASCII;
 static PyObject *__pyx_n_s__Ellipsis;
 static PyObject *__pyx_n_s__GPLv3;
@@ -1601,10 +1744,13 @@ static PyObject *__pyx_n_s____class__;
 static PyObject *__pyx_n_s____contact__;
 static PyObject *__pyx_n_s____copyright__;
 static PyObject *__pyx_n_s____date__;
+static PyObject *__pyx_n_s____import__;
 static PyObject *__pyx_n_s____license__;
 static PyObject *__pyx_n_s____main__;
 static PyObject *__pyx_n_s____name__;
 static PyObject *__pyx_n_s____pyx_getbuffer;
+static PyObject *__pyx_n_s____pyx_releasebuffer;
+static PyObject *__pyx_n_s____pyx_vtable__;
 static PyObject *__pyx_n_s____test__;
 static PyObject *__pyx_n_s__allocate_buffer;
 static PyObject *__pyx_n_s__ascontiguousarray;
@@ -1613,6 +1759,7 @@ static PyObject *__pyx_n_b__c;
 static PyObject *__pyx_n_s__c;
 static PyObject *__pyx_n_u__c;
 static PyObject *__pyx_n_s__data;
+static PyObject *__pyx_n_s__debug;
 static PyObject *__pyx_n_s__decode;
 static PyObject *__pyx_n_s__dtype;
 static PyObject *__pyx_n_s__dtype_is_object;
@@ -1625,8 +1772,11 @@ static PyObject *__pyx_n_s__float32;
 static PyObject *__pyx_n_s__format;
 static PyObject *__pyx_n_b__fortran;
 static PyObject *__pyx_n_s__fortran;
+static PyObject *__pyx_n_s__getLogger;
 static PyObject *__pyx_n_s__id;
 static PyObject *__pyx_n_s__itemsize;
+static PyObject *__pyx_n_s__logger;
+static PyObject *__pyx_n_s__logging;
 static PyObject *__pyx_n_s__max;
 static PyObject *__pyx_n_s__memview;
 static PyObject *__pyx_n_s__min;
@@ -1655,32 +1805,38 @@ static PyObject *__pyx_int_15;
 static PyObject *__pyx_k_tuple_2;
 static PyObject *__pyx_k_tuple_4;
 static PyObject *__pyx_k_tuple_6;
-static PyObject *__pyx_k_tuple_9;
+static PyObject *__pyx_k_tuple_8;
 static PyObject *__pyx_k_tuple_10;
-static PyObject *__pyx_k_tuple_12;
+static PyObject *__pyx_k_tuple_13;
 static PyObject *__pyx_k_tuple_14;
 static PyObject *__pyx_k_tuple_16;
-static PyObject *__pyx_k_tuple_17;
-static PyObject *__pyx_k_tuple_19;
-static PyObject *__pyx_k_tuple_22;
-static PyObject *__pyx_k_tuple_24;
+static PyObject *__pyx_k_tuple_18;
+static PyObject *__pyx_k_tuple_20;
+static PyObject *__pyx_k_tuple_21;
+static PyObject *__pyx_k_tuple_23;
 static PyObject *__pyx_k_tuple_26;
 static PyObject *__pyx_k_tuple_28;
 static PyObject *__pyx_k_tuple_30;
-static PyObject *__pyx_k_tuple_33;
+static PyObject *__pyx_k_tuple_32;
 static PyObject *__pyx_k_tuple_34;
-static PyObject *__pyx_k_tuple_36;
+static PyObject *__pyx_k_tuple_37;
 static PyObject *__pyx_k_tuple_38;
-static PyObject *__pyx_k_tuple_52;
-static PyObject *__pyx_k_tuple_54;
-static PyObject *__pyx_k_tuple_56;
+static PyObject *__pyx_k_tuple_40;
+static PyObject *__pyx_k_tuple_42;
+static PyObject *__pyx_k_tuple_55;
 static PyObject *__pyx_k_tuple_58;
 static PyObject *__pyx_k_tuple_60;
+static PyObject *__pyx_k_tuple_62;
+static PyObject *__pyx_k_tuple_64;
+static PyObject *__pyx_k_tuple_66;
 
 /* Python wrapper */
 static int __pyx_pw_8bilinear_8Bilinear_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static int __pyx_pw_8bilinear_8Bilinear_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_data = 0;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
@@ -1702,7 +1858,7 @@ static int __pyx_pw_8bilinear_8Bilinear_1__cinit__(PyObject *__pyx_v_self, PyObj
         else goto __pyx_L5_argtuple_error;
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
       goto __pyx_L5_argtuple_error;
@@ -1713,14 +1869,14 @@ static int __pyx_pw_8bilinear_8Bilinear_1__cinit__(PyObject *__pyx_v_self, PyObj
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_AddTraceback("bilinear.Bilinear.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return -1;
   __pyx_L4_argument_unpacking_done:;
   if (unlikely(((PyObject *)__pyx_v_data) == Py_None)) {
-    PyErr_Format(PyExc_TypeError, "Argument 'data' must not be None"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    PyErr_Format(PyExc_TypeError, "Argument 'data' must not be None"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   __pyx_r = __pyx_pf_8bilinear_8Bilinear___cinit__(((struct __pyx_obj_8bilinear_Bilinear *)__pyx_v_self), __pyx_v_data);
   goto __pyx_L0;
@@ -1731,7 +1887,7 @@ static int __pyx_pw_8bilinear_8Bilinear_1__cinit__(PyObject *__pyx_v_self, PyObj
   return __pyx_r;
 }
 
-/* "bilinear.pyx":46
+/* "bilinear.pyx":48
  *     cdef size_t d0_max, d1_max, r
  * 
  *     def __cinit__(self, data not None):             # <<<<<<<<<<<<<<
@@ -1756,7 +1912,7 @@ static int __pyx_pf_8bilinear_8Bilinear___cinit__(struct __pyx_obj_8bilinear_Bil
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__cinit__", 0);
 
-  /* "bilinear.pyx":47
+  /* "bilinear.pyx":49
  * 
  *     def __cinit__(self, data not None):
  *         assert data.ndim == 2             # <<<<<<<<<<<<<<
@@ -1764,121 +1920,121 @@ static int __pyx_pf_8bilinear_8Bilinear___cinit__(struct __pyx_obj_8bilinear_Bil
  *         self.d1_max = data.shape[1] - 1
  */
   #ifndef CYTHON_WITHOUT_ASSERTIONS
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_data, __pyx_n_s__ndim); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_data, __pyx_n_s__ndim); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   if (unlikely(!__pyx_t_3)) {
     PyErr_SetNone(PyExc_AssertionError);
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   #endif
 
-  /* "bilinear.pyx":48
+  /* "bilinear.pyx":50
  *     def __cinit__(self, data not None):
  *         assert data.ndim == 2
  *         self.d0_max = data.shape[0] - 1             # <<<<<<<<<<<<<<
  *         self.d1_max = data.shape[1] - 1
  *         self.maxi = data.max()
  */
-  __pyx_t_2 = PyObject_GetAttr(__pyx_v_data, __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_data, __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_4 = __Pyx_PyInt_AsSize_t(__pyx_t_2); if (unlikely((__pyx_t_4 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyInt_AsSize_t(__pyx_t_2); if (unlikely((__pyx_t_4 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_v_self->d0_max = __pyx_t_4;
 
-  /* "bilinear.pyx":49
+  /* "bilinear.pyx":51
  *         assert data.ndim == 2
  *         self.d0_max = data.shape[0] - 1
  *         self.d1_max = data.shape[1] - 1             # <<<<<<<<<<<<<<
  *         self.maxi = data.max()
  *         self.mini = data.min()
  */
-  __pyx_t_2 = PyObject_GetAttr(__pyx_v_data, __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_data, __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_4 = __Pyx_PyInt_AsSize_t(__pyx_t_2); if (unlikely((__pyx_t_4 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyInt_AsSize_t(__pyx_t_2); if (unlikely((__pyx_t_4 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_v_self->d1_max = __pyx_t_4;
 
-  /* "bilinear.pyx":50
+  /* "bilinear.pyx":52
  *         self.d0_max = data.shape[0] - 1
  *         self.d1_max = data.shape[1] - 1
  *         self.maxi = data.max()             # <<<<<<<<<<<<<<
  *         self.mini = data.min()
  *         self.data = numpy.ascontiguousarray(data, dtype=numpy.float32)
  */
-  __pyx_t_2 = PyObject_GetAttr(__pyx_v_data, __pyx_n_s__max); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_data, __pyx_n_s__max); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __pyx_v_self->maxi = __pyx_t_5;
 
-  /* "bilinear.pyx":51
+  /* "bilinear.pyx":53
  *         self.d1_max = data.shape[1] - 1
  *         self.maxi = data.max()
  *         self.mini = data.min()             # <<<<<<<<<<<<<<
  *         self.data = numpy.ascontiguousarray(data, dtype=numpy.float32)
  * 
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_data, __pyx_n_s__min); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_data, __pyx_n_s__min); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __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 = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __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 = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_t_2); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_t_2); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_v_self->mini = __pyx_t_5;
 
-  /* "bilinear.pyx":52
+  /* "bilinear.pyx":54
  *         self.maxi = data.max()
  *         self.mini = data.min()
  *         self.data = numpy.ascontiguousarray(data, dtype=numpy.float32)             # <<<<<<<<<<<<<<
  * 
  *     @cython.boundscheck(False)
  */
-  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_INCREF(__pyx_v_data);
   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_data);
   __Pyx_GIVEREF(__pyx_v_data);
-  __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_6));
-  __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_7);
-  __pyx_t_8 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__float32); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s__float32); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_8);
   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-  if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-  __pyx_t_8 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_8 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_8);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
   __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(__pyx_t_8);
-  if (unlikely(!__pyx_t_9.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(!__pyx_t_9.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
   __PYX_XDEC_MEMVIEW(&__pyx_v_self->data, 0);
   __pyx_v_self->data = __pyx_t_9;
@@ -1913,7 +2069,7 @@ static PyObject *__pyx_pw_8bilinear_8Bilinear_3f_cy(PyObject *__pyx_v_self, PyOb
   return __pyx_r;
 }
 
-/* "bilinear.pyx":56
+/* "bilinear.pyx":58
  *     @cython.boundscheck(False)
  *     @cython.wraparound(False)
  *     def f_cy(self, x):             # <<<<<<<<<<<<<<
@@ -1963,33 +2119,33 @@ static PyObject *__pyx_pf_8bilinear_8Bilinear_2f_cy(struct __pyx_obj_8bilinear_B
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("f_cy", 0);
 
-  /* "bilinear.pyx":63
+  /* "bilinear.pyx":65
  * 
  *         """
  *         cdef float d0 = x[0]             # <<<<<<<<<<<<<<
  *         cdef float d1 = x[1]
  *         cdef int i0, i1, j0, j1
  */
-  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_x, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_x, 0, sizeof(long), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_2 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_2 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __pyx_v_d0 = __pyx_t_2;
 
-  /* "bilinear.pyx":64
+  /* "bilinear.pyx":66
  *         """
  *         cdef float d0 = x[0]
  *         cdef float d1 = x[1]             # <<<<<<<<<<<<<<
  *         cdef int i0, i1, j0, j1
  *         cdef float x0, x1, y0, y1, res
  */
-  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_x, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_x, 1, sizeof(long), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_2 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_2 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __pyx_v_d1 = __pyx_t_2;
 
-  /* "bilinear.pyx":67
+  /* "bilinear.pyx":69
  *         cdef int i0, i1, j0, j1
  *         cdef float x0, x1, y0, y1, res
  *         with nogil:             # <<<<<<<<<<<<<<
@@ -1998,12 +2154,12 @@ static PyObject *__pyx_pf_8bilinear_8Bilinear_2f_cy(struct __pyx_obj_8bilinear_B
  */
   {
       #ifdef WITH_THREAD
-      PyThreadState *_save = NULL;
-      #endif
+      PyThreadState *_save;
       Py_UNBLOCK_THREADS
+      #endif
       /*try:*/ {
 
-        /* "bilinear.pyx":68
+        /* "bilinear.pyx":70
  *         cdef float x0, x1, y0, y1, res
  *         with nogil:
  *             x0 = floor(d0)             # <<<<<<<<<<<<<<
@@ -2012,7 +2168,7 @@ static PyObject *__pyx_pf_8bilinear_8Bilinear_2f_cy(struct __pyx_obj_8bilinear_B
  */
         __pyx_v_x0 = floor(__pyx_v_d0);
 
-        /* "bilinear.pyx":69
+        /* "bilinear.pyx":71
  *         with nogil:
  *             x0 = floor(d0)
  *             x1 = ceil(d0)             # <<<<<<<<<<<<<<
@@ -2021,7 +2177,7 @@ static PyObject *__pyx_pf_8bilinear_8Bilinear_2f_cy(struct __pyx_obj_8bilinear_B
  */
         __pyx_v_x1 = ceil(__pyx_v_d0);
 
-        /* "bilinear.pyx":70
+        /* "bilinear.pyx":72
  *             x0 = floor(d0)
  *             x1 = ceil(d0)
  *             y0 = floor(d1)             # <<<<<<<<<<<<<<
@@ -2030,7 +2186,7 @@ static PyObject *__pyx_pf_8bilinear_8Bilinear_2f_cy(struct __pyx_obj_8bilinear_B
  */
         __pyx_v_y0 = floor(__pyx_v_d1);
 
-        /* "bilinear.pyx":71
+        /* "bilinear.pyx":73
  *             x1 = ceil(d0)
  *             y0 = floor(d1)
  *             y1 = ceil(d1)             # <<<<<<<<<<<<<<
@@ -2039,7 +2195,7 @@ static PyObject *__pyx_pf_8bilinear_8Bilinear_2f_cy(struct __pyx_obj_8bilinear_B
  */
         __pyx_v_y1 = ceil(__pyx_v_d1);
 
-        /* "bilinear.pyx":72
+        /* "bilinear.pyx":74
  *             y0 = floor(d1)
  *             y1 = ceil(d1)
  *             i0 = < int > x0             # <<<<<<<<<<<<<<
@@ -2048,7 +2204,7 @@ static PyObject *__pyx_pf_8bilinear_8Bilinear_2f_cy(struct __pyx_obj_8bilinear_B
  */
         __pyx_v_i0 = ((int)__pyx_v_x0);
 
-        /* "bilinear.pyx":73
+        /* "bilinear.pyx":75
  *             y1 = ceil(d1)
  *             i0 = < int > x0
  *             i1 = < int > x1             # <<<<<<<<<<<<<<
@@ -2057,7 +2213,7 @@ static PyObject *__pyx_pf_8bilinear_8Bilinear_2f_cy(struct __pyx_obj_8bilinear_B
  */
         __pyx_v_i1 = ((int)__pyx_v_x1);
 
-        /* "bilinear.pyx":74
+        /* "bilinear.pyx":76
  *             i0 = < int > x0
  *             i1 = < int > x1
  *             j0 = < int > y0             # <<<<<<<<<<<<<<
@@ -2066,7 +2222,7 @@ static PyObject *__pyx_pf_8bilinear_8Bilinear_2f_cy(struct __pyx_obj_8bilinear_B
  */
         __pyx_v_j0 = ((int)__pyx_v_y0);
 
-        /* "bilinear.pyx":75
+        /* "bilinear.pyx":77
  *             i1 = < int > x1
  *             j0 = < int > y0
  *             j1 = < int > y1             # <<<<<<<<<<<<<<
@@ -2075,17 +2231,17 @@ static PyObject *__pyx_pf_8bilinear_8Bilinear_2f_cy(struct __pyx_obj_8bilinear_B
  */
         __pyx_v_j1 = ((int)__pyx_v_y1);
 
-        /* "bilinear.pyx":76
+        /* "bilinear.pyx":78
  *             j0 = < int > y0
  *             j1 = < int > y1
  *             if d0 < 0:             # <<<<<<<<<<<<<<
  *                 res = self.mini + d0
  *             elif d1 < 0:
  */
-        __pyx_t_3 = (__pyx_v_d0 < 0.0);
+        __pyx_t_3 = ((__pyx_v_d0 < 0.0) != 0);
         if (__pyx_t_3) {
 
-          /* "bilinear.pyx":77
+          /* "bilinear.pyx":79
  *             j1 = < int > y1
  *             if d0 < 0:
  *                 res = self.mini + d0             # <<<<<<<<<<<<<<
@@ -2096,17 +2252,17 @@ static PyObject *__pyx_pf_8bilinear_8Bilinear_2f_cy(struct __pyx_obj_8bilinear_B
           goto __pyx_L6;
         }
 
-        /* "bilinear.pyx":78
+        /* "bilinear.pyx":80
  *             if d0 < 0:
  *                 res = self.mini + d0
  *             elif d1 < 0:             # <<<<<<<<<<<<<<
  *                 res = self.mini + d1
  *             elif d0 > self.d0_max:
  */
-        __pyx_t_3 = (__pyx_v_d1 < 0.0);
+        __pyx_t_3 = ((__pyx_v_d1 < 0.0) != 0);
         if (__pyx_t_3) {
 
-          /* "bilinear.pyx":79
+          /* "bilinear.pyx":81
  *                 res = self.mini + d0
  *             elif d1 < 0:
  *                 res = self.mini + d1             # <<<<<<<<<<<<<<
@@ -2117,17 +2273,17 @@ static PyObject *__pyx_pf_8bilinear_8Bilinear_2f_cy(struct __pyx_obj_8bilinear_B
           goto __pyx_L6;
         }
 
-        /* "bilinear.pyx":80
+        /* "bilinear.pyx":82
  *             elif d1 < 0:
  *                 res = self.mini + d1
  *             elif d0 > self.d0_max:             # <<<<<<<<<<<<<<
  *                 res = self.mini - d0 + self.d0_max
  *             elif d1 > self.d1_max:
  */
-        __pyx_t_3 = (__pyx_v_d0 > __pyx_v_self->d0_max);
+        __pyx_t_3 = ((__pyx_v_d0 > __pyx_v_self->d0_max) != 0);
         if (__pyx_t_3) {
 
-          /* "bilinear.pyx":81
+          /* "bilinear.pyx":83
  *                 res = self.mini + d1
  *             elif d0 > self.d0_max:
  *                 res = self.mini - d0 + self.d0_max             # <<<<<<<<<<<<<<
@@ -2138,17 +2294,17 @@ static PyObject *__pyx_pf_8bilinear_8Bilinear_2f_cy(struct __pyx_obj_8bilinear_B
           goto __pyx_L6;
         }
 
-        /* "bilinear.pyx":82
+        /* "bilinear.pyx":84
  *             elif d0 > self.d0_max:
  *                 res = self.mini - d0 + self.d0_max
  *             elif d1 > self.d1_max:             # <<<<<<<<<<<<<<
  *                 res = self.mini - d1 + self.d1_max
  *             elif (i0 == i1) and (j0 == j1):
  */
-        __pyx_t_3 = (__pyx_v_d1 > __pyx_v_self->d1_max);
+        __pyx_t_3 = ((__pyx_v_d1 > __pyx_v_self->d1_max) != 0);
         if (__pyx_t_3) {
 
-          /* "bilinear.pyx":83
+          /* "bilinear.pyx":85
  *                 res = self.mini - d0 + self.d0_max
  *             elif d1 > self.d1_max:
  *                 res = self.mini - d1 + self.d1_max             # <<<<<<<<<<<<<<
@@ -2159,84 +2315,84 @@ static PyObject *__pyx_pf_8bilinear_8Bilinear_2f_cy(struct __pyx_obj_8bilinear_B
           goto __pyx_L6;
         }
 
-        /* "bilinear.pyx":84
+        /* "bilinear.pyx":86
  *             elif d1 > self.d1_max:
  *                 res = self.mini - d1 + self.d1_max
  *             elif (i0 == i1) and (j0 == j1):             # <<<<<<<<<<<<<<
  *                 res = self.data[i0,j0]
  *             elif i0 == i1:
  */
-        __pyx_t_3 = (__pyx_v_i0 == __pyx_v_i1);
+        __pyx_t_3 = ((__pyx_v_i0 == __pyx_v_i1) != 0);
         if (__pyx_t_3) {
-          __pyx_t_4 = (__pyx_v_j0 == __pyx_v_j1);
+          __pyx_t_4 = ((__pyx_v_j0 == __pyx_v_j1) != 0);
           __pyx_t_5 = __pyx_t_4;
         } else {
           __pyx_t_5 = __pyx_t_3;
         }
         if (__pyx_t_5) {
 
-          /* "bilinear.pyx":85
+          /* "bilinear.pyx":87
  *                 res = self.mini - d1 + self.d1_max
  *             elif (i0 == i1) and (j0 == j1):
  *                 res = self.data[i0,j0]             # <<<<<<<<<<<<<<
  *             elif i0 == i1:
  *                 res = (self.data[i0,j0] * (y1 - d1)) + (self.data[i0,j1] * (d1 - y0))
  */
-          if (unlikely(!__pyx_v_self->data.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L4;}}
+          if (unlikely(!__pyx_v_self->data.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L4;}}
           __pyx_t_6 = __pyx_v_i0;
           __pyx_t_7 = __pyx_v_j0;
           __pyx_v_res = (*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_self->data.data + __pyx_t_6 * __pyx_v_self->data.strides[0]) ) + __pyx_t_7 * __pyx_v_self->data.strides[1]) )));
           goto __pyx_L6;
         }
 
-        /* "bilinear.pyx":86
+        /* "bilinear.pyx":88
  *             elif (i0 == i1) and (j0 == j1):
  *                 res = self.data[i0,j0]
  *             elif i0 == i1:             # <<<<<<<<<<<<<<
  *                 res = (self.data[i0,j0] * (y1 - d1)) + (self.data[i0,j1] * (d1 - y0))
  *             elif j0 == j1:
  */
-        __pyx_t_5 = (__pyx_v_i0 == __pyx_v_i1);
+        __pyx_t_5 = ((__pyx_v_i0 == __pyx_v_i1) != 0);
         if (__pyx_t_5) {
 
-          /* "bilinear.pyx":87
+          /* "bilinear.pyx":89
  *                 res = self.data[i0,j0]
  *             elif i0 == i1:
  *                 res = (self.data[i0,j0] * (y1 - d1)) + (self.data[i0,j1] * (d1 - y0))             # <<<<<<<<<<<<<<
  *             elif j0 == j1:
  *                 res = (self.data[i0,j0] * (x1 - d0)) + (self.data[i1,j0] * (d0 - x0))
  */
-          if (unlikely(!__pyx_v_self->data.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L4;}}
+          if (unlikely(!__pyx_v_self->data.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L4;}}
           __pyx_t_8 = __pyx_v_i0;
           __pyx_t_9 = __pyx_v_j0;
-          if (unlikely(!__pyx_v_self->data.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L4;}}
+          if (unlikely(!__pyx_v_self->data.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L4;}}
           __pyx_t_10 = __pyx_v_i0;
           __pyx_t_11 = __pyx_v_j1;
           __pyx_v_res = (((*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_self->data.data + __pyx_t_8 * __pyx_v_self->data.strides[0]) ) + __pyx_t_9 * __pyx_v_self->data.strides[1]) ))) * (__pyx_v_y1 - __pyx_v_d1)) + ((*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_self->data.data + __pyx_t_10 * __pyx_v_self->data.strides[0]) ) + __pyx_t_11 * __pyx_v_self->data.strides[1]) ))) * (__pyx_v_d1 - __pyx_v_y0)));
           goto __pyx_L6;
         }
 
-        /* "bilinear.pyx":88
+        /* "bilinear.pyx":90
  *             elif i0 == i1:
  *                 res = (self.data[i0,j0] * (y1 - d1)) + (self.data[i0,j1] * (d1 - y0))
  *             elif j0 == j1:             # <<<<<<<<<<<<<<
  *                 res = (self.data[i0,j0] * (x1 - d0)) + (self.data[i1,j0] * (d0 - x0))
  *             else:
  */
-        __pyx_t_5 = (__pyx_v_j0 == __pyx_v_j1);
+        __pyx_t_5 = ((__pyx_v_j0 == __pyx_v_j1) != 0);
         if (__pyx_t_5) {
 
-          /* "bilinear.pyx":89
+          /* "bilinear.pyx":91
  *                 res = (self.data[i0,j0] * (y1 - d1)) + (self.data[i0,j1] * (d1 - y0))
  *             elif j0 == j1:
  *                 res = (self.data[i0,j0] * (x1 - d0)) + (self.data[i1,j0] * (d0 - x0))             # <<<<<<<<<<<<<<
  *             else:
  *                 res = (self.data[i0,j0] * (x1 - d0) * (y1 - d1))  \
  */
-          if (unlikely(!__pyx_v_self->data.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L4;}}
+          if (unlikely(!__pyx_v_self->data.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L4;}}
           __pyx_t_12 = __pyx_v_i0;
           __pyx_t_13 = __pyx_v_j0;
-          if (unlikely(!__pyx_v_self->data.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L4;}}
+          if (unlikely(!__pyx_v_self->data.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L4;}}
           __pyx_t_14 = __pyx_v_i1;
           __pyx_t_15 = __pyx_v_j0;
           __pyx_v_res = (((*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_self->data.data + __pyx_t_12 * __pyx_v_self->data.strides[0]) ) + __pyx_t_13 * __pyx_v_self->data.strides[1]) ))) * (__pyx_v_x1 - __pyx_v_d0)) + ((*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_self->data.data + __pyx_t_14 * __pyx_v_self->data.strides[0]) ) + __pyx_t_15 * __pyx_v_self->data.strides[1]) ))) * (__pyx_v_d0 - __pyx_v_x0)));
@@ -2244,47 +2400,47 @@ static PyObject *__pyx_pf_8bilinear_8Bilinear_2f_cy(struct __pyx_obj_8bilinear_B
         }
         /*else*/ {
 
-          /* "bilinear.pyx":91
+          /* "bilinear.pyx":93
  *                 res = (self.data[i0,j0] * (x1 - d0)) + (self.data[i1,j0] * (d0 - x0))
  *             else:
  *                 res = (self.data[i0,j0] * (x1 - d0) * (y1 - d1))  \             # <<<<<<<<<<<<<<
  *                     + (self.data[i1,j0] * (d0 - x0) * (y1 - d1))  \
  *                     + (self.data[i0,j1] * (x1 - d0) * (d1 - y0))  \
  */
-          if (unlikely(!__pyx_v_self->data.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L4;}}
+          if (unlikely(!__pyx_v_self->data.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L4;}}
           __pyx_t_16 = __pyx_v_i0;
           __pyx_t_17 = __pyx_v_j0;
 
-          /* "bilinear.pyx":92
+          /* "bilinear.pyx":94
  *             else:
  *                 res = (self.data[i0,j0] * (x1 - d0) * (y1 - d1))  \
  *                     + (self.data[i1,j0] * (d0 - x0) * (y1 - d1))  \             # <<<<<<<<<<<<<<
  *                     + (self.data[i0,j1] * (x1 - d0) * (d1 - y0))  \
  *                     + (self.data[i1,j1] * (d0 - x0) * (d1 - y0))
  */
-          if (unlikely(!__pyx_v_self->data.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L4;}}
+          if (unlikely(!__pyx_v_self->data.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L4;}}
           __pyx_t_18 = __pyx_v_i1;
           __pyx_t_19 = __pyx_v_j0;
 
-          /* "bilinear.pyx":93
+          /* "bilinear.pyx":95
  *                 res = (self.data[i0,j0] * (x1 - d0) * (y1 - d1))  \
  *                     + (self.data[i1,j0] * (d0 - x0) * (y1 - d1))  \
  *                     + (self.data[i0,j1] * (x1 - d0) * (d1 - y0))  \             # <<<<<<<<<<<<<<
  *                     + (self.data[i1,j1] * (d0 - x0) * (d1 - y0))
  *         return - res
  */
-          if (unlikely(!__pyx_v_self->data.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L4;}}
+          if (unlikely(!__pyx_v_self->data.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L4;}}
           __pyx_t_20 = __pyx_v_i0;
           __pyx_t_21 = __pyx_v_j1;
 
-          /* "bilinear.pyx":94
+          /* "bilinear.pyx":96
  *                     + (self.data[i1,j0] * (d0 - x0) * (y1 - d1))  \
  *                     + (self.data[i0,j1] * (x1 - d0) * (d1 - y0))  \
  *                     + (self.data[i1,j1] * (d0 - x0) * (d1 - y0))             # <<<<<<<<<<<<<<
  *         return - res
  * 
  */
-          if (unlikely(!__pyx_v_self->data.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L4;}}
+          if (unlikely(!__pyx_v_self->data.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L4;}}
           __pyx_t_22 = __pyx_v_i1;
           __pyx_t_23 = __pyx_v_j1;
           __pyx_v_res = ((((((*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_self->data.data + __pyx_t_16 * __pyx_v_self->data.strides[0]) ) + __pyx_t_17 * __pyx_v_self->data.strides[1]) ))) * (__pyx_v_x1 - __pyx_v_d0)) * (__pyx_v_y1 - __pyx_v_d1)) + (((*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_self->data.data + __pyx_t_18 * __pyx_v_self->data.strides[0]) ) + __pyx_t_19 * __pyx_v_self->data.strides[1]) ))) * (__pyx_v_d0 - __pyx_v_x0)) * (__pyx_v_y1 - __pyx_v_d1))) + (((*((floa [...]
@@ -2292,7 +2448,7 @@ static PyObject *__pyx_pf_8bilinear_8Bilinear_2f_cy(struct __pyx_obj_8bilinear_B
         __pyx_L6:;
       }
 
-      /* "bilinear.pyx":67
+      /* "bilinear.pyx":69
  *         cdef int i0, i1, j0, j1
  *         cdef float x0, x1, y0, y1, res
  *         with nogil:             # <<<<<<<<<<<<<<
@@ -2304,14 +2460,16 @@ static PyObject *__pyx_pf_8bilinear_8Bilinear_2f_cy(struct __pyx_obj_8bilinear_B
         __pyx_why = 0; goto __pyx_L5;
         __pyx_L4: __pyx_why = 4; goto __pyx_L5;
         __pyx_L5:;
+        #ifdef WITH_THREAD
         Py_BLOCK_THREADS
+        #endif
         switch (__pyx_why) {
           case 4: goto __pyx_L1_error;
         }
       }
   }
 
-  /* "bilinear.pyx":95
+  /* "bilinear.pyx":97
  *                     + (self.data[i0,j1] * (x1 - d0) * (d1 - y0))  \
  *                     + (self.data[i1,j1] * (d0 - x0) * (d1 - y0))
  *         return - res             # <<<<<<<<<<<<<<
@@ -2319,7 +2477,7 @@ static PyObject *__pyx_pf_8bilinear_8Bilinear_2f_cy(struct __pyx_obj_8bilinear_B
  *     @cython.boundscheck(False)
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyFloat_FromDouble((-__pyx_v_res)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyFloat_FromDouble((-__pyx_v_res)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
@@ -2339,10 +2497,13 @@ static PyObject *__pyx_pf_8bilinear_8Bilinear_2f_cy(struct __pyx_obj_8bilinear_B
 
 /* Python wrapper */
 static PyObject *__pyx_pw_8bilinear_8Bilinear_5local_maxi(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_8bilinear_8Bilinear_4local_maxi[] = "\n        Return the local maximum ... with sub-pixel refinement\n        \n        @param x: 2-tuple of int\n        @param w: half with of the window: 1 or 2 are adviced\n        @return: 2-tuple of int with the nearest local maximum\n\n        ";
+static char __pyx_doc_8bilinear_8Bilinear_4local_maxi[] = "\n        Return the local maximum ... with sub-pixel refinement\n        \n        @param x: 2-tuple of int\n        @param w: half with of the window: 1 or 2 are adviced\n        @return: 2-tuple of int with the nearest local maximum\n\n        Sub-pixel refinement:\n        Second order taylor expansion of the function; first derivative is nul\n        delta = x-i = -Inverse[Hessian].gradient \n        ";
 static PyObject *__pyx_pw_8bilinear_8Bilinear_5local_maxi(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_x = 0;
   int __pyx_v_w;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("local_maxi (wrapper)", 0);
@@ -2370,7 +2531,7 @@ static PyObject *__pyx_pw_8bilinear_8Bilinear_5local_maxi(PyObject *__pyx_v_self
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "local_maxi") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "local_maxi") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     } else {
       switch (PyTuple_GET_SIZE(__pyx_args)) {
@@ -2382,14 +2543,14 @@ static PyObject *__pyx_pw_8bilinear_8Bilinear_5local_maxi(PyObject *__pyx_v_self
     }
     __pyx_v_x = values[0];
     if (values[1]) {
-      __pyx_v_w = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_w == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      __pyx_v_w = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_w == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     } else {
       __pyx_v_w = ((int)1);
     }
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("local_maxi", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __Pyx_RaiseArgtupleInvalid("local_maxi", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_AddTraceback("bilinear.Bilinear.local_maxi", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
@@ -2400,9 +2561,9 @@ static PyObject *__pyx_pw_8bilinear_8Bilinear_5local_maxi(PyObject *__pyx_v_self
   return __pyx_r;
 }
 
-/* "bilinear.pyx":99
- *     @cython.boundscheck(False)
+/* "bilinear.pyx":102
  *     @cython.wraparound(False)
+ *     @cython.cdivision(True)
  *     def local_maxi(self, x, int w=1):             # <<<<<<<<<<<<<<
  *         """
  *         Return the local maximum ... with sub-pixel refinement
@@ -2428,6 +2589,21 @@ static PyObject *__pyx_pf_8bilinear_8Bilinear_4local_maxi(struct __pyx_obj_8bili
   float __pyx_v_sum0;
   float __pyx_v_sum1;
   float __pyx_v_sum;
+  float __pyx_v_a00;
+  float __pyx_v_a01;
+  float __pyx_v_a02;
+  float __pyx_v_a10;
+  float __pyx_v_a11;
+  float __pyx_v_a12;
+  float __pyx_v_a20;
+  float __pyx_v_a21;
+  float __pyx_v_a22;
+  float __pyx_v_d00;
+  float __pyx_v_d11;
+  float __pyx_v_d01;
+  float __pyx_v_denom;
+  PyObject *__pyx_v_delta0 = NULL;
+  PyObject *__pyx_v_delta1 = NULL;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -2436,46 +2612,69 @@ static PyObject *__pyx_pf_8bilinear_8Bilinear_4local_maxi(struct __pyx_obj_8bili
   int __pyx_t_4;
   int __pyx_t_5;
   int __pyx_t_6;
-  long __pyx_t_7;
+  size_t __pyx_t_7;
   long __pyx_t_8;
-  int __pyx_t_9;
+  long __pyx_t_9;
   int __pyx_t_10;
   int __pyx_t_11;
   int __pyx_t_12;
-  PyObject *__pyx_t_13 = NULL;
-  PyObject *__pyx_t_14 = NULL;
+  int __pyx_t_13;
+  int __pyx_t_14;
+  int __pyx_t_15;
+  int __pyx_t_16;
+  int __pyx_t_17;
+  long __pyx_t_18;
+  long __pyx_t_19;
+  long __pyx_t_20;
+  long __pyx_t_21;
+  int __pyx_t_22;
+  long __pyx_t_23;
+  long __pyx_t_24;
+  long __pyx_t_25;
+  long __pyx_t_26;
+  int __pyx_t_27;
+  long __pyx_t_28;
+  long __pyx_t_29;
+  PyObject *__pyx_t_30 = NULL;
+  PyObject *__pyx_t_31 = NULL;
+  long __pyx_t_32;
+  int __pyx_t_33;
+  long __pyx_t_34;
+  int __pyx_t_35;
+  int __pyx_t_36;
+  int __pyx_t_37;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("local_maxi", 0);
 
-  /* "bilinear.pyx":108
- * 
+  /* "bilinear.pyx":114
+ *         delta = x-i = -Inverse[Hessian].gradient
  *         """
  *         cdef int current0 = x[0]             # <<<<<<<<<<<<<<
  *         cdef int current1 = x[1]
  *         cdef int i0, i1, start0, stop0, start1, stop1, new0, new1, cnt=0, width0=w, width1=w
  */
-  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_x, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_x, 0, sizeof(long), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __pyx_v_current0 = __pyx_t_2;
 
-  /* "bilinear.pyx":109
+  /* "bilinear.pyx":115
  *         """
  *         cdef int current0 = x[0]
  *         cdef int current1 = x[1]             # <<<<<<<<<<<<<<
  *         cdef int i0, i1, start0, stop0, start1, stop1, new0, new1, cnt=0, width0=w, width1=w
  *         cdef float tmp, value, current_value, sum0=0,  sum1=0, sum=0
  */
-  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_x, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_x, 1, sizeof(long), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __pyx_v_current1 = __pyx_t_2;
 
-  /* "bilinear.pyx":110
+  /* "bilinear.pyx":116
  *         cdef int current0 = x[0]
  *         cdef int current1 = x[1]
  *         cdef int i0, i1, start0, stop0, start1, stop1, new0, new1, cnt=0, width0=w, width1=w             # <<<<<<<<<<<<<<
@@ -2486,7 +2685,7 @@ static PyObject *__pyx_pf_8bilinear_8Bilinear_4local_maxi(struct __pyx_obj_8bili
   __pyx_v_width0 = __pyx_v_w;
   __pyx_v_width1 = __pyx_v_w;
 
-  /* "bilinear.pyx":111
+  /* "bilinear.pyx":117
  *         cdef int current1 = x[1]
  *         cdef int i0, i1, start0, stop0, start1, stop1, new0, new1, cnt=0, width0=w, width1=w
  *         cdef float tmp, value, current_value, sum0=0,  sum1=0, sum=0             # <<<<<<<<<<<<<<
@@ -2497,19 +2696,19 @@ static PyObject *__pyx_pf_8bilinear_8Bilinear_4local_maxi(struct __pyx_obj_8bili
   __pyx_v_sum1 = 0.0;
   __pyx_v_sum = 0.0;
 
-  /* "bilinear.pyx":112
+  /* "bilinear.pyx":118
  *         cdef int i0, i1, start0, stop0, start1, stop1, new0, new1, cnt=0, width0=w, width1=w
  *         cdef float tmp, value, current_value, sum0=0,  sum1=0, sum=0
  *         value = self.data[current0,current1]             # <<<<<<<<<<<<<<
  *         current_value = value-1.0
  *         new0,new1 = current0,current1
  */
-  if (unlikely(!__pyx_v_self->data.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}}
+  if (unlikely(!__pyx_v_self->data.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}}
   __pyx_t_2 = __pyx_v_current0;
   __pyx_t_3 = __pyx_v_current1;
   __pyx_v_value = (*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_self->data.data + __pyx_t_2 * __pyx_v_self->data.strides[0]) ) + __pyx_t_3 * __pyx_v_self->data.strides[1]) )));
 
-  /* "bilinear.pyx":113
+  /* "bilinear.pyx":119
  *         cdef float tmp, value, current_value, sum0=0,  sum1=0, sum=0
  *         value = self.data[current0,current1]
  *         current_value = value-1.0             # <<<<<<<<<<<<<<
@@ -2518,7 +2717,7 @@ static PyObject *__pyx_pf_8bilinear_8Bilinear_4local_maxi(struct __pyx_obj_8bili
  */
   __pyx_v_current_value = (__pyx_v_value - 1.0);
 
-  /* "bilinear.pyx":114
+  /* "bilinear.pyx":120
  *         value = self.data[current0,current1]
  *         current_value = value-1.0
  *         new0,new1 = current0,current1             # <<<<<<<<<<<<<<
@@ -2530,7 +2729,7 @@ static PyObject *__pyx_pf_8bilinear_8Bilinear_4local_maxi(struct __pyx_obj_8bili
   __pyx_v_new0 = __pyx_t_4;
   __pyx_v_new1 = __pyx_t_5;
 
-  /* "bilinear.pyx":115
+  /* "bilinear.pyx":121
  *         current_value = value-1.0
  *         new0,new1 = current0,current1
  *         with nogil:             # <<<<<<<<<<<<<<
@@ -2539,12 +2738,12 @@ static PyObject *__pyx_pf_8bilinear_8Bilinear_4local_maxi(struct __pyx_obj_8bili
  */
   {
       #ifdef WITH_THREAD
-      PyThreadState *_save = NULL;
-      #endif
+      PyThreadState *_save;
       Py_UNBLOCK_THREADS
+      #endif
       /*try:*/ {
 
-        /* "bilinear.pyx":116
+        /* "bilinear.pyx":122
  *         new0,new1 = current0,current1
  *         with nogil:
  *             while value>current_value:             # <<<<<<<<<<<<<<
@@ -2552,10 +2751,10 @@ static PyObject *__pyx_pf_8bilinear_8Bilinear_4local_maxi(struct __pyx_obj_8bili
  *                 cnt+=1
  */
         while (1) {
-          __pyx_t_6 = (__pyx_v_value > __pyx_v_current_value);
+          __pyx_t_6 = ((__pyx_v_value > __pyx_v_current_value) != 0);
           if (!__pyx_t_6) break;
 
-          /* "bilinear.pyx":117
+          /* "bilinear.pyx":123
  *         with nogil:
  *             while value>current_value:
  *                 current_value=value             # <<<<<<<<<<<<<<
@@ -2564,7 +2763,7 @@ static PyObject *__pyx_pf_8bilinear_8Bilinear_4local_maxi(struct __pyx_obj_8bili
  */
           __pyx_v_current_value = __pyx_v_value;
 
-          /* "bilinear.pyx":118
+          /* "bilinear.pyx":124
  *             while value>current_value:
  *                 current_value=value
  *                 cnt+=1             # <<<<<<<<<<<<<<
@@ -2573,17 +2772,17 @@ static PyObject *__pyx_pf_8bilinear_8Bilinear_4local_maxi(struct __pyx_obj_8bili
  */
           __pyx_v_cnt = (__pyx_v_cnt + 1);
 
-          /* "bilinear.pyx":119
+          /* "bilinear.pyx":125
  *                 current_value=value
  *                 cnt+=1
  *                 if current0 < width0:             # <<<<<<<<<<<<<<
  *                     start0 = 0
  *                 else:
  */
-          __pyx_t_6 = (__pyx_v_current0 < __pyx_v_width0);
+          __pyx_t_6 = ((__pyx_v_current0 < __pyx_v_width0) != 0);
           if (__pyx_t_6) {
 
-            /* "bilinear.pyx":120
+            /* "bilinear.pyx":126
  *                 cnt+=1
  *                 if current0 < width0:
  *                     start0 = 0             # <<<<<<<<<<<<<<
@@ -2595,7 +2794,7 @@ static PyObject *__pyx_pf_8bilinear_8Bilinear_4local_maxi(struct __pyx_obj_8bili
           }
           /*else*/ {
 
-            /* "bilinear.pyx":122
+            /* "bilinear.pyx":128
  *                     start0 = 0
  *                 else:
  *                     start0 = current0 - width0             # <<<<<<<<<<<<<<
@@ -2606,29 +2805,30 @@ static PyObject *__pyx_pf_8bilinear_8Bilinear_4local_maxi(struct __pyx_obj_8bili
           }
           __pyx_L8:;
 
-          /* "bilinear.pyx":123
+          /* "bilinear.pyx":129
  *                 else:
  *                     start0 = current0 - width0
  *                 if current0 >= self.d0_max - width0:             # <<<<<<<<<<<<<<
  *                     stop0 = self.d0_max
  *                 else:
  */
-          __pyx_t_6 = (__pyx_v_current0 >= (__pyx_v_self->d0_max - __pyx_v_width0));
+          __pyx_t_6 = ((__pyx_v_current0 >= (__pyx_v_self->d0_max - __pyx_v_width0)) != 0);
           if (__pyx_t_6) {
 
-            /* "bilinear.pyx":124
+            /* "bilinear.pyx":130
  *                     start0 = current0 - width0
  *                 if current0 >= self.d0_max - width0:
  *                     stop0 = self.d0_max             # <<<<<<<<<<<<<<
  *                 else:
  *                     stop0 = current0 + width0
  */
-            __pyx_v_stop0 = __pyx_v_self->d0_max;
+            __pyx_t_7 = __pyx_v_self->d0_max;
+            __pyx_v_stop0 = __pyx_t_7;
             goto __pyx_L9;
           }
           /*else*/ {
 
-            /* "bilinear.pyx":126
+            /* "bilinear.pyx":132
  *                     stop0 = self.d0_max
  *                 else:
  *                     stop0 = current0 + width0             # <<<<<<<<<<<<<<
@@ -2639,17 +2839,17 @@ static PyObject *__pyx_pf_8bilinear_8Bilinear_4local_maxi(struct __pyx_obj_8bili
           }
           __pyx_L9:;
 
-          /* "bilinear.pyx":127
+          /* "bilinear.pyx":133
  *                 else:
  *                     stop0 = current0 + width0
  *                 if current1 < width1:             # <<<<<<<<<<<<<<
  *                     start1 = 0
  *                 else:
  */
-          __pyx_t_6 = (__pyx_v_current1 < __pyx_v_width1);
+          __pyx_t_6 = ((__pyx_v_current1 < __pyx_v_width1) != 0);
           if (__pyx_t_6) {
 
-            /* "bilinear.pyx":128
+            /* "bilinear.pyx":134
  *                     stop0 = current0 + width0
  *                 if current1 < width1:
  *                     start1 = 0             # <<<<<<<<<<<<<<
@@ -2661,7 +2861,7 @@ static PyObject *__pyx_pf_8bilinear_8Bilinear_4local_maxi(struct __pyx_obj_8bili
           }
           /*else*/ {
 
-            /* "bilinear.pyx":130
+            /* "bilinear.pyx":136
  *                     start1 = 0
  *                 else:
  *                     start1 = current1 - width1             # <<<<<<<<<<<<<<
@@ -2672,29 +2872,30 @@ static PyObject *__pyx_pf_8bilinear_8Bilinear_4local_maxi(struct __pyx_obj_8bili
           }
           __pyx_L10:;
 
-          /* "bilinear.pyx":131
+          /* "bilinear.pyx":137
  *                 else:
  *                     start1 = current1 - width1
  *                 if current1 >= self.d1_max - width1:             # <<<<<<<<<<<<<<
  *                     stop1=self.d1_max
  *                 else:
  */
-          __pyx_t_6 = (__pyx_v_current1 >= (__pyx_v_self->d1_max - __pyx_v_width1));
+          __pyx_t_6 = ((__pyx_v_current1 >= (__pyx_v_self->d1_max - __pyx_v_width1)) != 0);
           if (__pyx_t_6) {
 
-            /* "bilinear.pyx":132
+            /* "bilinear.pyx":138
  *                     start1 = current1 - width1
  *                 if current1 >= self.d1_max - width1:
  *                     stop1=self.d1_max             # <<<<<<<<<<<<<<
  *                 else:
  *                     stop1 = current1 + width1
  */
-            __pyx_v_stop1 = __pyx_v_self->d1_max;
+            __pyx_t_7 = __pyx_v_self->d1_max;
+            __pyx_v_stop1 = __pyx_t_7;
             goto __pyx_L11;
           }
           /*else*/ {
 
-            /* "bilinear.pyx":134
+            /* "bilinear.pyx":140
  *                     stop1=self.d1_max
  *                 else:
  *                     stop1 = current1 + width1             # <<<<<<<<<<<<<<
@@ -2705,68 +2906,68 @@ static PyObject *__pyx_pf_8bilinear_8Bilinear_4local_maxi(struct __pyx_obj_8bili
           }
           __pyx_L11:;
 
-          /* "bilinear.pyx":135
+          /* "bilinear.pyx":141
  *                 else:
  *                     stop1 = current1 + width1
  *                 for i0 in range(start0, stop0+1):             # <<<<<<<<<<<<<<
  *                     for i1 in range(start1, stop1+1):
  *                         tmp=self.data[i0,i1]
  */
-          __pyx_t_7 = (__pyx_v_stop0 + 1);
-          for (__pyx_t_5 = __pyx_v_start0; __pyx_t_5 < __pyx_t_7; __pyx_t_5+=1) {
+          __pyx_t_8 = (__pyx_v_stop0 + 1);
+          for (__pyx_t_5 = __pyx_v_start0; __pyx_t_5 < __pyx_t_8; __pyx_t_5+=1) {
             __pyx_v_i0 = __pyx_t_5;
 
-            /* "bilinear.pyx":136
+            /* "bilinear.pyx":142
  *                     stop1 = current1 + width1
  *                 for i0 in range(start0, stop0+1):
  *                     for i1 in range(start1, stop1+1):             # <<<<<<<<<<<<<<
  *                         tmp=self.data[i0,i1]
  *                         if tmp>current_value:
  */
-            __pyx_t_8 = (__pyx_v_stop1 + 1);
-            for (__pyx_t_4 = __pyx_v_start1; __pyx_t_4 < __pyx_t_8; __pyx_t_4+=1) {
+            __pyx_t_9 = (__pyx_v_stop1 + 1);
+            for (__pyx_t_4 = __pyx_v_start1; __pyx_t_4 < __pyx_t_9; __pyx_t_4+=1) {
               __pyx_v_i1 = __pyx_t_4;
 
-              /* "bilinear.pyx":137
+              /* "bilinear.pyx":143
  *                 for i0 in range(start0, stop0+1):
  *                     for i1 in range(start1, stop1+1):
  *                         tmp=self.data[i0,i1]             # <<<<<<<<<<<<<<
  *                         if tmp>current_value:
  *                             new0,new1=i0,i1
  */
-              if (unlikely(!__pyx_v_self->data.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L4;}}
-              __pyx_t_9 = __pyx_v_i0;
-              __pyx_t_10 = __pyx_v_i1;
-              __pyx_v_tmp = (*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_self->data.data + __pyx_t_9 * __pyx_v_self->data.strides[0]) ) + __pyx_t_10 * __pyx_v_self->data.strides[1]) )));
+              if (unlikely(!__pyx_v_self->data.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L4;}}
+              __pyx_t_10 = __pyx_v_i0;
+              __pyx_t_11 = __pyx_v_i1;
+              __pyx_v_tmp = (*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_self->data.data + __pyx_t_10 * __pyx_v_self->data.strides[0]) ) + __pyx_t_11 * __pyx_v_self->data.strides[1]) )));
 
-              /* "bilinear.pyx":138
+              /* "bilinear.pyx":144
  *                     for i1 in range(start1, stop1+1):
  *                         tmp=self.data[i0,i1]
  *                         if tmp>current_value:             # <<<<<<<<<<<<<<
  *                             new0,new1=i0,i1
  *                             value = tmp
  */
-              __pyx_t_6 = (__pyx_v_tmp > __pyx_v_current_value);
+              __pyx_t_6 = ((__pyx_v_tmp > __pyx_v_current_value) != 0);
               if (__pyx_t_6) {
 
-                /* "bilinear.pyx":139
+                /* "bilinear.pyx":145
  *                         tmp=self.data[i0,i1]
  *                         if tmp>current_value:
  *                             new0,new1=i0,i1             # <<<<<<<<<<<<<<
  *                             value = tmp
  *                 current0,current1=new0,new1
  */
-                __pyx_t_11 = __pyx_v_i0;
-                __pyx_t_12 = __pyx_v_i1;
-                __pyx_v_new0 = __pyx_t_11;
-                __pyx_v_new1 = __pyx_t_12;
+                __pyx_t_12 = __pyx_v_i0;
+                __pyx_t_13 = __pyx_v_i1;
+                __pyx_v_new0 = __pyx_t_12;
+                __pyx_v_new1 = __pyx_t_13;
 
-                /* "bilinear.pyx":140
+                /* "bilinear.pyx":146
  *                         if tmp>current_value:
  *                             new0,new1=i0,i1
  *                             value = tmp             # <<<<<<<<<<<<<<
  *                 current0,current1=new0,new1
- *         #refinement of the position by a simple center of mass of the last valid region used
+ * 
  */
                 __pyx_v_value = __pyx_v_tmp;
                 goto __pyx_L16;
@@ -2775,12 +2976,12 @@ static PyObject *__pyx_pf_8bilinear_8Bilinear_4local_maxi(struct __pyx_obj_8bili
             }
           }
 
-          /* "bilinear.pyx":141
+          /* "bilinear.pyx":147
  *                             new0,new1=i0,i1
  *                             value = tmp
  *                 current0,current1=new0,new1             # <<<<<<<<<<<<<<
- *         #refinement of the position by a simple center of mass of the last valid region used
- *         for i0 in range(start0, stop0+1):
+ * 
+ *         cdef float a00, a01, a02, a10, a11, a12, a20, a21, a22 # coefficients of the array
  */
           __pyx_t_5 = __pyx_v_new0;
           __pyx_t_4 = __pyx_v_new1;
@@ -2789,7 +2990,7 @@ static PyObject *__pyx_pf_8bilinear_8Bilinear_4local_maxi(struct __pyx_obj_8bili
         }
       }
 
-      /* "bilinear.pyx":115
+      /* "bilinear.pyx":121
  *         current_value = value-1.0
  *         new0,new1 = current0,current1
  *         with nogil:             # <<<<<<<<<<<<<<
@@ -2801,48 +3002,365 @@ static PyObject *__pyx_pf_8bilinear_8Bilinear_4local_maxi(struct __pyx_obj_8bili
         __pyx_why = 0; goto __pyx_L5;
         __pyx_L4: __pyx_why = 4; goto __pyx_L5;
         __pyx_L5:;
+        #ifdef WITH_THREAD
         Py_BLOCK_THREADS
+        #endif
         switch (__pyx_why) {
           case 4: goto __pyx_L1_error;
         }
       }
   }
 
-  /* "bilinear.pyx":143
- *                 current0,current1=new0,new1
+  /* "bilinear.pyx":153
+ *         cdef float d00, d11, d01, denom # Hessian coefficient
+ * #        print(current0,current1)
+ *         if (stop0>current0) and (current0>start0) and (stop1>current1) and (current1>start1):             # <<<<<<<<<<<<<<
+ *             #Use second order polynomial taylor expansion
+ *             a00 = self.data[current0-1,current1-1]
+ */
+  __pyx_t_6 = ((__pyx_v_stop0 > __pyx_v_current0) != 0);
+  if (__pyx_t_6) {
+    __pyx_t_14 = ((__pyx_v_current0 > __pyx_v_start0) != 0);
+    if (__pyx_t_14) {
+      __pyx_t_15 = ((__pyx_v_stop1 > __pyx_v_current1) != 0);
+      if (__pyx_t_15) {
+        __pyx_t_16 = ((__pyx_v_current1 > __pyx_v_start1) != 0);
+        __pyx_t_17 = __pyx_t_16;
+      } else {
+        __pyx_t_17 = __pyx_t_15;
+      }
+      __pyx_t_15 = __pyx_t_17;
+    } else {
+      __pyx_t_15 = __pyx_t_14;
+    }
+    __pyx_t_14 = __pyx_t_15;
+  } else {
+    __pyx_t_14 = __pyx_t_6;
+  }
+  if (__pyx_t_14) {
+
+    /* "bilinear.pyx":155
+ *         if (stop0>current0) and (current0>start0) and (stop1>current1) and (current1>start1):
+ *             #Use second order polynomial taylor expansion
+ *             a00 = self.data[current0-1,current1-1]             # <<<<<<<<<<<<<<
+ *             a01 = self.data[current0-1,current1  ]
+ *             a02 = self.data[current0-1,current1+1]
+ */
+    if (unlikely(!__pyx_v_self->data.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}}
+    __pyx_t_8 = (__pyx_v_current0 - 1);
+    __pyx_t_9 = (__pyx_v_current1 - 1);
+    __pyx_v_a00 = (*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_self->data.data + __pyx_t_8 * __pyx_v_self->data.strides[0]) ) + __pyx_t_9 * __pyx_v_self->data.strides[1]) )));
+
+    /* "bilinear.pyx":156
+ *             #Use second order polynomial taylor expansion
+ *             a00 = self.data[current0-1,current1-1]
+ *             a01 = self.data[current0-1,current1  ]             # <<<<<<<<<<<<<<
+ *             a02 = self.data[current0-1,current1+1]
+ *             a10 = self.data[current0  ,current1-1]
+ */
+    if (unlikely(!__pyx_v_self->data.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}}
+    __pyx_t_18 = (__pyx_v_current0 - 1);
+    __pyx_t_4 = __pyx_v_current1;
+    __pyx_v_a01 = (*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_self->data.data + __pyx_t_18 * __pyx_v_self->data.strides[0]) ) + __pyx_t_4 * __pyx_v_self->data.strides[1]) )));
+
+    /* "bilinear.pyx":157
+ *             a00 = self.data[current0-1,current1-1]
+ *             a01 = self.data[current0-1,current1  ]
+ *             a02 = self.data[current0-1,current1+1]             # <<<<<<<<<<<<<<
+ *             a10 = self.data[current0  ,current1-1]
+ *             a11 = self.data[current0  ,current1  ]
+ */
+    if (unlikely(!__pyx_v_self->data.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}}
+    __pyx_t_19 = (__pyx_v_current0 - 1);
+    __pyx_t_20 = (__pyx_v_current1 + 1);
+    __pyx_v_a02 = (*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_self->data.data + __pyx_t_19 * __pyx_v_self->data.strides[0]) ) + __pyx_t_20 * __pyx_v_self->data.strides[1]) )));
+
+    /* "bilinear.pyx":158
+ *             a01 = self.data[current0-1,current1  ]
+ *             a02 = self.data[current0-1,current1+1]
+ *             a10 = self.data[current0  ,current1-1]             # <<<<<<<<<<<<<<
+ *             a11 = self.data[current0  ,current1  ]
+ *             a12 = self.data[current0  ,current1+1]
+ */
+    if (unlikely(!__pyx_v_self->data.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}}
+    __pyx_t_5 = __pyx_v_current0;
+    __pyx_t_21 = (__pyx_v_current1 - 1);
+    __pyx_v_a10 = (*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_self->data.data + __pyx_t_5 * __pyx_v_self->data.strides[0]) ) + __pyx_t_21 * __pyx_v_self->data.strides[1]) )));
+
+    /* "bilinear.pyx":159
+ *             a02 = self.data[current0-1,current1+1]
+ *             a10 = self.data[current0  ,current1-1]
+ *             a11 = self.data[current0  ,current1  ]             # <<<<<<<<<<<<<<
+ *             a12 = self.data[current0  ,current1+1]
+ *             a20 = self.data[current0+1,current1-1]
+ */
+    if (unlikely(!__pyx_v_self->data.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}}
+    __pyx_t_13 = __pyx_v_current0;
+    __pyx_t_12 = __pyx_v_current1;
+    __pyx_v_a11 = (*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_self->data.data + __pyx_t_13 * __pyx_v_self->data.strides[0]) ) + __pyx_t_12 * __pyx_v_self->data.strides[1]) )));
+
+    /* "bilinear.pyx":160
+ *             a10 = self.data[current0  ,current1-1]
+ *             a11 = self.data[current0  ,current1  ]
+ *             a12 = self.data[current0  ,current1+1]             # <<<<<<<<<<<<<<
+ *             a20 = self.data[current0+1,current1-1]
+ *             a21 = self.data[current0+1,current1  ]
+ */
+    if (unlikely(!__pyx_v_self->data.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}}
+    __pyx_t_22 = __pyx_v_current0;
+    __pyx_t_23 = (__pyx_v_current1 + 1);
+    __pyx_v_a12 = (*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_self->data.data + __pyx_t_22 * __pyx_v_self->data.strides[0]) ) + __pyx_t_23 * __pyx_v_self->data.strides[1]) )));
+
+    /* "bilinear.pyx":161
+ *             a11 = self.data[current0  ,current1  ]
+ *             a12 = self.data[current0  ,current1+1]
+ *             a20 = self.data[current0+1,current1-1]             # <<<<<<<<<<<<<<
+ *             a21 = self.data[current0+1,current1  ]
+ *             a22 = self.data[current0+1,current1-1]
+ */
+    if (unlikely(!__pyx_v_self->data.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}}
+    __pyx_t_24 = (__pyx_v_current0 + 1);
+    __pyx_t_25 = (__pyx_v_current1 - 1);
+    __pyx_v_a20 = (*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_self->data.data + __pyx_t_24 * __pyx_v_self->data.strides[0]) ) + __pyx_t_25 * __pyx_v_self->data.strides[1]) )));
+
+    /* "bilinear.pyx":162
+ *             a12 = self.data[current0  ,current1+1]
+ *             a20 = self.data[current0+1,current1-1]
+ *             a21 = self.data[current0+1,current1  ]             # <<<<<<<<<<<<<<
+ *             a22 = self.data[current0+1,current1-1]
+ * #            g0 = (a21 - a01)/2.0
+ */
+    if (unlikely(!__pyx_v_self->data.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}}
+    __pyx_t_26 = (__pyx_v_current0 + 1);
+    __pyx_t_27 = __pyx_v_current1;
+    __pyx_v_a21 = (*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_self->data.data + __pyx_t_26 * __pyx_v_self->data.strides[0]) ) + __pyx_t_27 * __pyx_v_self->data.strides[1]) )));
+
+    /* "bilinear.pyx":163
+ *             a20 = self.data[current0+1,current1-1]
+ *             a21 = self.data[current0+1,current1  ]
+ *             a22 = self.data[current0+1,current1-1]             # <<<<<<<<<<<<<<
+ * #            g0 = (a21 - a01)/2.0
+ * #            g1 = (a12 - a10)/2.0
+ */
+    if (unlikely(!__pyx_v_self->data.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}}
+    __pyx_t_28 = (__pyx_v_current0 + 1);
+    __pyx_t_29 = (__pyx_v_current1 - 1);
+    __pyx_v_a22 = (*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_self->data.data + __pyx_t_28 * __pyx_v_self->data.strides[0]) ) + __pyx_t_29 * __pyx_v_self->data.strides[1]) )));
+
+    /* "bilinear.pyx":166
+ * #            g0 = (a21 - a01)/2.0
+ * #            g1 = (a12 - a10)/2.0
+ *             d00 = a12 - 2.0*a11 + a10             # <<<<<<<<<<<<<<
+ *             d11 = a21 - 2.0*a11 + a01
+ *             d01 = (a00 - a02 - a20 + a22)/4.0
+ */
+    __pyx_v_d00 = ((__pyx_v_a12 - (2.0 * __pyx_v_a11)) + __pyx_v_a10);
+
+    /* "bilinear.pyx":167
+ * #            g1 = (a12 - a10)/2.0
+ *             d00 = a12 - 2.0*a11 + a10
+ *             d11 = a21 - 2.0*a11 + a01             # <<<<<<<<<<<<<<
+ *             d01 = (a00 - a02 - a20 + a22)/4.0
+ *             denom = 2.0*(d00*d11-d01*d01)
+ */
+    __pyx_v_d11 = ((__pyx_v_a21 - (2.0 * __pyx_v_a11)) + __pyx_v_a01);
+
+    /* "bilinear.pyx":168
+ *             d00 = a12 - 2.0*a11 + a10
+ *             d11 = a21 - 2.0*a11 + a01
+ *             d01 = (a00 - a02 - a20 + a22)/4.0             # <<<<<<<<<<<<<<
+ *             denom = 2.0*(d00*d11-d01*d01)
+ *             if abs(denom)<1e-10:
+ */
+    __pyx_v_d01 = ((((__pyx_v_a00 - __pyx_v_a02) - __pyx_v_a20) + __pyx_v_a22) / 4.0);
+
+    /* "bilinear.pyx":169
+ *             d11 = a21 - 2.0*a11 + a01
+ *             d01 = (a00 - a02 - a20 + a22)/4.0
+ *             denom = 2.0*(d00*d11-d01*d01)             # <<<<<<<<<<<<<<
+ *             if abs(denom)<1e-10:
+ *                 logger.debug("Singular determinant, Hessian undefined")
+ */
+    __pyx_v_denom = (2.0 * ((__pyx_v_d00 * __pyx_v_d11) - (__pyx_v_d01 * __pyx_v_d01)));
+
+    /* "bilinear.pyx":170
+ *             d01 = (a00 - a02 - a20 + a22)/4.0
+ *             denom = 2.0*(d00*d11-d01*d01)
+ *             if abs(denom)<1e-10:             # <<<<<<<<<<<<<<
+ *                 logger.debug("Singular determinant, Hessian undefined")
+ *             else:
+ */
+    __pyx_t_14 = ((fabsf(__pyx_v_denom) < 1e-10) != 0);
+    if (__pyx_t_14) {
+
+      /* "bilinear.pyx":171
+ *             denom = 2.0*(d00*d11-d01*d01)
+ *             if abs(denom)<1e-10:
+ *                 logger.debug("Singular determinant, Hessian undefined")             # <<<<<<<<<<<<<<
+ *             else:
+ *                 delta0 = ((a12 - a10)*d01 + (a01 - a21)*d11)/denom
+ */
+      __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
+      __pyx_t_30 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__debug); if (unlikely(!__pyx_t_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_30);
+      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __pyx_t_1 = PyObject_Call(__pyx_t_30, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
+      __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0;
+      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+      goto __pyx_L19;
+    }
+    /*else*/ {
+
+      /* "bilinear.pyx":173
+ *                 logger.debug("Singular determinant, Hessian undefined")
+ *             else:
+ *                 delta0 = ((a12 - a10)*d01 + (a01 - a21)*d11)/denom             # <<<<<<<<<<<<<<
+ *                 delta1 = ((a10 - a12)*d00 + (a21 - a01)*d01)/denom
+ *     #            print(delta0,delta1)
+ */
+      __pyx_t_1 = PyFloat_FromDouble(((((__pyx_v_a12 - __pyx_v_a10) * __pyx_v_d01) + ((__pyx_v_a01 - __pyx_v_a21) * __pyx_v_d11)) / __pyx_v_denom)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
+      __pyx_v_delta0 = __pyx_t_1;
+      __pyx_t_1 = 0;
+
+      /* "bilinear.pyx":174
+ *             else:
+ *                 delta0 = ((a12 - a10)*d01 + (a01 - a21)*d11)/denom
+ *                 delta1 = ((a10 - a12)*d00 + (a21 - a01)*d01)/denom             # <<<<<<<<<<<<<<
+ *     #            print(delta0,delta1)
+ *                 if abs(delta0)<=1.0 and abs(delta1)<=1.0: #Result is OK is nower than 0.5.
+ */
+      __pyx_t_1 = PyFloat_FromDouble(((((__pyx_v_a10 - __pyx_v_a12) * __pyx_v_d00) + ((__pyx_v_a21 - __pyx_v_a01) * __pyx_v_d01)) / __pyx_v_denom)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
+      __pyx_v_delta1 = __pyx_t_1;
+      __pyx_t_1 = 0;
+
+      /* "bilinear.pyx":176
+ *                 delta1 = ((a10 - a12)*d00 + (a21 - a01)*d01)/denom
+ *     #            print(delta0,delta1)
+ *                 if abs(delta0)<=1.0 and abs(delta1)<=1.0: #Result is OK is nower than 0.5.             # <<<<<<<<<<<<<<
+ *                     return (float(current0) + delta0, float(current1) + delta1)
+ *                 else:
+ */
+      __pyx_t_1 = PyNumber_Absolute(__pyx_v_delta0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
+      __pyx_t_30 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_30);
+      __pyx_t_31 = PyObject_RichCompare(__pyx_t_1, __pyx_t_30, Py_LE); __Pyx_XGOTREF(__pyx_t_31); if (unlikely(!__pyx_t_31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0;
+      __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_31); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_31); __pyx_t_31 = 0;
+      if (__pyx_t_14) {
+        __pyx_t_31 = PyNumber_Absolute(__pyx_v_delta1); if (unlikely(!__pyx_t_31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_31);
+        __pyx_t_30 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_30);
+        __pyx_t_1 = PyObject_RichCompare(__pyx_t_31, __pyx_t_30, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_31); __pyx_t_31 = 0;
+        __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0;
+        __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+        __pyx_t_15 = __pyx_t_6;
+      } else {
+        __pyx_t_15 = __pyx_t_14;
+      }
+      if (__pyx_t_15) {
+
+        /* "bilinear.pyx":177
+ *     #            print(delta0,delta1)
+ *                 if abs(delta0)<=1.0 and abs(delta1)<=1.0: #Result is OK is nower than 0.5.
+ *                     return (float(current0) + delta0, float(current1) + delta1)             # <<<<<<<<<<<<<<
+ *                 else:
+ *                     logger.debug("Failed to find root using second order expansion")
+ */
+        __Pyx_XDECREF(__pyx_r);
+        __pyx_t_1 = PyFloat_FromDouble(((double)__pyx_v_current0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_1);
+        __pyx_t_30 = PyNumber_Add(__pyx_t_1, __pyx_v_delta0); if (unlikely(!__pyx_t_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_30);
+        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+        __pyx_t_1 = PyFloat_FromDouble(((double)__pyx_v_current1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_1);
+        __pyx_t_31 = PyNumber_Add(__pyx_t_1, __pyx_v_delta1); if (unlikely(!__pyx_t_31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_31);
+        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+        __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_1);
+        PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_30);
+        __Pyx_GIVEREF(__pyx_t_30);
+        PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_31);
+        __Pyx_GIVEREF(__pyx_t_31);
+        __pyx_t_30 = 0;
+        __pyx_t_31 = 0;
+        __pyx_r = ((PyObject *)__pyx_t_1);
+        __pyx_t_1 = 0;
+        goto __pyx_L0;
+        goto __pyx_L20;
+      }
+      /*else*/ {
+
+        /* "bilinear.pyx":179
+ *                     return (float(current0) + delta0, float(current1) + delta1)
+ *                 else:
+ *                     logger.debug("Failed to find root using second order expansion")             # <<<<<<<<<<<<<<
+ *         #refinement of the position by a simple center of mass of the last valid region used
+ *         for i0 in range(start0, stop0+1):
+ */
+        __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_1);
+        __pyx_t_31 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__debug); if (unlikely(!__pyx_t_31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_31);
+        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+        __pyx_t_1 = PyObject_Call(__pyx_t_31, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_1);
+        __Pyx_DECREF(__pyx_t_31); __pyx_t_31 = 0;
+        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+      }
+      __pyx_L20:;
+    }
+    __pyx_L19:;
+    goto __pyx_L18;
+  }
+  __pyx_L18:;
+
+  /* "bilinear.pyx":181
+ *                     logger.debug("Failed to find root using second order expansion")
  *         #refinement of the position by a simple center of mass of the last valid region used
  *         for i0 in range(start0, stop0+1):             # <<<<<<<<<<<<<<
  *             for i1 in range(start1, stop1+1):
  *                 tmp = self.data[i0,i1]
  */
-  __pyx_t_7 = (__pyx_v_stop0 + 1);
-  for (__pyx_t_4 = __pyx_v_start0; __pyx_t_4 < __pyx_t_7; __pyx_t_4+=1) {
-    __pyx_v_i0 = __pyx_t_4;
+  __pyx_t_32 = (__pyx_v_stop0 + 1);
+  for (__pyx_t_33 = __pyx_v_start0; __pyx_t_33 < __pyx_t_32; __pyx_t_33+=1) {
+    __pyx_v_i0 = __pyx_t_33;
 
-    /* "bilinear.pyx":144
+    /* "bilinear.pyx":182
  *         #refinement of the position by a simple center of mass of the last valid region used
  *         for i0 in range(start0, stop0+1):
  *             for i1 in range(start1, stop1+1):             # <<<<<<<<<<<<<<
  *                 tmp = self.data[i0,i1]
  *                 sum0 += tmp * i0
  */
-    __pyx_t_8 = (__pyx_v_stop1 + 1);
-    for (__pyx_t_5 = __pyx_v_start1; __pyx_t_5 < __pyx_t_8; __pyx_t_5+=1) {
-      __pyx_v_i1 = __pyx_t_5;
+    __pyx_t_34 = (__pyx_v_stop1 + 1);
+    for (__pyx_t_35 = __pyx_v_start1; __pyx_t_35 < __pyx_t_34; __pyx_t_35+=1) {
+      __pyx_v_i1 = __pyx_t_35;
 
-      /* "bilinear.pyx":145
+      /* "bilinear.pyx":183
  *         for i0 in range(start0, stop0+1):
  *             for i1 in range(start1, stop1+1):
  *                 tmp = self.data[i0,i1]             # <<<<<<<<<<<<<<
  *                 sum0 += tmp * i0
  *                 sum1 += tmp * i1
  */
-      if (unlikely(!__pyx_v_self->data.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}}
-      __pyx_t_12 = __pyx_v_i0;
-      __pyx_t_11 = __pyx_v_i1;
-      __pyx_v_tmp = (*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_self->data.data + __pyx_t_12 * __pyx_v_self->data.strides[0]) ) + __pyx_t_11 * __pyx_v_self->data.strides[1]) )));
+      if (unlikely(!__pyx_v_self->data.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");{__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}}
+      __pyx_t_36 = __pyx_v_i0;
+      __pyx_t_37 = __pyx_v_i1;
+      __pyx_v_tmp = (*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_self->data.data + __pyx_t_36 * __pyx_v_self->data.strides[0]) ) + __pyx_t_37 * __pyx_v_self->data.strides[1]) )));
 
-      /* "bilinear.pyx":146
+      /* "bilinear.pyx":184
  *             for i1 in range(start1, stop1+1):
  *                 tmp = self.data[i0,i1]
  *                 sum0 += tmp * i0             # <<<<<<<<<<<<<<
@@ -2851,7 +3369,7 @@ static PyObject *__pyx_pf_8bilinear_8Bilinear_4local_maxi(struct __pyx_obj_8bili
  */
       __pyx_v_sum0 = (__pyx_v_sum0 + (__pyx_v_tmp * __pyx_v_i0));
 
-      /* "bilinear.pyx":147
+      /* "bilinear.pyx":185
  *                 tmp = self.data[i0,i1]
  *                 sum0 += tmp * i0
  *                 sum1 += tmp * i1             # <<<<<<<<<<<<<<
@@ -2860,104 +3378,97 @@ static PyObject *__pyx_pf_8bilinear_8Bilinear_4local_maxi(struct __pyx_obj_8bili
  */
       __pyx_v_sum1 = (__pyx_v_sum1 + (__pyx_v_tmp * __pyx_v_i1));
 
-      /* "bilinear.pyx":148
+      /* "bilinear.pyx":186
  *                 sum0 += tmp * i0
  *                 sum1 += tmp * i1
  *                 sum += tmp             # <<<<<<<<<<<<<<
  *         if sum>0:
- * #            print current0,current1,sum0/sum,sum1/sum
+ *            #print current0,current1,sum0/sum,sum1/sum
  */
       __pyx_v_sum = (__pyx_v_sum + __pyx_v_tmp);
     }
   }
 
-  /* "bilinear.pyx":149
+  /* "bilinear.pyx":187
  *                 sum1 += tmp * i1
  *                 sum += tmp
  *         if sum>0:             # <<<<<<<<<<<<<<
- * #            print current0,current1,sum0/sum,sum1/sum
- *             return (sum0/sum,sum1/sum)
+ *            #print current0,current1,sum0/sum,sum1/sum
+ *            return (sum0/sum,sum1/sum)
  */
-  __pyx_t_6 = (__pyx_v_sum > 0.0);
-  if (__pyx_t_6) {
+  __pyx_t_15 = ((__pyx_v_sum > 0.0) != 0);
+  if (__pyx_t_15) {
 
-    /* "bilinear.pyx":151
+    /* "bilinear.pyx":189
  *         if sum>0:
- * #            print current0,current1,sum0/sum,sum1/sum
- *             return (sum0/sum,sum1/sum)             # <<<<<<<<<<<<<<
+ *            #print current0,current1,sum0/sum,sum1/sum
+ *            return (sum0/sum,sum1/sum)             # <<<<<<<<<<<<<<
  *         else:
  *             return (current0,current1)
  */
     __Pyx_XDECREF(__pyx_r);
-    if (unlikely(__pyx_v_sum == 0)) {
-      PyErr_Format(PyExc_ZeroDivisionError, "float division");
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    }
-    __pyx_t_1 = PyFloat_FromDouble((__pyx_v_sum0 / __pyx_v_sum)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyFloat_FromDouble((__pyx_v_sum0 / __pyx_v_sum)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    if (unlikely(__pyx_v_sum == 0)) {
-      PyErr_Format(PyExc_ZeroDivisionError, "float division");
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    }
-    __pyx_t_13 = PyFloat_FromDouble((__pyx_v_sum1 / __pyx_v_sum)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_13);
-    __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_14);
-    PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_1);
+    __pyx_t_31 = PyFloat_FromDouble((__pyx_v_sum1 / __pyx_v_sum)); if (unlikely(!__pyx_t_31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_31);
+    __pyx_t_30 = PyTuple_New(2); if (unlikely(!__pyx_t_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_30);
+    PyTuple_SET_ITEM(__pyx_t_30, 0, __pyx_t_1);
     __Pyx_GIVEREF(__pyx_t_1);
-    PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_13);
-    __Pyx_GIVEREF(__pyx_t_13);
+    PyTuple_SET_ITEM(__pyx_t_30, 1, __pyx_t_31);
+    __Pyx_GIVEREF(__pyx_t_31);
     __pyx_t_1 = 0;
-    __pyx_t_13 = 0;
-    __pyx_r = ((PyObject *)__pyx_t_14);
-    __pyx_t_14 = 0;
+    __pyx_t_31 = 0;
+    __pyx_r = ((PyObject *)__pyx_t_30);
+    __pyx_t_30 = 0;
     goto __pyx_L0;
-    goto __pyx_L22;
+    goto __pyx_L25;
   }
   /*else*/ {
 
-    /* "bilinear.pyx":153
- *             return (sum0/sum,sum1/sum)
+    /* "bilinear.pyx":191
+ *            return (sum0/sum,sum1/sum)
  *         else:
  *             return (current0,current1)             # <<<<<<<<<<<<<<
- * 
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_14 = PyInt_FromLong(__pyx_v_current0); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_14);
-    __pyx_t_13 = PyInt_FromLong(__pyx_v_current1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_13);
-    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_30 = PyInt_FromLong(__pyx_v_current0); if (unlikely(!__pyx_t_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_30);
+    __pyx_t_31 = PyInt_FromLong(__pyx_v_current1); if (unlikely(!__pyx_t_31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_31);
+    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_14);
-    __Pyx_GIVEREF(__pyx_t_14);
-    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_13);
-    __Pyx_GIVEREF(__pyx_t_13);
-    __pyx_t_14 = 0;
-    __pyx_t_13 = 0;
+    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_30);
+    __Pyx_GIVEREF(__pyx_t_30);
+    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_31);
+    __Pyx_GIVEREF(__pyx_t_31);
+    __pyx_t_30 = 0;
+    __pyx_t_31 = 0;
     __pyx_r = ((PyObject *)__pyx_t_1);
     __pyx_t_1 = 0;
     goto __pyx_L0;
   }
-  __pyx_L22:;
+  __pyx_L25:;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_13);
-  __Pyx_XDECREF(__pyx_t_14);
+  __Pyx_XDECREF(__pyx_t_30);
+  __Pyx_XDECREF(__pyx_t_31);
   __Pyx_AddTraceback("bilinear.Bilinear.local_maxi", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
+  __Pyx_XDECREF(__pyx_v_delta0);
+  __Pyx_XDECREF(__pyx_v_delta1);
   __Pyx_XGIVEREF(__pyx_r);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
 /* Python wrapper */
-static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
-static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
+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);
@@ -3012,7 +3523,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  * 
  *             cdef int copy_shape, i, ndim
  */
-  __pyx_t_1 = (__pyx_v_info == NULL);
+  __pyx_t_1 = ((__pyx_v_info == NULL) != 0);
   if (__pyx_t_1) {
     __pyx_r = 0;
     goto __pyx_L0;
@@ -3054,7 +3565,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 copy_shape = 1
  *             else:
  */
-  __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t)));
+  __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":209
@@ -3087,7 +3598,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
  *                 raise ValueError(u"ndarray is not C contiguous")
  */
-  __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS);
+  __pyx_t_1 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":214
@@ -3097,7 +3608,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 raise ValueError(u"ndarray is not C contiguous")
  * 
  */
-    __pyx_t_2 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS));
+    __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS) != 0)) != 0);
     __pyx_t_3 = __pyx_t_2;
   } else {
     __pyx_t_3 = __pyx_t_1;
@@ -3111,7 +3622,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  * 
  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
  */
-    __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __Pyx_Raise(__pyx_t_4, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
@@ -3127,7 +3638,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
  *                 raise ValueError(u"ndarray is not Fortran contiguous")
  */
-  __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS);
+  __pyx_t_3 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0);
   if (__pyx_t_3) {
 
     /* "numpy.pxd":218
@@ -3137,7 +3648,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 raise ValueError(u"ndarray is not Fortran contiguous")
  * 
  */
-    __pyx_t_1 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS));
+    __pyx_t_1 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS) != 0)) != 0);
     __pyx_t_2 = __pyx_t_1;
   } else {
     __pyx_t_2 = __pyx_t_3;
@@ -3151,7 +3662,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  * 
  *             info.buf = PyArray_DATA(self)
  */
-    __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __Pyx_Raise(__pyx_t_4, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
@@ -3185,7 +3696,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 # Allocate new buffer for strides and shape info.
  *                 # This is allocated as one block, strides first.
  */
-  if (__pyx_v_copy_shape) {
+  __pyx_t_2 = (__pyx_v_copy_shape != 0);
+  if (__pyx_t_2) {
 
     /* "numpy.pxd":226
  *                 # Allocate new buffer for strides and shape info.
@@ -3283,7 +3795,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  * 
  *             cdef int t
  */
-  __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self));
+  __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0));
 
   /* "numpy.pxd":239
  * 
@@ -3301,8 +3813,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *             cdef list stack
  *             cdef int offset
  */
-  __Pyx_INCREF(((PyObject *)__pyx_v_self->descr));
-  __pyx_v_descr = __pyx_v_self->descr;
+  __pyx_t_4 = ((PyObject *)__pyx_v_self->descr);
+  __Pyx_INCREF(__pyx_t_4);
+  __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4);
+  __pyx_t_4 = 0;
 
   /* "numpy.pxd":244
  *             cdef int offset
@@ -3320,9 +3834,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 # do not call releasebuffer
  *                 info.obj = None
  */
-  __pyx_t_2 = (!__pyx_v_hasfields);
+  __pyx_t_2 = ((!(__pyx_v_hasfields != 0)) != 0);
   if (__pyx_t_2) {
-    __pyx_t_3 = (!__pyx_v_copy_shape);
+    __pyx_t_3 = ((!(__pyx_v_copy_shape != 0)) != 0);
     __pyx_t_1 = __pyx_t_3;
   } else {
     __pyx_t_1 = __pyx_t_2;
@@ -3367,7 +3881,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 t = descr.type_num
  *                 if ((descr.byteorder == c'>' and little_endian) or
  */
-  __pyx_t_1 = (!__pyx_v_hasfields);
+  __pyx_t_1 = ((!(__pyx_v_hasfields != 0)) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":254
@@ -3377,7 +3891,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 if ((descr.byteorder == c'>' and little_endian) or
  *                     (descr.byteorder == c'<' and not little_endian)):
  */
-    __pyx_v_t = __pyx_v_descr->type_num;
+    __pyx_t_5 = __pyx_v_descr->type_num;
+    __pyx_v_t = __pyx_t_5;
 
     /* "numpy.pxd":255
  *             if not hasfields:
@@ -3386,9 +3901,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                     (descr.byteorder == c'<' and not little_endian)):
  *                     raise ValueError(u"Non-native byte order not supported")
  */
-    __pyx_t_1 = (__pyx_v_descr->byteorder == '>');
+    __pyx_t_1 = ((__pyx_v_descr->byteorder == '>') != 0);
     if (__pyx_t_1) {
-      __pyx_t_2 = __pyx_v_little_endian;
+      __pyx_t_2 = (__pyx_v_little_endian != 0);
     } else {
       __pyx_t_2 = __pyx_t_1;
     }
@@ -3401,9 +3916,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                     raise ValueError(u"Non-native byte order not supported")
  *                 if   t == NPY_BYTE:        f = "b"
  */
-      __pyx_t_1 = (__pyx_v_descr->byteorder == '<');
+      __pyx_t_1 = ((__pyx_v_descr->byteorder == '<') != 0);
       if (__pyx_t_1) {
-        __pyx_t_3 = (!__pyx_v_little_endian);
+        __pyx_t_3 = ((!(__pyx_v_little_endian != 0)) != 0);
         __pyx_t_7 = __pyx_t_3;
       } else {
         __pyx_t_7 = __pyx_t_1;
@@ -3421,7 +3936,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 if   t == NPY_BYTE:        f = "b"
  *                 elif t == NPY_UBYTE:       f = "B"
  */
-      __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_4);
       __Pyx_Raise(__pyx_t_4, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
@@ -3430,227 +3945,202 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
     }
     __pyx_L12:;
 
-    /* "numpy.pxd":258
+    /* "numpy.pxd":274
+ *                 elif t == NPY_CDOUBLE:     f = "Zd"
+ *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
+ *                 elif t == NPY_OBJECT:      f = "O"             # <<<<<<<<<<<<<<
+ *                 else:
+ *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
+ */
+    switch (__pyx_v_t) {
+
+      /* "numpy.pxd":258
  *                     (descr.byteorder == c'<' and not little_endian)):
  *                     raise ValueError(u"Non-native byte order not supported")
  *                 if   t == NPY_BYTE:        f = "b"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_UBYTE:       f = "B"
  *                 elif t == NPY_SHORT:       f = "h"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_BYTE);
-    if (__pyx_t_1) {
+      case NPY_BYTE:
       __pyx_v_f = __pyx_k__b;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":259
+      /* "numpy.pxd":259
  *                     raise ValueError(u"Non-native byte order not supported")
  *                 if   t == NPY_BYTE:        f = "b"
  *                 elif t == NPY_UBYTE:       f = "B"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_SHORT:       f = "h"
  *                 elif t == NPY_USHORT:      f = "H"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_UBYTE);
-    if (__pyx_t_1) {
+      case NPY_UBYTE:
       __pyx_v_f = __pyx_k__B;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":260
+      /* "numpy.pxd":260
  *                 if   t == NPY_BYTE:        f = "b"
  *                 elif t == NPY_UBYTE:       f = "B"
  *                 elif t == NPY_SHORT:       f = "h"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_USHORT:      f = "H"
  *                 elif t == NPY_INT:         f = "i"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_SHORT);
-    if (__pyx_t_1) {
+      case NPY_SHORT:
       __pyx_v_f = __pyx_k__h;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":261
+      /* "numpy.pxd":261
  *                 elif t == NPY_UBYTE:       f = "B"
  *                 elif t == NPY_SHORT:       f = "h"
  *                 elif t == NPY_USHORT:      f = "H"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_INT:         f = "i"
  *                 elif t == NPY_UINT:        f = "I"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_USHORT);
-    if (__pyx_t_1) {
+      case NPY_USHORT:
       __pyx_v_f = __pyx_k__H;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":262
+      /* "numpy.pxd":262
  *                 elif t == NPY_SHORT:       f = "h"
  *                 elif t == NPY_USHORT:      f = "H"
  *                 elif t == NPY_INT:         f = "i"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_UINT:        f = "I"
  *                 elif t == NPY_LONG:        f = "l"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_INT);
-    if (__pyx_t_1) {
+      case NPY_INT:
       __pyx_v_f = __pyx_k__i;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":263
+      /* "numpy.pxd":263
  *                 elif t == NPY_USHORT:      f = "H"
  *                 elif t == NPY_INT:         f = "i"
  *                 elif t == NPY_UINT:        f = "I"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_LONG:        f = "l"
  *                 elif t == NPY_ULONG:       f = "L"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_UINT);
-    if (__pyx_t_1) {
+      case NPY_UINT:
       __pyx_v_f = __pyx_k__I;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":264
+      /* "numpy.pxd":264
  *                 elif t == NPY_INT:         f = "i"
  *                 elif t == NPY_UINT:        f = "I"
  *                 elif t == NPY_LONG:        f = "l"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_ULONG:       f = "L"
  *                 elif t == NPY_LONGLONG:    f = "q"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_LONG);
-    if (__pyx_t_1) {
+      case NPY_LONG:
       __pyx_v_f = __pyx_k__l;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":265
+      /* "numpy.pxd":265
  *                 elif t == NPY_UINT:        f = "I"
  *                 elif t == NPY_LONG:        f = "l"
  *                 elif t == NPY_ULONG:       f = "L"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_LONGLONG:    f = "q"
  *                 elif t == NPY_ULONGLONG:   f = "Q"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_ULONG);
-    if (__pyx_t_1) {
+      case NPY_ULONG:
       __pyx_v_f = __pyx_k__L;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":266
+      /* "numpy.pxd":266
  *                 elif t == NPY_LONG:        f = "l"
  *                 elif t == NPY_ULONG:       f = "L"
  *                 elif t == NPY_LONGLONG:    f = "q"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_ULONGLONG:   f = "Q"
  *                 elif t == NPY_FLOAT:       f = "f"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG);
-    if (__pyx_t_1) {
+      case NPY_LONGLONG:
       __pyx_v_f = __pyx_k__q;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":267
+      /* "numpy.pxd":267
  *                 elif t == NPY_ULONG:       f = "L"
  *                 elif t == NPY_LONGLONG:    f = "q"
  *                 elif t == NPY_ULONGLONG:   f = "Q"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_FLOAT:       f = "f"
  *                 elif t == NPY_DOUBLE:      f = "d"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG);
-    if (__pyx_t_1) {
+      case NPY_ULONGLONG:
       __pyx_v_f = __pyx_k__Q;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":268
+      /* "numpy.pxd":268
  *                 elif t == NPY_LONGLONG:    f = "q"
  *                 elif t == NPY_ULONGLONG:   f = "Q"
  *                 elif t == NPY_FLOAT:       f = "f"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_DOUBLE:      f = "d"
  *                 elif t == NPY_LONGDOUBLE:  f = "g"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_FLOAT);
-    if (__pyx_t_1) {
+      case NPY_FLOAT:
       __pyx_v_f = __pyx_k__f;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":269
+      /* "numpy.pxd":269
  *                 elif t == NPY_ULONGLONG:   f = "Q"
  *                 elif t == NPY_FLOAT:       f = "f"
  *                 elif t == NPY_DOUBLE:      f = "d"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_LONGDOUBLE:  f = "g"
  *                 elif t == NPY_CFLOAT:      f = "Zf"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE);
-    if (__pyx_t_1) {
+      case NPY_DOUBLE:
       __pyx_v_f = __pyx_k__d;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":270
+      /* "numpy.pxd":270
  *                 elif t == NPY_FLOAT:       f = "f"
  *                 elif t == NPY_DOUBLE:      f = "d"
  *                 elif t == NPY_LONGDOUBLE:  f = "g"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_CFLOAT:      f = "Zf"
  *                 elif t == NPY_CDOUBLE:     f = "Zd"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE);
-    if (__pyx_t_1) {
+      case NPY_LONGDOUBLE:
       __pyx_v_f = __pyx_k__g;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":271
+      /* "numpy.pxd":271
  *                 elif t == NPY_DOUBLE:      f = "d"
  *                 elif t == NPY_LONGDOUBLE:  f = "g"
  *                 elif t == NPY_CFLOAT:      f = "Zf"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_CDOUBLE:     f = "Zd"
  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT);
-    if (__pyx_t_1) {
+      case NPY_CFLOAT:
       __pyx_v_f = __pyx_k__Zf;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":272
+      /* "numpy.pxd":272
  *                 elif t == NPY_LONGDOUBLE:  f = "g"
  *                 elif t == NPY_CFLOAT:      f = "Zf"
  *                 elif t == NPY_CDOUBLE:     f = "Zd"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
  *                 elif t == NPY_OBJECT:      f = "O"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE);
-    if (__pyx_t_1) {
+      case NPY_CDOUBLE:
       __pyx_v_f = __pyx_k__Zd;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":273
+      /* "numpy.pxd":273
  *                 elif t == NPY_CFLOAT:      f = "Zf"
  *                 elif t == NPY_CDOUBLE:     f = "Zd"
  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_OBJECT:      f = "O"
  *                 else:
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE);
-    if (__pyx_t_1) {
+      case NPY_CLONGDOUBLE:
       __pyx_v_f = __pyx_k__Zg;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":274
+      /* "numpy.pxd":274
  *                 elif t == NPY_CDOUBLE:     f = "Zd"
  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
  *                 elif t == NPY_OBJECT:      f = "O"             # <<<<<<<<<<<<<<
  *                 else:
  *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_OBJECT);
-    if (__pyx_t_1) {
+      case NPY_OBJECT:
       __pyx_v_f = __pyx_k__O;
-      goto __pyx_L13;
-    }
-    /*else*/ {
+      break;
+      default:
 
       /* "numpy.pxd":276
  *                 elif t == NPY_OBJECT:      f = "O"
@@ -3661,7 +4151,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  */
       __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_7), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_11), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_8));
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
       __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -3675,8 +4165,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
       {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      break;
     }
-    __pyx_L13:;
 
     /* "numpy.pxd":277
  *                 else:
@@ -3772,8 +4262,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
 }
 
 /* Python wrapper */
-static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
-static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
+static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
+static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
   __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));
@@ -3800,7 +4290,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s
  *                 stdlib.free(info.format)
  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
  */
-  __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self);
+  __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":290
@@ -3822,7 +4312,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s
  *                 stdlib.free(info.strides)
  *                 # info.shape was stored after info.strides in the same block
  */
-  __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t)));
+  __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":292
@@ -4127,8 +4617,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
     #else
     __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     #endif
-    __Pyx_XDECREF(__pyx_v_childname);
-    __pyx_v_childname = __pyx_t_3;
+    __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3);
     __pyx_t_3 = 0;
 
     /* "numpy.pxd":795
@@ -4141,8 +4630,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
     __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_XDECREF(((PyObject *)__pyx_v_fields));
-    __pyx_v_fields = ((PyObject*)__pyx_t_3);
+    __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3));
     __pyx_t_3 = 0;
 
     /* "numpy.pxd":796
@@ -4171,7 +4659,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
       __Pyx_INCREF(__pyx_t_4);
       #else
       __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
       __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_4);
       #endif
     } else if (1) {
       __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -4197,11 +4687,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
       __pyx_L6_unpacking_done:;
     }
     if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_XDECREF(((PyObject *)__pyx_v_child));
-    __pyx_v_child = ((PyArray_Descr *)__pyx_t_3);
+    __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3));
     __pyx_t_3 = 0;
-    __Pyx_XDECREF(__pyx_v_new_offset);
-    __pyx_v_new_offset = __pyx_t_4;
+    __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4);
     __pyx_t_4 = 0;
 
     /* "numpy.pxd":798
@@ -4235,7 +4723,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  * 
  *         if ((child.byteorder == c'>' and little_endian) or
  */
-      __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_9), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_13), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
       __Pyx_Raise(__pyx_t_5, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
@@ -4251,9 +4739,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  *             (child.byteorder == c'<' and not little_endian)):
  *             raise ValueError(u"Non-native byte order not supported")
  */
-    __pyx_t_7 = (__pyx_v_child->byteorder == '>');
+    __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0);
     if (__pyx_t_7) {
-      __pyx_t_8 = __pyx_v_little_endian;
+      __pyx_t_8 = (__pyx_v_little_endian != 0);
     } else {
       __pyx_t_8 = __pyx_t_7;
     }
@@ -4266,9 +4754,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  *             raise ValueError(u"Non-native byte order not supported")
  *             # One could encode it in the format string and have Cython
  */
-      __pyx_t_7 = (__pyx_v_child->byteorder == '<');
+      __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0);
       if (__pyx_t_7) {
-        __pyx_t_9 = (!__pyx_v_little_endian);
+        __pyx_t_9 = ((!(__pyx_v_little_endian != 0)) != 0);
         __pyx_t_10 = __pyx_t_9;
       } else {
         __pyx_t_10 = __pyx_t_7;
@@ -4286,7 +4774,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  *             # One could encode it in the format string and have Cython
  *             # complain instead, BUT: < and > in format strings also imply
  */
-      __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
       __Pyx_Raise(__pyx_t_5, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
@@ -4357,7 +4845,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  *             t = child.type_num
  *             if end - f < 5:
  */
-    __pyx_t_7 = (!PyDataType_HASFIELDS(__pyx_v_child));
+    __pyx_t_7 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0);
     if (__pyx_t_7) {
 
       /* "numpy.pxd":821
@@ -4369,8 +4857,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  */
       __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
-      __Pyx_XDECREF(__pyx_v_t);
-      __pyx_v_t = __pyx_t_3;
+      __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_3);
       __pyx_t_3 = 0;
 
       /* "numpy.pxd":822
@@ -4380,7 +4867,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  *                 raise RuntimeError(u"Format string allocated too short.")
  * 
  */
-      __pyx_t_7 = ((__pyx_v_end - __pyx_v_f) < 5);
+      __pyx_t_7 = (((__pyx_v_end - __pyx_v_f) < 5) != 0);
       if (__pyx_t_7) {
 
         /* "numpy.pxd":823
@@ -4390,7 +4877,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  * 
  *             # Until ticket #99 is fixed, use integers to avoid warnings
  */
-        __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_16), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_3);
         __Pyx_Raise(__pyx_t_3, 0, 0, 0);
         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
@@ -4719,7 +5206,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  *             f += 1
  *         else:
  */
-        __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_7), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_11), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(((PyObject *)__pyx_t_5));
         __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_3);
@@ -4802,6 +5289,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a
   PyObject *__pyx_v_baseptr;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
+  int __pyx_t_2;
   __Pyx_RefNannySetupContext("set_array_base", 0);
 
   /* "numpy.pxd":967
@@ -4812,7 +5300,8 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a
  *      else:
  */
   __pyx_t_1 = (__pyx_v_base == Py_None);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
     /* "numpy.pxd":968
  *      cdef PyObject* baseptr
@@ -4888,7 +5377,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py
  *         return None
  *     else:
  */
-  __pyx_t_1 = (__pyx_v_arr->base == NULL);
+  __pyx_t_1 = ((__pyx_v_arr->base == NULL) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":977
@@ -4933,6 +5422,9 @@ static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, P
   PyObject *__pyx_v_format = 0;
   PyObject *__pyx_v_mode = 0;
   int __pyx_v_allocate_buffer;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
@@ -5052,12 +5544,12 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
   Py_ssize_t __pyx_t_1;
   int __pyx_t_2;
   PyObject *__pyx_t_3 = NULL;
-  PyObject *__pyx_t_4 = NULL;
-  PyObject *__pyx_t_5 = NULL;
-  char *__pyx_t_6;
+  char *__pyx_t_4;
+  int __pyx_t_5;
+  int __pyx_t_6;
   int __pyx_t_7;
-  int __pyx_t_8;
-  int __pyx_t_9;
+  PyObject *__pyx_t_8 = NULL;
+  PyObject *__pyx_t_9 = NULL;
   Py_ssize_t __pyx_t_10;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
@@ -5069,7 +5561,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
   /* "View.MemoryView":120
  *         cdef PyObject **p
  * 
- *         self.ndim = len(shape)             # <<<<<<<<<<<<<<
+ *         self.ndim = <int> len(shape)             # <<<<<<<<<<<<<<
  *         self.itemsize = itemsize
  * 
  */
@@ -5078,11 +5570,11 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   __pyx_t_1 = PyTuple_GET_SIZE(((PyObject *)__pyx_v_shape)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_self->ndim = __pyx_t_1;
+  __pyx_v_self->ndim = ((int)__pyx_t_1);
 
   /* "View.MemoryView":121
  * 
- *         self.ndim = len(shape)
+ *         self.ndim = <int> len(shape)
  *         self.itemsize = itemsize             # <<<<<<<<<<<<<<
  * 
  *         if not self.ndim:
@@ -5096,7 +5588,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             raise ValueError("Empty shape tuple for cython.array")
  * 
  */
-  __pyx_t_2 = (!__pyx_v_self->ndim);
+  __pyx_t_2 = ((!(__pyx_v_self->ndim != 0)) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":124
@@ -5106,7 +5598,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  *         if self.itemsize <= 0:
  */
-    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_18), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
@@ -5122,7 +5614,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             raise ValueError("itemsize <= 0 for cython.array")
  * 
  */
-  __pyx_t_2 = (__pyx_v_self->itemsize <= 0);
+  __pyx_t_2 = ((__pyx_v_self->itemsize <= 0) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":127
@@ -5132,7 +5624,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  *         encode = getattr(format, 'encode', None)
  */
-    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_16), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_20), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
@@ -5148,16 +5640,10 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *         if encode:
  *             format = encode('ASCII')
  */
-  __pyx_t_3 = ((PyObject *)__pyx_n_s__encode);
-  __Pyx_INCREF(__pyx_t_3);
-  __pyx_t_4 = Py_None;
-  __Pyx_INCREF(__pyx_t_4);
-  __pyx_t_5 = __Pyx_GetAttr3(__pyx_v_format, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_v_encode = __pyx_t_5;
-  __pyx_t_5 = 0;
+  __pyx_t_3 = __Pyx_GetAttr3(__pyx_v_format, ((PyObject *)__pyx_n_s__encode), Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_v_encode = __pyx_t_3;
+  __pyx_t_3 = 0;
 
   /* "View.MemoryView":130
  * 
@@ -5176,11 +5662,10 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *         self._format = format
  *         self.format = self._format
  */
-    __pyx_t_5 = PyObject_Call(__pyx_v_encode, ((PyObject *)__pyx_k_tuple_17), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_v_format);
-    __pyx_v_format = __pyx_t_5;
-    __pyx_t_5 = 0;
+    __pyx_t_3 = PyObject_Call(__pyx_v_encode, ((PyObject *)__pyx_k_tuple_21), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_3);
+    __pyx_t_3 = 0;
     goto __pyx_L5;
   }
   __pyx_L5:;
@@ -5206,8 +5691,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  *         self._shape = <Py_ssize_t *> malloc(sizeof(Py_ssize_t)*self.ndim)
  */
-  __pyx_t_6 = PyBytes_AsString(((PyObject *)__pyx_v_self->_format)); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_self->format = __pyx_t_6;
+  __pyx_t_4 = __Pyx_PyObject_AsString(((PyObject *)__pyx_v_self->_format)); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_v_self->format = __pyx_t_4;
 
   /* "View.MemoryView":135
  *         self.format = self._format
@@ -5234,14 +5719,14 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             free(self._shape)
  *             free(self._strides)
  */
-  __pyx_t_2 = (!(__pyx_v_self->_shape != 0));
+  __pyx_t_2 = ((!(__pyx_v_self->_shape != 0)) != 0);
   if (!__pyx_t_2) {
-    __pyx_t_7 = (!(__pyx_v_self->_strides != 0));
-    __pyx_t_8 = __pyx_t_7;
+    __pyx_t_5 = ((!(__pyx_v_self->_strides != 0)) != 0);
+    __pyx_t_6 = __pyx_t_5;
   } else {
-    __pyx_t_8 = __pyx_t_2;
+    __pyx_t_6 = __pyx_t_2;
   }
-  if (__pyx_t_8) {
+  if (__pyx_t_6) {
 
     /* "View.MemoryView":139
  * 
@@ -5268,10 +5753,10 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  * 
  */
-    __pyx_t_5 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_19), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_23), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L6;
   }
@@ -5293,20 +5778,19 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             if dim <= 0:
  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
  */
-  __pyx_t_9 = 0;
-  __pyx_t_5 = ((PyObject *)__pyx_v_shape); __Pyx_INCREF(__pyx_t_5); __pyx_t_1 = 0;
+  __pyx_t_7 = 0;
+  __pyx_t_3 = ((PyObject *)__pyx_v_shape); __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
   for (;;) {
-    if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
+    if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
     #if CYTHON_COMPILING_IN_CPYTHON
-    __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_1); __Pyx_INCREF(__pyx_t_4); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_8); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     #else
-    __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_8 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     #endif
-    __Pyx_XDECREF(__pyx_v_dim);
-    __pyx_v_dim = __pyx_t_4;
-    __pyx_t_4 = 0;
-    __pyx_v_idx = __pyx_t_9;
-    __pyx_t_9 = (__pyx_t_9 + 1);
+    __Pyx_XDECREF_SET(__pyx_v_dim, __pyx_t_8);
+    __pyx_t_8 = 0;
+    __pyx_v_idx = __pyx_t_7;
+    __pyx_t_7 = (__pyx_t_7 + 1);
 
     /* "View.MemoryView":146
  *         idx = 0
@@ -5315,10 +5799,10 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
  * 
  */
-    __pyx_t_4 = PyObject_RichCompare(__pyx_v_dim, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    if (__pyx_t_8) {
+    __pyx_t_8 = PyObject_RichCompare(__pyx_v_dim, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    if (__pyx_t_6) {
 
       /* "View.MemoryView":147
  *         for idx, dim in enumerate(shape):
@@ -5327,29 +5811,29 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  *             self._shape[idx] = dim
  */
-      __pyx_t_4 = PyInt_FromLong(__pyx_v_idx); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
-      __Pyx_GIVEREF(__pyx_t_4);
+      __pyx_t_8 = PyInt_FromLong(__pyx_v_idx); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_8);
+      __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
+      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8);
+      __Pyx_GIVEREF(__pyx_t_8);
       __Pyx_INCREF(__pyx_v_dim);
-      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_dim);
+      PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_dim);
       __Pyx_GIVEREF(__pyx_v_dim);
-      __pyx_t_4 = 0;
-      __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_20), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
-      __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
-      __pyx_t_4 = 0;
-      __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+      __pyx_t_8 = 0;
+      __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_24), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_8));
+      __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
+      __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
+      PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_t_8));
+      __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
+      __pyx_t_8 = 0;
+      __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_8);
+      __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
+      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
+      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
       {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L9;
     }
@@ -5374,7 +5858,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  */
     __pyx_v_idx = (__pyx_v_idx + 1);
   }
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
   /* "View.MemoryView":152
  *             idx += 1
@@ -5384,21 +5868,21 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  */
   __Pyx_INCREF(__pyx_v_mode);
-  __pyx_t_5 = __pyx_v_mode;
-  __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, ((PyObject *)__pyx_n_s__fortran), Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (((int)__pyx_t_8)) {
-    __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, ((PyObject *)__pyx_n_s__c), Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_7 = ((int)__pyx_t_2);
+  __pyx_t_3 = __pyx_v_mode;
+  __pyx_t_8 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__fortran), Py_NE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+  if (((int)__pyx_t_6)) {
+    __pyx_t_8 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__c), Py_NE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    __pyx_t_5 = ((int)__pyx_t_2);
   } else {
-    __pyx_t_7 = ((int)__pyx_t_8);
+    __pyx_t_5 = ((int)__pyx_t_6);
   }
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __pyx_t_8 = __pyx_t_7;
-  if (__pyx_t_8) {
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_6 = (__pyx_t_5 != 0);
+  if (__pyx_t_6) {
 
     /* "View.MemoryView":153
  * 
@@ -5407,18 +5891,18 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  *         cdef char order
  */
-    __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_21), __pyx_v_mode); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
-    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_5));
-    __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
-    __pyx_t_5 = 0;
-    __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_25), __pyx_v_mode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+    __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_8);
+    PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_3));
+    __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
+    __pyx_t_3 = 0;
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
+    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L10;
   }
@@ -5431,10 +5915,10 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             order = 'F'
  *         else:
  */
-  __pyx_t_5 = PyObject_RichCompare(__pyx_v_mode, ((PyObject *)__pyx_n_s__fortran), Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  if (__pyx_t_8) {
+  __pyx_t_3 = PyObject_RichCompare(__pyx_v_mode, ((PyObject *)__pyx_n_s__fortran), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  if (__pyx_t_6) {
 
     /* "View.MemoryView":157
  *         cdef char order
@@ -5475,14 +5959,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *         if decode:
  *             mode = decode('ASCII')
  */
-  __pyx_t_5 = ((PyObject *)__pyx_n_s__decode);
-  __Pyx_INCREF(__pyx_t_5);
-  __pyx_t_4 = Py_None;
-  __Pyx_INCREF(__pyx_t_4);
-  __pyx_t_3 = __Pyx_GetAttr3(__pyx_v_mode, __pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_GetAttr3(__pyx_v_mode, ((PyObject *)__pyx_n_s__decode), Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   __pyx_v_decode = __pyx_t_3;
   __pyx_t_3 = 0;
 
@@ -5493,8 +5971,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             mode = decode('ASCII')
  *         self.mode = mode
  */
-  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_decode); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__pyx_t_8) {
+  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_decode); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__pyx_t_6) {
 
     /* "View.MemoryView":166
  *         decode = getattr(mode, 'decode', None)
@@ -5503,10 +5981,9 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *         self.mode = mode
  * 
  */
-    __pyx_t_3 = PyObject_Call(__pyx_v_decode, ((PyObject *)__pyx_k_tuple_22), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Call(__pyx_v_decode, ((PyObject *)__pyx_k_tuple_26), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_v_mode);
-    __pyx_v_mode = __pyx_t_3;
+    __Pyx_DECREF_SET(__pyx_v_mode, __pyx_t_3);
     __pyx_t_3 = 0;
     goto __pyx_L12;
   }
@@ -5543,9 +6020,9 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             self.data = <char *>malloc(self.len)
  */
   __pyx_t_3 = PyObject_RichCompare(__pyx_v_format, ((PyObject *)__pyx_n_b__O), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_v_self->dtype_is_object = __pyx_t_8;
+  __pyx_v_self->dtype_is_object = __pyx_t_6;
 
   /* "View.MemoryView":171
  *         self.free_data = allocate_buffer
@@ -5554,7 +6031,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             self.data = <char *>malloc(self.len)
  *             if not self.data:
  */
-  if (__pyx_v_allocate_buffer) {
+  __pyx_t_6 = (__pyx_v_allocate_buffer != 0);
+  if (__pyx_t_6) {
 
     /* "View.MemoryView":172
  *         self.dtype_is_object = format == b'O'
@@ -5572,8 +6050,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *                 raise MemoryError("unable to allocate array data.")
  * 
  */
-    __pyx_t_8 = (!(__pyx_v_self->data != 0));
-    if (__pyx_t_8) {
+    __pyx_t_6 = ((!(__pyx_v_self->data != 0)) != 0);
+    if (__pyx_t_6) {
 
       /* "View.MemoryView":174
  *             self.data = <char *>malloc(self.len)
@@ -5582,7 +6060,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  *             if self.dtype_is_object:
  */
-      __pyx_t_3 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_24), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_28), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
@@ -5598,7 +6076,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *                 p = <PyObject **> self.data
  *                 for i in range(self.len / itemsize):
  */
-    if (__pyx_v_self->dtype_is_object) {
+    __pyx_t_6 = (__pyx_v_self->dtype_is_object != 0);
+    if (__pyx_t_6) {
 
       /* "View.MemoryView":177
  * 
@@ -5617,11 +6096,23 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *                     Py_INCREF(Py_None)
  */
       if (unlikely(__pyx_v_itemsize == 0)) {
+        #ifdef WITH_THREAD
+        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+        #endif
         PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero");
+        #ifdef WITH_THREAD
+        PyGILState_Release(__pyx_gilstate_save);
+        #endif
         {__pyx_filename = __pyx_f[2]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       }
       else if (sizeof(Py_ssize_t) == sizeof(long) && unlikely(__pyx_v_itemsize == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) {
+        #ifdef WITH_THREAD
+        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+        #endif
         PyErr_Format(PyExc_OverflowError, "value too large to perform division");
+        #ifdef WITH_THREAD
+        PyGILState_Release(__pyx_gilstate_save);
+        #endif
         {__pyx_filename = __pyx_f[2]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       }
       __pyx_t_1 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_itemsize);
@@ -5657,8 +6148,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_XDECREF(__pyx_t_4);
-  __Pyx_XDECREF(__pyx_t_5);
+  __Pyx_XDECREF(__pyx_t_8);
+  __Pyx_XDECREF(__pyx_t_9);
   __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
@@ -5672,8 +6163,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
 }
 
 /* Python wrapper */
-static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
-static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
+static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
+static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
@@ -5695,8 +6186,12 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
-  PyObject *__pyx_t_2 = NULL;
-  int __pyx_t_3;
+  int __pyx_t_2;
+  PyObject *__pyx_t_3 = NULL;
+  char *__pyx_t_4;
+  Py_ssize_t __pyx_t_5;
+  int __pyx_t_6;
+  Py_ssize_t *__pyx_t_7;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -5723,7 +6218,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         elif self.mode == b"fortran":
  */
   __pyx_t_1 = (__Pyx_PyUnicode_Equals(((PyObject *)__pyx_v_self->mode), ((PyObject *)__pyx_n_b__c), Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":186
  *         cdef int bufmode = -1
@@ -5743,7 +6239,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
  *         if not (flags & bufmode):
  */
-  __pyx_t_1 = (__Pyx_PyUnicode_Equals(((PyObject *)__pyx_v_self->mode), ((PyObject *)__pyx_n_b__fortran), Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = (__Pyx_PyUnicode_Equals(((PyObject *)__pyx_v_self->mode), ((PyObject *)__pyx_n_b__fortran), Py_EQ)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = (__pyx_t_2 != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":188
@@ -5765,7 +6262,7 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
  *         info.buf = self.data
  */
-  __pyx_t_1 = (!(__pyx_v_flags & __pyx_v_bufmode));
+  __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":190
@@ -5775,10 +6272,10 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.buf = self.data
  *         info.len = self.len
  */
-    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_26), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_30), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L4;
   }
@@ -5791,7 +6288,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.len = self.len
  *         info.ndim = self.ndim
  */
-  __pyx_v_info->buf = __pyx_v_self->data;
+  __pyx_t_4 = __pyx_v_self->data;
+  __pyx_v_info->buf = __pyx_t_4;
 
   /* "View.MemoryView":192
  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
@@ -5800,7 +6298,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.ndim = self.ndim
  *         info.shape = self._shape
  */
-  __pyx_v_info->len = __pyx_v_self->len;
+  __pyx_t_5 = __pyx_v_self->len;
+  __pyx_v_info->len = __pyx_t_5;
 
   /* "View.MemoryView":193
  *         info.buf = self.data
@@ -5809,7 +6308,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.shape = self._shape
  *         info.strides = self._strides
  */
-  __pyx_v_info->ndim = __pyx_v_self->ndim;
+  __pyx_t_6 = __pyx_v_self->ndim;
+  __pyx_v_info->ndim = __pyx_t_6;
 
   /* "View.MemoryView":194
  *         info.len = self.len
@@ -5818,7 +6318,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.strides = self._strides
  *         info.suboffsets = NULL
  */
-  __pyx_v_info->shape = __pyx_v_self->_shape;
+  __pyx_t_7 = __pyx_v_self->_shape;
+  __pyx_v_info->shape = __pyx_t_7;
 
   /* "View.MemoryView":195
  *         info.ndim = self.ndim
@@ -5827,7 +6328,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.suboffsets = NULL
  *         info.itemsize = self.itemsize
  */
-  __pyx_v_info->strides = __pyx_v_self->_strides;
+  __pyx_t_7 = __pyx_v_self->_strides;
+  __pyx_v_info->strides = __pyx_t_7;
 
   /* "View.MemoryView":196
  *         info.shape = self._shape
@@ -5845,7 +6347,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.readonly = 0
  * 
  */
-  __pyx_v_info->itemsize = __pyx_v_self->itemsize;
+  __pyx_t_5 = __pyx_v_self->itemsize;
+  __pyx_v_info->itemsize = __pyx_t_5;
 
   /* "View.MemoryView":198
  *         info.suboffsets = NULL
@@ -5863,8 +6366,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *             info.format = self.format
  *         else:
  */
-  __pyx_t_3 = (__pyx_v_flags & PyBUF_FORMAT);
-  if (__pyx_t_3) {
+  __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
+  if (__pyx_t_1) {
 
     /* "View.MemoryView":201
  * 
@@ -5873,7 +6376,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         else:
  *             info.format = NULL
  */
-    __pyx_v_info->format = __pyx_v_self->format;
+    __pyx_t_4 = __pyx_v_self->format;
+    __pyx_v_info->format = __pyx_t_4;
     goto __pyx_L5;
   }
   /*else*/ {
@@ -5905,7 +6409,7 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
   __pyx_r = 0;
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_2);
+  __Pyx_XDECREF(__pyx_t_3);
   __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) {
@@ -5952,7 +6456,7 @@ static void __pyx_array_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *_
  *             self.callback_free_data(self.data)
  *         elif self.free_data:
  */
-  __pyx_t_1 = (__pyx_v_self->callback_free_data != NULL);
+  __pyx_t_1 = ((__pyx_v_self->callback_free_data != NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":211
@@ -5973,7 +6477,8 @@ static void __pyx_array_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *_
  *             if self.dtype_is_object:
  *                 refcount_objects_in_slice(self.data, self._shape,
  */
-  if (__pyx_v_self->free_data) {
+  __pyx_t_1 = (__pyx_v_self->free_data != 0);
+  if (__pyx_t_1) {
 
     /* "View.MemoryView":213
  *             self.callback_free_data(self.data)
@@ -5982,7 +6487,8 @@ static void __pyx_array_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *_
  *                 refcount_objects_in_slice(self.data, self._shape,
  *                                           self._strides, self.ndim, False)
  */
-    if (__pyx_v_self->dtype_is_object) {
+    __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
+    if (__pyx_t_1) {
 
       /* "View.MemoryView":215
  *             if self.dtype_is_object:
@@ -6150,9 +6656,9 @@ static PyObject *__pyx_array_MemoryView_5array_6__getattr__(struct __pyx_array_o
  *     def __getitem__(self, item):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __pyx_r = __pyx_t_2;
@@ -6209,7 +6715,7 @@ static PyObject *__pyx_array_MemoryView_5array_8__getitem__(struct __pyx_array_o
  *     def __setitem__(self, item, value):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (!__pyx_t_2) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
@@ -6266,7 +6772,7 @@ static int __pyx_array_MemoryView_5array_10__setitem__(struct __pyx_array_obj *_
  * 
  * 
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   if (PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -6311,7 +6817,7 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize
  *         result = array(shape, itemsize, format, mode.decode('ASCII'))
  *     else:
  */
-  __pyx_t_1 = (__pyx_v_buf == NULL);
+  __pyx_t_1 = ((__pyx_v_buf == NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":245
@@ -6323,7 +6829,7 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize
  */
     __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_3 = PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_3));
     __pyx_t_4 = ((PyObject *)__Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_4));
@@ -6359,7 +6865,7 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize
  */
     __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_5 = PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_5));
     __pyx_t_3 = ((PyObject *)__Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_3));
@@ -6441,6 +6947,9 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize
 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_name = 0;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
@@ -6597,7 +7106,7 @@ static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment)
  *         aligned_p += alignment - offset
  * 
  */
-  __pyx_t_1 = (__pyx_v_offset > 0);
+  __pyx_t_1 = ((__pyx_v_offset > 0) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":303
@@ -6633,6 +7142,9 @@ static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_ar
   PyObject *__pyx_v_obj = 0;
   int __pyx_v_flags;
   int __pyx_v_dtype_is_object;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
@@ -6750,11 +7262,11 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor
  *             if <PyObject *> self.view.obj == NULL:
  */
   __pyx_t_1 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)((PyObject *)__pyx_memoryview_type)));
-  if (!__pyx_t_1) {
+  if (!(__pyx_t_1 != 0)) {
     __pyx_t_2 = (__pyx_v_obj != Py_None);
-    __pyx_t_3 = __pyx_t_2;
+    __pyx_t_3 = (__pyx_t_2 != 0);
   } else {
-    __pyx_t_3 = __pyx_t_1;
+    __pyx_t_3 = (__pyx_t_1 != 0);
   }
   if (__pyx_t_3) {
 
@@ -6774,7 +7286,7 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor
  *                 (<__pyx_buffer *> &self.view).obj = Py_None
  *                 Py_INCREF(Py_None)
  */
-    __pyx_t_3 = (((PyObject *)__pyx_v_self->view.obj) == NULL);
+    __pyx_t_3 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0);
     if (__pyx_t_3) {
 
       /* "View.MemoryView":329
@@ -6817,7 +7329,7 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor
  *             raise MemoryError
  * 
  */
-  __pyx_t_3 = (__pyx_v_self->lock == NULL);
+  __pyx_t_3 = ((__pyx_v_self->lock == NULL) != 0);
   if (__pyx_t_3) {
 
     /* "View.MemoryView":334
@@ -6839,8 +7351,8 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor
  *             self.dtype_is_object = self.view.format == b'O'
  *         else:
  */
-  __pyx_t_4 = (__pyx_v_flags & PyBUF_FORMAT);
-  if (__pyx_t_4) {
+  __pyx_t_3 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
+  if (__pyx_t_3) {
 
     /* "View.MemoryView":337
  * 
@@ -6849,7 +7361,7 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor
  *         else:
  *             self.dtype_is_object = dtype_is_object
  */
-    __pyx_t_5 = PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_5));
     __pyx_t_6 = PyObject_RichCompare(((PyObject *)__pyx_t_5), ((PyObject *)__pyx_n_b__O), Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
@@ -6921,6 +7433,7 @@ static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) {
 static void __pyx_memoryview_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) {
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
+  int __pyx_t_2;
   __Pyx_RefNannySetupContext("__dealloc__", 0);
 
   /* "View.MemoryView":346
@@ -6931,7 +7444,8 @@ static void __pyx_memoryview_MemoryView_10memoryview_2__dealloc__(struct __pyx_m
  * 
  */
   __pyx_t_1 = (__pyx_v_self->obj != Py_None);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":347
  *     def __dealloc__(memoryview self):
@@ -6952,8 +7466,8 @@ static void __pyx_memoryview_MemoryView_10memoryview_2__dealloc__(struct __pyx_m
  *             PyThread_free_lock(self.lock)
  * 
  */
-  __pyx_t_1 = (__pyx_v_self->lock != NULL);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((__pyx_v_self->lock != NULL) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":350
  * 
@@ -7047,8 +7561,7 @@ static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__py
       }
       __Pyx_GOTREF(__pyx_t_5);
     }
-    __Pyx_XDECREF(__pyx_v_idx);
-    __pyx_v_idx = __pyx_t_5;
+    __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5);
     __pyx_t_5 = 0;
     __pyx_v_dim = __pyx_t_1;
     __pyx_t_1 = (__pyx_t_1 + 1);
@@ -7115,12 +7628,13 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
-  PyObject *__pyx_t_2 = NULL;
+  int __pyx_t_2;
   PyObject *__pyx_t_3 = NULL;
   PyObject *__pyx_t_4 = NULL;
   PyObject *__pyx_t_5 = NULL;
-  PyObject *(*__pyx_t_6)(PyObject *);
-  char *__pyx_t_7;
+  PyObject *__pyx_t_6 = NULL;
+  PyObject *(*__pyx_t_7)(PyObject *);
+  char *__pyx_t_8;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -7134,7 +7648,8 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  * 
  */
   __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":364
  *     def __getitem__(memoryview self, object index):
@@ -7158,10 +7673,10 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  * 
  *         cdef char *itemp
  */
-  __pyx_t_2 = ((PyObject *)_unellipsify(__pyx_v_index, __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  if (likely(PyTuple_CheckExact(__pyx_t_2))) {
-    PyObject* sequence = __pyx_t_2;
+  __pyx_t_3 = ((PyObject *)_unellipsify(__pyx_v_index, __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  if (likely(PyTuple_CheckExact(__pyx_t_3))) {
+    PyObject* sequence = __pyx_t_3;
     #if CYTHON_COMPILING_IN_CPYTHON
     Py_ssize_t size = Py_SIZE(sequence);
     #else
@@ -7173,43 +7688,45 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
       {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     #if CYTHON_COMPILING_IN_CPYTHON
-    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
-    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
-    __Pyx_INCREF(__pyx_t_3);
+    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
+    __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
     __Pyx_INCREF(__pyx_t_4);
+    __Pyx_INCREF(__pyx_t_5);
     #else
-    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
     #endif
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   } else if (1) {
     __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   } else
   {
     Py_ssize_t index = -1;
-    __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
-    index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L4_unpacking_failed;
-    __Pyx_GOTREF(__pyx_t_3);
-    index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed;
+    __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
+    index = 0; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed;
     __Pyx_GOTREF(__pyx_t_4);
-    if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_6 = NULL;
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L4_unpacking_failed;
+    __Pyx_GOTREF(__pyx_t_5);
+    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = NULL;
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
     goto __pyx_L5_unpacking_done;
     __pyx_L4_unpacking_failed:;
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_6 = NULL;
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __pyx_t_7 = NULL;
     if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_L5_unpacking_done:;
   }
-  __pyx_v_have_slices = __pyx_t_3;
-  __pyx_t_3 = 0;
-  __pyx_v_indices = __pyx_t_4;
+  __pyx_v_have_slices = __pyx_t_4;
   __pyx_t_4 = 0;
+  __pyx_v_indices = __pyx_t_5;
+  __pyx_t_5 = 0;
 
   /* "View.MemoryView":369
  * 
@@ -7218,8 +7735,8 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  *             return memview_slice(self, indices)
  *         else:
  */
-  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__pyx_t_1) {
+  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":370
  *         cdef char *itemp
@@ -7229,10 +7746,10 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  *             itemp = self.get_item_pointer(indices)
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_2 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_r = __pyx_t_2;
-    __pyx_t_2 = 0;
+    __pyx_t_3 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_r = __pyx_t_3;
+    __pyx_t_3 = 0;
     goto __pyx_L0;
     goto __pyx_L6;
   }
@@ -7245,8 +7762,8 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  *             return self.convert_item_to_object(itemp)
  * 
  */
-    __pyx_t_7 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_v_itemp = __pyx_t_7;
+    __pyx_t_8 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_8 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_v_itemp = __pyx_t_8;
 
     /* "View.MemoryView":373
  *         else:
@@ -7256,10 +7773,10 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  *     def __setitem__(memoryview self, object index, object value):
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_r = __pyx_t_2;
-    __pyx_t_2 = 0;
+    __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_r = __pyx_t_3;
+    __pyx_t_3 = 0;
     goto __pyx_L0;
   }
   __pyx_L6:;
@@ -7267,10 +7784,10 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_5);
+  __Pyx_XDECREF(__pyx_t_6);
   __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
@@ -7345,7 +7862,9 @@ static int __pyx_memoryview_MemoryView_10memoryview_6__setitem__(struct __pyx_me
     __Pyx_INCREF(__pyx_t_3);
     #else
     __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
     __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
     #endif
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   } else if (1) {
@@ -7374,8 +7893,7 @@ static int __pyx_memoryview_MemoryView_10memoryview_6__setitem__(struct __pyx_me
   }
   __pyx_v_have_slices = __pyx_t_2;
   __pyx_t_2 = 0;
-  __Pyx_DECREF(__pyx_v_index);
-  __pyx_v_index = __pyx_t_3;
+  __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_3);
   __pyx_t_3 = 0;
 
   /* "View.MemoryView":378
@@ -7488,9 +8006,9 @@ static int __pyx_memoryview_MemoryView_10memoryview_6__setitem__(struct __pyx_me
 static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
+  int __pyx_t_1;
   int __pyx_t_2;
-  int __pyx_t_3;
+  PyObject *__pyx_t_3 = NULL;
   PyObject *__pyx_t_4 = NULL;
   PyObject *__pyx_t_5 = NULL;
   PyObject *__pyx_t_6 = NULL;
@@ -7510,12 +8028,9 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
  *             try:
  *                 obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS,
  */
-  __pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryview_type));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = (!__pyx_t_2);
-  if (__pyx_t_3) {
+  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, ((PyObject *)__pyx_memoryview_type)); 
+  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":389
  *     cdef is_slice(self, obj):
@@ -7525,10 +8040,10 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
  *                                  self.dtype_is_object)
  */
     {
-      __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
+      __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
+      __Pyx_XGOTREF(__pyx_t_3);
       __Pyx_XGOTREF(__pyx_t_4);
       __Pyx_XGOTREF(__pyx_t_5);
-      __Pyx_XGOTREF(__pyx_t_6);
       /*try:*/ {
 
         /* "View.MemoryView":390
@@ -7538,8 +8053,8 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
  *                                  self.dtype_is_object)
  *             except TypeError:
  */
-        __pyx_t_1 = PyInt_FromLong((__pyx_v_self->flags | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
-        __Pyx_GOTREF(__pyx_t_1);
+        __pyx_t_6 = PyInt_FromLong((__pyx_v_self->flags | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+        __Pyx_GOTREF(__pyx_t_6);
 
         /* "View.MemoryView":391
  *             try:
@@ -7555,25 +8070,24 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
         __Pyx_INCREF(__pyx_v_obj);
         PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj);
         __Pyx_GIVEREF(__pyx_v_obj);
-        PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_1);
-        __Pyx_GIVEREF(__pyx_t_1);
+        PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
+        __Pyx_GIVEREF(__pyx_t_6);
         PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
         __Pyx_GIVEREF(__pyx_t_7);
-        __pyx_t_1 = 0;
+        __pyx_t_6 = 0;
         __pyx_t_7 = 0;
         __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject *)__pyx_memoryview_type)), ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
         __Pyx_GOTREF(__pyx_t_7);
         __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
-        __Pyx_DECREF(__pyx_v_obj);
-        __pyx_v_obj = __pyx_t_7;
+        __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7);
         __pyx_t_7 = 0;
       }
+      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
       goto __pyx_L11_try_end;
       __pyx_L4_error:;
-      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
       __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
 
@@ -7587,10 +8101,10 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
       __pyx_t_9 = PyErr_ExceptionMatches(__pyx_builtin_TypeError);
       if (__pyx_t_9) {
         __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
-        if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
+        if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
         __Pyx_GOTREF(__pyx_t_7);
         __Pyx_GOTREF(__pyx_t_8);
-        __Pyx_GOTREF(__pyx_t_1);
+        __Pyx_GOTREF(__pyx_t_6);
 
         /* "View.MemoryView":393
  *                                  self.dtype_is_object)
@@ -7602,32 +8116,32 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
         __Pyx_XDECREF(__pyx_r);
         __Pyx_INCREF(Py_None);
         __pyx_r = Py_None;
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
         goto __pyx_L7_except_return;
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
         goto __pyx_L5_exception_handled;
       }
       __pyx_L6_except_error:;
+      __Pyx_XGIVEREF(__pyx_t_3);
       __Pyx_XGIVEREF(__pyx_t_4);
       __Pyx_XGIVEREF(__pyx_t_5);
-      __Pyx_XGIVEREF(__pyx_t_6);
-      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
+      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
       goto __pyx_L1_error;
       __pyx_L7_except_return:;
+      __Pyx_XGIVEREF(__pyx_t_3);
       __Pyx_XGIVEREF(__pyx_t_4);
       __Pyx_XGIVEREF(__pyx_t_5);
-      __Pyx_XGIVEREF(__pyx_t_6);
-      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
+      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
       goto __pyx_L0;
       __pyx_L5_exception_handled:;
+      __Pyx_XGIVEREF(__pyx_t_3);
       __Pyx_XGIVEREF(__pyx_t_4);
       __Pyx_XGIVEREF(__pyx_t_5);
-      __Pyx_XGIVEREF(__pyx_t_6);
-      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
+      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
       __pyx_L11_try_end:;
     }
     goto __pyx_L3;
@@ -7649,7 +8163,7 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_XDECREF(__pyx_t_6);
   __Pyx_XDECREF(__pyx_t_7);
   __Pyx_XDECREF(__pyx_t_8);
   __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -7675,11 +8189,9 @@ static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryvi
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
-  PyObject *__pyx_t_2 = NULL;
-  PyObject *__pyx_t_3 = NULL;
+  int __pyx_t_2;
+  int __pyx_t_3;
   int __pyx_t_4;
-  int __pyx_t_5;
-  int __pyx_t_6;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -7693,8 +8205,6 @@ static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryvi
  *                                  src.ndim, dst.ndim, self.dtype_is_object)
  */
   if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_1 = __pyx_v_src;
-  __Pyx_INCREF(__pyx_t_1);
 
   /* "View.MemoryView":402
  * 
@@ -7704,8 +8214,6 @@ static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryvi
  * 
  */
   if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_2 = __pyx_v_dst;
-  __Pyx_INCREF(__pyx_t_2);
 
   /* "View.MemoryView":403
  *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
@@ -7714,24 +8222,20 @@ static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryvi
  * 
  *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):
  */
-  __pyx_t_3 = PyObject_GetAttr(__pyx_v_src, __pyx_n_s__ndim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = PyObject_GetAttr(__pyx_v_dst, __pyx_n_s__ndim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_6 = __pyx_memoryview_copy_contents((__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_t_1), (&__pyx_v_src_slice))[0]), (__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_t_2), (&__pyx_v_dst_slice))[0]), __pyx_t_4, __pyx_t_5, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s__ndim); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __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_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s__ndim); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_4 = __pyx_memoryview_copy_contents((__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice))[0]), (__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice))[0]), __pyx_t_2, __pyx_t_3, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_XDECREF(__pyx_t_3);
   __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
@@ -7793,7 +8297,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor
  *             tmp = malloc(self.view.itemsize)
  *             if tmp == NULL:
  */
-  __pyx_t_1 = (((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array)));
+  __pyx_t_1 = ((((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":414
@@ -7812,7 +8316,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor
  *                 raise MemoryError
  *             item = tmp
  */
-    __pyx_t_1 = (__pyx_v_tmp == NULL);
+    __pyx_t_1 = ((__pyx_v_tmp == NULL) != 0);
     if (__pyx_t_1) {
 
       /* "View.MemoryView":416
@@ -7857,7 +8361,8 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor
  *             (<PyObject **> item)[0] = <PyObject *> value
  *         else:
  */
-  if (__pyx_v_self->dtype_is_object) {
+  __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
+  if (__pyx_t_1) {
 
     /* "View.MemoryView":422
  * 
@@ -7967,7 +8472,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor
  *             assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
  *         slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
  */
-  __pyx_t_1 = (__pyx_v_self->view.suboffsets != NULL);
+  __pyx_t_1 = ((__pyx_v_self->view.suboffsets != NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":433
@@ -8116,9 +8621,9 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview
  *         try:
  *             result = struct.unpack(self.view.format, bytesitem)
  */
-  __pyx_t_1 = PyBytes_FromStringAndSize(((const char*)__pyx_v_itemp) + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  __pyx_v_bytesitem = __pyx_t_1;
+  __pyx_v_bytesitem = ((PyObject*)__pyx_t_1);
   __pyx_t_1 = 0;
 
   /* "View.MemoryView":449
@@ -8142,9 +8647,9 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview
  *         except struct.error:
  *             raise ValueError("Unable to convert item to object")
  */
-      __pyx_t_1 = PyObject_GetAttr(__pyx_v_struct, __pyx_n_s__unpack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s__unpack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_5 = PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_5));
       __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       __Pyx_GOTREF(__pyx_t_6);
@@ -8171,7 +8676,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview
  *             return result
  */
       __pyx_t_7 = strlen(__pyx_v_self->view.format); 
-      __pyx_t_8 = (__pyx_t_7 == 1);
+      __pyx_t_8 = ((__pyx_t_7 == 1) != 0);
       if (__pyx_t_8) {
 
         /* "View.MemoryView":455
@@ -8182,7 +8687,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview
  * 
  */
         __Pyx_XDECREF(__pyx_r);
-        __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_result, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
+        __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_result, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_5) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
         __Pyx_GOTREF(__pyx_t_5);
         __pyx_r = __pyx_t_5;
         __pyx_t_5 = 0;
@@ -8219,7 +8724,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview
  *             raise ValueError("Unable to convert item to object")
  *         else:
  */
-    __pyx_t_5 = PyObject_GetAttr(__pyx_v_struct, __pyx_n_s__error); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
+    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s__error); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __pyx_t_9 = PyErr_ExceptionMatches(__pyx_t_5);
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
@@ -8237,7 +8742,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview
  *         else:
  *             if len(self.view.format) == 1:
  */
-      __pyx_t_10 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_28), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
+      __pyx_t_10 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_32), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
       __Pyx_GOTREF(__pyx_t_10);
       __Pyx_Raise(__pyx_t_10, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
@@ -8302,15 +8807,16 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
   int __pyx_t_2;
-  PyObject *__pyx_t_3 = NULL;
+  int __pyx_t_3;
   PyObject *__pyx_t_4 = NULL;
   PyObject *__pyx_t_5 = NULL;
-  Py_ssize_t __pyx_t_6;
-  PyObject *__pyx_t_7 = NULL;
-  char *__pyx_t_8;
+  PyObject *__pyx_t_6 = NULL;
+  Py_ssize_t __pyx_t_7;
+  PyObject *__pyx_t_8 = NULL;
   char *__pyx_t_9;
   char *__pyx_t_10;
   char *__pyx_t_11;
+  char *__pyx_t_12;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -8335,11 +8841,9 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  *             bytesvalue = struct.pack(self.view.format, *value)
  *         else:
  */
-  __pyx_t_1 = ((PyObject *)((PyObject*)(&PyTuple_Type)));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_value, __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (__pyx_t_2) {
+  __pyx_t_2 = PyTuple_Check(__pyx_v_value); 
+  __pyx_t_3 = (__pyx_t_2 != 0);
+  if (__pyx_t_3) {
 
     /* "View.MemoryView":467
  * 
@@ -8348,28 +8852,28 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  *         else:
  *             bytesvalue = struct.pack(self.view.format, value)
  */
-    __pyx_t_1 = PyObject_GetAttr(__pyx_v_struct, __pyx_n_s__pack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s__pack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_3 = PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
-    __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
-    __pyx_t_3 = 0;
-    __pyx_t_3 = PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-    __pyx_t_5 = PyNumber_Add(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+    __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4));
+    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
+    __pyx_t_4 = 0;
+    __pyx_t_4 = PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+    __pyx_t_6 = PyNumber_Add(((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
+    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-    __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
-    if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_v_bytesvalue = ((PyObject*)__pyx_t_3);
-    __pyx_t_3 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+    if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_4)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
+    __pyx_t_4 = 0;
     goto __pyx_L3;
   }
   /*else*/ {
@@ -8381,25 +8885,25 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  * 
  *         for i, c in enumerate(bytesvalue):
  */
-    __pyx_t_3 = PyObject_GetAttr(__pyx_v_struct, __pyx_n_s__pack); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_5 = PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s__pack); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
     __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_5));
-    __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
+    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_6));
+    __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
     __Pyx_INCREF(__pyx_v_value);
     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_value);
     __Pyx_GIVEREF(__pyx_v_value);
-    __pyx_t_5 = 0;
-    __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __pyx_t_6 = 0;
+    __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-    if (!(likely(PyBytes_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_5)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_v_bytesvalue = ((PyObject*)__pyx_t_5);
-    __pyx_t_5 = 0;
+    if (!(likely(PyBytes_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_6)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_v_bytesvalue = ((PyObject*)__pyx_t_6);
+    __pyx_t_6 = 0;
   }
   __pyx_L3:;
 
@@ -8410,18 +8914,18 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  *             itemp[i] = c
  * 
  */
-  __pyx_t_6 = 0;
+  __pyx_t_7 = 0;
   if (unlikely(((PyObject *)__pyx_v_bytesvalue) == Py_None)) {
     PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   __Pyx_INCREF(((PyObject *)__pyx_v_bytesvalue));
-  __pyx_t_7 = __pyx_v_bytesvalue;
-  __pyx_t_9 = PyBytes_AS_STRING(__pyx_t_7);
-  __pyx_t_10 = (__pyx_t_9 + PyBytes_GET_SIZE(__pyx_t_7));
-  for (__pyx_t_11 = __pyx_t_9; __pyx_t_11 < __pyx_t_10; __pyx_t_11++) {
-    __pyx_t_8 = __pyx_t_11;
-    __pyx_v_c = (__pyx_t_8[0]);
+  __pyx_t_8 = __pyx_v_bytesvalue;
+  __pyx_t_10 = PyBytes_AS_STRING(__pyx_t_8);
+  __pyx_t_11 = (__pyx_t_10 + PyBytes_GET_SIZE(__pyx_t_8));
+  for (__pyx_t_12 = __pyx_t_10; __pyx_t_12 < __pyx_t_11; __pyx_t_12++) {
+    __pyx_t_9 = __pyx_t_12;
+    __pyx_v_c = (__pyx_t_9[0]);
 
     /* "View.MemoryView":472
  * 
@@ -8430,7 +8934,7 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  * 
  *     @cname('getbuffer')
  */
-    __pyx_v_i = __pyx_t_6;
+    __pyx_v_i = __pyx_t_7;
 
     /* "View.MemoryView":471
  *             bytesvalue = struct.pack(self.view.format, value)
@@ -8439,7 +8943,7 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  *             itemp[i] = c
  * 
  */
-    __pyx_t_6 = (__pyx_t_6 + 1);
+    __pyx_t_7 = (__pyx_t_7 + 1);
 
     /* "View.MemoryView":472
  * 
@@ -8450,16 +8954,16 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  */
     (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c;
   }
-  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_5);
-  __Pyx_XDECREF(((PyObject *)__pyx_t_7));
+  __Pyx_XDECREF(__pyx_t_6);
+  __Pyx_XDECREF(((PyObject *)__pyx_t_8));
   __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
@@ -8471,8 +8975,8 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
 }
 
 /* Python wrapper */
-static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
-static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
+static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
+static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
@@ -8493,6 +8997,11 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
+  Py_ssize_t *__pyx_t_2;
+  char *__pyx_t_3;
+  void *__pyx_t_4;
+  int __pyx_t_5;
+  Py_ssize_t __pyx_t_6;
   __Pyx_RefNannySetupContext("__getbuffer__", 0);
   if (__pyx_v_info != NULL) {
     __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
@@ -8506,7 +9015,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *             info.shape = self.view.shape
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_flags & PyBUF_STRIDES);
+  __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":477
@@ -8516,7 +9025,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         else:
  *             info.shape = NULL
  */
-    __pyx_v_info->shape = __pyx_v_self->view.shape;
+    __pyx_t_2 = __pyx_v_self->view.shape;
+    __pyx_v_info->shape = __pyx_t_2;
     goto __pyx_L3;
   }
   /*else*/ {
@@ -8539,7 +9049,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *             info.strides = self.view.strides
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_flags & PyBUF_STRIDES);
+  __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":482
@@ -8549,7 +9059,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         else:
  *             info.strides = NULL
  */
-    __pyx_v_info->strides = __pyx_v_self->view.strides;
+    __pyx_t_2 = __pyx_v_self->view.strides;
+    __pyx_v_info->strides = __pyx_t_2;
     goto __pyx_L4;
   }
   /*else*/ {
@@ -8572,7 +9083,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *             info.suboffsets = self.view.suboffsets
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_flags & PyBUF_INDIRECT);
+  __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":487
@@ -8582,7 +9093,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         else:
  *             info.suboffsets = NULL
  */
-    __pyx_v_info->suboffsets = __pyx_v_self->view.suboffsets;
+    __pyx_t_2 = __pyx_v_self->view.suboffsets;
+    __pyx_v_info->suboffsets = __pyx_t_2;
     goto __pyx_L5;
   }
   /*else*/ {
@@ -8605,7 +9117,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *             info.format = self.view.format
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_flags & PyBUF_FORMAT);
+  __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":492
@@ -8615,7 +9127,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         else:
  *             info.format = NULL
  */
-    __pyx_v_info->format = __pyx_v_self->view.format;
+    __pyx_t_3 = __pyx_v_self->view.format;
+    __pyx_v_info->format = __pyx_t_3;
     goto __pyx_L6;
   }
   /*else*/ {
@@ -8638,7 +9151,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         info.ndim = self.view.ndim
  *         info.itemsize = self.view.itemsize
  */
-  __pyx_v_info->buf = __pyx_v_self->view.buf;
+  __pyx_t_4 = __pyx_v_self->view.buf;
+  __pyx_v_info->buf = __pyx_t_4;
 
   /* "View.MemoryView":497
  * 
@@ -8647,7 +9161,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         info.itemsize = self.view.itemsize
  *         info.len = self.view.len
  */
-  __pyx_v_info->ndim = __pyx_v_self->view.ndim;
+  __pyx_t_5 = __pyx_v_self->view.ndim;
+  __pyx_v_info->ndim = __pyx_t_5;
 
   /* "View.MemoryView":498
  *         info.buf = self.view.buf
@@ -8656,7 +9171,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         info.len = self.view.len
  *         info.readonly = 0
  */
-  __pyx_v_info->itemsize = __pyx_v_self->view.itemsize;
+  __pyx_t_6 = __pyx_v_self->view.itemsize;
+  __pyx_v_info->itemsize = __pyx_t_6;
 
   /* "View.MemoryView":499
  *         info.ndim = self.view.ndim
@@ -8665,7 +9181,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         info.readonly = 0
  *         info.obj = self
  */
-  __pyx_v_info->len = __pyx_v_self->view.len;
+  __pyx_t_6 = __pyx_v_self->view.len;
+  __pyx_v_info->len = __pyx_t_6;
 
   /* "View.MemoryView":500
  *         info.itemsize = self.view.itemsize
@@ -8865,10 +9382,10 @@ static PyObject *__pyx_memoryview_get_shape_MemoryView_10memoryview_5shape___get
     __pyx_v_i = __pyx_t_3;
     __pyx_t_4 = PyInt_FromSsize_t((__pyx_v_self->view.shape[__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    if (unlikely(__Pyx_PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   }
-  __pyx_t_4 = ((PyObject *)PyList_AsTuple(__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = ((PyObject *)PyList_AsTuple(((PyObject*)__pyx_t_1))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_4));
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   __pyx_r = ((PyObject *)__pyx_t_4);
@@ -8928,7 +9445,7 @@ static PyObject *__pyx_memoryview_get_strides_MemoryView_10memoryview_7strides__
  * 
  *                 raise ValueError("Buffer view does not expose strides")
  */
-  __pyx_t_1 = (__pyx_v_self->view.strides == NULL);
+  __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":528
@@ -8938,7 +9455,7 @@ static PyObject *__pyx_memoryview_get_strides_MemoryView_10memoryview_7strides__
  * 
  *             return tuple([self.view.strides[i] for i in xrange(self.view.ndim)])
  */
-    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_30), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_34), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
@@ -8962,10 +9479,10 @@ static PyObject *__pyx_memoryview_get_strides_MemoryView_10memoryview_7strides__
     __pyx_v_i = __pyx_t_4;
     __pyx_t_5 = PyInt_FromSsize_t((__pyx_v_self->view.strides[__pyx_v_i])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    if (unlikely(__Pyx_PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
   }
-  __pyx_t_5 = ((PyObject *)PyList_AsTuple(__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = ((PyObject *)PyList_AsTuple(((PyObject*)__pyx_t_2))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_5));
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __pyx_r = ((PyObject *)__pyx_t_5);
@@ -9025,7 +9542,7 @@ static PyObject *__pyx_memoryview_get_suboffsets_MemoryView_10memoryview_10subof
  *                 return [-1] * self.view.ndim
  * 
  */
-  __pyx_t_1 = (__pyx_v_self->view.suboffsets == NULL);
+  __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":536
@@ -9067,10 +9584,10 @@ static PyObject *__pyx_memoryview_get_suboffsets_MemoryView_10memoryview_10subof
     __pyx_v_i = __pyx_t_4;
     __pyx_t_5 = PyInt_FromSsize_t((__pyx_v_self->view.suboffsets[__pyx_v_i])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    if (unlikely(__Pyx_PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
   }
-  __pyx_t_5 = ((PyObject *)PyList_AsTuple(__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = ((PyObject *)PyList_AsTuple(((PyObject*)__pyx_t_2))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_5));
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __pyx_r = ((PyObject *)__pyx_t_5);
@@ -9236,7 +9753,7 @@ static PyObject *__pyx_memoryview_get_nbytes_MemoryView_10memoryview_6nbytes___g
  *     property size:
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
@@ -9287,10 +9804,11 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
-  PyObject *__pyx_t_2 = NULL;
+  int __pyx_t_2;
   PyObject *__pyx_t_3 = NULL;
-  Py_ssize_t __pyx_t_4;
-  PyObject *(*__pyx_t_5)(PyObject *);
+  PyObject *__pyx_t_4 = NULL;
+  Py_ssize_t __pyx_t_5;
+  PyObject *(*__pyx_t_6)(PyObject *);
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -9304,7 +9822,8 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__
  * 
  */
   __pyx_t_1 = (__pyx_v_self->_size == Py_None);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":559
  *         def __get__(self):
@@ -9323,46 +9842,45 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__
  *                     result *= length
  * 
  */
-    __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
-      __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
-      __pyx_t_5 = NULL;
+    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) {
+      __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
+      __pyx_t_6 = NULL;
     } else {
-      __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext;
+      __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_4);
+      __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext;
     }
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     for (;;) {
-      if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_3)) {
-        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
+      if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_4)) {
+        if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
         #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         #else
-        __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         #endif
-      } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_3)) {
-        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
+      } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_4)) {
+        if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
         #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         #else
-        __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         #endif
       } else {
-        __pyx_t_2 = __pyx_t_5(__pyx_t_3);
-        if (unlikely(!__pyx_t_2)) {
+        __pyx_t_3 = __pyx_t_6(__pyx_t_4);
+        if (unlikely(!__pyx_t_3)) {
           if (PyErr_Occurred()) {
             if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
             else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           }
           break;
         }
-        __Pyx_GOTREF(__pyx_t_2);
+        __Pyx_GOTREF(__pyx_t_3);
       }
-      __Pyx_XDECREF(__pyx_v_length);
-      __pyx_v_length = __pyx_t_2;
-      __pyx_t_2 = 0;
+      __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_3);
+      __pyx_t_3 = 0;
 
       /* "View.MemoryView":562
  * 
@@ -9371,13 +9889,12 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__
  * 
  *                 self._size = result
  */
-      __pyx_t_2 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(__pyx_v_result);
-      __pyx_v_result = __pyx_t_2;
-      __pyx_t_2 = 0;
+      __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_3);
+      __pyx_t_3 = 0;
     }
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
     /* "View.MemoryView":564
  *                     result *= length
@@ -9410,8 +9927,8 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
+  __Pyx_XDECREF(__pyx_t_4);
   __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
@@ -9454,7 +9971,7 @@ static Py_ssize_t __pyx_memoryview_MemoryView_10memoryview_10__len__(struct __py
  *             return self.view.shape[0]
  * 
  */
-  __pyx_t_1 = (__pyx_v_self->view.ndim >= 1);
+  __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":570
@@ -9524,12 +10041,12 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_12__repr__(struct __py
  * 
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__base); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__base); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____name__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s____name__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
@@ -9556,7 +10073,7 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_12__repr__(struct __py
   __Pyx_GIVEREF(__pyx_t_3);
   __pyx_t_1 = 0;
   __pyx_t_3 = 0;
-  __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_31), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_35), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_3));
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __pyx_r = ((PyObject *)__pyx_t_3);
@@ -9614,12 +10131,12 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_14__str__(struct __pyx
  * 
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__base); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__base); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____name__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s____name__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -9627,7 +10144,7 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_14__str__(struct __pyx
   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
   __pyx_t_1 = 0;
-  __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_32), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_36), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __pyx_r = ((PyObject *)__pyx_t_1);
@@ -10035,30 +10552,26 @@ static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, in
 /* "View.MemoryView":624
  * 
  * @cname('__pyx_memoryview_check')
- * cdef bint memoryview_check(object o):             # <<<<<<<<<<<<<<
+ * cdef inline bint memoryview_check(object o):             # <<<<<<<<<<<<<<
  *     return isinstance(o, memoryview)
  * 
  */
 
-static int __pyx_memoryview_check(PyObject *__pyx_v_o) {
+static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
-  int __pyx_t_2;
+  int __pyx_t_1;
   __Pyx_RefNannySetupContext("memoryview_check", 0);
 
   /* "View.MemoryView":625
  * @cname('__pyx_memoryview_check')
- * cdef bint memoryview_check(object o):
+ * cdef inline bint memoryview_check(object o):
  *     return isinstance(o, memoryview)             # <<<<<<<<<<<<<<
  * 
  * cdef tuple _unellipsify(object index, int ndim):
  */
-  __pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryview_type));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_o, __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_r = __pyx_t_2;
+  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, ((PyObject *)__pyx_memoryview_type)); 
+  __pyx_r = __pyx_t_1;
   goto __pyx_L0;
 
   __pyx_r = 0;
@@ -10085,9 +10598,9 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
   PyObject *__pyx_v_nslices = NULL;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
+  int __pyx_t_1;
   int __pyx_t_2;
-  int __pyx_t_3;
+  PyObject *__pyx_t_3 = NULL;
   PyObject *__pyx_t_4 = NULL;
   Py_ssize_t __pyx_t_5;
   PyObject *(*__pyx_t_6)(PyObject *);
@@ -10109,12 +10622,9 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *         tup = (index,)
  *     else:
  */
-  __pyx_t_1 = ((PyObject *)((PyObject*)(&PyTuple_Type)));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_index, __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = (!__pyx_t_2);
-  if (__pyx_t_3) {
+  __pyx_t_1 = PyTuple_Check(__pyx_v_index); 
+  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":633
  *     """
@@ -10123,13 +10633,13 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *     else:
  *         tup = index
  */
-    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
     __Pyx_INCREF(__pyx_v_index);
-    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_index);
+    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index);
     __Pyx_GIVEREF(__pyx_v_index);
-    __pyx_v_tup = ((PyObject *)__pyx_t_1);
-    __pyx_t_1 = 0;
+    __pyx_v_tup = ((PyObject *)__pyx_t_3);
+    __pyx_t_3 = 0;
     goto __pyx_L3;
   }
   /*else*/ {
@@ -10153,10 +10663,10 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *     have_slices = False
  *     seen_ellipsis = False
  */
-  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_v_result = __pyx_t_1;
-  __pyx_t_1 = 0;
+  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_v_result = ((PyObject*)__pyx_t_3);
+  __pyx_t_3 = 0;
 
   /* "View.MemoryView":638
  * 
@@ -10165,12 +10675,12 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *     seen_ellipsis = False
  *     for idx, item in enumerate(tup):
  */
-  __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_v_have_slices = __pyx_t_1;
-  __pyx_t_1 = 0;
-
-  /* "View.MemoryView":639
+  __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_v_have_slices = __pyx_t_3;
+  __pyx_t_3 = 0;
+
+  /* "View.MemoryView":639
  *     result = []
  *     have_slices = False
  *     seen_ellipsis = False             # <<<<<<<<<<<<<<
@@ -10187,7 +10697,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *             if not seen_ellipsis:
  */
   __Pyx_INCREF(__pyx_int_0);
-  __pyx_t_1 = __pyx_int_0;
+  __pyx_t_3 = __pyx_int_0;
   if (PyList_CheckExact(__pyx_v_tup) || PyTuple_CheckExact(__pyx_v_tup)) {
     __pyx_t_4 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
     __pyx_t_6 = NULL;
@@ -10222,16 +10732,14 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
       }
       __Pyx_GOTREF(__pyx_t_7);
     }
-    __Pyx_XDECREF(__pyx_v_item);
-    __pyx_v_item = __pyx_t_7;
+    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7);
     __pyx_t_7 = 0;
-    __Pyx_INCREF(__pyx_t_1);
-    __Pyx_XDECREF(__pyx_v_idx);
-    __pyx_v_idx = __pyx_t_1;
-    __pyx_t_7 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_INCREF(__pyx_t_3);
+    __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3);
+    __pyx_t_7 = PyNumber_Add(__pyx_t_3, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
-    __Pyx_DECREF(__pyx_t_1);
-    __pyx_t_1 = __pyx_t_7;
+    __Pyx_DECREF(__pyx_t_3);
+    __pyx_t_3 = __pyx_t_7;
     __pyx_t_7 = 0;
 
     /* "View.MemoryView":641
@@ -10241,8 +10749,9 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *             if not seen_ellipsis:
  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
  */
-    __pyx_t_3 = (__pyx_v_item == __pyx_builtin_Ellipsis);
-    if (__pyx_t_3) {
+    __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis);
+    __pyx_t_1 = (__pyx_t_2 != 0);
+    if (__pyx_t_1) {
 
       /* "View.MemoryView":642
  *     for idx, item in enumerate(tup):
@@ -10251,8 +10760,8 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
  *                 seen_ellipsis = True
  */
-      __pyx_t_3 = (!__pyx_v_seen_ellipsis);
-      if (__pyx_t_3) {
+      __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0);
+      if (__pyx_t_1) {
 
         /* "View.MemoryView":643
  *         if item is Ellipsis:
@@ -10261,9 +10770,9 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *                 seen_ellipsis = True
  *             else:
  */
-        __pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_v_result), __pyx_n_s__extend); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_result), __pyx_n_s__extend); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_7);
-        __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_33), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_37), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_8);
         __pyx_t_9 = PyObject_Length(__pyx_v_tup); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __pyx_t_10 = PyList_New(1 * ((((__pyx_v_ndim - __pyx_t_9) + 1)<0) ? 0:((__pyx_v_ndim - __pyx_t_9) + 1))); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -10306,9 +10815,9 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *             have_slices = True
  *         else:
  */
-        __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_34), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_38), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_10);
-        __pyx_t_11 = PyList_Append(__pyx_v_result, __pyx_t_10); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_10); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
       }
       __pyx_L7:;
@@ -10322,8 +10831,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  */
       __pyx_t_10 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_10);
-      __Pyx_DECREF(__pyx_v_have_slices);
-      __pyx_v_have_slices = __pyx_t_10;
+      __Pyx_DECREF_SET(__pyx_v_have_slices, __pyx_t_10);
       __pyx_t_10 = 0;
       goto __pyx_L6;
     }
@@ -10336,14 +10844,11 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *                 raise TypeError("Cannot index with type '%s'" % type(item))
  * 
  */
-      __pyx_t_10 = ((PyObject *)((PyObject*)(&PySlice_Type)));
-      __Pyx_INCREF(__pyx_t_10);
-      __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_item, __pyx_t_10); 
-      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-      __pyx_t_2 = (!__pyx_t_3);
+      __pyx_t_1 = PySlice_Check(__pyx_v_item); 
+      __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
       if (__pyx_t_2) {
-        __pyx_t_3 = (!PyIndex_Check(__pyx_v_item));
-        __pyx_t_12 = __pyx_t_3;
+        __pyx_t_1 = ((!(__Pyx_PyIndex_Check(__pyx_v_item) != 0)) != 0);
+        __pyx_t_12 = __pyx_t_1;
       } else {
         __pyx_t_12 = __pyx_t_2;
       }
@@ -10356,7 +10861,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  * 
  *             have_slices = have_slices or isinstance(item, slice)
  */
-        __pyx_t_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_35), ((PyObject *)Py_TYPE(__pyx_v_item))); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_39), ((PyObject *)Py_TYPE(__pyx_v_item))); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(((PyObject *)__pyx_t_10));
         __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_8);
@@ -10382,10 +10887,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  */
       __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       if (!__pyx_t_12) {
-        __pyx_t_10 = ((PyObject *)((PyObject*)(&PySlice_Type)));
-        __Pyx_INCREF(__pyx_t_10);
-        __pyx_t_12 = __Pyx_TypeCheck(__pyx_v_item, __pyx_t_10); 
-        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+        __pyx_t_12 = PySlice_Check(__pyx_v_item); 
         __pyx_t_10 = __Pyx_PyBool_FromLong(__pyx_t_12); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_10);
         __pyx_t_8 = __pyx_t_10;
@@ -10394,8 +10896,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
         __Pyx_INCREF(__pyx_v_have_slices);
         __pyx_t_8 = __pyx_v_have_slices;
       }
-      __Pyx_DECREF(__pyx_v_have_slices);
-      __pyx_v_have_slices = __pyx_t_8;
+      __Pyx_DECREF_SET(__pyx_v_have_slices, __pyx_t_8);
       __pyx_t_8 = 0;
 
       /* "View.MemoryView":653
@@ -10405,12 +10906,12 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  * 
  *     nslices = ndim - len(result)
  */
-      __pyx_t_11 = PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     __pyx_L6:;
   }
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
   /* "View.MemoryView":655
  *             result.append(item)
@@ -10420,10 +10921,10 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *         result.extend([slice(None)] * nslices)
  */
   __pyx_t_5 = PyList_GET_SIZE(((PyObject *)__pyx_v_result)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_1 = PyInt_FromSsize_t((__pyx_v_ndim - __pyx_t_5)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_v_nslices = __pyx_t_1;
-  __pyx_t_1 = 0;
+  __pyx_t_3 = PyInt_FromSsize_t((__pyx_v_ndim - __pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_v_nslices = __pyx_t_3;
+  __pyx_t_3 = 0;
 
   /* "View.MemoryView":656
  * 
@@ -10442,9 +10943,9 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  * 
  *     return have_slices or nslices, tuple(result)
  */
-    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_result), __pyx_n_s__extend); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_36), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_result), __pyx_n_s__extend); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_40), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_8);
@@ -10461,9 +10962,9 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
     PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
     __pyx_t_8 = 0;
-    __pyx_t_8 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_8 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_8);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
     goto __pyx_L9;
@@ -10488,22 +10989,22 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
   }
   __pyx_t_4 = ((PyObject *)PyList_AsTuple(__pyx_v_result)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8);
+  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_8);
   __Pyx_GIVEREF(__pyx_t_8);
-  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_t_4));
+  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_t_4));
   __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
   __pyx_t_8 = 0;
   __pyx_t_4 = 0;
-  __pyx_r = __pyx_t_1;
-  __pyx_t_1 = 0;
+  __pyx_r = ((PyObject*)__pyx_t_3);
+  __pyx_t_3 = 0;
   goto __pyx_L0;
 
   __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_7);
   __Pyx_XDECREF(__pyx_t_8);
@@ -10561,7 +11062,7 @@ static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __
  *             raise ValueError("Indirect dimensions not supported")
  * 
  */
-    __pyx_t_3 = ((__pyx_v_suboffsets[__pyx_v_i]) >= 0);
+    __pyx_t_3 = (((__pyx_v_suboffsets[__pyx_v_i]) >= 0) != 0);
     if (__pyx_t_3) {
 
       /* "View.MemoryView":665
@@ -10571,7 +11072,7 @@ static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __
  * 
  * 
  */
-      __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_38), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_42), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_4);
       __Pyx_Raise(__pyx_t_4, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
@@ -10620,15 +11121,18 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
   PyObject *__pyx_v_index = NULL;
   struct __pyx_memoryview_obj *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
+  int __pyx_t_1;
   int __pyx_t_2;
-  int __pyx_t_3;
-  Py_ssize_t __pyx_t_4;
-  PyObject *(*__pyx_t_5)(PyObject *);
+  struct __pyx_memoryview_obj *__pyx_t_3;
+  char *__pyx_t_4;
+  int __pyx_t_5;
   PyObject *__pyx_t_6 = NULL;
-  int __pyx_t_7;
-  Py_ssize_t __pyx_t_8;
+  Py_ssize_t __pyx_t_7;
+  PyObject *(*__pyx_t_8)(PyObject *);
   PyObject *__pyx_t_9 = NULL;
+  Py_ssize_t __pyx_t_10;
+  int __pyx_t_11;
+  PyObject *__pyx_t_12 = NULL;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -10661,7 +11165,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *     if isinstance(memview, _memoryviewslice):
  */
   #ifndef CYTHON_WITHOUT_ASSERTIONS
-  if (unlikely(!(__pyx_v_memview->view.ndim > 0))) {
+  if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) {
     PyErr_SetNone(PyExc_AssertionError);
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
@@ -10674,10 +11178,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *         memviewsliceobj = memview
  *         p_src = &memviewsliceobj.from_slice
  */
-  __pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryviewslice_type));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), ((PyObject *)__pyx_memoryviewslice_type)); 
+  __pyx_t_2 = (__pyx_t_1 != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":687
@@ -10730,7 +11232,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *     dst.data = p_src.data
  * 
  */
-  __pyx_v_dst.memview = __pyx_v_p_src->memview;
+  __pyx_t_3 = __pyx_v_p_src->memview;
+  __pyx_v_dst.memview = __pyx_t_3;
 
   /* "View.MemoryView":698
  * 
@@ -10739,7 +11242,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  * 
  * 
  */
-  __pyx_v_dst.data = __pyx_v_p_src->data;
+  __pyx_t_4 = __pyx_v_p_src->data;
+  __pyx_v_dst.data = __pyx_t_4;
 
   /* "View.MemoryView":703
  * 
@@ -10766,46 +11270,45 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *         if PyIndex_Check(index):
  *             slice_memviewslice(
  */
-  __pyx_t_3 = 0;
+  __pyx_t_5 = 0;
   if (PyList_CheckExact(__pyx_v_indices) || PyTuple_CheckExact(__pyx_v_indices)) {
-    __pyx_t_1 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0;
-    __pyx_t_5 = NULL;
+    __pyx_t_6 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_6); __pyx_t_7 = 0;
+    __pyx_t_8 = NULL;
   } else {
-    __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext;
+    __pyx_t_7 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __pyx_t_8 = Py_TYPE(__pyx_t_6)->tp_iternext;
   }
   for (;;) {
-    if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_1)) {
-      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
+    if (!__pyx_t_8 && PyList_CheckExact(__pyx_t_6)) {
+      if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_6)) break;
       #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       #else
-      __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       #endif
-    } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_1)) {
-      if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+    } else if (!__pyx_t_8 && PyTuple_CheckExact(__pyx_t_6)) {
+      if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
       #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       #else
-      __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       #endif
     } else {
-      __pyx_t_6 = __pyx_t_5(__pyx_t_1);
-      if (unlikely(!__pyx_t_6)) {
+      __pyx_t_9 = __pyx_t_8(__pyx_t_6);
+      if (unlikely(!__pyx_t_9)) {
         if (PyErr_Occurred()) {
           if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
           else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         }
         break;
       }
-      __Pyx_GOTREF(__pyx_t_6);
+      __Pyx_GOTREF(__pyx_t_9);
     }
-    __Pyx_XDECREF(__pyx_v_index);
-    __pyx_v_index = __pyx_t_6;
-    __pyx_t_6 = 0;
-    __pyx_v_dim = __pyx_t_3;
-    __pyx_t_3 = (__pyx_t_3 + 1);
+    __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9);
+    __pyx_t_9 = 0;
+    __pyx_v_dim = __pyx_t_5;
+    __pyx_t_5 = (__pyx_t_5 + 1);
 
     /* "View.MemoryView":709
  * 
@@ -10814,8 +11317,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             slice_memviewslice(
  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
  */
-    __pyx_t_7 = PyIndex_Check(__pyx_v_index);
-    if (__pyx_t_7) {
+    __pyx_t_2 = (__Pyx_PyIndex_Check(__pyx_v_index) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":713
  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
@@ -10824,7 +11327,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *                 0, 0, 0, # have_{start,stop,step}
  *                 False)
  */
-      __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
       /* "View.MemoryView":715
  *                 index, 0, 0, # start, stop, step
@@ -10833,7 +11336,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *         elif index is None:
  *             p_dst.shape[new_ndim] = 1
  */
-      __pyx_t_7 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_8, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_10, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L6;
     }
 
@@ -10845,7 +11348,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             p_dst.strides[new_ndim] = 0
  */
     __pyx_t_2 = (__pyx_v_index == Py_None);
-    if (__pyx_t_2) {
+    __pyx_t_1 = (__pyx_t_2 != 0);
+    if (__pyx_t_1) {
 
       /* "View.MemoryView":717
  *                 False)
@@ -10893,20 +11397,20 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             stop = index.stop or 0
  *             step = index.step or 0
  */
-      __pyx_t_6 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_6);
-      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      if (!__pyx_t_2) {
-        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
+      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      if (!__pyx_t_1) {
+        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
         __Pyx_INCREF(__pyx_int_0);
-        __pyx_t_9 = __pyx_int_0;
+        __pyx_t_12 = __pyx_int_0;
       } else {
-        __pyx_t_9 = __pyx_t_6;
-        __pyx_t_6 = 0;
+        __pyx_t_12 = __pyx_t_9;
+        __pyx_t_9 = 0;
       }
-      __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_v_start = __pyx_t_8;
+      __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_12); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+      __pyx_v_start = __pyx_t_10;
 
       /* "View.MemoryView":723
  *         else:
@@ -10915,20 +11419,20 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             step = index.step or 0
  * 
  */
-      __pyx_t_9 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__stop); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      if (!__pyx_t_2) {
-        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__stop); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_12);
+      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      if (!__pyx_t_1) {
+        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
         __Pyx_INCREF(__pyx_int_0);
-        __pyx_t_6 = __pyx_int_0;
+        __pyx_t_9 = __pyx_int_0;
       } else {
-        __pyx_t_6 = __pyx_t_9;
-        __pyx_t_9 = 0;
+        __pyx_t_9 = __pyx_t_12;
+        __pyx_t_12 = 0;
       }
-      __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-      __pyx_v_stop = __pyx_t_8;
+      __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_v_stop = __pyx_t_10;
 
       /* "View.MemoryView":724
  *             start = index.start or 0
@@ -10937,20 +11441,20 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  * 
  *             have_start = index.start is not None
  */
-      __pyx_t_6 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_6);
-      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      if (!__pyx_t_2) {
-        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
+      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      if (!__pyx_t_1) {
+        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
         __Pyx_INCREF(__pyx_int_0);
-        __pyx_t_9 = __pyx_int_0;
+        __pyx_t_12 = __pyx_int_0;
       } else {
-        __pyx_t_9 = __pyx_t_6;
-        __pyx_t_6 = 0;
+        __pyx_t_12 = __pyx_t_9;
+        __pyx_t_9 = 0;
       }
-      __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_v_step = __pyx_t_8;
+      __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_12); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+      __pyx_v_step = __pyx_t_10;
 
       /* "View.MemoryView":726
  *             step = index.step or 0
@@ -10959,11 +11463,11 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             have_stop = index.stop is not None
  *             have_step = index.step is not None
  */
-      __pyx_t_9 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_2 = (__pyx_t_9 != Py_None);
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_v_have_start = __pyx_t_2;
+      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_12);
+      __pyx_t_1 = (__pyx_t_12 != Py_None);
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+      __pyx_v_have_start = __pyx_t_1;
 
       /* "View.MemoryView":727
  * 
@@ -10972,11 +11476,11 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             have_step = index.step is not None
  * 
  */
-      __pyx_t_9 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__stop); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_2 = (__pyx_t_9 != Py_None);
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_v_have_stop = __pyx_t_2;
+      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__stop); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_12);
+      __pyx_t_1 = (__pyx_t_12 != Py_None);
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+      __pyx_v_have_stop = __pyx_t_1;
 
       /* "View.MemoryView":728
  *             have_start = index.start is not None
@@ -10985,11 +11489,11 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  * 
  *             slice_memviewslice(
  */
-      __pyx_t_9 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_2 = (__pyx_t_9 != Py_None);
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_v_have_step = __pyx_t_2;
+      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_12);
+      __pyx_t_1 = (__pyx_t_12 != Py_None);
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+      __pyx_v_have_step = __pyx_t_1;
 
       /* "View.MemoryView":735
  *                 start, stop, step,
@@ -10998,7 +11502,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             new_ndim += 1
  * 
  */
-      __pyx_t_7 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
       /* "View.MemoryView":736
  *                 have_start, have_stop, have_step,
@@ -11011,7 +11515,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
     }
     __pyx_L6:;
   }
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
 
   /* "View.MemoryView":738
  *             new_ndim += 1
@@ -11020,10 +11524,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *         return memoryview_fromslice(dst, new_ndim,
  *                                     memviewsliceobj.to_object_func,
  */
-  __pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryviewslice_type));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), ((PyObject *)__pyx_memoryviewslice_type)); 
+  __pyx_t_2 = (__pyx_t_1 != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":739
@@ -11051,11 +11553,11 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *     else:
  *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,
  */
-    __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_1);
-    __pyx_t_1 = 0;
+    __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_6);
+    __pyx_t_6 = 0;
     goto __pyx_L0;
     goto __pyx_L7;
   }
@@ -11077,11 +11579,11 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  * 
  * 
  */
-    __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_1);
-    __pyx_t_1 = 0;
+    __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_6);
+    __pyx_t_6 = 0;
     goto __pyx_L0;
   }
   __pyx_L7:;
@@ -11089,9 +11591,9 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
   __pyx_r = ((struct __pyx_memoryview_obj *)Py_None); __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_6);
   __Pyx_XDECREF(__pyx_t_9);
+  __Pyx_XDECREF(__pyx_t_12);
   __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
@@ -11118,7 +11620,6 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
   int __pyx_t_2;
   int __pyx_t_3;
   int __pyx_t_4;
-  Py_ssize_t __pyx_t_5;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -11130,7 +11631,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  * 
  *         if start < 0:
  */
-  __pyx_t_1 = (!__pyx_v_is_slice);
+  __pyx_t_1 = ((!(__pyx_v_is_slice != 0)) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":791
@@ -11140,7 +11641,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             start += shape
  *         if not 0 <= start < shape:
  */
-    __pyx_t_1 = (__pyx_v_start < 0);
+    __pyx_t_1 = ((__pyx_v_start < 0) != 0);
     if (__pyx_t_1) {
 
       /* "View.MemoryView":792
@@ -11166,7 +11667,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
     if (__pyx_t_1) {
       __pyx_t_1 = (__pyx_v_start < __pyx_v_shape);
     }
-    __pyx_t_2 = (!__pyx_t_1);
+    __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":794
@@ -11176,7 +11677,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *     else:
  * 
  */
-      __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, __pyx_k_39, __pyx_v_dim); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, __pyx_k_43, __pyx_v_dim); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L5;
     }
     __pyx_L5:;
@@ -11207,11 +11708,11 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
  * 
  */
-    if (__pyx_v_have_step) {
+    if ((__pyx_v_have_step != 0)) {
       __pyx_t_4 = (__pyx_v_step == 0);
       __pyx_t_2 = __pyx_t_4;
     } else {
-      __pyx_t_2 = __pyx_v_have_step;
+      __pyx_t_2 = (__pyx_v_have_step != 0);
     }
     if (__pyx_t_2) {
 
@@ -11222,7 +11723,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  * 
  * 
  */
-      __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, __pyx_k_40, __pyx_v_dim); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, __pyx_k_44, __pyx_v_dim); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L6;
     }
     __pyx_L6:;
@@ -11234,7 +11735,8 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             if start < 0:
  *                 start += shape
  */
-    if (__pyx_v_have_start) {
+    __pyx_t_2 = (__pyx_v_have_start != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":804
  * 
@@ -11243,7 +11745,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 start += shape
  *                 if start < 0:
  */
-      __pyx_t_2 = (__pyx_v_start < 0);
+      __pyx_t_2 = ((__pyx_v_start < 0) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":805
@@ -11262,7 +11764,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                     start = 0
  *             elif start >= shape:
  */
-        __pyx_t_2 = (__pyx_v_start < 0);
+        __pyx_t_2 = ((__pyx_v_start < 0) != 0);
         if (__pyx_t_2) {
 
           /* "View.MemoryView":807
@@ -11286,7 +11788,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 if negative_step:
  *                     start = shape - 1
  */
-      __pyx_t_2 = (__pyx_v_start >= __pyx_v_shape);
+      __pyx_t_2 = ((__pyx_v_start >= __pyx_v_shape) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":809
@@ -11296,7 +11798,8 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                     start = shape - 1
  *                 else:
  */
-        if (__pyx_v_negative_step) {
+        __pyx_t_2 = (__pyx_v_negative_step != 0);
+        if (__pyx_t_2) {
 
           /* "View.MemoryView":810
  *             elif start >= shape:
@@ -11334,7 +11837,8 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 start = shape - 1
  *             else:
  */
-      if (__pyx_v_negative_step) {
+      __pyx_t_2 = (__pyx_v_negative_step != 0);
+      if (__pyx_t_2) {
 
         /* "View.MemoryView":815
  *         else:
@@ -11368,7 +11872,8 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             if stop < 0:
  *                 stop += shape
  */
-    if (__pyx_v_have_stop) {
+    __pyx_t_2 = (__pyx_v_have_stop != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":820
  * 
@@ -11377,7 +11882,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 stop += shape
  *                 if stop < 0:
  */
-      __pyx_t_2 = (__pyx_v_stop < 0);
+      __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":821
@@ -11396,7 +11901,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                     stop = 0
  *             elif stop > shape:
  */
-        __pyx_t_2 = (__pyx_v_stop < 0);
+        __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
         if (__pyx_t_2) {
 
           /* "View.MemoryView":823
@@ -11420,7 +11925,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 stop = shape
  *         else:
  */
-      __pyx_t_2 = (__pyx_v_stop > __pyx_v_shape);
+      __pyx_t_2 = ((__pyx_v_stop > __pyx_v_shape) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":825
@@ -11445,7 +11950,8 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 stop = -1
  *             else:
  */
-      if (__pyx_v_negative_step) {
+      __pyx_t_2 = (__pyx_v_negative_step != 0);
+      if (__pyx_t_2) {
 
         /* "View.MemoryView":828
  *         else:
@@ -11479,7 +11985,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             step = 1
  * 
  */
-    __pyx_t_2 = (!__pyx_v_have_step);
+    __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":833
@@ -11499,23 +12005,23 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *         with cython.cdivision(True):
  *             new_shape = (stop - start) // step             # <<<<<<<<<<<<<<
  * 
- *             if (stop - start) % step:
+ *             if (stop - start) - step * new_shape:
  */
     __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step);
 
     /* "View.MemoryView":839
  *             new_shape = (stop - start) // step
  * 
- *             if (stop - start) % step:             # <<<<<<<<<<<<<<
+ *             if (stop - start) - step * new_shape:             # <<<<<<<<<<<<<<
  *                 new_shape += 1
  * 
  */
-    __pyx_t_5 = ((__pyx_v_stop - __pyx_v_start) % __pyx_v_step);
-    if (__pyx_t_5) {
+    __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":840
  * 
- *             if (stop - start) % step:
+ *             if (stop - start) - step * new_shape:
  *                 new_shape += 1             # <<<<<<<<<<<<<<
  * 
  *         if new_shape < 0:
@@ -11532,7 +12038,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             new_shape = 0
  * 
  */
-    __pyx_t_2 = (__pyx_v_new_shape < 0);
+    __pyx_t_2 = ((__pyx_v_new_shape < 0) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":843
@@ -11583,7 +12089,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *         dst.data += start * stride
  *     else:
  */
-  __pyx_t_2 = ((__pyx_v_suboffset_dim[0]) < 0);
+  __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":852
@@ -11617,7 +12123,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *         if not is_slice:
  *             if new_ndim == 0:
  */
-  __pyx_t_2 = (__pyx_v_suboffset >= 0);
+  __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":857
@@ -11627,7 +12133,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             if new_ndim == 0:
  *                 dst.data = (<char **> dst.data)[0] + suboffset
  */
-    __pyx_t_2 = (!__pyx_v_is_slice);
+    __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":858
@@ -11637,7 +12143,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 dst.data = (<char **> dst.data)[0] + suboffset
  *             else:
  */
-      __pyx_t_2 = (__pyx_v_new_ndim == 0);
+      __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":859
@@ -11659,7 +12165,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *         else:
  *             suboffset_dim[0] = new_ndim
  */
-        __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, __pyx_k_41, __pyx_v_dim); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, __pyx_k_45, __pyx_v_dim); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       }
       __pyx_L22:;
       goto __pyx_L21;
@@ -11711,11 +12217,11 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  * 
  * @cname('__pyx_pybuffer_index')
  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,             # <<<<<<<<<<<<<<
- *                           int dim) except NULL:
+ *                           Py_ssize_t dim) except NULL:
  *     cdef Py_ssize_t shape, stride, suboffset = -1
  */
 
-static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, int __pyx_v_dim) {
+static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) {
   Py_ssize_t __pyx_v_shape;
   Py_ssize_t __pyx_v_stride;
   Py_ssize_t __pyx_v_suboffset;
@@ -11723,9 +12229,10 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
   char *__pyx_v_resultp;
   char *__pyx_r;
   __Pyx_RefNannyDeclarations
-  int __pyx_t_1;
-  PyObject *__pyx_t_2 = NULL;
+  Py_ssize_t __pyx_t_1;
+  int __pyx_t_2;
   PyObject *__pyx_t_3 = NULL;
+  PyObject *__pyx_t_4 = NULL;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -11733,7 +12240,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
 
   /* "View.MemoryView":874
  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,
- *                           int dim) except NULL:
+ *                           Py_ssize_t dim) except NULL:
  *     cdef Py_ssize_t shape, stride, suboffset = -1             # <<<<<<<<<<<<<<
  *     cdef Py_ssize_t itemsize = view.itemsize
  *     cdef char *resultp
@@ -11741,13 +12248,14 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
   __pyx_v_suboffset = -1;
 
   /* "View.MemoryView":875
- *                           int dim) except NULL:
+ *                           Py_ssize_t dim) except NULL:
  *     cdef Py_ssize_t shape, stride, suboffset = -1
  *     cdef Py_ssize_t itemsize = view.itemsize             # <<<<<<<<<<<<<<
  *     cdef char *resultp
  * 
  */
-  __pyx_v_itemsize = __pyx_v_view->itemsize;
+  __pyx_t_1 = __pyx_v_view->itemsize;
+  __pyx_v_itemsize = __pyx_t_1;
 
   /* "View.MemoryView":878
  *     cdef char *resultp
@@ -11756,8 +12264,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *         shape = view.len / itemsize
  *         stride = itemsize
  */
-  __pyx_t_1 = (__pyx_v_view->ndim == 0);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":879
  * 
@@ -11767,11 +12275,23 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *     else:
  */
     if (unlikely(__pyx_v_itemsize == 0)) {
+      #ifdef WITH_THREAD
+      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+      #endif
       PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero");
+      #ifdef WITH_THREAD
+      PyGILState_Release(__pyx_gilstate_save);
+      #endif
       {__pyx_filename = __pyx_f[2]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     else if (sizeof(Py_ssize_t) == sizeof(long) && unlikely(__pyx_v_itemsize == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) {
+      #ifdef WITH_THREAD
+      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+      #endif
       PyErr_Format(PyExc_OverflowError, "value too large to perform division");
+      #ifdef WITH_THREAD
+      PyGILState_Release(__pyx_gilstate_save);
+      #endif
       {__pyx_filename = __pyx_f[2]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize);
@@ -11813,8 +12333,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *             suboffset = view.suboffsets[dim]
  * 
  */
-    __pyx_t_1 = (__pyx_v_view->suboffsets != NULL);
-    if (__pyx_t_1) {
+    __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":885
  *         stride = view.strides[dim]
@@ -11837,8 +12357,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *         index += view.shape[dim]
  *         if index < 0:
  */
-  __pyx_t_1 = (__pyx_v_index < 0);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((__pyx_v_index < 0) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":888
  * 
@@ -11856,8 +12376,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
  * 
  */
-    __pyx_t_1 = (__pyx_v_index < 0);
-    if (__pyx_t_1) {
+    __pyx_t_2 = ((__pyx_v_index < 0) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":890
  *         index += view.shape[dim]
@@ -11866,21 +12386,21 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  * 
  *     if index >= shape:
  */
-      __pyx_t_2 = PyInt_FromLong(__pyx_v_dim); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_42), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3));
-      __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
-      __pyx_t_3 = 0;
-      __pyx_t_3 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
-      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+      __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_46), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
+      __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
+      __pyx_t_4 = 0;
+      __pyx_t_4 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_4);
+      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
+      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
       {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L6;
     }
@@ -11896,8 +12416,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
  * 
  */
-  __pyx_t_1 = (__pyx_v_index >= __pyx_v_shape);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":893
  * 
@@ -11906,21 +12426,21 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  * 
  *     resultp = bufp + index * stride
  */
-    __pyx_t_3 = PyInt_FromLong(__pyx_v_dim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_46), __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
+    __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
+    __pyx_t_3 = 0;
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_42), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
-    __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
-    __pyx_t_2 = 0;
-    __pyx_t_2 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L7;
   }
@@ -11942,8 +12462,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *         resultp = (<char **> resultp)[0] + suboffset
  * 
  */
-  __pyx_t_1 = (__pyx_v_suboffset >= 0);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":897
  *     resultp = bufp + index * stride
@@ -11970,8 +12490,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
   __pyx_r = 0;
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
+  __Pyx_XDECREF(__pyx_t_4);
   __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
@@ -11994,14 +12514,15 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
   int __pyx_v_i;
   int __pyx_v_j;
   int __pyx_r;
-  long __pyx_t_1;
-  int __pyx_t_2;
-  Py_ssize_t __pyx_t_3;
+  int __pyx_t_1;
+  Py_ssize_t *__pyx_t_2;
+  long __pyx_t_3;
   Py_ssize_t __pyx_t_4;
-  int __pyx_t_5;
+  Py_ssize_t __pyx_t_5;
   int __pyx_t_6;
   int __pyx_t_7;
   int __pyx_t_8;
+  int __pyx_t_9;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -12013,7 +12534,8 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  * 
  *     cdef Py_ssize_t *shape = memslice.shape
  */
-  __pyx_v_ndim = __pyx_v_memslice->memview->view.ndim;
+  __pyx_t_1 = __pyx_v_memslice->memview->view.ndim;
+  __pyx_v_ndim = __pyx_t_1;
 
   /* "View.MemoryView":908
  *     cdef int ndim = memslice.memview.view.ndim
@@ -12022,7 +12544,8 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  *     cdef Py_ssize_t *strides = memslice.strides
  * 
  */
-  __pyx_v_shape = __pyx_v_memslice->shape;
+  __pyx_t_2 = __pyx_v_memslice->shape;
+  __pyx_v_shape = __pyx_t_2;
 
   /* "View.MemoryView":909
  * 
@@ -12031,7 +12554,8 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  * 
  * 
  */
-  __pyx_v_strides = __pyx_v_memslice->strides;
+  __pyx_t_2 = __pyx_v_memslice->strides;
+  __pyx_v_strides = __pyx_t_2;
 
   /* "View.MemoryView":913
  * 
@@ -12040,9 +12564,9 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  *         j = ndim - 1 - i
  *         strides[i], strides[j] = strides[j], strides[i]
  */
-  __pyx_t_1 = __Pyx_div_long(__pyx_v_ndim, 2);
-  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
-    __pyx_v_i = __pyx_t_2;
+  __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2);
+  for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_3; __pyx_t_1+=1) {
+    __pyx_v_i = __pyx_t_1;
 
     /* "View.MemoryView":914
  *     cdef int i, j
@@ -12060,10 +12584,10 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  *         shape[i], shape[j] = shape[j], shape[i]
  * 
  */
-    __pyx_t_3 = (__pyx_v_strides[__pyx_v_j]);
-    __pyx_t_4 = (__pyx_v_strides[__pyx_v_i]);
-    (__pyx_v_strides[__pyx_v_i]) = __pyx_t_3;
-    (__pyx_v_strides[__pyx_v_j]) = __pyx_t_4;
+    __pyx_t_4 = (__pyx_v_strides[__pyx_v_j]);
+    __pyx_t_5 = (__pyx_v_strides[__pyx_v_i]);
+    (__pyx_v_strides[__pyx_v_i]) = __pyx_t_4;
+    (__pyx_v_strides[__pyx_v_j]) = __pyx_t_5;
 
     /* "View.MemoryView":916
  *         j = ndim - 1 - i
@@ -12072,10 +12596,10 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  * 
  *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
  */
-    __pyx_t_4 = (__pyx_v_shape[__pyx_v_j]);
-    __pyx_t_3 = (__pyx_v_shape[__pyx_v_i]);
-    (__pyx_v_shape[__pyx_v_i]) = __pyx_t_4;
-    (__pyx_v_shape[__pyx_v_j]) = __pyx_t_3;
+    __pyx_t_5 = (__pyx_v_shape[__pyx_v_j]);
+    __pyx_t_4 = (__pyx_v_shape[__pyx_v_i]);
+    (__pyx_v_shape[__pyx_v_i]) = __pyx_t_5;
+    (__pyx_v_shape[__pyx_v_j]) = __pyx_t_4;
 
     /* "View.MemoryView":918
  *         shape[i], shape[j] = shape[j], shape[i]
@@ -12084,14 +12608,14 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
  * 
  */
-    __pyx_t_5 = ((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0);
-    if (!__pyx_t_5) {
-      __pyx_t_6 = ((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0);
-      __pyx_t_7 = __pyx_t_6;
+    __pyx_t_6 = (((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0) != 0);
+    if (!__pyx_t_6) {
+      __pyx_t_7 = (((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0) != 0);
+      __pyx_t_8 = __pyx_t_7;
     } else {
-      __pyx_t_7 = __pyx_t_5;
+      __pyx_t_8 = __pyx_t_6;
     }
-    if (__pyx_t_7) {
+    if (__pyx_t_8) {
 
       /* "View.MemoryView":919
  * 
@@ -12100,7 +12624,7 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  * 
  *     return 1
  */
-      __pyx_t_8 = __pyx_memoryview_err(__pyx_builtin_ValueError, __pyx_k_43); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = __pyx_memoryview_err(__pyx_builtin_ValueError, __pyx_k_47); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L5;
     }
     __pyx_L5:;
@@ -12191,7 +12715,7 @@ static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memor
  *             return self.to_object_func(itemp)
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_self->to_object_func != NULL);
+  __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":943
@@ -12265,7 +12789,7 @@ static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memo
  *             self.to_dtype_func(itemp, value)
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_self->to_dtype_func != NULL);
+  __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":949
@@ -12364,8 +12888,11 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
   int __pyx_t_1;
   PyObject *__pyx_t_2 = NULL;
   PyObject *__pyx_t_3 = NULL;
-  int __pyx_t_4;
-  int __pyx_t_5;
+  __Pyx_TypeInfo *__pyx_t_4;
+  Py_buffer __pyx_t_5;
+  Py_ssize_t __pyx_t_6;
+  int __pyx_t_7;
+  int __pyx_t_8;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -12378,7 +12905,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
  *         return None
  * 
  */
-  __pyx_t_1 = (((PyObject *)__pyx_v_memviewslice.memview) == Py_None);
+  __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":972
@@ -12447,7 +12974,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
  *     result.typeinfo = memviewslice.memview.typeinfo
  * 
  */
-  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s__base); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s__base); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_GIVEREF(__pyx_t_2);
   __Pyx_GOTREF(__pyx_v_result->from_object);
@@ -12462,7 +12989,8 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
  * 
  *     result.view = memviewslice.memview.view
  */
-  __pyx_v_result->__pyx_base.typeinfo = __pyx_v_memviewslice.memview->typeinfo;
+  __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo;
+  __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4;
 
   /* "View.MemoryView":985
  *     result.typeinfo = memviewslice.memview.typeinfo
@@ -12471,7 +12999,8 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
  *     result.view.buf = <void *> memviewslice.data
  *     result.view.ndim = ndim
  */
-  __pyx_v_result->__pyx_base.view = __pyx_v_memviewslice.memview->view;
+  __pyx_t_5 = __pyx_v_memviewslice.memview->view;
+  __pyx_v_result->__pyx_base.view = __pyx_t_5;
 
   /* "View.MemoryView":986
  * 
@@ -12552,7 +13081,8 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
  *     for i in range(ndim):
  *         result.view.len *= result.view.shape[i]
  */
-  __pyx_v_result->__pyx_base.view.len = __pyx_v_result->__pyx_base.view.itemsize;
+  __pyx_t_6 = __pyx_v_result->__pyx_base.view.itemsize;
+  __pyx_v_result->__pyx_base.view.len = __pyx_t_6;
 
   /* "View.MemoryView":998
  * 
@@ -12561,9 +13091,9 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
  *         result.view.len *= result.view.shape[i]
  * 
  */
-  __pyx_t_4 = __pyx_v_ndim;
-  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
-    __pyx_v_i = __pyx_t_5;
+  __pyx_t_7 = __pyx_v_ndim;
+  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
+    __pyx_v_i = __pyx_t_8;
 
     /* "View.MemoryView":999
  *     result.view.len = result.view.itemsize
@@ -12631,7 +13161,7 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p
   struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0;
   __Pyx_memviewslice *__pyx_r;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
+  int __pyx_t_1;
   int __pyx_t_2;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
@@ -12645,10 +13175,8 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p
  *         obj = memview
  *         return &obj.from_slice
  */
-  __pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryviewslice_type));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), ((PyObject *)__pyx_memoryviewslice_type)); 
+  __pyx_t_2 = (__pyx_t_1 != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":1011
@@ -12699,7 +13227,6 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p
   __pyx_r = 0;
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
   __Pyx_WriteUnraisable("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
@@ -12722,9 +13249,10 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem
   Py_ssize_t *__pyx_v_strides;
   Py_ssize_t *__pyx_v_suboffsets;
   __Pyx_RefNannyDeclarations
-  int __pyx_t_1;
+  Py_ssize_t *__pyx_t_1;
   int __pyx_t_2;
   int __pyx_t_3;
+  int __pyx_t_4;
   __Pyx_RefNannySetupContext("slice_copy", 0);
 
   /* "View.MemoryView":1022
@@ -12734,7 +13262,8 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem
  *     strides = memview.view.strides
  *     suboffsets = memview.view.suboffsets
  */
-  __pyx_v_shape = __pyx_v_memview->view.shape;
+  __pyx_t_1 = __pyx_v_memview->view.shape;
+  __pyx_v_shape = __pyx_t_1;
 
   /* "View.MemoryView":1023
  * 
@@ -12743,7 +13272,8 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem
  *     suboffsets = memview.view.suboffsets
  * 
  */
-  __pyx_v_strides = __pyx_v_memview->view.strides;
+  __pyx_t_1 = __pyx_v_memview->view.strides;
+  __pyx_v_strides = __pyx_t_1;
 
   /* "View.MemoryView":1024
  *     shape = memview.view.shape
@@ -12752,7 +13282,8 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem
  * 
  *     dst.memview = <__pyx_memoryview *> memview
  */
-  __pyx_v_suboffsets = __pyx_v_memview->view.suboffsets;
+  __pyx_t_1 = __pyx_v_memview->view.suboffsets;
+  __pyx_v_suboffsets = __pyx_t_1;
 
   /* "View.MemoryView":1026
  *     suboffsets = memview.view.suboffsets
@@ -12779,9 +13310,9 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem
  *         dst.shape[dim] = shape[dim]
  *         dst.strides[dim] = strides[dim]
  */
-  __pyx_t_1 = __pyx_v_memview->view.ndim;
-  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
-    __pyx_v_dim = __pyx_t_2;
+  __pyx_t_2 = __pyx_v_memview->view.ndim;
+  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
+    __pyx_v_dim = __pyx_t_3;
 
     /* "View.MemoryView":1030
  * 
@@ -12808,8 +13339,8 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem
  *             dst.suboffsets[dim] = -1
  *         else:
  */
-    __pyx_t_3 = (__pyx_v_suboffsets == NULL);
-    if (__pyx_t_3) {
+    __pyx_t_4 = ((__pyx_v_suboffsets == NULL) != 0);
+    if (__pyx_t_4) {
 
       /* "View.MemoryView":1033
  *         dst.strides[dim] = strides[dim]
@@ -12904,8 +13435,11 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview
   int (*__pyx_v_to_dtype_func)(char *, PyObject *);
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
+  int __pyx_t_1;
   int __pyx_t_2;
+  PyObject *(*__pyx_t_3)(char *);
+  int (*__pyx_t_4)(char *, PyObject *);
+  PyObject *__pyx_t_5 = NULL;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -12918,10 +13452,8 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview
  *         to_object_func = (<_memoryviewslice> memview).to_object_func
  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
  */
-  __pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryviewslice_type));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), ((PyObject *)__pyx_memoryviewslice_type)); 
+  __pyx_t_2 = (__pyx_t_1 != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":1053
@@ -12931,7 +13463,8 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview
  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
  *     else:
  */
-    __pyx_v_to_object_func = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
+    __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
+    __pyx_v_to_object_func = __pyx_t_3;
 
     /* "View.MemoryView":1054
  *     if isinstance(memview, _memoryviewslice):
@@ -12940,7 +13473,8 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview
  *     else:
  *         to_object_func = NULL
  */
-    __pyx_v_to_dtype_func = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
+    __pyx_t_4 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
+    __pyx_v_to_dtype_func = __pyx_t_4;
     goto __pyx_L3;
   }
   /*else*/ {
@@ -12981,16 +13515,16 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview
  * 
  * 
  */
-  __pyx_t_1 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_r = __pyx_t_1;
-  __pyx_t_1 = 0;
+  __pyx_t_5 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
+  __pyx_r = __pyx_t_5;
+  __pyx_t_5 = 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_5);
   __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
@@ -13018,7 +13552,7 @@ static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) {
  *         return -arg
  *     else:
  */
-  __pyx_t_1 = (__pyx_v_arg < 0);
+  __pyx_t_1 = ((__pyx_v_arg < 0) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":1069
@@ -13103,7 +13637,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _
  *             c_stride = mslice.strides[i]
  *             break
  */
-    __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1);
+    __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":1084
@@ -13147,7 +13681,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _
  *             f_stride = mslice.strides[i]
  *             break
  */
-    __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1);
+    __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":1089
@@ -13180,7 +13714,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _
  *         return 'C'
  *     else:
  */
-  __pyx_t_2 = (abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride));
+  __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":1093
@@ -13277,7 +13811,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v
  *        if (src_stride > 0 and dst_stride > 0 and
  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
  */
-  __pyx_t_1 = (__pyx_v_ndim == 1);
+  __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":1111
@@ -13287,9 +13821,9 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v
  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
  *            memcpy(dst_data, src_data, itemsize * dst_extent)
  */
-    __pyx_t_1 = (__pyx_v_src_stride > 0);
+    __pyx_t_1 = ((__pyx_v_src_stride > 0) != 0);
     if (__pyx_t_1) {
-      __pyx_t_2 = (__pyx_v_dst_stride > 0);
+      __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":1112
@@ -13303,7 +13837,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v
         if (__pyx_t_3) {
           __pyx_t_3 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride));
         }
-        __pyx_t_4 = __pyx_t_3;
+        __pyx_t_4 = (__pyx_t_3 != 0);
       } else {
         __pyx_t_4 = __pyx_t_2;
       }
@@ -13445,8 +13979,9 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_sr
   int __pyx_v_i;
   Py_ssize_t __pyx_v_size;
   Py_ssize_t __pyx_r;
-  int __pyx_t_1;
+  Py_ssize_t __pyx_t_1;
   int __pyx_t_2;
+  int __pyx_t_3;
 
   /* "View.MemoryView":1138
  *     "Return the size of the memory occupied by the slice in number of bytes"
@@ -13455,7 +13990,8 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_sr
  * 
  *     for i in range(ndim):
  */
-  __pyx_v_size = __pyx_v_src->memview->view.itemsize;
+  __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
+  __pyx_v_size = __pyx_t_1;
 
   /* "View.MemoryView":1140
  *     cdef Py_ssize_t size = src.memview.view.itemsize
@@ -13464,9 +14000,9 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_sr
  *         size *= src.shape[i]
  * 
  */
-  __pyx_t_1 = __pyx_v_ndim;
-  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
-    __pyx_v_i = __pyx_t_2;
+  __pyx_t_2 = __pyx_v_ndim;
+  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
+    __pyx_v_i = __pyx_t_3;
 
     /* "View.MemoryView":1141
  * 
@@ -13515,7 +14051,7 @@ static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_
  *         for idx in range(ndim):
  *             strides[idx] = stride
  */
-  __pyx_t_1 = (__pyx_v_order == 'F');
+  __pyx_t_1 = ((__pyx_v_order == 'F') != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":1156
@@ -13611,9 +14147,11 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
   size_t __pyx_v_itemsize;
   size_t __pyx_v_size;
   void *__pyx_r;
-  int __pyx_t_1;
+  Py_ssize_t __pyx_t_1;
   int __pyx_t_2;
   int __pyx_t_3;
+  struct __pyx_memoryview_obj *__pyx_t_4;
+  int __pyx_t_5;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -13625,7 +14163,8 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *     cdef size_t size = slice_get_size(src, ndim)
  * 
  */
-  __pyx_v_itemsize = __pyx_v_src->memview->view.itemsize;
+  __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
+  __pyx_v_itemsize = __pyx_t_1;
 
   /* "View.MemoryView":1179
  * 
@@ -13652,8 +14191,8 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *         _err(MemoryError, NULL)
  * 
  */
-  __pyx_t_1 = (!(__pyx_v_result != 0));
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":1183
  *     result = malloc(size)
@@ -13662,7 +14201,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  * 
  * 
  */
-    __pyx_t_2 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L3;
   }
   __pyx_L3:;
@@ -13683,7 +14222,8 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *     for i in range(ndim):
  *         tmpslice.shape[i] = src.shape[i]
  */
-  __pyx_v_tmpslice->memview = __pyx_v_src->memview;
+  __pyx_t_4 = __pyx_v_src->memview;
+  __pyx_v_tmpslice->memview = __pyx_t_4;
 
   /* "View.MemoryView":1188
  *     tmpslice.data = <char *> result
@@ -13692,9 +14232,9 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *         tmpslice.shape[i] = src.shape[i]
  *         tmpslice.suboffsets[i] = -1
  */
-  __pyx_t_2 = __pyx_v_ndim;
-  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
-    __pyx_v_i = __pyx_t_3;
+  __pyx_t_3 = __pyx_v_ndim;
+  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_3; __pyx_t_5+=1) {
+    __pyx_v_i = __pyx_t_5;
 
     /* "View.MemoryView":1189
  *     tmpslice.memview = src.memview
@@ -13731,9 +14271,9 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *         if tmpslice.shape[i] == 1:
  *             tmpslice.strides[i] = 0
  */
-  __pyx_t_2 = __pyx_v_ndim;
-  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
-    __pyx_v_i = __pyx_t_3;
+  __pyx_t_3 = __pyx_v_ndim;
+  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_3; __pyx_t_5+=1) {
+    __pyx_v_i = __pyx_t_5;
 
     /* "View.MemoryView":1197
  * 
@@ -13742,8 +14282,8 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *             tmpslice.strides[i] = 0
  * 
  */
-    __pyx_t_1 = ((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1);
-    if (__pyx_t_1) {
+    __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1198
  *     for i in range(ndim):
@@ -13765,8 +14305,8 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *         memcpy(result, src.data, size)
  *     else:
  */
-  __pyx_t_1 = __pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":1201
  * 
@@ -13865,7 +14405,7 @@ static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent
   __pyx_t_1 = 0;
   __pyx_t_2 = 0;
   __pyx_t_3 = 0;
-  __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_44), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_48), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_3));
   __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
   __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -13994,7 +14534,7 @@ static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) {
  *         raise error(msg.decode('ascii'))
  *     else:
  */
-  __pyx_t_1 = (__pyx_v_msg != NULL);
+  __pyx_t_1 = ((__pyx_v_msg != NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":1222
@@ -14067,11 +14607,13 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
   __Pyx_memviewslice __pyx_v_tmp;
   int __pyx_v_ndim;
   int __pyx_r;
-  int __pyx_t_1;
+  Py_ssize_t __pyx_t_1;
   int __pyx_t_2;
   int __pyx_t_3;
   int __pyx_t_4;
-  void *__pyx_t_5;
+  int __pyx_t_5;
+  void *__pyx_t_6;
+  int __pyx_t_7;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -14092,7 +14634,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *     cdef int i
  *     cdef char order = get_best_order(&src, src_ndim)
  */
-  __pyx_v_itemsize = __pyx_v_src.memview->view.itemsize;
+  __pyx_t_1 = __pyx_v_src.memview->view.itemsize;
+  __pyx_v_itemsize = __pyx_t_1;
 
   /* "View.MemoryView":1238
  *     cdef size_t itemsize = src.memview.view.itemsize
@@ -14128,8 +14671,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *         broadcast_leading(&src, src_ndim, dst_ndim)
  *     elif dst_ndim < src_ndim:
  */
-  __pyx_t_1 = (__pyx_v_src_ndim < __pyx_v_dst_ndim);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":1244
  * 
@@ -14149,8 +14692,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *         broadcast_leading(&dst, dst_ndim, src_ndim)
  * 
  */
-  __pyx_t_1 = (__pyx_v_dst_ndim < __pyx_v_src_ndim);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":1246
  *         broadcast_leading(&src, src_ndim, dst_ndim)
@@ -14171,14 +14714,14 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  *     for i in range(ndim):
  */
-  __pyx_t_2 = __pyx_v_dst_ndim;
-  __pyx_t_3 = __pyx_v_src_ndim;
-  if ((__pyx_t_2 > __pyx_t_3)) {
-    __pyx_t_4 = __pyx_t_2;
+  __pyx_t_3 = __pyx_v_dst_ndim;
+  __pyx_t_4 = __pyx_v_src_ndim;
+  if (((__pyx_t_3 > __pyx_t_4) != 0)) {
+    __pyx_t_5 = __pyx_t_3;
   } else {
-    __pyx_t_4 = __pyx_t_3;
+    __pyx_t_5 = __pyx_t_4;
   }
-  __pyx_v_ndim = __pyx_t_4;
+  __pyx_v_ndim = __pyx_t_5;
 
   /* "View.MemoryView":1250
  *     cdef int ndim = max(src_ndim, dst_ndim)
@@ -14187,9 +14730,9 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *         if src.shape[i] != dst.shape[i]:
  *             if src.shape[i] == 1:
  */
-  __pyx_t_4 = __pyx_v_ndim;
-  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_4; __pyx_t_2+=1) {
-    __pyx_v_i = __pyx_t_2;
+  __pyx_t_5 = __pyx_v_ndim;
+  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_5; __pyx_t_3+=1) {
+    __pyx_v_i = __pyx_t_3;
 
     /* "View.MemoryView":1251
  * 
@@ -14198,8 +14741,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *             if src.shape[i] == 1:
  *                 broadcasting = True
  */
-    __pyx_t_1 = ((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i]));
-    if (__pyx_t_1) {
+    __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1252
  *     for i in range(ndim):
@@ -14208,8 +14751,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *                 broadcasting = True
  *                 src.strides[i] = 0
  */
-      __pyx_t_1 = ((__pyx_v_src.shape[__pyx_v_i]) == 1);
-      if (__pyx_t_1) {
+      __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0);
+      if (__pyx_t_2) {
 
         /* "View.MemoryView":1253
  *         if src.shape[i] != dst.shape[i]:
@@ -14239,7 +14782,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  *         if src.suboffsets[i] >= 0:
  */
-        __pyx_t_3 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_4 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       }
       __pyx_L7:;
       goto __pyx_L6;
@@ -14253,8 +14796,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *             _err_dim(ValueError, "Dimension %d is not direct", i)
  * 
  */
-    __pyx_t_1 = ((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0);
-    if (__pyx_t_1) {
+    __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1259
  * 
@@ -14263,7 +14806,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  *     if slices_overlap(&src, &dst, ndim, itemsize):
  */
-      __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, __pyx_k_45, __pyx_v_i); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, __pyx_k_49, __pyx_v_i); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L8;
     }
     __pyx_L8:;
@@ -14276,8 +14819,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  *         if not slice_is_contig(&src, order, ndim):
  */
-  __pyx_t_1 = __pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":1263
  *     if slices_overlap(&src, &dst, ndim, itemsize):
@@ -14286,8 +14829,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *             order = get_best_order(&dst, ndim)
  * 
  */
-    __pyx_t_1 = (!__pyx_memviewslice_is_contig((&__pyx_v_src), __pyx_v_order, __pyx_v_ndim));
-    if (__pyx_t_1) {
+    __pyx_t_2 = ((!(__pyx_memviewslice_is_contig((&__pyx_v_src), __pyx_v_order, __pyx_v_ndim) != 0)) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1264
  * 
@@ -14308,8 +14851,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *         src = tmp
  * 
  */
-    __pyx_t_5 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_v_tmpdata = __pyx_t_5;
+    __pyx_t_6 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_v_tmpdata = __pyx_t_6;
 
     /* "View.MemoryView":1267
  * 
@@ -14330,8 +14873,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  * 
  */
-  __pyx_t_1 = (!__pyx_v_broadcasting);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":1272
  * 
@@ -14340,8 +14883,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *             direct_copy = slice_is_contig(&dst, 'C', ndim)
  *         elif slice_is_contig(&src, 'F', ndim):
  */
-    __pyx_t_1 = __pyx_memviewslice_is_contig((&__pyx_v_src), 'C', __pyx_v_ndim);
-    if (__pyx_t_1) {
+    __pyx_t_2 = (__pyx_memviewslice_is_contig((&__pyx_v_src), 'C', __pyx_v_ndim) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1273
  * 
@@ -14361,8 +14904,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *             direct_copy = slice_is_contig(&dst, 'F', ndim)
  * 
  */
-    __pyx_t_1 = __pyx_memviewslice_is_contig((&__pyx_v_src), 'F', __pyx_v_ndim);
-    if (__pyx_t_1) {
+    __pyx_t_2 = (__pyx_memviewslice_is_contig((&__pyx_v_src), 'F', __pyx_v_ndim) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1275
  *             direct_copy = slice_is_contig(&dst, 'C', ndim)
@@ -14383,7 +14926,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  *             refcount_copying(&dst, dtype_is_object, ndim, False)
  */
-    if (__pyx_v_direct_copy) {
+    __pyx_t_2 = (__pyx_v_direct_copy != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1279
  *         if direct_copy:
@@ -14435,11 +14979,12 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  * 
  */
-  __pyx_t_1 = (__pyx_v_order == 'F');
-  if (__pyx_t_1) {
-    __pyx_t_1 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
+  __pyx_t_2 = (__pyx_v_order == 'F');
+  if (__pyx_t_2) {
+    __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
   }
-  if (__pyx_t_1) {
+  __pyx_t_7 = (__pyx_t_2 != 0);
+  if (__pyx_t_7) {
 
     /* "View.MemoryView":1287
  * 
@@ -14448,7 +14993,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *         transpose_memslice(&dst)
  * 
  */
-    __pyx_t_4 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_4 == 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
     /* "View.MemoryView":1288
  * 
@@ -14457,7 +15002,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  *     refcount_copying(&dst, dtype_is_object, ndim, False)
  */
-    __pyx_t_4 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_4 == 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L14;
   }
   __pyx_L14:;
@@ -14636,6 +15181,7 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_slice
  */
 
 static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) {
+  int __pyx_t_1;
 
   /* "View.MemoryView":1324
  * 
@@ -14644,7 +15190,8 @@ static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, i
  *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,
  *                                            dst.strides, ndim, inc)
  */
-  if (__pyx_v_dtype_is_object) {
+  __pyx_t_1 = (__pyx_v_dtype_is_object != 0);
+  if (__pyx_t_1) {
 
     /* "View.MemoryView":1326
  *     if dtype_is_object:
@@ -14724,7 +15271,7 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss
  *             if inc:
  *                 Py_INCREF((<PyObject **> data)[0])
  */
-    __pyx_t_3 = (__pyx_v_ndim == 1);
+    __pyx_t_3 = ((__pyx_v_ndim == 1) != 0);
     if (__pyx_t_3) {
 
       /* "View.MemoryView":1341
@@ -14734,7 +15281,8 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss
  *                 Py_INCREF((<PyObject **> data)[0])
  *             else:
  */
-      if (__pyx_v_inc) {
+      __pyx_t_3 = (__pyx_v_inc != 0);
+      if (__pyx_t_3) {
 
         /* "View.MemoryView":1342
  *         if ndim == 1:
@@ -14866,7 +15414,7 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t
  *         for i in range(extent):
  *             memcpy(data, item, itemsize)
  */
-  __pyx_t_1 = (__pyx_v_ndim == 1);
+  __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":1373
@@ -14935,95 +15483,157 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t
   __pyx_L3:;
 
 }
+static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;
 
-static PyObject *__pyx_tp_new_8bilinear_Bilinear(PyTypeObject *t, PyObject *a, PyObject *k) {
-  struct __pyx_obj_8bilinear_Bilinear *p;
-  PyObject *o = (*t->tp_alloc)(t, 0);
-  if (!o) return 0;
-  p = ((struct __pyx_obj_8bilinear_Bilinear *)o);
-  p->data.data = NULL;
-  p->data.memview = NULL;
-  if (__pyx_pw_8bilinear_8Bilinear_1__cinit__(o, a, k) < 0) {
-    Py_DECREF(o); o = 0;
+static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
+  struct __pyx_memoryview_obj *p;
+  PyObject *o;
+  o = (*t->tp_alloc)(t, 0);
+  if (unlikely(!o)) return 0;
+  p = ((struct __pyx_memoryview_obj *)o);
+  p->__pyx_vtab = __pyx_vtabptr_memoryview;
+  p->obj = Py_None; Py_INCREF(Py_None);
+  p->_size = Py_None; Py_INCREF(Py_None);
+  p->_array_interface = Py_None; Py_INCREF(Py_None);
+  p->view.obj = NULL;
+  if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) {
+    Py_DECREF(o); o = 0;
   }
   return o;
 }
 
-static void __pyx_tp_dealloc_8bilinear_Bilinear(PyObject *o) {
-  struct __pyx_obj_8bilinear_Bilinear *p = (struct __pyx_obj_8bilinear_Bilinear *)o;
-  __PYX_XDEC_MEMVIEW(&p->data, 1);
+static void __pyx_tp_dealloc_memoryview(PyObject *o) {
+  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
+  PyObject_GC_UnTrack(o);
+  {
+    PyObject *etype, *eval, *etb;
+    PyErr_Fetch(&etype, &eval, &etb);
+    ++Py_REFCNT(o);
+    __pyx_memoryview___dealloc__(o);
+    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
+    --Py_REFCNT(o);
+    PyErr_Restore(etype, eval, etb);
+  }
+  Py_CLEAR(p->obj);
+  Py_CLEAR(p->_size);
+  Py_CLEAR(p->_array_interface);
   (*Py_TYPE(o)->tp_free)(o);
 }
 
-static PyMethodDef __pyx_methods_8bilinear_Bilinear[] = {
-  {__Pyx_NAMESTR("f_cy"), (PyCFunction)__pyx_pw_8bilinear_8Bilinear_3f_cy, METH_O, __Pyx_DOCSTR(__pyx_doc_8bilinear_8Bilinear_2f_cy)},
-  {__Pyx_NAMESTR("local_maxi"), (PyCFunction)__pyx_pw_8bilinear_8Bilinear_5local_maxi, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8bilinear_8Bilinear_4local_maxi)},
+static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) {
+  int e;
+  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
+  if (p->obj) {
+    e = (*v)(p->obj, a); if (e) return e;
+  }
+  if (p->_size) {
+    e = (*v)(p->_size, a); if (e) return e;
+  }
+  if (p->_array_interface) {
+    e = (*v)(p->_array_interface, a); if (e) return e;
+  }
+  if (p->view.obj) {
+    e = (*v)(p->view.obj, a); if (e) return e;
+  }
+  return 0;
+}
+
+static int __pyx_tp_clear_memoryview(PyObject *o) {
+  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
+  PyObject* tmp;
+  tmp = ((PyObject*)p->obj);
+  p->obj = Py_None; Py_INCREF(Py_None);
+  Py_XDECREF(tmp);
+  tmp = ((PyObject*)p->_size);
+  p->_size = Py_None; Py_INCREF(Py_None);
+  Py_XDECREF(tmp);
+  tmp = ((PyObject*)p->_array_interface);
+  p->_array_interface = Py_None; Py_INCREF(Py_None);
+  Py_XDECREF(tmp);
+  Py_CLEAR(p->view.obj);
+  return 0;
+}
+static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
+  PyObject *r;
+  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
+  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
+  Py_DECREF(x);
+  return r;
+}
+
+static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) {
+  if (v) {
+    return __pyx_memoryview___setitem__(o, i, v);
+  }
+  else {
+    PyErr_Format(PyExc_NotImplementedError,
+      "Subscript deletion not supported by %s", Py_TYPE(o)->tp_name);
+    return -1;
+  }
+}
+
+static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_transpose(o);
+}
+
+static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview__get__base(o);
+}
+
+static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_shape(o);
+}
+
+static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_strides(o);
+}
+
+static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_suboffsets(o);
+}
+
+static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_ndim(o);
+}
+
+static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_itemsize(o);
+}
+
+static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_nbytes(o);
+}
+
+static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_size(o);
+}
+
+static PyMethodDef __pyx_methods_memoryview[] = {
+  {__Pyx_NAMESTR("is_c_contig"), (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, __Pyx_DOCSTR(0)},
+  {__Pyx_NAMESTR("is_f_contig"), (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, __Pyx_DOCSTR(0)},
+  {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, __Pyx_DOCSTR(0)},
+  {__Pyx_NAMESTR("copy_fortran"), (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, __Pyx_DOCSTR(0)},
   {0, 0, 0, 0}
 };
 
-static PyNumberMethods __pyx_tp_as_number_Bilinear = {
-  0, /*nb_add*/
-  0, /*nb_subtract*/
-  0, /*nb_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_divide*/
-  #endif
-  0, /*nb_remainder*/
-  0, /*nb_divmod*/
-  0, /*nb_power*/
-  0, /*nb_negative*/
-  0, /*nb_positive*/
-  0, /*nb_absolute*/
-  0, /*nb_nonzero*/
-  0, /*nb_invert*/
-  0, /*nb_lshift*/
-  0, /*nb_rshift*/
-  0, /*nb_and*/
-  0, /*nb_xor*/
-  0, /*nb_or*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_coerce*/
-  #endif
-  0, /*nb_int*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_long*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*nb_float*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_oct*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_hex*/
-  #endif
-  0, /*nb_inplace_add*/
-  0, /*nb_inplace_subtract*/
-  0, /*nb_inplace_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_inplace_divide*/
-  #endif
-  0, /*nb_inplace_remainder*/
-  0, /*nb_inplace_power*/
-  0, /*nb_inplace_lshift*/
-  0, /*nb_inplace_rshift*/
-  0, /*nb_inplace_and*/
-  0, /*nb_inplace_xor*/
-  0, /*nb_inplace_or*/
-  0, /*nb_floor_divide*/
-  0, /*nb_true_divide*/
-  0, /*nb_inplace_floor_divide*/
-  0, /*nb_inplace_true_divide*/
-  #if PY_VERSION_HEX >= 0x02050000
-  0, /*nb_index*/
-  #endif
+static struct PyGetSetDef __pyx_getsets_memoryview[] = {
+  {(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, 0, 0},
+  {(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, 0, 0},
+  {(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, 0, 0},
+  {(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, 0, 0},
+  {(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, 0, 0},
+  {(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, 0, 0},
+  {(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, 0, 0},
+  {(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, 0, 0},
+  {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, 0, 0},
+  {0, 0, 0, 0, 0}
 };
 
-static PySequenceMethods __pyx_tp_as_sequence_Bilinear = {
-  0, /*sq_length*/
+static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
+  __pyx_memoryview___len__, /*sq_length*/
   0, /*sq_concat*/
   0, /*sq_repeat*/
-  0, /*sq_item*/
+  __pyx_sq_item_memoryview, /*sq_item*/
   0, /*sq_slice*/
   0, /*sq_ass_item*/
   0, /*sq_ass_slice*/
@@ -15032,13 +15642,13 @@ static PySequenceMethods __pyx_tp_as_sequence_Bilinear = {
   0, /*sq_inplace_repeat*/
 };
 
-static PyMappingMethods __pyx_tp_as_mapping_Bilinear = {
-  0, /*mp_length*/
-  0, /*mp_subscript*/
-  0, /*mp_ass_subscript*/
+static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
+  __pyx_memoryview___len__, /*mp_length*/
+  __pyx_memoryview___getitem__, /*mp_subscript*/
+  __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/
 };
 
-static PyBufferProcs __pyx_tp_as_buffer_Bilinear = {
+static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
   #if PY_MAJOR_VERSION < 3
   0, /*bf_getreadbuffer*/
   #endif
@@ -15052,19 +15662,19 @@ static PyBufferProcs __pyx_tp_as_buffer_Bilinear = {
   0, /*bf_getcharbuffer*/
   #endif
   #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_getbuffer*/
+  __pyx_memoryview_getbuffer, /*bf_getbuffer*/
   #endif
   #if PY_VERSION_HEX >= 0x02060000
   0, /*bf_releasebuffer*/
   #endif
 };
 
-static PyTypeObject __pyx_type_8bilinear_Bilinear = {
+static PyTypeObject __pyx_type___pyx_memoryview = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("bilinear.Bilinear"), /*tp_name*/
-  sizeof(struct __pyx_obj_8bilinear_Bilinear), /*tp_basicsize*/
+  __Pyx_NAMESTR("bilinear.memoryview"), /*tp_name*/
+  sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_8bilinear_Bilinear, /*tp_dealloc*/
+  __pyx_tp_dealloc_memoryview, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -15073,27 +15683,27 @@ static PyTypeObject __pyx_type_8bilinear_Bilinear = {
   #else
   0, /*reserved*/
   #endif
-  0, /*tp_repr*/
-  &__pyx_tp_as_number_Bilinear, /*tp_as_number*/
-  &__pyx_tp_as_sequence_Bilinear, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping_Bilinear, /*tp_as_mapping*/
+  __pyx_memoryview___repr__, /*tp_repr*/
+  0, /*tp_as_number*/
+  &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/
+  &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/
   0, /*tp_hash*/
   0, /*tp_call*/
-  0, /*tp_str*/
+  __pyx_memoryview___str__, /*tp_str*/
   0, /*tp_getattro*/
   0, /*tp_setattro*/
-  &__pyx_tp_as_buffer_Bilinear, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
-  __Pyx_DOCSTR("Bilinear interpolator for finding max"), /*tp_doc*/
-  0, /*tp_traverse*/
-  0, /*tp_clear*/
+  &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+  0, /*tp_doc*/
+  __pyx_tp_traverse_memoryview, /*tp_traverse*/
+  __pyx_tp_clear_memoryview, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
   0, /*tp_iter*/
   0, /*tp_iternext*/
-  __pyx_methods_8bilinear_Bilinear, /*tp_methods*/
+  __pyx_methods_memoryview, /*tp_methods*/
   0, /*tp_members*/
-  0, /*tp_getset*/
+  __pyx_getsets_memoryview, /*tp_getset*/
   0, /*tp_base*/
   0, /*tp_dict*/
   0, /*tp_descr_get*/
@@ -15101,7 +15711,7 @@ static PyTypeObject __pyx_type_8bilinear_Bilinear = {
   0, /*tp_dictoffset*/
   0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_8bilinear_Bilinear, /*tp_new*/
+  __pyx_tp_new_memoryview, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -15113,16 +15723,20 @@ static PyTypeObject __pyx_type_8bilinear_Bilinear = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
 static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
   struct __pyx_array_obj *p;
-  PyObject *o = (*t->tp_alloc)(t, 0);
-  if (!o) return 0;
+  PyObject *o;
+  o = (*t->tp_alloc)(t, 0);
+  if (unlikely(!o)) return 0;
   p = ((struct __pyx_array_obj *)o);
   p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
   p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
-  if (__pyx_array___cinit__(o, a, k) < 0) {
+  if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) {
     Py_DECREF(o); o = 0;
   }
   return o;
@@ -15130,6 +15744,7 @@ static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
 
 static void __pyx_tp_dealloc_array(PyObject *o) {
   struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
+  PyObject_GC_UnTrack(o);
   {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
@@ -15209,64 +15824,6 @@ static struct PyGetSetDef __pyx_getsets_array[] = {
   {0, 0, 0, 0, 0}
 };
 
-static PyNumberMethods __pyx_tp_as_number_array = {
-  0, /*nb_add*/
-  0, /*nb_subtract*/
-  0, /*nb_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_divide*/
-  #endif
-  0, /*nb_remainder*/
-  0, /*nb_divmod*/
-  0, /*nb_power*/
-  0, /*nb_negative*/
-  0, /*nb_positive*/
-  0, /*nb_absolute*/
-  0, /*nb_nonzero*/
-  0, /*nb_invert*/
-  0, /*nb_lshift*/
-  0, /*nb_rshift*/
-  0, /*nb_and*/
-  0, /*nb_xor*/
-  0, /*nb_or*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_coerce*/
-  #endif
-  0, /*nb_int*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_long*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*nb_float*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_oct*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_hex*/
-  #endif
-  0, /*nb_inplace_add*/
-  0, /*nb_inplace_subtract*/
-  0, /*nb_inplace_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_inplace_divide*/
-  #endif
-  0, /*nb_inplace_remainder*/
-  0, /*nb_inplace_power*/
-  0, /*nb_inplace_lshift*/
-  0, /*nb_inplace_rshift*/
-  0, /*nb_inplace_and*/
-  0, /*nb_inplace_xor*/
-  0, /*nb_inplace_or*/
-  0, /*nb_floor_divide*/
-  0, /*nb_true_divide*/
-  0, /*nb_inplace_floor_divide*/
-  0, /*nb_inplace_true_divide*/
-  #if PY_VERSION_HEX >= 0x02050000
-  0, /*nb_index*/
-  #endif
-};
-
 static PySequenceMethods __pyx_tp_as_sequence_array = {
   0, /*sq_length*/
   0, /*sq_concat*/
@@ -15322,7 +15879,7 @@ static PyTypeObject __pyx_type___pyx_array = {
   0, /*reserved*/
   #endif
   0, /*tp_repr*/
-  &__pyx_tp_as_number_array, /*tp_as_number*/
+  0, /*tp_as_number*/
   &__pyx_tp_as_sequence_array, /*tp_as_sequence*/
   &__pyx_tp_as_mapping_array, /*tp_as_mapping*/
   0, /*tp_hash*/
@@ -15331,7 +15888,7 @@ static PyTypeObject __pyx_type___pyx_array = {
   __pyx_tp_getattro_array, /*tp_getattro*/
   0, /*tp_setattro*/
   &__pyx_tp_as_buffer_array, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
   0, /*tp_doc*/
   __pyx_tp_traverse_array, /*tp_traverse*/
   __pyx_tp_clear_array, /*tp_clear*/
@@ -15361,12 +15918,16 @@ static PyTypeObject __pyx_type___pyx_array = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
 static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
   struct __pyx_MemviewEnum_obj *p;
-  PyObject *o = (*t->tp_alloc)(t, 0);
-  if (!o) return 0;
+  PyObject *o;
+  o = (*t->tp_alloc)(t, 0);
+  if (unlikely(!o)) return 0;
   p = ((struct __pyx_MemviewEnum_obj *)o);
   p->name = Py_None; Py_INCREF(Py_None);
   return o;
@@ -15374,6 +15935,7 @@ static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, C
 
 static void __pyx_tp_dealloc_Enum(PyObject *o) {
   struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
+  PyObject_GC_UnTrack(o);
   Py_CLEAR(p->name);
   (*Py_TYPE(o)->tp_free)(o);
 }
@@ -15400,104 +15962,6 @@ static PyMethodDef __pyx_methods_Enum[] = {
   {0, 0, 0, 0}
 };
 
-static PyNumberMethods __pyx_tp_as_number_Enum = {
-  0, /*nb_add*/
-  0, /*nb_subtract*/
-  0, /*nb_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_divide*/
-  #endif
-  0, /*nb_remainder*/
-  0, /*nb_divmod*/
-  0, /*nb_power*/
-  0, /*nb_negative*/
-  0, /*nb_positive*/
-  0, /*nb_absolute*/
-  0, /*nb_nonzero*/
-  0, /*nb_invert*/
-  0, /*nb_lshift*/
-  0, /*nb_rshift*/
-  0, /*nb_and*/
-  0, /*nb_xor*/
-  0, /*nb_or*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_coerce*/
-  #endif
-  0, /*nb_int*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_long*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*nb_float*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_oct*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_hex*/
-  #endif
-  0, /*nb_inplace_add*/
-  0, /*nb_inplace_subtract*/
-  0, /*nb_inplace_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_inplace_divide*/
-  #endif
-  0, /*nb_inplace_remainder*/
-  0, /*nb_inplace_power*/
-  0, /*nb_inplace_lshift*/
-  0, /*nb_inplace_rshift*/
-  0, /*nb_inplace_and*/
-  0, /*nb_inplace_xor*/
-  0, /*nb_inplace_or*/
-  0, /*nb_floor_divide*/
-  0, /*nb_true_divide*/
-  0, /*nb_inplace_floor_divide*/
-  0, /*nb_inplace_true_divide*/
-  #if PY_VERSION_HEX >= 0x02050000
-  0, /*nb_index*/
-  #endif
-};
-
-static PySequenceMethods __pyx_tp_as_sequence_Enum = {
-  0, /*sq_length*/
-  0, /*sq_concat*/
-  0, /*sq_repeat*/
-  0, /*sq_item*/
-  0, /*sq_slice*/
-  0, /*sq_ass_item*/
-  0, /*sq_ass_slice*/
-  0, /*sq_contains*/
-  0, /*sq_inplace_concat*/
-  0, /*sq_inplace_repeat*/
-};
-
-static PyMappingMethods __pyx_tp_as_mapping_Enum = {
-  0, /*mp_length*/
-  0, /*mp_subscript*/
-  0, /*mp_ass_subscript*/
-};
-
-static PyBufferProcs __pyx_tp_as_buffer_Enum = {
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getreadbuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getwritebuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getsegcount*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getcharbuffer*/
-  #endif
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_getbuffer*/
-  #endif
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_releasebuffer*/
-  #endif
-};
-
 static PyTypeObject __pyx_type___pyx_MemviewEnum = {
   PyVarObject_HEAD_INIT(0, 0)
   __Pyx_NAMESTR("bilinear.Enum"), /*tp_name*/
@@ -15513,16 +15977,16 @@ static PyTypeObject __pyx_type___pyx_MemviewEnum = {
   0, /*reserved*/
   #endif
   __pyx_MemviewEnum___repr__, /*tp_repr*/
-  &__pyx_tp_as_number_Enum, /*tp_as_number*/
-  &__pyx_tp_as_sequence_Enum, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping_Enum, /*tp_as_mapping*/
+  0, /*tp_as_number*/
+  0, /*tp_as_sequence*/
+  0, /*tp_as_mapping*/
   0, /*tp_hash*/
   0, /*tp_call*/
   0, /*tp_str*/
   0, /*tp_getattro*/
   0, /*tp_setattro*/
-  &__pyx_tp_as_buffer_Enum, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+  0, /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
   0, /*tp_doc*/
   __pyx_tp_traverse_Enum, /*tp_traverse*/
   __pyx_tp_clear_Enum, /*tp_clear*/
@@ -15552,255 +16016,43 @@ static PyTypeObject __pyx_type___pyx_MemviewEnum = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
-static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;
 
-static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
-  struct __pyx_memoryview_obj *p;
-  PyObject *o = (*t->tp_alloc)(t, 0);
-  if (!o) return 0;
-  p = ((struct __pyx_memoryview_obj *)o);
-  p->__pyx_vtab = __pyx_vtabptr_memoryview;
-  p->obj = Py_None; Py_INCREF(Py_None);
-  p->_size = Py_None; Py_INCREF(Py_None);
-  p->_array_interface = Py_None; Py_INCREF(Py_None);
-  p->view.obj = NULL;
-  if (__pyx_memoryview___cinit__(o, a, k) < 0) {
+static PyObject *__pyx_tp_new_8bilinear_Bilinear(PyTypeObject *t, PyObject *a, PyObject *k) {
+  struct __pyx_obj_8bilinear_Bilinear *p;
+  PyObject *o;
+  o = (*t->tp_alloc)(t, 0);
+  if (unlikely(!o)) return 0;
+  p = ((struct __pyx_obj_8bilinear_Bilinear *)o);
+  p->data.data = NULL;
+  p->data.memview = NULL;
+  if (unlikely(__pyx_pw_8bilinear_8Bilinear_1__cinit__(o, a, k) < 0)) {
     Py_DECREF(o); o = 0;
   }
   return o;
 }
 
-static void __pyx_tp_dealloc_memoryview(PyObject *o) {
-  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
-  {
-    PyObject *etype, *eval, *etb;
-    PyErr_Fetch(&etype, &eval, &etb);
-    ++Py_REFCNT(o);
-    __pyx_memoryview___dealloc__(o);
-    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
-    --Py_REFCNT(o);
-    PyErr_Restore(etype, eval, etb);
-  }
-  Py_CLEAR(p->obj);
-  Py_CLEAR(p->_size);
-  Py_CLEAR(p->_array_interface);
+static void __pyx_tp_dealloc_8bilinear_Bilinear(PyObject *o) {
+  struct __pyx_obj_8bilinear_Bilinear *p = (struct __pyx_obj_8bilinear_Bilinear *)o;
+  __PYX_XDEC_MEMVIEW(&p->data, 1);
   (*Py_TYPE(o)->tp_free)(o);
 }
 
-static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) {
-  int e;
-  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
-  if (p->obj) {
-    e = (*v)(p->obj, a); if (e) return e;
-  }
-  if (p->_size) {
-    e = (*v)(p->_size, a); if (e) return e;
-  }
-  if (p->_array_interface) {
-    e = (*v)(p->_array_interface, a); if (e) return e;
-  }
-  if (p->view.obj) {
-    e = (*v)(p->view.obj, a); if (e) return e;
-  }
-  return 0;
-}
-
-static int __pyx_tp_clear_memoryview(PyObject *o) {
-  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
-  PyObject* tmp;
-  tmp = ((PyObject*)p->obj);
-  p->obj = Py_None; Py_INCREF(Py_None);
-  Py_XDECREF(tmp);
-  tmp = ((PyObject*)p->_size);
-  p->_size = Py_None; Py_INCREF(Py_None);
-  Py_XDECREF(tmp);
-  tmp = ((PyObject*)p->_array_interface);
-  p->_array_interface = Py_None; Py_INCREF(Py_None);
-  Py_XDECREF(tmp);
-  Py_CLEAR(p->view.obj);
-  return 0;
-}
-static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
-  PyObject *r;
-  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
-  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
-  Py_DECREF(x);
-  return r;
-}
-
-static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) {
-  if (v) {
-    return __pyx_memoryview___setitem__(o, i, v);
-  }
-  else {
-    PyErr_Format(PyExc_NotImplementedError,
-      "Subscript deletion not supported by %s", Py_TYPE(o)->tp_name);
-    return -1;
-  }
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_transpose(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview__get__base(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_shape(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_strides(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_suboffsets(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_ndim(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_itemsize(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_nbytes(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_size(o);
-}
-
-static PyMethodDef __pyx_methods_memoryview[] = {
-  {__Pyx_NAMESTR("is_c_contig"), (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, __Pyx_DOCSTR(0)},
-  {__Pyx_NAMESTR("is_f_contig"), (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, __Pyx_DOCSTR(0)},
-  {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, __Pyx_DOCSTR(0)},
-  {__Pyx_NAMESTR("copy_fortran"), (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, __Pyx_DOCSTR(0)},
+static PyMethodDef __pyx_methods_8bilinear_Bilinear[] = {
+  {__Pyx_NAMESTR("f_cy"), (PyCFunction)__pyx_pw_8bilinear_8Bilinear_3f_cy, METH_O, __Pyx_DOCSTR(__pyx_doc_8bilinear_8Bilinear_2f_cy)},
+  {__Pyx_NAMESTR("local_maxi"), (PyCFunction)__pyx_pw_8bilinear_8Bilinear_5local_maxi, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8bilinear_8Bilinear_4local_maxi)},
   {0, 0, 0, 0}
 };
 
-static struct PyGetSetDef __pyx_getsets_memoryview[] = {
-  {(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, 0, 0},
-  {(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, 0, 0},
-  {(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, 0, 0},
-  {(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, 0, 0},
-  {(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, 0, 0},
-  {(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, 0, 0},
-  {(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, 0, 0},
-  {(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, 0, 0},
-  {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, 0, 0},
-  {0, 0, 0, 0, 0}
-};
-
-static PyNumberMethods __pyx_tp_as_number_memoryview = {
-  0, /*nb_add*/
-  0, /*nb_subtract*/
-  0, /*nb_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_divide*/
-  #endif
-  0, /*nb_remainder*/
-  0, /*nb_divmod*/
-  0, /*nb_power*/
-  0, /*nb_negative*/
-  0, /*nb_positive*/
-  0, /*nb_absolute*/
-  0, /*nb_nonzero*/
-  0, /*nb_invert*/
-  0, /*nb_lshift*/
-  0, /*nb_rshift*/
-  0, /*nb_and*/
-  0, /*nb_xor*/
-  0, /*nb_or*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_coerce*/
-  #endif
-  0, /*nb_int*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_long*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*nb_float*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_oct*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_hex*/
-  #endif
-  0, /*nb_inplace_add*/
-  0, /*nb_inplace_subtract*/
-  0, /*nb_inplace_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_inplace_divide*/
-  #endif
-  0, /*nb_inplace_remainder*/
-  0, /*nb_inplace_power*/
-  0, /*nb_inplace_lshift*/
-  0, /*nb_inplace_rshift*/
-  0, /*nb_inplace_and*/
-  0, /*nb_inplace_xor*/
-  0, /*nb_inplace_or*/
-  0, /*nb_floor_divide*/
-  0, /*nb_true_divide*/
-  0, /*nb_inplace_floor_divide*/
-  0, /*nb_inplace_true_divide*/
-  #if PY_VERSION_HEX >= 0x02050000
-  0, /*nb_index*/
-  #endif
-};
-
-static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
-  __pyx_memoryview___len__, /*sq_length*/
-  0, /*sq_concat*/
-  0, /*sq_repeat*/
-  __pyx_sq_item_memoryview, /*sq_item*/
-  0, /*sq_slice*/
-  0, /*sq_ass_item*/
-  0, /*sq_ass_slice*/
-  0, /*sq_contains*/
-  0, /*sq_inplace_concat*/
-  0, /*sq_inplace_repeat*/
-};
-
-static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
-  __pyx_memoryview___len__, /*mp_length*/
-  __pyx_memoryview___getitem__, /*mp_subscript*/
-  __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/
-};
-
-static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getreadbuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getwritebuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getsegcount*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getcharbuffer*/
-  #endif
-  #if PY_VERSION_HEX >= 0x02060000
-  __pyx_memoryview_getbuffer, /*bf_getbuffer*/
-  #endif
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_releasebuffer*/
-  #endif
-};
-
-static PyTypeObject __pyx_type___pyx_memoryview = {
+static PyTypeObject __pyx_type_8bilinear_Bilinear = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("bilinear.memoryview"), /*tp_name*/
-  sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/
+  __Pyx_NAMESTR("bilinear.Bilinear"), /*tp_name*/
+  sizeof(struct __pyx_obj_8bilinear_Bilinear), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_memoryview, /*tp_dealloc*/
+  __pyx_tp_dealloc_8bilinear_Bilinear, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -15809,27 +16061,27 @@ static PyTypeObject __pyx_type___pyx_memoryview = {
   #else
   0, /*reserved*/
   #endif
-  __pyx_memoryview___repr__, /*tp_repr*/
-  &__pyx_tp_as_number_memoryview, /*tp_as_number*/
-  &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/
+  0, /*tp_repr*/
+  0, /*tp_as_number*/
+  0, /*tp_as_sequence*/
+  0, /*tp_as_mapping*/
   0, /*tp_hash*/
   0, /*tp_call*/
-  __pyx_memoryview___str__, /*tp_str*/
-  0, /*tp_getattro*/
-  0, /*tp_setattro*/
-  &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
-  0, /*tp_doc*/
-  __pyx_tp_traverse_memoryview, /*tp_traverse*/
-  __pyx_tp_clear_memoryview, /*tp_clear*/
+  0, /*tp_str*/
+  0, /*tp_getattro*/
+  0, /*tp_setattro*/
+  0, /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
+  __Pyx_DOCSTR("Bilinear interpolator for finding max"), /*tp_doc*/
+  0, /*tp_traverse*/
+  0, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
   0, /*tp_iter*/
   0, /*tp_iternext*/
-  __pyx_methods_memoryview, /*tp_methods*/
+  __pyx_methods_8bilinear_Bilinear, /*tp_methods*/
   0, /*tp_members*/
-  __pyx_getsets_memoryview, /*tp_getset*/
+  0, /*tp_getset*/
   0, /*tp_base*/
   0, /*tp_dict*/
   0, /*tp_descr_get*/
@@ -15837,7 +16089,7 @@ static PyTypeObject __pyx_type___pyx_memoryview = {
   0, /*tp_dictoffset*/
   0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_memoryview, /*tp_new*/
+  __pyx_tp_new_8bilinear_Bilinear, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -15849,13 +16101,16 @@ static PyTypeObject __pyx_type___pyx_memoryview = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice;
 
 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) {
   struct __pyx_memoryviewslice_obj *p;
   PyObject *o = __pyx_tp_new_memoryview(t, a, k);
-  if (!o) return 0;
+  if (unlikely(!o)) return 0;
   p = ((struct __pyx_memoryviewslice_obj *)o);
   p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice;
   p->from_object = Py_None; Py_INCREF(Py_None);
@@ -15865,6 +16120,7 @@ static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyO
 
 static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) {
   struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
+  PyObject_GC_UnTrack(o);
   {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
@@ -15875,6 +16131,7 @@ static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) {
     PyErr_Restore(etype, eval, etb);
   }
   Py_CLEAR(p->from_object);
+  PyObject_GC_Track(o);
   __pyx_tp_dealloc_memoryview(o);
 }
 
@@ -15912,120 +16169,6 @@ static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = {
   {0, 0, 0, 0, 0}
 };
 
-static PyNumberMethods __pyx_tp_as_number__memoryviewslice = {
-  0, /*nb_add*/
-  0, /*nb_subtract*/
-  0, /*nb_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_divide*/
-  #endif
-  0, /*nb_remainder*/
-  0, /*nb_divmod*/
-  0, /*nb_power*/
-  0, /*nb_negative*/
-  0, /*nb_positive*/
-  0, /*nb_absolute*/
-  0, /*nb_nonzero*/
-  0, /*nb_invert*/
-  0, /*nb_lshift*/
-  0, /*nb_rshift*/
-  0, /*nb_and*/
-  0, /*nb_xor*/
-  0, /*nb_or*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_coerce*/
-  #endif
-  0, /*nb_int*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_long*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*nb_float*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_oct*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_hex*/
-  #endif
-  0, /*nb_inplace_add*/
-  0, /*nb_inplace_subtract*/
-  0, /*nb_inplace_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_inplace_divide*/
-  #endif
-  0, /*nb_inplace_remainder*/
-  0, /*nb_inplace_power*/
-  0, /*nb_inplace_lshift*/
-  0, /*nb_inplace_rshift*/
-  0, /*nb_inplace_and*/
-  0, /*nb_inplace_xor*/
-  0, /*nb_inplace_or*/
-  0, /*nb_floor_divide*/
-  0, /*nb_true_divide*/
-  0, /*nb_inplace_floor_divide*/
-  0, /*nb_inplace_true_divide*/
-  #if PY_VERSION_HEX >= 0x02050000
-  0, /*nb_index*/
-  #endif
-};
-
-static PySequenceMethods __pyx_tp_as_sequence__memoryviewslice = {
-  #if CYTHON_COMPILING_IN_PYPY
-  __pyx_memoryview___len__, /*sq_length*/
-  #else
-  0, /*sq_length*/
-  #endif
-  0, /*sq_concat*/
-  0, /*sq_repeat*/
-  0, /*sq_item*/
-  0, /*sq_slice*/
-  0, /*sq_ass_item*/
-  0, /*sq_ass_slice*/
-  0, /*sq_contains*/
-  0, /*sq_inplace_concat*/
-  0, /*sq_inplace_repeat*/
-};
-
-static PyMappingMethods __pyx_tp_as_mapping__memoryviewslice = {
-  #if CYTHON_COMPILING_IN_PYPY
-  __pyx_memoryview___len__, /*mp_length*/
-  #else
-  0, /*mp_length*/
-  #endif
-  #if CYTHON_COMPILING_IN_PYPY
-  __pyx_memoryview___getitem__, /*mp_subscript*/
-  #else
-  0, /*mp_subscript*/
-  #endif
-  0, /*mp_ass_subscript*/
-};
-
-static PyBufferProcs __pyx_tp_as_buffer__memoryviewslice = {
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getreadbuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getwritebuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getsegcount*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getcharbuffer*/
-  #endif
-  #if CYTHON_COMPILING_IN_PYPY
-  __pyx_memoryview_getbuffer, /*bf_getbuffer*/
-  #else
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_getbuffer*/
-  #endif
-  #endif
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_releasebuffer*/
-  #endif
-};
-
 static PyTypeObject __pyx_type___pyx_memoryviewslice = {
   PyVarObject_HEAD_INIT(0, 0)
   __Pyx_NAMESTR("bilinear._memoryviewslice"), /*tp_name*/
@@ -16045,9 +16188,9 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = {
   #else
   0, /*tp_repr*/
   #endif
-  &__pyx_tp_as_number__memoryviewslice, /*tp_as_number*/
-  &__pyx_tp_as_sequence__memoryviewslice, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping__memoryviewslice, /*tp_as_mapping*/
+  0, /*tp_as_number*/
+  0, /*tp_as_sequence*/
+  0, /*tp_as_mapping*/
   0, /*tp_hash*/
   0, /*tp_call*/
   #if CYTHON_COMPILING_IN_PYPY
@@ -16057,8 +16200,8 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = {
   #endif
   0, /*tp_getattro*/
   0, /*tp_setattro*/
-  &__pyx_tp_as_buffer__memoryviewslice, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+  0, /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
   __Pyx_DOCSTR("Internal class for passing memoryview slices to Python"), /*tp_doc*/
   __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/
   __pyx_tp_clear__memoryviewslice, /*tp_clear*/
@@ -16088,6 +16231,9 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
 static PyMethodDef __pyx_methods[] = {
@@ -16096,7 +16242,11 @@ static PyMethodDef __pyx_methods[] = {
 
 #if PY_MAJOR_VERSION >= 3
 static struct PyModuleDef __pyx_moduledef = {
+  #if PY_VERSION_HEX < 0x03020000
+    { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
+  #else
     PyModuleDef_HEAD_INIT,
+  #endif
     __Pyx_NAMESTR("bilinear"),
     0, /* m_doc */
     -1, /* m_size */
@@ -16109,36 +16259,39 @@ static struct PyModuleDef __pyx_moduledef = {
 #endif
 
 static __Pyx_StringTabEntry __pyx_string_tab[] = {
-  {&__pyx_kp_u_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 1, 0, 0},
+  {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0},
   {&__pyx_kp_u_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 1, 0, 0},
-  {&__pyx_kp_s_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 0, 1, 0},
-  {&__pyx_kp_s_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 1, 0},
-  {&__pyx_kp_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 0},
-  {&__pyx_kp_s_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 1, 0},
-  {&__pyx_kp_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 0},
-  {&__pyx_kp_s_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 1, 0},
+  {&__pyx_kp_u_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 1, 0, 0},
+  {&__pyx_kp_u_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 1, 0, 0},
+  {&__pyx_kp_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 0},
+  {&__pyx_kp_s_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 0, 1, 0},
+  {&__pyx_kp_s_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 0, 1, 0},
+  {&__pyx_kp_s_24, __pyx_k_24, sizeof(__pyx_k_24), 0, 0, 1, 0},
   {&__pyx_kp_s_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 1, 0},
   {&__pyx_kp_s_27, __pyx_k_27, sizeof(__pyx_k_27), 0, 0, 1, 0},
   {&__pyx_kp_s_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 0, 1, 0},
-  {&__pyx_kp_u_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 1, 0, 0},
+  {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0},
   {&__pyx_kp_s_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 0, 1, 0},
-  {&__pyx_kp_s_32, __pyx_k_32, sizeof(__pyx_k_32), 0, 0, 1, 0},
+  {&__pyx_kp_s_33, __pyx_k_33, sizeof(__pyx_k_33), 0, 0, 1, 0},
   {&__pyx_kp_s_35, __pyx_k_35, sizeof(__pyx_k_35), 0, 0, 1, 0},
-  {&__pyx_kp_s_37, __pyx_k_37, sizeof(__pyx_k_37), 0, 0, 1, 0},
-  {&__pyx_kp_s_42, __pyx_k_42, sizeof(__pyx_k_42), 0, 0, 1, 0},
-  {&__pyx_kp_s_44, __pyx_k_44, sizeof(__pyx_k_44), 0, 0, 1, 0},
+  {&__pyx_kp_s_36, __pyx_k_36, sizeof(__pyx_k_36), 0, 0, 1, 0},
+  {&__pyx_kp_s_39, __pyx_k_39, sizeof(__pyx_k_39), 0, 0, 1, 0},
+  {&__pyx_kp_s_41, __pyx_k_41, sizeof(__pyx_k_41), 0, 0, 1, 0},
   {&__pyx_kp_s_46, __pyx_k_46, sizeof(__pyx_k_46), 0, 0, 1, 0},
-  {&__pyx_kp_s_47, __pyx_k_47, sizeof(__pyx_k_47), 0, 0, 1, 0},
   {&__pyx_kp_s_48, __pyx_k_48, sizeof(__pyx_k_48), 0, 0, 1, 0},
-  {&__pyx_kp_s_49, __pyx_k_49, sizeof(__pyx_k_49), 0, 0, 1, 0},
   {&__pyx_kp_u_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 1, 0, 0},
+  {&__pyx_kp_s_50, __pyx_k_50, sizeof(__pyx_k_50), 0, 0, 1, 0},
   {&__pyx_kp_s_51, __pyx_k_51, sizeof(__pyx_k_51), 0, 0, 1, 0},
+  {&__pyx_kp_s_52, __pyx_k_52, sizeof(__pyx_k_52), 0, 0, 1, 0},
   {&__pyx_kp_s_53, __pyx_k_53, sizeof(__pyx_k_53), 0, 0, 1, 0},
-  {&__pyx_kp_s_55, __pyx_k_55, sizeof(__pyx_k_55), 0, 0, 1, 0},
+  {&__pyx_kp_s_54, __pyx_k_54, sizeof(__pyx_k_54), 0, 0, 1, 0},
   {&__pyx_kp_s_57, __pyx_k_57, sizeof(__pyx_k_57), 0, 0, 1, 0},
   {&__pyx_kp_s_59, __pyx_k_59, sizeof(__pyx_k_59), 0, 0, 1, 0},
+  {&__pyx_kp_s_61, __pyx_k_61, sizeof(__pyx_k_61), 0, 0, 1, 0},
+  {&__pyx_kp_s_63, __pyx_k_63, sizeof(__pyx_k_63), 0, 0, 1, 0},
+  {&__pyx_kp_s_65, __pyx_k_65, sizeof(__pyx_k_65), 0, 0, 1, 0},
   {&__pyx_kp_u_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 1, 0, 0},
-  {&__pyx_kp_u_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 1, 0, 0},
+  {&__pyx_kp_u_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 1, 0, 0},
   {&__pyx_n_s__ASCII, __pyx_k__ASCII, sizeof(__pyx_k__ASCII), 0, 0, 1, 1},
   {&__pyx_n_s__Ellipsis, __pyx_k__Ellipsis, sizeof(__pyx_k__Ellipsis), 0, 0, 1, 1},
   {&__pyx_n_s__GPLv3, __pyx_k__GPLv3, sizeof(__pyx_k__GPLv3), 0, 0, 1, 1},
@@ -16153,10 +16306,13 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s____contact__, __pyx_k____contact__, sizeof(__pyx_k____contact__), 0, 0, 1, 1},
   {&__pyx_n_s____copyright__, __pyx_k____copyright__, sizeof(__pyx_k____copyright__), 0, 0, 1, 1},
   {&__pyx_n_s____date__, __pyx_k____date__, sizeof(__pyx_k____date__), 0, 0, 1, 1},
+  {&__pyx_n_s____import__, __pyx_k____import__, sizeof(__pyx_k____import__), 0, 0, 1, 1},
   {&__pyx_n_s____license__, __pyx_k____license__, sizeof(__pyx_k____license__), 0, 0, 1, 1},
   {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
   {&__pyx_n_s____name__, __pyx_k____name__, sizeof(__pyx_k____name__), 0, 0, 1, 1},
   {&__pyx_n_s____pyx_getbuffer, __pyx_k____pyx_getbuffer, sizeof(__pyx_k____pyx_getbuffer), 0, 0, 1, 1},
+  {&__pyx_n_s____pyx_releasebuffer, __pyx_k____pyx_releasebuffer, sizeof(__pyx_k____pyx_releasebuffer), 0, 0, 1, 1},
+  {&__pyx_n_s____pyx_vtable__, __pyx_k____pyx_vtable__, sizeof(__pyx_k____pyx_vtable__), 0, 0, 1, 1},
   {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
   {&__pyx_n_s__allocate_buffer, __pyx_k__allocate_buffer, sizeof(__pyx_k__allocate_buffer), 0, 0, 1, 1},
   {&__pyx_n_s__ascontiguousarray, __pyx_k__ascontiguousarray, sizeof(__pyx_k__ascontiguousarray), 0, 0, 1, 1},
@@ -16165,6 +16321,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s__c, __pyx_k__c, sizeof(__pyx_k__c), 0, 0, 1, 1},
   {&__pyx_n_u__c, __pyx_k__c, sizeof(__pyx_k__c), 0, 1, 0, 1},
   {&__pyx_n_s__data, __pyx_k__data, sizeof(__pyx_k__data), 0, 0, 1, 1},
+  {&__pyx_n_s__debug, __pyx_k__debug, sizeof(__pyx_k__debug), 0, 0, 1, 1},
   {&__pyx_n_s__decode, __pyx_k__decode, sizeof(__pyx_k__decode), 0, 0, 1, 1},
   {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1},
   {&__pyx_n_s__dtype_is_object, __pyx_k__dtype_is_object, sizeof(__pyx_k__dtype_is_object), 0, 0, 1, 1},
@@ -16177,8 +16334,11 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s__format, __pyx_k__format, sizeof(__pyx_k__format), 0, 0, 1, 1},
   {&__pyx_n_b__fortran, __pyx_k__fortran, sizeof(__pyx_k__fortran), 0, 0, 0, 1},
   {&__pyx_n_s__fortran, __pyx_k__fortran, sizeof(__pyx_k__fortran), 0, 0, 1, 1},
+  {&__pyx_n_s__getLogger, __pyx_k__getLogger, sizeof(__pyx_k__getLogger), 0, 0, 1, 1},
   {&__pyx_n_s__id, __pyx_k__id, sizeof(__pyx_k__id), 0, 0, 1, 1},
   {&__pyx_n_s__itemsize, __pyx_k__itemsize, sizeof(__pyx_k__itemsize), 0, 0, 1, 1},
+  {&__pyx_n_s__logger, __pyx_k__logger, sizeof(__pyx_k__logger), 0, 0, 1, 1},
+  {&__pyx_n_s__logging, __pyx_k__logging, sizeof(__pyx_k__logging), 0, 0, 1, 1},
   {&__pyx_n_s__max, __pyx_k__max, sizeof(__pyx_k__max), 0, 0, 1, 1},
   {&__pyx_n_s__memview, __pyx_k__memview, sizeof(__pyx_k__memview), 0, 0, 1, 1},
   {&__pyx_n_s__min, __pyx_k__min, sizeof(__pyx_k__min), 0, 0, 1, 1},
@@ -16202,20 +16362,20 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {0, 0, 0, 0, 0, 0, 0}
 };
 static int __Pyx_InitCachedBuiltins(void) {
-  __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_MemoryError = __Pyx_GetName(__pyx_b, __pyx_n_s__MemoryError); if (!__pyx_builtin_MemoryError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_enumerate = __Pyx_GetName(__pyx_b, __pyx_n_s__enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_Ellipsis = __Pyx_GetName(__pyx_b, __pyx_n_s__Ellipsis); if (!__pyx_builtin_Ellipsis) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s__MemoryError); if (!__pyx_builtin_MemoryError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s__enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s__Ellipsis); if (!__pyx_builtin_Ellipsis) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   #if PY_MAJOR_VERSION >= 3
-  __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   #else
-  __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__xrange); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s__xrange); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   #endif
-  __pyx_builtin_id = __Pyx_GetName(__pyx_b, __pyx_n_s__id); if (!__pyx_builtin_id) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_IndexError = __Pyx_GetName(__pyx_b, __pyx_n_s__IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s__id); if (!__pyx_builtin_id) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s__IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   return 0;
   __pyx_L1_error:;
   return -1;
@@ -16225,6 +16385,28 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
 
+  /* "bilinear.pyx":171
+ *             denom = 2.0*(d00*d11-d01*d01)
+ *             if abs(denom)<1e-10:
+ *                 logger.debug("Singular determinant, Hessian undefined")             # <<<<<<<<<<<<<<
+ *             else:
+ *                 delta0 = ((a12 - a10)*d01 + (a01 - a21)*d11)/denom
+ */
+  __pyx_k_tuple_2 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_1)); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_2);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2));
+
+  /* "bilinear.pyx":179
+ *                     return (float(current0) + delta0, float(current1) + delta1)
+ *                 else:
+ *                     logger.debug("Failed to find root using second order expansion")             # <<<<<<<<<<<<<<
+ *         #refinement of the position by a simple center of mass of the last valid region used
+ *         for i0 in range(start0, stop0+1):
+ */
+  __pyx_k_tuple_4 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_3)); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_4);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4));
+
   /* "numpy.pxd":215
  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
  *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
@@ -16232,12 +16414,9 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
  */
-  __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_2);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_kp_u_1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2));
+  __pyx_k_tuple_6 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_5)); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_6);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6));
 
   /* "numpy.pxd":219
  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
@@ -16246,12 +16425,9 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *             info.buf = PyArray_DATA(self)
  */
-  __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_4);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_3));
-  PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_kp_u_3));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4));
+  __pyx_k_tuple_8 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_7)); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_8);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8));
 
   /* "numpy.pxd":257
  *                 if ((descr.byteorder == c'>' and little_endian) or
@@ -16260,12 +16436,9 @@ static int __Pyx_InitCachedConstants(void) {
  *                 if   t == NPY_BYTE:        f = "b"
  *                 elif t == NPY_UBYTE:       f = "B"
  */
-  __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_6);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_5));
-  PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_kp_u_5));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6));
+  __pyx_k_tuple_10 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_9)); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_10);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10));
 
   /* "numpy.pxd":799
  * 
@@ -16274,12 +16447,9 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *         if ((child.byteorder == c'>' and little_endian) or
  */
-  __pyx_k_tuple_9 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_9);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_8));
-  PyTuple_SET_ITEM(__pyx_k_tuple_9, 0, ((PyObject *)__pyx_kp_u_8));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_8));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9));
+  __pyx_k_tuple_13 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_12)); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_13);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_13));
 
   /* "numpy.pxd":803
  *         if ((child.byteorder == c'>' and little_endian) or
@@ -16288,12 +16458,9 @@ static int __Pyx_InitCachedConstants(void) {
  *             # One could encode it in the format string and have Cython
  *             # complain instead, BUT: < and > in format strings also imply
  */
-  __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_10);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_5));
-  PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_kp_u_5));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10));
+  __pyx_k_tuple_14 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_9)); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_14);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14));
 
   /* "numpy.pxd":823
  *             t = child.type_num
@@ -16302,12 +16469,9 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *             # Until ticket #99 is fixed, use integers to avoid warnings
  */
-  __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_12);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_11));
-  PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_u_11));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_11));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12));
+  __pyx_k_tuple_16 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_15)); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_16);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16));
 
   /* "View.MemoryView":124
  * 
@@ -16316,12 +16480,9 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *         if self.itemsize <= 0:
  */
-  __pyx_k_tuple_14 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_14);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_13));
-  PyTuple_SET_ITEM(__pyx_k_tuple_14, 0, ((PyObject *)__pyx_kp_s_13));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_13));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14));
+  __pyx_k_tuple_18 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_17)); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_18);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18));
 
   /* "View.MemoryView":127
  * 
@@ -16330,12 +16491,9 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *         encode = getattr(format, 'encode', None)
  */
-  __pyx_k_tuple_16 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_16);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_15));
-  PyTuple_SET_ITEM(__pyx_k_tuple_16, 0, ((PyObject *)__pyx_kp_s_15));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_15));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16));
+  __pyx_k_tuple_20 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_19)); if (unlikely(!__pyx_k_tuple_20)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_20);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_20));
 
   /* "View.MemoryView":131
  *         encode = getattr(format, 'encode', None)
@@ -16344,12 +16502,9 @@ static int __Pyx_InitCachedConstants(void) {
  *         self._format = format
  *         self.format = self._format
  */
-  __pyx_k_tuple_17 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_17);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__ASCII));
-  PyTuple_SET_ITEM(__pyx_k_tuple_17, 0, ((PyObject *)__pyx_n_s__ASCII));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ASCII));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17));
+  __pyx_k_tuple_21 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__ASCII)); if (unlikely(!__pyx_k_tuple_21)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_21);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_21));
 
   /* "View.MemoryView":141
  *             free(self._shape)
@@ -16358,12 +16513,9 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  * 
  */
-  __pyx_k_tuple_19 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_19);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_18));
-  PyTuple_SET_ITEM(__pyx_k_tuple_19, 0, ((PyObject *)__pyx_kp_s_18));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_18));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_19));
+  __pyx_k_tuple_23 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_22)); if (unlikely(!__pyx_k_tuple_23)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_23);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_23));
 
   /* "View.MemoryView":166
  *         decode = getattr(mode, 'decode', None)
@@ -16372,12 +16524,9 @@ static int __Pyx_InitCachedConstants(void) {
  *         self.mode = mode
  * 
  */
-  __pyx_k_tuple_22 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_22)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_22);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__ASCII));
-  PyTuple_SET_ITEM(__pyx_k_tuple_22, 0, ((PyObject *)__pyx_n_s__ASCII));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ASCII));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_22));
+  __pyx_k_tuple_26 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__ASCII)); if (unlikely(!__pyx_k_tuple_26)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_26);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_26));
 
   /* "View.MemoryView":174
  *             self.data = <char *>malloc(self.len)
@@ -16386,12 +16535,9 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *             if self.dtype_is_object:
  */
-  __pyx_k_tuple_24 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_24)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_24);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_23));
-  PyTuple_SET_ITEM(__pyx_k_tuple_24, 0, ((PyObject *)__pyx_kp_s_23));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_23));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_24));
+  __pyx_k_tuple_28 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_27)); if (unlikely(!__pyx_k_tuple_28)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_28);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_28));
 
   /* "View.MemoryView":190
  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
@@ -16400,12 +16546,9 @@ static int __Pyx_InitCachedConstants(void) {
  *         info.buf = self.data
  *         info.len = self.len
  */
-  __pyx_k_tuple_26 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_26)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_26);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_25));
-  PyTuple_SET_ITEM(__pyx_k_tuple_26, 0, ((PyObject *)__pyx_kp_s_25));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_25));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_26));
+  __pyx_k_tuple_30 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_29)); if (unlikely(!__pyx_k_tuple_30)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_30);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_30));
 
   /* "View.MemoryView":452
  *             result = struct.unpack(self.view.format, bytesitem)
@@ -16414,12 +16557,9 @@ static int __Pyx_InitCachedConstants(void) {
  *         else:
  *             if len(self.view.format) == 1:
  */
-  __pyx_k_tuple_28 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_28)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_28);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_27));
-  PyTuple_SET_ITEM(__pyx_k_tuple_28, 0, ((PyObject *)__pyx_kp_s_27));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_27));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_28));
+  __pyx_k_tuple_32 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_31)); if (unlikely(!__pyx_k_tuple_32)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_32);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_32));
 
   /* "View.MemoryView":528
  *             if self.view.strides == NULL:
@@ -16428,12 +16568,9 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *             return tuple([self.view.strides[i] for i in xrange(self.view.ndim)])
  */
-  __pyx_k_tuple_30 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_30)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_30);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_29));
-  PyTuple_SET_ITEM(__pyx_k_tuple_30, 0, ((PyObject *)__pyx_kp_s_29));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_29));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_30));
+  __pyx_k_tuple_34 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_33)); if (unlikely(!__pyx_k_tuple_34)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_34);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_34));
 
   /* "View.MemoryView":643
  *         if item is Ellipsis:
@@ -16442,12 +16579,9 @@ static int __Pyx_InitCachedConstants(void) {
  *                 seen_ellipsis = True
  *             else:
  */
-  __pyx_k_tuple_33 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_33)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_33);
-  __Pyx_INCREF(Py_None);
-  PyTuple_SET_ITEM(__pyx_k_tuple_33, 0, Py_None);
-  __Pyx_GIVEREF(Py_None);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_33));
+  __pyx_k_tuple_37 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_k_tuple_37)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_37);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_37));
 
   /* "View.MemoryView":646
  *                 seen_ellipsis = True
@@ -16456,12 +16590,9 @@ static int __Pyx_InitCachedConstants(void) {
  *             have_slices = True
  *         else:
  */
-  __pyx_k_tuple_34 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_34)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_34);
-  __Pyx_INCREF(Py_None);
-  PyTuple_SET_ITEM(__pyx_k_tuple_34, 0, Py_None);
-  __Pyx_GIVEREF(Py_None);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_34));
+  __pyx_k_tuple_38 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_k_tuple_38)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_38);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_38));
 
   /* "View.MemoryView":657
  *     nslices = ndim - len(result)
@@ -16470,12 +16601,9 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *     return have_slices or nslices, tuple(result)
  */
-  __pyx_k_tuple_36 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_36)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_36);
-  __Pyx_INCREF(Py_None);
-  PyTuple_SET_ITEM(__pyx_k_tuple_36, 0, Py_None);
-  __Pyx_GIVEREF(Py_None);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_36));
+  __pyx_k_tuple_40 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_k_tuple_40)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_40);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_40));
 
   /* "View.MemoryView":665
  *     for i in range(ndim):
@@ -16484,12 +16612,20 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  * 
  */
-  __pyx_k_tuple_38 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_38)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_38);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_37));
-  PyTuple_SET_ITEM(__pyx_k_tuple_38, 0, ((PyObject *)__pyx_kp_s_37));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_37));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_38));
+  __pyx_k_tuple_42 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_41)); if (unlikely(!__pyx_k_tuple_42)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_42);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_42));
+
+  /* "bilinear.pyx":39
+ * 
+ * import logging
+ * logger = logging.getLogger("pyFAI.bilinear")             # <<<<<<<<<<<<<<
+ * 
+ * cdef class Bilinear:
+ */
+  __pyx_k_tuple_55 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_54)); if (unlikely(!__pyx_k_tuple_55)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_55);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_55));
 
   /* "View.MemoryView":282
  *         return self.name
@@ -16498,12 +16634,9 @@ static int __Pyx_InitCachedConstants(void) {
  * cdef strided = Enum("<strided and direct>") # default
  * cdef indirect = Enum("<strided and indirect>")
  */
-  __pyx_k_tuple_52 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_52)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_52);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_51));
-  PyTuple_SET_ITEM(__pyx_k_tuple_52, 0, ((PyObject *)__pyx_kp_s_51));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_51));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_52));
+  __pyx_k_tuple_58 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_57)); if (unlikely(!__pyx_k_tuple_58)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_58);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_58));
 
   /* "View.MemoryView":283
  * 
@@ -16512,12 +16645,9 @@ static int __Pyx_InitCachedConstants(void) {
  * cdef indirect = Enum("<strided and indirect>")
  * 
  */
-  __pyx_k_tuple_54 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_54)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_54);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_53));
-  PyTuple_SET_ITEM(__pyx_k_tuple_54, 0, ((PyObject *)__pyx_kp_s_53));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_53));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_54));
+  __pyx_k_tuple_60 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_59)); if (unlikely(!__pyx_k_tuple_60)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_60);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_60));
 
   /* "View.MemoryView":284
  * cdef generic = Enum("<strided and direct or indirect>")
@@ -16526,12 +16656,9 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  * 
  */
-  __pyx_k_tuple_56 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_56)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_56);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_55));
-  PyTuple_SET_ITEM(__pyx_k_tuple_56, 0, ((PyObject *)__pyx_kp_s_55));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_55));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_56));
+  __pyx_k_tuple_62 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_61)); if (unlikely(!__pyx_k_tuple_62)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_62);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_62));
 
   /* "View.MemoryView":287
  * 
@@ -16540,12 +16667,9 @@ static int __Pyx_InitCachedConstants(void) {
  * cdef indirect_contiguous = Enum("<contiguous and indirect>")
  * 
  */
-  __pyx_k_tuple_58 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_58)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_58);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_57));
-  PyTuple_SET_ITEM(__pyx_k_tuple_58, 0, ((PyObject *)__pyx_kp_s_57));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_57));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_58));
+  __pyx_k_tuple_64 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_63)); if (unlikely(!__pyx_k_tuple_64)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_64);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_64));
 
   /* "View.MemoryView":288
  * 
@@ -16554,12 +16678,9 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  * 
  */
-  __pyx_k_tuple_60 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_60)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_60);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_59));
-  PyTuple_SET_ITEM(__pyx_k_tuple_60, 0, ((PyObject *)__pyx_kp_s_59));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_59));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_60));
+  __pyx_k_tuple_66 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_65)); if (unlikely(!__pyx_k_tuple_66)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_66);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_66));
   __Pyx_RefNannyFinishContext();
   return 0;
   __pyx_L1_error:;
@@ -16588,6 +16709,10 @@ PyMODINIT_FUNC PyInit_bilinear(void)
 #endif
 {
   PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannyDeclarations
   #if CYTHON_REFNANNY
   __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
@@ -16625,6 +16750,16 @@ PyMODINIT_FUNC PyInit_bilinear(void)
   __pyx_m = PyModule_Create(&__pyx_moduledef);
   #endif
   if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  Py_INCREF(__pyx_d);
+  #if PY_MAJOR_VERSION >= 3
+  {
+    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (!PyDict_GetItemString(modules, "bilinear")) {
+      if (unlikely(PyDict_SetItemString(modules, "bilinear", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    }
+  }
+  #endif
   __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   #if CYTHON_COMPILING_IN_PYPY
   Py_INCREF(__pyx_b);
@@ -16632,6 +16767,9 @@ PyMODINIT_FUNC PyInit_bilinear(void)
   if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
   /*--- Initialize various global constants etc. ---*/
   if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
+  if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  #endif
   if (__pyx_module_is_main_bilinear) {
     if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
   }
@@ -16648,15 +16786,6 @@ PyMODINIT_FUNC PyInit_bilinear(void)
   /*--- Variable export code ---*/
   /*--- Function export code ---*/
   /*--- Type init code ---*/
-  if (PyType_Ready(&__pyx_type_8bilinear_Bilinear) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "Bilinear", (PyObject *)&__pyx_type_8bilinear_Bilinear) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_8bilinear_Bilinear = &__pyx_type_8bilinear_Bilinear;
-  if (PyType_Ready(&__pyx_type___pyx_array) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "array", (PyObject *)&__pyx_type___pyx_array) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_array_type = &__pyx_type___pyx_array;
-  if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "Enum", (PyObject *)&__pyx_type___pyx_MemviewEnum) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
   __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview;
   __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer;
   __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice;
@@ -16667,8 +16796,14 @@ PyMODINIT_FUNC PyInit_bilinear(void)
   __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object;
   if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "memoryview", (PyObject *)&__pyx_type___pyx_memoryview) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_memoryview_type = &__pyx_type___pyx_memoryview;
+  if (PyType_Ready(&__pyx_type___pyx_array) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_array_type = &__pyx_type___pyx_array;
+  if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
+  if (PyType_Ready(&__pyx_type_8bilinear_Bilinear) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_SetAttrString(__pyx_m, "Bilinear", (PyObject *)&__pyx_type_8bilinear_Bilinear) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_8bilinear_Bilinear = &__pyx_type_8bilinear_Bilinear;
   __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice;
   __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview;
   __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object;
@@ -16676,7 +16811,6 @@ PyMODINIT_FUNC PyInit_bilinear(void)
   __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type;
   if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "_memoryviewslice", (PyObject *)&__pyx_type___pyx_memoryviewslice) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice;
   /*--- Type import code ---*/
   __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", 
@@ -16702,7 +16836,7 @@ PyMODINIT_FUNC PyInit_bilinear(void)
  * __license__ = "GPLv3"
  * __date__ = "31/01/2013"
  */
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____author__, ((PyObject *)__pyx_kp_s_46)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s____author__, ((PyObject *)__pyx_kp_s_50)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   /* "bilinear.pyx":27
  * 
@@ -16711,7 +16845,7 @@ PyMODINIT_FUNC PyInit_bilinear(void)
  * __date__ = "31/01/2013"
  * __copyright__ = "2011-2013, ESRF"
  */
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____license__, ((PyObject *)__pyx_n_s__GPLv3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s____license__, ((PyObject *)__pyx_n_s__GPLv3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   /* "bilinear.pyx":28
  * __author__ = "Jerome Kieffer"
@@ -16720,7 +16854,7 @@ PyMODINIT_FUNC PyInit_bilinear(void)
  * __copyright__ = "2011-2013, ESRF"
  * __contact__ = "jerome.kieffer at esrf.fr"
  */
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____date__, ((PyObject *)__pyx_kp_s_47)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s____date__, ((PyObject *)__pyx_kp_s_51)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   /* "bilinear.pyx":29
  * __license__ = "GPLv3"
@@ -16729,7 +16863,7 @@ PyMODINIT_FUNC PyInit_bilinear(void)
  * __contact__ = "jerome.kieffer at esrf.fr"
  * 
  */
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____copyright__, ((PyObject *)__pyx_kp_s_48)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s____copyright__, ((PyObject *)__pyx_kp_s_52)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   /* "bilinear.pyx":30
  * __date__ = "31/01/2013"
@@ -16738,7 +16872,7 @@ PyMODINIT_FUNC PyInit_bilinear(void)
  * 
  * import cython
  */
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____contact__, ((PyObject *)__pyx_kp_s_49)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s____contact__, ((PyObject *)__pyx_kp_s_53)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   /* "bilinear.pyx":33
  * 
@@ -16749,7 +16883,37 @@ PyMODINIT_FUNC PyInit_bilinear(void)
  */
   __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__numpy, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s__numpy, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+  /* "bilinear.pyx":38
+ * from libc.math cimport floor,ceil
+ * 
+ * import logging             # <<<<<<<<<<<<<<
+ * logger = logging.getLogger("pyFAI.bilinear")
+ * 
+ */
+  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__logging), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s__logging, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+  /* "bilinear.pyx":39
+ * 
+ * import logging
+ * logger = logging.getLogger("pyFAI.bilinear")             # <<<<<<<<<<<<<<
+ * 
+ * cdef class Bilinear:
+ */
+  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__logging); 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_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__getLogger); 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_1); __pyx_t_1 = 0;
+  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_55), NULL); 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_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s__logger, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
   /* "bilinear.pyx":1
@@ -16759,7 +16923,7 @@ PyMODINIT_FUNC PyInit_bilinear(void)
  */
   __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
   /* "View.MemoryView":207
@@ -16769,7 +16933,7 @@ PyMODINIT_FUNC PyInit_bilinear(void)
  * 
  *     def __dealloc__(array self):
  */
-  __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), __pyx_k_50); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), __pyx_k_56); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   if (PyDict_SetItem(__pyx_array_type->tp_dict, __pyx_n_s____pyx_getbuffer, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -16782,12 +16946,11 @@ PyMODINIT_FUNC PyInit_bilinear(void)
  * cdef strided = Enum("<strided and direct>") # default
  * cdef indirect = Enum("<strided and indirect>")
  */
-  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_52), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_58), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_XGOTREF(generic);
-  __Pyx_DECREF(generic);
+  __Pyx_DECREF_SET(generic, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
-  generic = __pyx_t_1;
   __pyx_t_1 = 0;
 
   /* "View.MemoryView":283
@@ -16797,12 +16960,11 @@ PyMODINIT_FUNC PyInit_bilinear(void)
  * cdef indirect = Enum("<strided and indirect>")
  * 
  */
-  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_54), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_60), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_XGOTREF(strided);
-  __Pyx_DECREF(strided);
+  __Pyx_DECREF_SET(strided, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
-  strided = __pyx_t_1;
   __pyx_t_1 = 0;
 
   /* "View.MemoryView":284
@@ -16812,12 +16974,11 @@ PyMODINIT_FUNC PyInit_bilinear(void)
  * 
  * 
  */
-  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_56), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_62), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_XGOTREF(indirect);
-  __Pyx_DECREF(indirect);
+  __Pyx_DECREF_SET(indirect, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
-  indirect = __pyx_t_1;
   __pyx_t_1 = 0;
 
   /* "View.MemoryView":287
@@ -16827,12 +16988,11 @@ PyMODINIT_FUNC PyInit_bilinear(void)
  * cdef indirect_contiguous = Enum("<contiguous and indirect>")
  * 
  */
-  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_58), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_64), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_XGOTREF(contiguous);
-  __Pyx_DECREF(contiguous);
+  __Pyx_DECREF_SET(contiguous, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
-  contiguous = __pyx_t_1;
   __pyx_t_1 = 0;
 
   /* "View.MemoryView":288
@@ -16842,12 +17002,11 @@ PyMODINIT_FUNC PyInit_bilinear(void)
  * 
  * 
  */
-  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_60), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_66), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_XGOTREF(indirect_contiguous);
-  __Pyx_DECREF(indirect_contiguous);
+  __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
-  indirect_contiguous = __pyx_t_1;
   __pyx_t_1 = 0;
 
   /* "View.MemoryView":503
@@ -16857,7 +17016,7 @@ PyMODINIT_FUNC PyInit_bilinear(void)
  * 
  * 
  */
-  __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), __pyx_k_50); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), __pyx_k_56); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   if (PyDict_SetItem(__pyx_memoryview_type->tp_dict, __pyx_n_s____pyx_getbuffer, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -16870,7 +17029,7 @@ PyMODINIT_FUNC PyInit_bilinear(void)
  * 
  * 
  */
-  __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), __pyx_k_50); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), __pyx_k_56); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   if (PyDict_SetItem(__pyx_memoryviewslice_type->tp_dict, __pyx_n_s____pyx_getbuffer, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -16886,6 +17045,7 @@ PyMODINIT_FUNC PyInit_bilinear(void)
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_XDECREF(__pyx_t_2);
   if (__pyx_m) {
     __Pyx_AddTraceback("init bilinear", __pyx_clineno, __pyx_lineno, __pyx_filename);
     Py_DECREF(__pyx_m); __pyx_m = 0;
@@ -16918,17 +17078,15 @@ end:
 }
 #endif /* CYTHON_REFNANNY */
 
-static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
-    PyObject *result;
-    result = PyObject_GetAttr(dict, name);
-    if (!result) {
-        if (dict != __pyx_b) {
-            PyErr_Clear();
-            result = PyObject_GetAttr(__pyx_b, name);
-        }
-        if (!result) {
-            PyErr_SetObject(PyExc_NameError, name);
-        }
+static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
+    PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
+    if (unlikely(!result)) {
+        PyErr_Format(PyExc_NameError,
+#if PY_MAJOR_VERSION >= 3
+            "name '%U' is not defined", name);
+#else
+            "name '%s' is not defined", PyString_AS_STRING(name));
+#endif
     }
     return result;
 }
@@ -17047,29 +17205,124 @@ bad:
     return -1;
 }
 
-static void __Pyx_RaiseArgtupleInvalid(
-    const char* func_name,
-    int exact,
-    Py_ssize_t num_min,
-    Py_ssize_t num_max,
-    Py_ssize_t num_found)
-{
-    Py_ssize_t num_expected;
-    const char *more_or_less;
-    if (num_found < num_min) {
-        num_expected = num_min;
-        more_or_less = "at least";
+static void __Pyx_RaiseArgtupleInvalid(
+    const char* func_name,
+    int exact,
+    Py_ssize_t num_min,
+    Py_ssize_t num_max,
+    Py_ssize_t num_found)
+{
+    Py_ssize_t num_expected;
+    const char *more_or_less;
+    if (num_found < num_min) {
+        num_expected = num_min;
+        more_or_less = "at least";
+    } else {
+        num_expected = num_max;
+        more_or_less = "at most";
+    }
+    if (exact) {
+        more_or_less = "exactly";
+    }
+    PyErr_Format(PyExc_TypeError,
+                 "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)",
+                 func_name, more_or_less, num_expected,
+                 (num_expected == 1) ? "" : "s", num_found);
+}
+
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
+    PyObject *r;
+    if (!j) return NULL;
+    r = PyObject_GetItem(o, j);
+    Py_DECREF(j);
+    return r;
+}
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
+                                                              int wraparound, int boundscheck) {
+#if CYTHON_COMPILING_IN_CPYTHON
+    if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o);
+    if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
+        PyObject *r = PyList_GET_ITEM(o, i);
+        Py_INCREF(r);
+        return r;
+    }
+    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+#else
+    return PySequence_GetItem(o, i);
+#endif
+}
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
+                                                              int wraparound, int boundscheck) {
+#if CYTHON_COMPILING_IN_CPYTHON
+    if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o);
+    if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
+        PyObject *r = PyTuple_GET_ITEM(o, i);
+        Py_INCREF(r);
+        return r;
+    }
+    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+#else
+    return PySequence_GetItem(o, i);
+#endif
+}
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
+                                                     int is_list, int wraparound, int boundscheck) {
+#if CYTHON_COMPILING_IN_CPYTHON
+    if (is_list || PyList_CheckExact(o)) {
+        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
+        if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) {
+            PyObject *r = PyList_GET_ITEM(o, n);
+            Py_INCREF(r);
+            return r;
+        }
+    }
+    else if (PyTuple_CheckExact(o)) {
+        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
+        if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
+            PyObject *r = PyTuple_GET_ITEM(o, n);
+            Py_INCREF(r);
+            return r;
+        }
+    } else {
+        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
+        if (likely(m && m->sq_item)) {
+            if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
+                Py_ssize_t l = m->sq_length(o);
+                if (likely(l >= 0)) {
+                    i += l;
+                } else {
+                    if (PyErr_ExceptionMatches(PyExc_OverflowError))
+                        PyErr_Clear();
+                    else
+                        return NULL;
+                }
+            }
+            return m->sq_item(o, i);
+        }
+    }
+#else
+    if (is_list || PySequence_Check(o)) {
+        return PySequence_GetItem(o, i);
+    }
+#endif
+    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+}
+
+static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
+    PyObject *result;
+#if CYTHON_COMPILING_IN_CPYTHON
+    result = PyDict_GetItem(__pyx_d, name);
+    if (result) {
+        Py_INCREF(result);
     } else {
-        num_expected = num_max;
-        more_or_less = "at most";
-    }
-    if (exact) {
-        more_or_less = "exactly";
+#else
+    result = PyObject_GetItem(__pyx_d, name);
+    if (!result) {
+        PyErr_Clear();
+#endif
+        result = __Pyx_GetBuiltinName(name);
     }
-    PyErr_Format(PyExc_TypeError,
-                 "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)",
-                 func_name, more_or_less, num_expected,
-                 (num_expected == 1) ? "" : "s", num_found);
+    return result;
 }
 
 static CYTHON_INLINE int __Pyx_IsLittleEndian(void) {
@@ -17514,293 +17767,107 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha
           ctx->enc_type = 0; /* Erase processed last struct element */
           if (alignment && ctx->fmt_offset % alignment) {
             ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
-          }
-        }
-        return ts;
-      case 'x':
-        if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
-        ctx->fmt_offset += ctx->new_count;
-        ctx->new_count = 1;
-        ctx->enc_count = 0;
-        ctx->enc_type = 0;
-        ctx->enc_packmode = ctx->new_packmode;
-        ++ts;
-        break;
-      case 'Z':
-        got_Z = 1;
-        ++ts;
-        if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
-          __Pyx_BufFmt_RaiseUnexpectedChar('Z');
-          return NULL;
-        }        /* fall through */
-      case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
-      case 'l': case 'L': case 'q': case 'Q':
-      case 'f': case 'd': case 'g':
-      case 'O': case 's': case 'p':
-        if (ctx->enc_type == *ts && got_Z == ctx->is_complex &&
-            ctx->enc_packmode == ctx->new_packmode) {
-          ctx->enc_count += ctx->new_count;
-        } else {
-          if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
-          ctx->enc_count = ctx->new_count;
-          ctx->enc_packmode = ctx->new_packmode;
-          ctx->enc_type = *ts;
-          ctx->is_complex = got_Z;
-        }
-        ++ts;
-        ctx->new_count = 1;
-        got_Z = 0;
-        break;
-      case ':':
-        ++ts;
-        while(*ts != ':') ++ts;
-        ++ts;
-        break;
-      case '(':
-        if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
-        break;
-      default:
-        {
-          int number = __Pyx_BufFmt_ExpectNumber(&ts);
-          if (number == -1) return NULL;
-          ctx->new_count = (size_t)number;
-        }
-    }
-  }
-}
-static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) {
-  buf->buf = NULL;
-  buf->obj = NULL;
-  buf->strides = __Pyx_zeros;
-  buf->shape = __Pyx_zeros;
-  buf->suboffsets = __Pyx_minusones;
-}
-static CYTHON_INLINE int __Pyx_GetBufferAndValidate(
-        Py_buffer* buf, PyObject* obj,  __Pyx_TypeInfo* dtype, int flags,
-        int nd, int cast, __Pyx_BufFmt_StackElem* stack)
-{
-  if (obj == Py_None || obj == NULL) {
-    __Pyx_ZeroBuffer(buf);
-    return 0;
-  }
-  buf->buf = NULL;
-  if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail;
-  if (buf->ndim != nd) {
-    PyErr_Format(PyExc_ValueError,
-                 "Buffer has wrong number of dimensions (expected %d, got %d)",
-                 nd, buf->ndim);
-    goto fail;
-  }
-  if (!cast) {
-    __Pyx_BufFmt_Context ctx;
-    __Pyx_BufFmt_Init(&ctx, stack, dtype);
-    if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
-  }
-  if ((unsigned)buf->itemsize != dtype->size) {
-    PyErr_Format(PyExc_ValueError,
-      "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)",
-      buf->itemsize, (buf->itemsize > 1) ? "s" : "",
-      dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : "");
-    goto fail;
-  }
-  if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
-  return 0;
-fail:;
-  __Pyx_ZeroBuffer(buf);
-  return -1;
-}
-static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
-  if (info->buf == NULL) return;
-  if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
-  __Pyx_ReleaseBuffer(info);
-}
-
-static int
-__pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b)
-{
-    int i;
-    if (!a || !b)
-        return 0;
-    if (a == b)
-        return 1;
-    if (a->size != b->size || a->typegroup != b->typegroup ||
-            a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) {
-        if (a->typegroup == 'H' || b->typegroup == 'H') {
-            return a->size == b->size;
-        } else {
-            return 0;
-        }
-    }
-    if (a->ndim) {
-        for (i = 0; i < a->ndim; i++)
-            if (a->arraysize[i] != b->arraysize[i])
-                return 0;
-    }
-    if (a->typegroup == 'S') {
-        if (a->flags != b->flags)
-            return 0;
-        if (a->fields || b->fields) {
-            if (!(a->fields && b->fields))
-                return 0;
-            for (i = 0; a->fields[i].type && b->fields[i].type; i++) {
-                __Pyx_StructField *field_a = a->fields + i;
-                __Pyx_StructField *field_b = b->fields + i;
-                if (field_a->offset != field_b->offset ||
-                    !__pyx_typeinfo_cmp(field_a->type, field_b->type))
-                    return 0;
-            }
-            return !a->fields[i].type && !b->fields[i].type;
-        }
-    }
-    return 1;
-}
-
-static int __Pyx_ValidateAndInit_memviewslice(
-                int *axes_specs,
-                int c_or_f_flag,
-                int buf_flags,
-                int ndim,
-                __Pyx_TypeInfo *dtype,
-                __Pyx_BufFmt_StackElem stack[],
-                __Pyx_memviewslice *memviewslice,
-                PyObject *original_obj)
-{
-    struct __pyx_memoryview_obj *memview, *new_memview;
-    __Pyx_RefNannyDeclarations
-    Py_buffer *buf;
-    int i, spec = 0, retval = -1;
-    __Pyx_BufFmt_Context ctx;
-    int from_memoryview = __pyx_memoryview_check(original_obj);
-    __Pyx_RefNannySetupContext("ValidateAndInit_memviewslice", 0);
-    if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((struct __pyx_memoryview_obj *)
-                                                            original_obj)->typeinfo)) {
-        memview = (struct __pyx_memoryview_obj *) original_obj;
-        new_memview = NULL;
-    } else {
-        memview = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
-                                            original_obj, buf_flags, 0, dtype);
-        new_memview = memview;
-        if (unlikely(!memview))
-            goto fail;
-    }
-    buf = &memview->view;
-    if (buf->ndim != ndim) {
-        PyErr_Format(PyExc_ValueError,
-                "Buffer has wrong number of dimensions (expected %d, got %d)",
-                ndim, buf->ndim);
-        goto fail;
-    }
-    if (new_memview) {
-        __Pyx_BufFmt_Init(&ctx, stack, dtype);
-        if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
-    }
-    if ((unsigned)buf->itemsize != dtype->size) {
-        PyErr_Format(PyExc_ValueError,
-                     "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "u byte%s) "
-                     "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "u byte%s)",
-                     buf->itemsize,
-                     (buf->itemsize > 1) ? "s" : "",
-                     dtype->name,
-                     dtype->size,
-                     (dtype->size > 1) ? "s" : "");
-        goto fail;
-    }
-    for (i = 0; i < ndim; i++) {
-        spec = axes_specs[i];
-        if (buf->strides) {
-            if (spec & __Pyx_MEMVIEW_CONTIG) {
-                if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) {
-                    if (buf->strides[i] != sizeof(void *)) {
-                        PyErr_Format(PyExc_ValueError,
-                            "Buffer is not indirectly contiguous in dimension %d.", i);
-                        goto fail;
-                    }
-                } else if (buf->strides[i] != buf->itemsize) {
-                    PyErr_SetString(PyExc_ValueError,
-                        "Buffer and memoryview are not contiguous in the same dimension.");
-                    goto fail;
-                }
-            }
-            if (spec & __Pyx_MEMVIEW_FOLLOW) {
-                Py_ssize_t stride = buf->strides[i];
-                if (stride < 0)
-                    stride = -stride;
-                if (stride < buf->itemsize) {
-                    PyErr_SetString(PyExc_ValueError,
-                        "Buffer and memoryview are not contiguous in the same dimension.");
-                    goto fail;
-                }
-            }
-        } else {
-            if (spec & __Pyx_MEMVIEW_CONTIG && i != ndim - 1) {
-                PyErr_Format(PyExc_ValueError,
-                             "C-contiguous buffer is not contiguous in "
-                             "dimension %d", i);
-                goto fail;
-            } else if (spec & (__Pyx_MEMVIEW_PTR)) {
-                PyErr_Format(PyExc_ValueError,
-                             "C-contiguous buffer is not indirect in "
-                             "dimension %d", i);
-                goto fail;
-            } else if (buf->suboffsets) {
-                PyErr_SetString(PyExc_ValueError,
-                                "Buffer exposes suboffsets but no strides");
-                goto fail;
-            }
-        }
-        /* Todo: without PyBUF_INDIRECT we may not have suboffset information, i.e., the
-           ptr may not be set to NULL but may be uninitialized? */
-        if (spec & __Pyx_MEMVIEW_DIRECT) {
-            if (buf->suboffsets && buf->suboffsets[i] >= 0) {
-                PyErr_Format(PyExc_ValueError,
-                    "Buffer not compatible with direct access in dimension %d.", i);
-                goto fail;
-            }
+          }
         }
-        if (spec & __Pyx_MEMVIEW_PTR) {
-            if (!buf->suboffsets || (buf->suboffsets && buf->suboffsets[i] < 0)) {
-                PyErr_Format(PyExc_ValueError,
-                    "Buffer is not indirectly accessisble in dimension %d.", i);
-                goto fail;
-            }
+        return ts;
+      case 'x':
+        if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
+        ctx->fmt_offset += ctx->new_count;
+        ctx->new_count = 1;
+        ctx->enc_count = 0;
+        ctx->enc_type = 0;
+        ctx->enc_packmode = ctx->new_packmode;
+        ++ts;
+        break;
+      case 'Z':
+        got_Z = 1;
+        ++ts;
+        if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
+          __Pyx_BufFmt_RaiseUnexpectedChar('Z');
+          return NULL;
+        }        /* fall through */
+      case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
+      case 'l': case 'L': case 'q': case 'Q':
+      case 'f': case 'd': case 'g':
+      case 'O': case 's': case 'p':
+        if (ctx->enc_type == *ts && got_Z == ctx->is_complex &&
+            ctx->enc_packmode == ctx->new_packmode) {
+          ctx->enc_count += ctx->new_count;
+        } else {
+          if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
+          ctx->enc_count = ctx->new_count;
+          ctx->enc_packmode = ctx->new_packmode;
+          ctx->enc_type = *ts;
+          ctx->is_complex = got_Z;
         }
-    }
-    if (buf->strides) {
-        if (c_or_f_flag & __Pyx_IS_F_CONTIG) {
-            Py_ssize_t stride = 1;
-            for (i=0; i<ndim; i++) {
-                if (stride * buf->itemsize != buf->strides[i]) {
-                    PyErr_SetString(PyExc_ValueError,
-                        "Buffer not fortran contiguous.");
-                    goto fail;
-                }
-                stride = stride * buf->shape[i];
-            }
-        } else if (c_or_f_flag & __Pyx_IS_C_CONTIG) {
-            Py_ssize_t stride = 1;
-            for (i = ndim-1; i>-1; i--) {
-                if(stride * buf->itemsize != buf->strides[i]) {
-                    PyErr_SetString(PyExc_ValueError,
-                        "Buffer not C contiguous.");
-                    goto fail;
-                }
-                stride = stride * buf->shape[i];
-            }
+        ++ts;
+        ctx->new_count = 1;
+        got_Z = 0;
+        break;
+      case ':':
+        ++ts;
+        while(*ts != ':') ++ts;
+        ++ts;
+        break;
+      case '(':
+        if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
+        break;
+      default:
+        {
+          int number = __Pyx_BufFmt_ExpectNumber(&ts);
+          if (number == -1) return NULL;
+          ctx->new_count = (size_t)number;
         }
     }
-    if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice,
-                                         new_memview != NULL) == -1)) {
-        goto fail;
-    }
-    retval = 0;
-    goto no_fail;
-fail:
-    Py_XDECREF(new_memview);
-    retval = -1;
-no_fail:
-    __Pyx_RefNannyFinishContext();
-    return retval;
+  }
+}
+static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) {
+  buf->buf = NULL;
+  buf->obj = NULL;
+  buf->strides = __Pyx_zeros;
+  buf->shape = __Pyx_zeros;
+  buf->suboffsets = __Pyx_minusones;
+}
+static CYTHON_INLINE int __Pyx_GetBufferAndValidate(
+        Py_buffer* buf, PyObject* obj,  __Pyx_TypeInfo* dtype, int flags,
+        int nd, int cast, __Pyx_BufFmt_StackElem* stack)
+{
+  if (obj == Py_None || obj == NULL) {
+    __Pyx_ZeroBuffer(buf);
+    return 0;
+  }
+  buf->buf = NULL;
+  if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail;
+  if (buf->ndim != nd) {
+    PyErr_Format(PyExc_ValueError,
+                 "Buffer has wrong number of dimensions (expected %d, got %d)",
+                 nd, buf->ndim);
+    goto fail;
+  }
+  if (!cast) {
+    __Pyx_BufFmt_Context ctx;
+    __Pyx_BufFmt_Init(&ctx, stack, dtype);
+    if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
+  }
+  if ((unsigned)buf->itemsize != dtype->size) {
+    PyErr_Format(PyExc_ValueError,
+      "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)",
+      buf->itemsize, (buf->itemsize > 1) ? "s" : "",
+      dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : "");
+    goto fail;
+  }
+  if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
+  return 0;
+fail:;
+  __Pyx_ZeroBuffer(buf);
+  return -1;
 }
+static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
+  if (info->buf == NULL) return;
+  if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
+  __Pyx_ReleaseBuffer(info);
+}
+
 static int
 __Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview,
                         int ndim,
@@ -18005,24 +18072,23 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
         }
         value = type;
         #if PY_VERSION_HEX < 0x02050000
-            if (PyInstance_Check(type)) {
-                type = (PyObject*) ((PyInstanceObject*)type)->in_class;
-                Py_INCREF(type);
-            }
-            else {
-                type = 0;
-                PyErr_SetString(PyExc_TypeError,
-                    "raise: exception must be an old-style class or instance");
-                goto raise_error;
-            }
-        #else
-            type = (PyObject*) Py_TYPE(type);
+        if (PyInstance_Check(type)) {
+            type = (PyObject*) ((PyInstanceObject*)type)->in_class;
             Py_INCREF(type);
-            if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
-                PyErr_SetString(PyExc_TypeError,
-                    "raise: exception class must be a subclass of BaseException");
-                goto raise_error;
-            }
+        } else {
+            type = 0;
+            PyErr_SetString(PyExc_TypeError,
+                "raise: exception must be an old-style class or instance");
+            goto raise_error;
+        }
+        #else
+        type = (PyObject*) Py_TYPE(type);
+        Py_INCREF(type);
+        if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
+            PyErr_SetString(PyExc_TypeError,
+                "raise: exception class must be a subclass of BaseException");
+            goto raise_error;
+        }
         #endif
     }
     __Pyx_ErrRestore(type, value, tb);
@@ -18054,46 +18120,62 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject
         value = type;
         type = (PyObject*) Py_TYPE(value);
     } else if (PyExceptionClass_Check(type)) {
-        PyObject *args;
-        if (!value)
-            args = PyTuple_New(0);
-        else if (PyTuple_Check(value)) {
-            Py_INCREF(value);
-            args = value;
+        PyObject *instance_class = NULL;
+        if (value && PyExceptionInstance_Check(value)) {
+            instance_class = (PyObject*) Py_TYPE(value);
+            if (instance_class != type) {
+                if (PyObject_IsSubclass(instance_class, type)) {
+                    type = instance_class;
+                } else {
+                    instance_class = NULL;
+                }
+            }
         }
-        else
-            args = PyTuple_Pack(1, value);
-        if (!args)
-            goto bad;
-        owned_instance = PyEval_CallObject(type, args);
-        Py_DECREF(args);
-        if (!owned_instance)
-            goto bad;
-        value = owned_instance;
-        if (!PyExceptionInstance_Check(value)) {
-            PyErr_Format(PyExc_TypeError,
-                         "calling %R should have returned an instance of "
-                         "BaseException, not %R",
-                         type, Py_TYPE(value));
-            goto bad;
+        if (!instance_class) {
+            PyObject *args;
+            if (!value)
+                args = PyTuple_New(0);
+            else if (PyTuple_Check(value)) {
+                Py_INCREF(value);
+                args = value;
+            } else
+                args = PyTuple_Pack(1, value);
+            if (!args)
+                goto bad;
+            owned_instance = PyObject_Call(type, args, NULL);
+            Py_DECREF(args);
+            if (!owned_instance)
+                goto bad;
+            value = owned_instance;
+            if (!PyExceptionInstance_Check(value)) {
+                PyErr_Format(PyExc_TypeError,
+                             "calling %R should have returned an instance of "
+                             "BaseException, not %R",
+                             type, Py_TYPE(value));
+                goto bad;
+            }
         }
     } else {
         PyErr_SetString(PyExc_TypeError,
             "raise: exception class must be a subclass of BaseException");
         goto bad;
     }
+#if PY_VERSION_HEX >= 0x03030000
+    if (cause) {
+#else
     if (cause && cause != Py_None) {
+#endif
         PyObject *fixed_cause;
-        if (PyExceptionClass_Check(cause)) {
+        if (cause == Py_None) {
+            fixed_cause = NULL;
+        } else if (PyExceptionClass_Check(cause)) {
             fixed_cause = PyObject_CallObject(cause, NULL);
             if (fixed_cause == NULL)
                 goto bad;
-        }
-        else if (PyExceptionInstance_Check(cause)) {
+        } else if (PyExceptionInstance_Check(cause)) {
             fixed_cause = cause;
             Py_INCREF(fixed_cause);
-        }
-        else {
+        } else {
             PyErr_SetString(PyExc_TypeError,
                             "exception causes must derive from "
                             "BaseException");
@@ -18209,8 +18291,20 @@ static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed
     return 0;
 }
 
+static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
+#if CYTHON_COMPILING_IN_CPYTHON
+#if PY_MAJOR_VERSION >= 3
+    if (likely(PyUnicode_Check(n)))
+#else
+    if (likely(PyString_Check(n)))
+#endif
+        return __Pyx_PyObject_GetAttrStr(o, n);
+#endif
+    return PyObject_GetAttr(o, n);
+}
+
 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
-    PyObject *r = PyObject_GetAttr(o, n);
+    PyObject *r = __Pyx_GetAttr(o, n);
     if (!r) {
         if (!PyErr_ExceptionMatches(PyExc_AttributeError))
             goto bad;
@@ -18370,16 +18464,54 @@ static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
     return q;
 }
 
-static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) {
-    PyObject *py_import = 0;
+static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
+                                  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename) {
+    PyObject *old_exc, *old_val, *old_tb;
+    PyObject *ctx;
+    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
+    #if PY_MAJOR_VERSION < 3
+    ctx = PyString_FromString(name);
+    #else
+    ctx = PyUnicode_FromString(name);
+    #endif
+    __Pyx_ErrRestore(old_exc, old_val, old_tb);
+    if (!ctx) {
+        PyErr_WriteUnraisable(Py_None);
+    } else {
+        PyErr_WriteUnraisable(ctx);
+        Py_DECREF(ctx);
+    }
+}
+
+static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
+#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
+    PyObject *ob = PyCapsule_New(vtable, 0, 0);
+#else
+    PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
+#endif
+    if (!ob)
+        goto bad;
+    if (PyDict_SetItem(dict, __pyx_n_s____pyx_vtable__, ob) < 0)
+        goto bad;
+    Py_DECREF(ob);
+    return 0;
+bad:
+    Py_XDECREF(ob);
+    return -1;
+}
+
+static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
     PyObject *empty_list = 0;
     PyObject *module = 0;
     PyObject *global_dict = 0;
     PyObject *empty_dict = 0;
     PyObject *list;
-    py_import = __Pyx_GetAttrString(__pyx_b, "__import__");
+    #if PY_VERSION_HEX < 0x03030000
+    PyObject *py_import;
+    py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s____import__);
     if (!py_import)
         goto bad;
+    #endif
     if (from_list)
         list = from_list;
     else {
@@ -18399,13 +18531,17 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) {
         #if PY_MAJOR_VERSION >= 3
         if (level == -1) {
             if (strchr(__Pyx_MODULE_NAME, '.')) {
-                /* try package relative import first */
+                #if PY_VERSION_HEX < 0x03030000
                 PyObject *py_level = PyInt_FromLong(1);
                 if (!py_level)
                     goto bad;
                 module = PyObject_CallFunctionObjArgs(py_import,
                     name, global_dict, empty_dict, list, py_level, NULL);
                 Py_DECREF(py_level);
+                #else
+                module = PyImport_ImportModuleLevelObject(
+                    name, global_dict, empty_dict, list, 1);
+                #endif
                 if (!module) {
                     if (!PyErr_ExceptionMatches(PyExc_ImportError))
                         goto bad;
@@ -18416,12 +18552,17 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) {
         }
         #endif
         if (!module) {
+            #if PY_VERSION_HEX < 0x03030000
             PyObject *py_level = PyInt_FromLong(level);
             if (!py_level)
                 goto bad;
             module = PyObject_CallFunctionObjArgs(py_import,
                 name, global_dict, empty_dict, list, py_level, NULL);
             Py_DECREF(py_level);
+            #else
+            module = PyImport_ImportModuleLevelObject(
+                name, global_dict, empty_dict, list, level);
+            #endif
         }
     }
     #else
@@ -18433,8 +18574,10 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) {
         name, global_dict, empty_dict, list, NULL);
     #endif
 bad:
-    Py_XDECREF(empty_list);
+    #if PY_VERSION_HEX < 0x03030000
     Py_XDECREF(py_import);
+    #endif
+    Py_XDECREF(empty_list);
     Py_XDECREF(empty_dict);
     return module;
 }
@@ -18681,7 +18824,6 @@ bad:
 
 #if PY_MAJOR_VERSION < 3
 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
-    CYTHON_UNUSED PyObject *getbuffer_cobj;
   #if PY_VERSION_HEX >= 0x02060000
     if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
   #endif
@@ -18689,21 +18831,18 @@ static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
         if (PyObject_TypeCheck(obj, __pyx_array_type)) return __pyx_array_getbuffer(obj, view, flags);
         if (PyObject_TypeCheck(obj, __pyx_memoryview_type)) return __pyx_memoryview_getbuffer(obj, view, flags);
   #if PY_VERSION_HEX < 0x02060000
-    if (obj->ob_type->tp_dict &&
-        (getbuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict,
-                                             "__pyx_getbuffer"))) {
-        getbufferproc func;
-      #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0)
-        func = (getbufferproc) PyCapsule_GetPointer(getbuffer_cobj, "getbuffer(obj, view, flags)");
-      #else
-        func = (getbufferproc) PyCObject_AsVoidPtr(getbuffer_cobj);
-      #endif
-        Py_DECREF(getbuffer_cobj);
-        if (!func)
-            goto fail;
-        return func(obj, view, flags);
-    } else {
-        PyErr_Clear();
+    if (obj->ob_type->tp_dict) {
+        PyObject *getbuffer_cobj = PyObject_GetItem(
+            obj->ob_type->tp_dict, __pyx_n_s____pyx_getbuffer);
+        if (getbuffer_cobj) {
+            getbufferproc func = (getbufferproc) PyCObject_AsVoidPtr(getbuffer_cobj);
+            Py_DECREF(getbuffer_cobj);
+            if (!func)
+                goto fail;
+            return func(obj, view, flags);
+        } else {
+            PyErr_Clear();
+        }
     }
   #endif
     PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
@@ -18714,7 +18853,6 @@ fail:
 }
 static void __Pyx_ReleaseBuffer(Py_buffer *view) {
     PyObject *obj = view->obj;
-    CYTHON_UNUSED PyObject *releasebuffer_cobj;
     if (!obj) return;
   #if PY_VERSION_HEX >= 0x02060000
     if (PyObject_CheckBuffer(obj)) {
@@ -18724,22 +18862,19 @@ static void __Pyx_ReleaseBuffer(Py_buffer *view) {
   #endif
         if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) { __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view); return; }
   #if PY_VERSION_HEX < 0x02060000
-    if (obj->ob_type->tp_dict &&
-        (releasebuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict,
-                                                      "__pyx_releasebuffer"))) {
-        releasebufferproc func;
-      #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0)
-        func = (releasebufferproc) PyCapsule_GetPointer(releasebuffer_cobj, "releasebuffer(obj, view)");
-      #else
-        func = (releasebufferproc) PyCObject_AsVoidPtr(releasebuffer_cobj);
-      #endif
-        Py_DECREF(releasebuffer_cobj);
-        if (!func)
-            goto fail;
-        func(obj, view);
-        return;
-    } else {
-        PyErr_Clear();
+    if (obj->ob_type->tp_dict) {
+        PyObject *releasebuffer_cobj = PyObject_GetItem(
+            obj->ob_type->tp_dict, __pyx_n_s____pyx_releasebuffer);
+        if (releasebuffer_cobj) {
+            releasebufferproc func = (releasebufferproc) PyCObject_AsVoidPtr(releasebuffer_cobj);
+            Py_DECREF(releasebuffer_cobj);
+            if (!func)
+                goto fail;
+            func(obj, view);
+            return;
+        } else {
+            PyErr_Clear();
+        }
     }
   #endif
     goto nofail;
@@ -18754,7 +18889,7 @@ nofail:
 #endif /*  PY_MAJOR_VERSION < 3 */
 
 
-      static int
+          static int
 __pyx_memviewslice_is_contig(const __Pyx_memviewslice *mvs,
                              char order, int ndim)
 {
@@ -18840,7 +18975,7 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
     }
     __Pyx_GOTREF(shape_tuple);
     for(i = 0; i < ndim; i++) {
-        temp_int = PyInt_FromLong(from_mvs->shape[i]);
+        temp_int = PyInt_FromSsize_t(from_mvs->shape[i]);
         if(unlikely(!temp_int)) {
             goto fail;
         } else {
@@ -18878,7 +19013,7 @@ no_fail:
 }
 
 static CYTHON_INLINE PyObject *
-__pyx_capsule_create(void *p, const char *sig)
+__pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig)
 {
     PyObject *cobj;
 #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0)
@@ -19110,10 +19245,15 @@ static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) {
     return (int)__Pyx_PyInt_AsLong(x);
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
     const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -19126,6 +19266,16 @@ static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(unsigned long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (unsigned long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to unsigned long");
@@ -19133,6 +19283,17 @@ static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
             }
             return (unsigned long)PyLong_AsUnsignedLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(unsigned long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(unsigned long) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(unsigned long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (unsigned long)PyLong_AsLong(x);
         }
     } else {
@@ -19145,10 +19306,15 @@ static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
     }
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
     const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -19161,6 +19327,16 @@ static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObje
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to unsigned PY_LONG_LONG");
@@ -19168,6 +19344,17 @@ static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObje
             }
             return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x);
         }
     } else {
@@ -19180,10 +19367,15 @@ static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObje
     }
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
     const long neg_one = (long)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -19196,6 +19388,16 @@ static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to long");
@@ -19203,6 +19405,17 @@ static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
             }
             return (long)PyLong_AsUnsignedLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(long) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (long)PyLong_AsLong(x);
         }
     } else {
@@ -19215,10 +19428,15 @@ static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
     }
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
     const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -19231,6 +19449,16 @@ static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to PY_LONG_LONG");
@@ -19238,6 +19466,17 @@ static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
             }
             return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (PY_LONG_LONG)PyLong_AsLongLong(x);
         }
     } else {
@@ -19250,10 +19489,15 @@ static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
     }
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
     const signed long neg_one = (signed long)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -19266,6 +19510,16 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(signed long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (signed long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to signed long");
@@ -19273,6 +19527,17 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
             }
             return (signed long)PyLong_AsUnsignedLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(signed long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(signed long) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(signed long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (signed long)PyLong_AsLong(x);
         }
     } else {
@@ -19285,10 +19550,15 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
     }
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
     const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -19301,6 +19571,16 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject*
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to signed PY_LONG_LONG");
@@ -19308,6 +19588,17 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject*
             }
             return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (signed PY_LONG_LONG)PyLong_AsLongLong(x);
         }
     } else {
@@ -19320,6 +19611,227 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject*
     }
 }
 
+static int
+__pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b)
+{
+    int i;
+    if (!a || !b)
+        return 0;
+    if (a == b)
+        return 1;
+    if (a->size != b->size || a->typegroup != b->typegroup ||
+            a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) {
+        if (a->typegroup == 'H' || b->typegroup == 'H') {
+            return a->size == b->size;
+        } else {
+            return 0;
+        }
+    }
+    if (a->ndim) {
+        for (i = 0; i < a->ndim; i++)
+            if (a->arraysize[i] != b->arraysize[i])
+                return 0;
+    }
+    if (a->typegroup == 'S') {
+        if (a->flags != b->flags)
+            return 0;
+        if (a->fields || b->fields) {
+            if (!(a->fields && b->fields))
+                return 0;
+            for (i = 0; a->fields[i].type && b->fields[i].type; i++) {
+                __Pyx_StructField *field_a = a->fields + i;
+                __Pyx_StructField *field_b = b->fields + i;
+                if (field_a->offset != field_b->offset ||
+                    !__pyx_typeinfo_cmp(field_a->type, field_b->type))
+                    return 0;
+            }
+            return !a->fields[i].type && !b->fields[i].type;
+        }
+    }
+    return 1;
+}
+
+static int
+__pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec)
+{
+    if (buf->shape[dim] <= 1)
+        return 1;
+    if (buf->strides) {
+        if (spec & __Pyx_MEMVIEW_CONTIG) {
+            if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) {
+                if (buf->strides[dim] != sizeof(void *)) {
+                    PyErr_Format(PyExc_ValueError,
+                                 "Buffer is not indirectly contiguous "
+                                 "in dimension %d.", dim);
+                    goto fail;
+                }
+            } else if (buf->strides[dim] != buf->itemsize) {
+                PyErr_SetString(PyExc_ValueError,
+                                "Buffer and memoryview are not contiguous "
+                                "in the same dimension.");
+                goto fail;
+            }
+        }
+        if (spec & __Pyx_MEMVIEW_FOLLOW) {
+            Py_ssize_t stride = buf->strides[dim];
+            if (stride < 0)
+                stride = -stride;
+            if (stride < buf->itemsize) {
+                PyErr_SetString(PyExc_ValueError,
+                                "Buffer and memoryview are not contiguous "
+                                "in the same dimension.");
+                goto fail;
+            }
+        }
+    } else {
+        if (spec & __Pyx_MEMVIEW_CONTIG && dim != ndim - 1) {
+            PyErr_Format(PyExc_ValueError,
+                         "C-contiguous buffer is not contiguous in "
+                         "dimension %d", dim);
+            goto fail;
+        } else if (spec & (__Pyx_MEMVIEW_PTR)) {
+            PyErr_Format(PyExc_ValueError,
+                         "C-contiguous buffer is not indirect in "
+                         "dimension %d", dim);
+            goto fail;
+        } else if (buf->suboffsets) {
+            PyErr_SetString(PyExc_ValueError,
+                            "Buffer exposes suboffsets but no strides");
+            goto fail;
+        }
+    }
+    return 1;
+fail:
+    return 0;
+}
+static int
+__pyx_check_suboffsets(Py_buffer *buf, int dim, CYTHON_UNUSED int ndim, int spec)
+{
+    if (spec & __Pyx_MEMVIEW_DIRECT) {
+        if (buf->suboffsets && buf->suboffsets[dim] >= 0) {
+            PyErr_Format(PyExc_ValueError,
+                         "Buffer not compatible with direct access "
+                         "in dimension %d.", dim);
+            goto fail;
+        }
+    }
+    if (spec & __Pyx_MEMVIEW_PTR) {
+        if (!buf->suboffsets || (buf->suboffsets && buf->suboffsets[dim] < 0)) {
+            PyErr_Format(PyExc_ValueError,
+                         "Buffer is not indirectly accessisble "
+                         "in dimension %d.", dim);
+            goto fail;
+        }
+    }
+    return 1;
+fail:
+    return 0;
+}
+static int
+__pyx_verify_contig(Py_buffer *buf, int ndim, int c_or_f_flag)
+{
+    int i;
+    if (c_or_f_flag & __Pyx_IS_F_CONTIG) {
+        Py_ssize_t stride = 1;
+        for (i = 0; i < ndim; i++) {
+            if (stride * buf->itemsize != buf->strides[i] &&
+                    buf->shape[i] > 1)
+            {
+                PyErr_SetString(PyExc_ValueError,
+                    "Buffer not fortran contiguous.");
+                goto fail;
+            }
+            stride = stride * buf->shape[i];
+        }
+    } else if (c_or_f_flag & __Pyx_IS_C_CONTIG) {
+        Py_ssize_t stride = 1;
+        for (i = ndim - 1; i >- 1; i--) {
+            if (stride * buf->itemsize != buf->strides[i] &&
+                    buf->shape[i] > 1) {
+                PyErr_SetString(PyExc_ValueError,
+                    "Buffer not C contiguous.");
+                goto fail;
+            }
+            stride = stride * buf->shape[i];
+        }
+    }
+    return 1;
+fail:
+    return 0;
+}
+static int __Pyx_ValidateAndInit_memviewslice(
+                int *axes_specs,
+                int c_or_f_flag,
+                int buf_flags,
+                int ndim,
+                __Pyx_TypeInfo *dtype,
+                __Pyx_BufFmt_StackElem stack[],
+                __Pyx_memviewslice *memviewslice,
+                PyObject *original_obj)
+{
+    struct __pyx_memoryview_obj *memview, *new_memview;
+    __Pyx_RefNannyDeclarations
+    Py_buffer *buf;
+    int i, spec = 0, retval = -1;
+    __Pyx_BufFmt_Context ctx;
+    int from_memoryview = __pyx_memoryview_check(original_obj);
+    __Pyx_RefNannySetupContext("ValidateAndInit_memviewslice", 0);
+    if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((struct __pyx_memoryview_obj *)
+                                                            original_obj)->typeinfo)) {
+        memview = (struct __pyx_memoryview_obj *) original_obj;
+        new_memview = NULL;
+    } else {
+        memview = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
+                                            original_obj, buf_flags, 0, dtype);
+        new_memview = memview;
+        if (unlikely(!memview))
+            goto fail;
+    }
+    buf = &memview->view;
+    if (buf->ndim != ndim) {
+        PyErr_Format(PyExc_ValueError,
+                "Buffer has wrong number of dimensions (expected %d, got %d)",
+                ndim, buf->ndim);
+        goto fail;
+    }
+    if (new_memview) {
+        __Pyx_BufFmt_Init(&ctx, stack, dtype);
+        if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
+    }
+    if ((unsigned) buf->itemsize != dtype->size) {
+        PyErr_Format(PyExc_ValueError,
+                     "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "u byte%s) "
+                     "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "u byte%s)",
+                     buf->itemsize,
+                     (buf->itemsize > 1) ? "s" : "",
+                     dtype->name,
+                     dtype->size,
+                     (dtype->size > 1) ? "s" : "");
+        goto fail;
+    }
+    for (i = 0; i < ndim; i++) {
+        spec = axes_specs[i];
+        if (!__pyx_check_strides(buf, i, ndim, spec))
+            goto fail;
+        if (!__pyx_check_suboffsets(buf, i, ndim, spec))
+            goto fail;
+    }
+    if (buf->strides && !__pyx_verify_contig(buf, ndim, c_or_f_flag))
+        goto fail;
+    if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice,
+                                         new_memview != NULL) == -1)) {
+        goto fail;
+    }
+    retval = 0;
+    goto no_fail;
+fail:
+    Py_XDECREF(new_memview);
+    retval = -1;
+no_fail:
+    __Pyx_RefNannyFinishContext();
+    return retval;
+}
+
 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_float(PyObject *obj) {
     __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
     __Pyx_BufFmt_StackElem stack[1];
@@ -19342,25 +19854,6 @@ __pyx_fail:
     return result;
 }
 
-static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
-                                  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename) {
-    PyObject *old_exc, *old_val, *old_tb;
-    PyObject *ctx;
-    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
-    #if PY_MAJOR_VERSION < 3
-    ctx = PyString_FromString(name);
-    #else
-    ctx = PyUnicode_FromString(name);
-    #endif
-    __Pyx_ErrRestore(old_exc, old_val, old_tb);
-    if (!ctx) {
-        PyErr_WriteUnraisable(Py_None);
-    } else {
-        PyErr_WriteUnraisable(ctx);
-        Py_DECREF(ctx);
-    }
-}
-
 static int __Pyx_check_binary_version(void) {
     char ctversion[4], rtversion[4];
     PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
@@ -19380,23 +19873,6 @@ static int __Pyx_check_binary_version(void) {
     return 0;
 }
 
-static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
-#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
-    PyObject *ob = PyCapsule_New(vtable, 0, 0);
-#else
-    PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
-#endif
-    if (!ob)
-        goto bad;
-    if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0)
-        goto bad;
-    Py_DECREF(ob);
-    return 0;
-bad:
-    Py_XDECREF(ob);
-    return -1;
-}
-
 #ifndef __PYX_HAVE_RT_ImportModule
 #define __PYX_HAVE_RT_ImportModule
 static PyObject *__Pyx_ImportModule(const char *name) {
@@ -19423,6 +19899,10 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class
     PyObject *result = 0;
     PyObject *py_name = 0;
     char warning[200];
+    Py_ssize_t basicsize;
+#ifdef Py_LIMITED_API
+    PyObject *py_basicsize;
+#endif
     py_module = __Pyx_ImportModule(module_name);
     if (!py_module)
         goto bad;
@@ -19442,7 +19922,19 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class
             module_name, class_name);
         goto bad;
     }
-    if (!strict && (size_t)((PyTypeObject *)result)->tp_basicsize > size) {
+#ifndef Py_LIMITED_API
+    basicsize = ((PyTypeObject *)result)->tp_basicsize;
+#else
+    py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
+    if (!py_basicsize)
+        goto bad;
+    basicsize = PyLong_AsSsize_t(py_basicsize);
+    Py_DECREF(py_basicsize);
+    py_basicsize = 0;
+    if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
+        goto bad;
+#endif
+    if (!strict && (size_t)basicsize > size) {
         PyOS_snprintf(warning, sizeof(warning),
             "%s.%s size changed, may indicate binary incompatibility",
             module_name, class_name);
@@ -19452,7 +19944,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class
         if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
         #endif
     }
-    else if ((size_t)((PyTypeObject *)result)->tp_basicsize != size) {
+    else if ((size_t)basicsize != size) {
         PyErr_Format(PyExc_ValueError,
             "%s.%s has the wrong size, try recompiling",
             module_name, class_name);
@@ -19658,27 +20150,82 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
     return 0;
 }
 
-
-/* Type Conversion Functions */
-
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char* c_str) {
+    return __Pyx_PyUnicode_FromStringAndSize(c_str, strlen(c_str));
+}
+static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
+    Py_ssize_t ignore;
+    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
+}
+static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
+    if (
+#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+            __Pyx_sys_getdefaultencoding_not_ascii &&
+#endif
+            PyUnicode_Check(o)) {
+#if PY_VERSION_HEX < 0x03030000
+        char* defenc_c;
+        PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
+        if (!defenc) return NULL;
+        defenc_c = PyBytes_AS_STRING(defenc);
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+        {
+            char* end = defenc_c + PyBytes_GET_SIZE(defenc);
+            char* c;
+            for (c = defenc_c; c < end; c++) {
+                if ((unsigned char) (*c) >= 128) {
+                    PyUnicode_AsASCIIString(o);
+                    return NULL;
+                }
+            }
+        }
+#endif /*__PYX_DEFAULT_STRING_ENCODING_IS_ASCII*/
+        *length = PyBytes_GET_SIZE(defenc);
+        return defenc_c;
+#else /* PY_VERSION_HEX < 0x03030000 */
+        if (PyUnicode_READY(o) == -1) return NULL;
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+        if (PyUnicode_IS_ASCII(o)) {
+            *length = PyUnicode_GET_DATA_SIZE(o);
+            return PyUnicode_AsUTF8(o);
+        } else {
+            PyUnicode_AsASCIIString(o);
+            return NULL;
+        }
+#else /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
+        return PyUnicode_AsUTF8AndSize(o, length);
+#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
+#endif /* PY_VERSION_HEX < 0x03030000 */
+    } else
+#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII  || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT */
+    {
+        char* result;
+        int r = PyBytes_AsStringAndSize(o, &result, length);
+        if (r < 0) {
+            return NULL;
+        } else {
+            return result;
+        }
+    }
+}
 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
    int is_true = x == Py_True;
    if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
    else return PyObject_IsTrue(x);
 }
-
 static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
   PyNumberMethods *m;
   const char *name = NULL;
   PyObject *res = NULL;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
   if (PyInt_Check(x) || PyLong_Check(x))
 #else
   if (PyLong_Check(x))
 #endif
     return Py_INCREF(x), x;
   m = Py_TYPE(x)->tp_as_number;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
   if (m && m->nb_int) {
     name = "int";
     res = PyNumber_Int(x);
@@ -19694,7 +20241,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
   }
 #endif
   if (res) {
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (!PyInt_Check(res) && !PyLong_Check(res)) {
 #else
     if (!PyLong_Check(res)) {
@@ -19712,7 +20259,6 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
   }
   return res;
 }
-
 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
   Py_ssize_t ival;
   PyObject* x = PyNumber_Index(b);
@@ -19721,7 +20267,6 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
   Py_DECREF(x);
   return ival;
 }
-
 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
 #if PY_VERSION_HEX < 0x02050000
    if (ival <= LONG_MAX)
@@ -19735,14 +20280,12 @@ static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
    return PyInt_FromSize_t(ival);
 #endif
 }
-
 static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
    unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
-   if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) {
-       return (size_t)-1;
-   } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
-       PyErr_SetString(PyExc_OverflowError,
-                       "value too large to convert to size_t");
+   if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
+       if ((val != (unsigned PY_LONG_LONG)-1) || !PyErr_Occurred())
+           PyErr_SetString(PyExc_OverflowError,
+                           "value too large to convert to size_t");
        return (size_t)-1;
    }
    return (size_t)val;
diff --git a/src/bilinear.pyx b/src/bilinear.pyx
index 499fb7a..f1d2393 100644
--- a/src/bilinear.pyx
+++ b/src/bilinear.pyx
@@ -35,6 +35,8 @@ cimport numpy
 
 from libc.math cimport floor,ceil
 
+import logging
+logger = logging.getLogger("pyFAI.bilinear")
 
 cdef class Bilinear:
     """Bilinear interpolator for finding max"""
@@ -96,6 +98,7 @@ cdef class Bilinear:
 
     @cython.boundscheck(False)
     @cython.wraparound(False)
+    @cython.cdivision(True)
     def local_maxi(self, x, int w=1):
         """
         Return the local maximum ... with sub-pixel refinement
@@ -104,6 +107,9 @@ cdef class Bilinear:
         @param w: half with of the window: 1 or 2 are adviced
         @return: 2-tuple of int with the nearest local maximum
 
+        Sub-pixel refinement:
+        Second order taylor expansion of the function; first derivative is nul
+        delta = x-i = -Inverse[Hessian].gradient 
         """
         cdef int current0 = x[0]
         cdef int current1 = x[1]
@@ -139,6 +145,38 @@ cdef class Bilinear:
                             new0,new1=i0,i1
                             value = tmp
                 current0,current1=new0,new1
+
+        cdef float a00, a01, a02, a10, a11, a12, a20, a21, a22 # coefficients of the array
+#        cdef float g0, g1       # gradient values
+        cdef float d00, d11, d01, denom # Hessian coefficient
+#        print(current0,current1)
+        if (stop0>current0) and (current0>start0) and (stop1>current1) and (current1>start1):
+            #Use second order polynomial taylor expansion
+            a00 = self.data[current0-1,current1-1]
+            a01 = self.data[current0-1,current1  ]
+            a02 = self.data[current0-1,current1+1]
+            a10 = self.data[current0  ,current1-1]
+            a11 = self.data[current0  ,current1  ]
+            a12 = self.data[current0  ,current1+1]
+            a20 = self.data[current0+1,current1-1]
+            a21 = self.data[current0+1,current1  ]
+            a22 = self.data[current0+1,current1-1]
+#            g0 = (a21 - a01)/2.0
+#            g1 = (a12 - a10)/2.0
+            d00 = a12 - 2.0*a11 + a10
+            d11 = a21 - 2.0*a11 + a01
+            d01 = (a00 - a02 - a20 + a22)/4.0
+            denom = 2.0*(d00*d11-d01*d01)
+            if abs(denom)<1e-10:
+                logger.debug("Singular determinant, Hessian undefined")
+            else:
+                delta0 = ((a12 - a10)*d01 + (a01 - a21)*d11)/denom
+                delta1 = ((a10 - a12)*d00 + (a21 - a01)*d01)/denom
+    #            print(delta0,delta1)
+                if abs(delta0)<=1.0 and abs(delta1)<=1.0: #Result is OK is nower than 0.5.
+                    return (float(current0) + delta0, float(current1) + delta1)
+                else:
+                    logger.debug("Failed to find root using second order expansion") 
         #refinement of the position by a simple center of mass of the last valid region used
         for i0 in range(start0, stop0+1):
             for i1 in range(start1, stop1+1):
@@ -147,8 +185,7 @@ cdef class Bilinear:
                 sum1 += tmp * i1
                 sum += tmp
         if sum>0:
-#            print current0,current1,sum0/sum,sum1/sum
-            return (sum0/sum,sum1/sum)
+           #print current0,current1,sum0/sum,sum1/sum
+           return (sum0/sum,sum1/sum)
         else:
             return (current0,current1)
-        
\ No newline at end of file
diff --git a/src/fastcrc.c b/src/fastcrc.c
index a9c741d..69efd7e 100644
--- a/src/fastcrc.c
+++ b/src/fastcrc.c
@@ -1,6 +1,18 @@
-/* Generated by Cython 0.17.1 on Tue Dec 11 13:42:42 2012 */
+/* Generated by Cython 0.19.2 on Mon Jan  6 15:01:35 2014 */
 
 #define PY_SSIZE_T_CLEAN
+#ifndef CYTHON_USE_PYLONG_INTERNALS
+#ifdef PYLONG_BITS_IN_DIGIT
+#define CYTHON_USE_PYLONG_INTERNALS 0
+#else
+#include "pyconfig.h"
+#ifdef PYLONG_BITS_IN_DIGIT
+#define CYTHON_USE_PYLONG_INTERNALS 1
+#else
+#define CYTHON_USE_PYLONG_INTERNALS 0
+#endif
+#endif
+#endif
 #include "Python.h"
 #ifndef Py_PYTHON_H
     #error Python headers needed to compile C extensions, please install development version of Python.
@@ -53,12 +65,15 @@
                                 (PyErr_Format(PyExc_TypeError, \
                                               "expected index value, got %.200s", Py_TYPE(o)->tp_name), \
                                  (PyObject*)0))
-  #define PyIndex_Check(o)     (PyNumber_Check(o) && !PyFloat_Check(o) && !PyComplex_Check(o))
+  #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \
+                                  !PyComplex_Check(o))
+  #define PyIndex_Check __Pyx_PyIndex_Check
   #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
   #define __PYX_BUILD_PY_SSIZE_T "i"
 #else
   #define __PYX_BUILD_PY_SSIZE_T "n"
   #define CYTHON_FORMAT_SSIZE_T "z"
+  #define __Pyx_PyIndex_Check PyIndex_Check
 #endif
 #if PY_VERSION_HEX < 0x02060000
   #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
@@ -113,6 +128,9 @@
 #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
   #define Py_TPFLAGS_HAVE_NEWBUFFER 0
 #endif
+#if PY_VERSION_HEX < 0x02060000
+  #define Py_TPFLAGS_HAVE_VERSION_TAG 0
+#endif
 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
   #define CYTHON_PEP393_ENABLED 1
   #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ? \
@@ -152,6 +170,14 @@
   #define PyBytes_Concat               PyString_Concat
   #define PyBytes_ConcatAndDel         PyString_ConcatAndDel
 #endif
+#if PY_MAJOR_VERSION >= 3
+  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
+  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
+#else
+  #define __Pyx_PyBaseString_Check(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj) || \
+                                         PyString_Check(obj) || PyUnicode_Check(obj))
+  #define __Pyx_PyBaseString_CheckExact(obj) (Py_TYPE(obj) == &PyBaseString_Type)
+#endif
 #if PY_VERSION_HEX < 0x02060000
   #define PySet_Check(obj)             PyObject_TypeCheck(obj, &PySet_Type)
   #define PyFrozenSet_Check(obj)       PyObject_TypeCheck(obj, &PyFrozenSet_Type)
@@ -224,6 +250,40 @@
   #define __Pyx_NAMESTR(n) (n)
   #define __Pyx_DOCSTR(n)  (n)
 #endif
+#ifndef CYTHON_INLINE
+  #if defined(__GNUC__)
+    #define CYTHON_INLINE __inline__
+  #elif defined(_MSC_VER)
+    #define CYTHON_INLINE __inline
+  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+    #define CYTHON_INLINE inline
+  #else
+    #define CYTHON_INLINE
+  #endif
+#endif
+#ifndef CYTHON_RESTRICT
+  #if defined(__GNUC__)
+    #define CYTHON_RESTRICT __restrict__
+  #elif defined(_MSC_VER) && _MSC_VER >= 1400
+    #define CYTHON_RESTRICT __restrict
+  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+    #define CYTHON_RESTRICT restrict
+  #else
+    #define CYTHON_RESTRICT
+  #endif
+#endif
+#ifdef NAN
+#define __PYX_NAN() ((float) NAN)
+#else
+static CYTHON_INLINE float __PYX_NAN() {
+  /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and
+   a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is
+   a quiet NaN. */
+  float value;
+  memset(&value, 0xFF, sizeof(value));
+  return value;
+}
+#endif
 
 
 #if PY_MAJOR_VERSION >= 3
@@ -248,6 +308,7 @@
 #include <math.h>
 #define __PYX_HAVE__fastcrc
 #define __PYX_HAVE_API__fastcrc
+#include "string.h"
 #include "stdio.h"
 #include "stdlib.h"
 #include "numpy/arrayobject.h"
@@ -262,21 +323,6 @@
 #define CYTHON_WITHOUT_ASSERTIONS
 #endif
 
-
-/* inline attribute */
-#ifndef CYTHON_INLINE
-  #if defined(__GNUC__)
-    #define CYTHON_INLINE __inline__
-  #elif defined(_MSC_VER)
-    #define CYTHON_INLINE __inline
-  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
-    #define CYTHON_INLINE inline
-  #else
-    #define CYTHON_INLINE
-  #endif
-#endif
-
-/* unused attribute */
 #ifndef CYTHON_UNUSED
 # if defined(__GNUC__)
 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
@@ -290,30 +336,130 @@
 #   define CYTHON_UNUSED
 # endif
 #endif
-
-typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/
-
-
-/* Type Conversion Predeclarations */
-
-#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
-#define __Pyx_PyBytes_AsUString(s)   ((unsigned char*) PyBytes_AsString(s))
-
+typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding;
+                const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/
+
+#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
+#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
+#define __PYX_DEFAULT_STRING_ENCODING ""
+#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
+#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
+static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
+static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
+#define __Pyx_PyBytes_FromString        PyBytes_FromString
+#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char*);
+#if PY_MAJOR_VERSION < 3
+    #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
+    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
+#else
+    #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
+    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
+#endif
+#define __Pyx_PyObject_AsUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
+#define __Pyx_PyObject_FromUString(s)  __Pyx_PyObject_FromString((char*)s)
+#define __Pyx_PyBytes_FromUString(s)   __Pyx_PyBytes_FromString((char*)s)
+#define __Pyx_PyStr_FromUString(s)     __Pyx_PyStr_FromString((char*)s)
+#define __Pyx_PyUnicode_FromUString(s) __Pyx_PyUnicode_FromString((char*)s)
+#if PY_MAJOR_VERSION < 3
+static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
+{
+    const Py_UNICODE *u_end = u;
+    while (*u_end++) ;
+    return u_end - u - 1;
+}
+#else
+#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
+#endif
+#define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
+#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
+#define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
 #define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
 #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
 static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
-
 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
 static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
-
 #if CYTHON_COMPILING_IN_CPYTHON
 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
 #else
 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
 #endif
 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
+#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+static int __Pyx_sys_getdefaultencoding_not_ascii;
+static int __Pyx_init_sys_getdefaultencoding_params() {
+    PyObject* sys = NULL;
+    PyObject* default_encoding = NULL;
+    PyObject* ascii_chars_u = NULL;
+    PyObject* ascii_chars_b = NULL;
+    sys = PyImport_ImportModule("sys");
+    if (sys == NULL) goto bad;
+    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
+    if (default_encoding == NULL) goto bad;
+    if (strcmp(PyBytes_AsString(default_encoding), "ascii") == 0) {
+        __Pyx_sys_getdefaultencoding_not_ascii = 0;
+    } else {
+        const char* default_encoding_c = PyBytes_AS_STRING(default_encoding);
+        char ascii_chars[128];
+        int c;
+        for (c = 0; c < 128; c++) {
+            ascii_chars[c] = c;
+        }
+        __Pyx_sys_getdefaultencoding_not_ascii = 1;
+        ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
+        if (ascii_chars_u == NULL) goto bad;
+        ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
+        if (ascii_chars_b == NULL || strncmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
+            PyErr_Format(
+                PyExc_ValueError,
+                "This module compiled with c_string_encoding=ascii, but default encoding '%s' is not a superset of ascii.",
+                default_encoding_c);
+            goto bad;
+        }
+    }
+    Py_XDECREF(sys);
+    Py_XDECREF(default_encoding);
+    Py_XDECREF(ascii_chars_u);
+    Py_XDECREF(ascii_chars_b);
+    return 0;
+bad:
+    Py_XDECREF(sys);
+    Py_XDECREF(default_encoding);
+    Py_XDECREF(ascii_chars_u);
+    Py_XDECREF(ascii_chars_b);
+    return -1;
+}
+#endif
+#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
+#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
+#else
+#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
+#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
+static char* __PYX_DEFAULT_STRING_ENCODING;
+static int __Pyx_init_sys_getdefaultencoding_params() {
+    PyObject* sys = NULL;
+    PyObject* default_encoding = NULL;
+    char* default_encoding_c;
+    sys = PyImport_ImportModule("sys");
+    if (sys == NULL) goto bad;
+    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
+    if (default_encoding == NULL) goto bad;
+    default_encoding_c = PyBytes_AS_STRING(default_encoding);
+    __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
+    strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
+    Py_DECREF(sys);
+    Py_DECREF(default_encoding);
+    return 0;
+bad:
+    Py_XDECREF(sys);
+    Py_XDECREF(default_encoding);
+    return -1;
+}
+#endif
+#endif
+
 
 #ifdef __GNUC__
   /* Test for GCC > 2.95 */
@@ -328,8 +474,9 @@ static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
   #define likely(x)   (x)
   #define unlikely(x) (x)
 #endif /* __GNUC__ */
-    
+
 static PyObject *__pyx_m;
+static PyObject *__pyx_d;
 static PyObject *__pyx_b;
 static PyObject *__pyx_empty_tuple;
 static PyObject *__pyx_empty_bytes;
@@ -663,13 +810,36 @@ typedef npy_cdouble __pyx_t_5numpy_complex_t;
   #define __Pyx_XGOTREF(r)
   #define __Pyx_XGIVEREF(r)
 #endif /* CYTHON_REFNANNY */
+#define __Pyx_XDECREF_SET(r, v) do {                            \
+        PyObject *tmp = (PyObject *) r;                         \
+        r = v; __Pyx_XDECREF(tmp);                              \
+    } while (0)
+#define __Pyx_DECREF_SET(r, v) do {                             \
+        PyObject *tmp = (PyObject *) r;                         \
+        r = v; __Pyx_DECREF(tmp);                               \
+    } while (0)
 #define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
 #define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
 
 static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
     const char *name, int exact); /*proto*/
 
-static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
+    PyTypeObject* tp = Py_TYPE(obj);
+    if (likely(tp->tp_getattro))
+        return tp->tp_getattro(obj, attr_name);
+#if PY_MAJOR_VERSION < 3
+    if (likely(tp->tp_getattr))
+        return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
+#endif
+    return PyObject_GetAttr(obj, attr_name);
+}
+#else
+#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
+#endif
+
+static PyObject *__Pyx_GetBuiltinName(PyObject *name); /*proto*/
 
 static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
 static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
@@ -688,7 +858,7 @@ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
 
 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/
 
-static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/
+static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /*proto*/
 
 static CYTHON_INLINE npy_uint32 __Pyx_PyInt_from_py_npy_uint32(PyObject *);
 
@@ -864,6 +1034,8 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
 
 /* Module declarations from 'cpython.ref' */
 
+/* Module declarations from 'libc.string' */
+
 /* Module declarations from 'libc.stdio' */
 
 /* Module declarations from 'cpython.object' */
@@ -942,6 +1114,7 @@ static char __pyx_k____main__[] = "__main__";
 static char __pyx_k____test__[] = "__test__";
 static char __pyx_k__ValueError[] = "ValueError";
 static char __pyx_k____author__[] = "__author__";
+static char __pyx_k____import__[] = "__import__";
 static char __pyx_k____contact__[] = "__contact__";
 static char __pyx_k____license__[] = "__license__";
 static char __pyx_k__RuntimeError[] = "RuntimeError";
@@ -963,6 +1136,7 @@ static PyObject *__pyx_n_s____author__;
 static PyObject *__pyx_n_s____contact__;
 static PyObject *__pyx_n_s____date__;
 static PyObject *__pyx_n_s____doc__;
+static PyObject *__pyx_n_s____import__;
 static PyObject *__pyx_n_s____license__;
 static PyObject *__pyx_n_s____main__;
 static PyObject *__pyx_n_s____test__;
@@ -988,6 +1162,9 @@ static PyObject *__pyx_pw_7fastcrc_1crc32(PyObject *__pyx_self, PyObject *__pyx_
 static char __pyx_doc_7fastcrc_crc32[] = "\n    Calculate the CRC32 checksum of a numpy array\n    @param data: a numpy array\n    @return unsigned integer\n    ";
 static PyMethodDef __pyx_mdef_7fastcrc_1crc32 = {__Pyx_NAMESTR("crc32"), (PyCFunction)__pyx_pw_7fastcrc_1crc32, METH_O, __Pyx_DOCSTR(__pyx_doc_7fastcrc_crc32)};
 static PyObject *__pyx_pw_7fastcrc_1crc32(PyObject *__pyx_self, PyObject *__pyx_v_data) {
+  CYTHON_UNUSED int __pyx_lineno = 0;
+  CYTHON_UNUSED const char *__pyx_filename = NULL;
+  CYTHON_UNUSED int __pyx_clineno = 0;
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("crc32 (wrapper)", 0);
@@ -1026,7 +1203,7 @@ static PyObject *__pyx_pf_7fastcrc_crc32(CYTHON_UNUSED PyObject *__pyx_self, PyA
  *     cdef numpy.uint32_t size = data.nbytes             # <<<<<<<<<<<<<<
  *     return C_crc32(<char *> data.data, size)
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_data), __pyx_n_s__nbytes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_data), __pyx_n_s__nbytes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = __Pyx_PyInt_from_py_npy_uint32(__pyx_t_1); if (unlikely((__pyx_t_2 == (npy_uint32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -1057,8 +1234,8 @@ static PyObject *__pyx_pf_7fastcrc_crc32(CYTHON_UNUSED PyObject *__pyx_self, PyA
 }
 
 /* Python wrapper */
-static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
-static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
+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);
@@ -1113,7 +1290,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  * 
  *             cdef int copy_shape, i, ndim
  */
-  __pyx_t_1 = (__pyx_v_info == NULL);
+  __pyx_t_1 = ((__pyx_v_info == NULL) != 0);
   if (__pyx_t_1) {
     __pyx_r = 0;
     goto __pyx_L0;
@@ -1155,7 +1332,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 copy_shape = 1
  *             else:
  */
-  __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t)));
+  __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":209
@@ -1188,7 +1365,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
  *                 raise ValueError(u"ndarray is not C contiguous")
  */
-  __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS);
+  __pyx_t_1 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":214
@@ -1198,7 +1375,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 raise ValueError(u"ndarray is not C contiguous")
  * 
  */
-    __pyx_t_2 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS));
+    __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS) != 0)) != 0);
     __pyx_t_3 = __pyx_t_2;
   } else {
     __pyx_t_3 = __pyx_t_1;
@@ -1228,7 +1405,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
  *                 raise ValueError(u"ndarray is not Fortran contiguous")
  */
-  __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS);
+  __pyx_t_3 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0);
   if (__pyx_t_3) {
 
     /* "numpy.pxd":218
@@ -1238,7 +1415,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 raise ValueError(u"ndarray is not Fortran contiguous")
  * 
  */
-    __pyx_t_1 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS));
+    __pyx_t_1 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS) != 0)) != 0);
     __pyx_t_2 = __pyx_t_1;
   } else {
     __pyx_t_2 = __pyx_t_3;
@@ -1286,7 +1463,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 # Allocate new buffer for strides and shape info.
  *                 # This is allocated as one block, strides first.
  */
-  if (__pyx_v_copy_shape) {
+  __pyx_t_2 = (__pyx_v_copy_shape != 0);
+  if (__pyx_t_2) {
 
     /* "numpy.pxd":226
  *                 # Allocate new buffer for strides and shape info.
@@ -1384,7 +1562,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  * 
  *             cdef int t
  */
-  __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self));
+  __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0));
 
   /* "numpy.pxd":239
  * 
@@ -1402,8 +1580,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *             cdef list stack
  *             cdef int offset
  */
-  __Pyx_INCREF(((PyObject *)__pyx_v_self->descr));
-  __pyx_v_descr = __pyx_v_self->descr;
+  __pyx_t_4 = ((PyObject *)__pyx_v_self->descr);
+  __Pyx_INCREF(__pyx_t_4);
+  __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4);
+  __pyx_t_4 = 0;
 
   /* "numpy.pxd":244
  *             cdef int offset
@@ -1421,9 +1601,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 # do not call releasebuffer
  *                 info.obj = None
  */
-  __pyx_t_2 = (!__pyx_v_hasfields);
+  __pyx_t_2 = ((!(__pyx_v_hasfields != 0)) != 0);
   if (__pyx_t_2) {
-    __pyx_t_3 = (!__pyx_v_copy_shape);
+    __pyx_t_3 = ((!(__pyx_v_copy_shape != 0)) != 0);
     __pyx_t_1 = __pyx_t_3;
   } else {
     __pyx_t_1 = __pyx_t_2;
@@ -1468,7 +1648,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 t = descr.type_num
  *                 if ((descr.byteorder == c'>' and little_endian) or
  */
-  __pyx_t_1 = (!__pyx_v_hasfields);
+  __pyx_t_1 = ((!(__pyx_v_hasfields != 0)) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":254
@@ -1478,7 +1658,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 if ((descr.byteorder == c'>' and little_endian) or
  *                     (descr.byteorder == c'<' and not little_endian)):
  */
-    __pyx_v_t = __pyx_v_descr->type_num;
+    __pyx_t_5 = __pyx_v_descr->type_num;
+    __pyx_v_t = __pyx_t_5;
 
     /* "numpy.pxd":255
  *             if not hasfields:
@@ -1487,9 +1668,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                     (descr.byteorder == c'<' and not little_endian)):
  *                     raise ValueError(u"Non-native byte order not supported")
  */
-    __pyx_t_1 = (__pyx_v_descr->byteorder == '>');
+    __pyx_t_1 = ((__pyx_v_descr->byteorder == '>') != 0);
     if (__pyx_t_1) {
-      __pyx_t_2 = __pyx_v_little_endian;
+      __pyx_t_2 = (__pyx_v_little_endian != 0);
     } else {
       __pyx_t_2 = __pyx_t_1;
     }
@@ -1502,9 +1683,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                     raise ValueError(u"Non-native byte order not supported")
  *                 if   t == NPY_BYTE:        f = "b"
  */
-      __pyx_t_1 = (__pyx_v_descr->byteorder == '<');
+      __pyx_t_1 = ((__pyx_v_descr->byteorder == '<') != 0);
       if (__pyx_t_1) {
-        __pyx_t_3 = (!__pyx_v_little_endian);
+        __pyx_t_3 = ((!(__pyx_v_little_endian != 0)) != 0);
         __pyx_t_7 = __pyx_t_3;
       } else {
         __pyx_t_7 = __pyx_t_1;
@@ -1531,227 +1712,202 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
     }
     __pyx_L12:;
 
-    /* "numpy.pxd":258
+    /* "numpy.pxd":274
+ *                 elif t == NPY_CDOUBLE:     f = "Zd"
+ *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
+ *                 elif t == NPY_OBJECT:      f = "O"             # <<<<<<<<<<<<<<
+ *                 else:
+ *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
+ */
+    switch (__pyx_v_t) {
+
+      /* "numpy.pxd":258
  *                     (descr.byteorder == c'<' and not little_endian)):
  *                     raise ValueError(u"Non-native byte order not supported")
  *                 if   t == NPY_BYTE:        f = "b"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_UBYTE:       f = "B"
  *                 elif t == NPY_SHORT:       f = "h"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_BYTE);
-    if (__pyx_t_1) {
+      case NPY_BYTE:
       __pyx_v_f = __pyx_k__b;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":259
+      /* "numpy.pxd":259
  *                     raise ValueError(u"Non-native byte order not supported")
  *                 if   t == NPY_BYTE:        f = "b"
  *                 elif t == NPY_UBYTE:       f = "B"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_SHORT:       f = "h"
  *                 elif t == NPY_USHORT:      f = "H"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_UBYTE);
-    if (__pyx_t_1) {
+      case NPY_UBYTE:
       __pyx_v_f = __pyx_k__B;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":260
+      /* "numpy.pxd":260
  *                 if   t == NPY_BYTE:        f = "b"
  *                 elif t == NPY_UBYTE:       f = "B"
  *                 elif t == NPY_SHORT:       f = "h"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_USHORT:      f = "H"
  *                 elif t == NPY_INT:         f = "i"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_SHORT);
-    if (__pyx_t_1) {
+      case NPY_SHORT:
       __pyx_v_f = __pyx_k__h;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":261
+      /* "numpy.pxd":261
  *                 elif t == NPY_UBYTE:       f = "B"
  *                 elif t == NPY_SHORT:       f = "h"
  *                 elif t == NPY_USHORT:      f = "H"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_INT:         f = "i"
  *                 elif t == NPY_UINT:        f = "I"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_USHORT);
-    if (__pyx_t_1) {
+      case NPY_USHORT:
       __pyx_v_f = __pyx_k__H;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":262
+      /* "numpy.pxd":262
  *                 elif t == NPY_SHORT:       f = "h"
  *                 elif t == NPY_USHORT:      f = "H"
  *                 elif t == NPY_INT:         f = "i"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_UINT:        f = "I"
  *                 elif t == NPY_LONG:        f = "l"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_INT);
-    if (__pyx_t_1) {
+      case NPY_INT:
       __pyx_v_f = __pyx_k__i;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":263
+      /* "numpy.pxd":263
  *                 elif t == NPY_USHORT:      f = "H"
  *                 elif t == NPY_INT:         f = "i"
  *                 elif t == NPY_UINT:        f = "I"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_LONG:        f = "l"
  *                 elif t == NPY_ULONG:       f = "L"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_UINT);
-    if (__pyx_t_1) {
+      case NPY_UINT:
       __pyx_v_f = __pyx_k__I;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":264
+      /* "numpy.pxd":264
  *                 elif t == NPY_INT:         f = "i"
  *                 elif t == NPY_UINT:        f = "I"
  *                 elif t == NPY_LONG:        f = "l"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_ULONG:       f = "L"
  *                 elif t == NPY_LONGLONG:    f = "q"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_LONG);
-    if (__pyx_t_1) {
+      case NPY_LONG:
       __pyx_v_f = __pyx_k__l;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":265
+      /* "numpy.pxd":265
  *                 elif t == NPY_UINT:        f = "I"
  *                 elif t == NPY_LONG:        f = "l"
  *                 elif t == NPY_ULONG:       f = "L"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_LONGLONG:    f = "q"
  *                 elif t == NPY_ULONGLONG:   f = "Q"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_ULONG);
-    if (__pyx_t_1) {
+      case NPY_ULONG:
       __pyx_v_f = __pyx_k__L;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":266
+      /* "numpy.pxd":266
  *                 elif t == NPY_LONG:        f = "l"
  *                 elif t == NPY_ULONG:       f = "L"
  *                 elif t == NPY_LONGLONG:    f = "q"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_ULONGLONG:   f = "Q"
  *                 elif t == NPY_FLOAT:       f = "f"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG);
-    if (__pyx_t_1) {
+      case NPY_LONGLONG:
       __pyx_v_f = __pyx_k__q;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":267
+      /* "numpy.pxd":267
  *                 elif t == NPY_ULONG:       f = "L"
  *                 elif t == NPY_LONGLONG:    f = "q"
  *                 elif t == NPY_ULONGLONG:   f = "Q"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_FLOAT:       f = "f"
  *                 elif t == NPY_DOUBLE:      f = "d"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG);
-    if (__pyx_t_1) {
+      case NPY_ULONGLONG:
       __pyx_v_f = __pyx_k__Q;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":268
+      /* "numpy.pxd":268
  *                 elif t == NPY_LONGLONG:    f = "q"
  *                 elif t == NPY_ULONGLONG:   f = "Q"
  *                 elif t == NPY_FLOAT:       f = "f"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_DOUBLE:      f = "d"
  *                 elif t == NPY_LONGDOUBLE:  f = "g"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_FLOAT);
-    if (__pyx_t_1) {
+      case NPY_FLOAT:
       __pyx_v_f = __pyx_k__f;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":269
+      /* "numpy.pxd":269
  *                 elif t == NPY_ULONGLONG:   f = "Q"
  *                 elif t == NPY_FLOAT:       f = "f"
  *                 elif t == NPY_DOUBLE:      f = "d"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_LONGDOUBLE:  f = "g"
  *                 elif t == NPY_CFLOAT:      f = "Zf"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE);
-    if (__pyx_t_1) {
+      case NPY_DOUBLE:
       __pyx_v_f = __pyx_k__d;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":270
+      /* "numpy.pxd":270
  *                 elif t == NPY_FLOAT:       f = "f"
  *                 elif t == NPY_DOUBLE:      f = "d"
  *                 elif t == NPY_LONGDOUBLE:  f = "g"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_CFLOAT:      f = "Zf"
  *                 elif t == NPY_CDOUBLE:     f = "Zd"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE);
-    if (__pyx_t_1) {
+      case NPY_LONGDOUBLE:
       __pyx_v_f = __pyx_k__g;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":271
+      /* "numpy.pxd":271
  *                 elif t == NPY_DOUBLE:      f = "d"
  *                 elif t == NPY_LONGDOUBLE:  f = "g"
  *                 elif t == NPY_CFLOAT:      f = "Zf"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_CDOUBLE:     f = "Zd"
  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT);
-    if (__pyx_t_1) {
+      case NPY_CFLOAT:
       __pyx_v_f = __pyx_k__Zf;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":272
+      /* "numpy.pxd":272
  *                 elif t == NPY_LONGDOUBLE:  f = "g"
  *                 elif t == NPY_CFLOAT:      f = "Zf"
  *                 elif t == NPY_CDOUBLE:     f = "Zd"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
  *                 elif t == NPY_OBJECT:      f = "O"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE);
-    if (__pyx_t_1) {
+      case NPY_CDOUBLE:
       __pyx_v_f = __pyx_k__Zd;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":273
+      /* "numpy.pxd":273
  *                 elif t == NPY_CFLOAT:      f = "Zf"
  *                 elif t == NPY_CDOUBLE:     f = "Zd"
  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_OBJECT:      f = "O"
  *                 else:
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE);
-    if (__pyx_t_1) {
+      case NPY_CLONGDOUBLE:
       __pyx_v_f = __pyx_k__Zg;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":274
+      /* "numpy.pxd":274
  *                 elif t == NPY_CDOUBLE:     f = "Zd"
  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
  *                 elif t == NPY_OBJECT:      f = "O"             # <<<<<<<<<<<<<<
  *                 else:
  *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_OBJECT);
-    if (__pyx_t_1) {
+      case NPY_OBJECT:
       __pyx_v_f = __pyx_k__O;
-      goto __pyx_L13;
-    }
-    /*else*/ {
+      break;
+      default:
 
       /* "numpy.pxd":276
  *                 elif t == NPY_OBJECT:      f = "O"
@@ -1776,8 +1932,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
       {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      break;
     }
-    __pyx_L13:;
 
     /* "numpy.pxd":277
  *                 else:
@@ -1873,8 +2029,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
 }
 
 /* Python wrapper */
-static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
-static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
+static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
+static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
   __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));
@@ -1901,7 +2057,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s
  *                 stdlib.free(info.format)
  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
  */
-  __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self);
+  __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":290
@@ -1923,7 +2079,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s
  *                 stdlib.free(info.strides)
  *                 # info.shape was stored after info.strides in the same block
  */
-  __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t)));
+  __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":292
@@ -2228,8 +2384,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
     #else
     __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     #endif
-    __Pyx_XDECREF(__pyx_v_childname);
-    __pyx_v_childname = __pyx_t_3;
+    __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3);
     __pyx_t_3 = 0;
 
     /* "numpy.pxd":795
@@ -2242,8 +2397,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
     __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_XDECREF(((PyObject *)__pyx_v_fields));
-    __pyx_v_fields = ((PyObject*)__pyx_t_3);
+    __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3));
     __pyx_t_3 = 0;
 
     /* "numpy.pxd":796
@@ -2272,7 +2426,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
       __Pyx_INCREF(__pyx_t_4);
       #else
       __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
       __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_4);
       #endif
     } else if (1) {
       __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -2298,11 +2454,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
       __pyx_L6_unpacking_done:;
     }
     if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_XDECREF(((PyObject *)__pyx_v_child));
-    __pyx_v_child = ((PyArray_Descr *)__pyx_t_3);
+    __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3));
     __pyx_t_3 = 0;
-    __Pyx_XDECREF(__pyx_v_new_offset);
-    __pyx_v_new_offset = __pyx_t_4;
+    __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4);
     __pyx_t_4 = 0;
 
     /* "numpy.pxd":798
@@ -2352,9 +2506,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  *             (child.byteorder == c'<' and not little_endian)):
  *             raise ValueError(u"Non-native byte order not supported")
  */
-    __pyx_t_7 = (__pyx_v_child->byteorder == '>');
+    __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0);
     if (__pyx_t_7) {
-      __pyx_t_8 = __pyx_v_little_endian;
+      __pyx_t_8 = (__pyx_v_little_endian != 0);
     } else {
       __pyx_t_8 = __pyx_t_7;
     }
@@ -2367,9 +2521,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  *             raise ValueError(u"Non-native byte order not supported")
  *             # One could encode it in the format string and have Cython
  */
-      __pyx_t_7 = (__pyx_v_child->byteorder == '<');
+      __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0);
       if (__pyx_t_7) {
-        __pyx_t_9 = (!__pyx_v_little_endian);
+        __pyx_t_9 = ((!(__pyx_v_little_endian != 0)) != 0);
         __pyx_t_10 = __pyx_t_9;
       } else {
         __pyx_t_10 = __pyx_t_7;
@@ -2458,7 +2612,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  *             t = child.type_num
  *             if end - f < 5:
  */
-    __pyx_t_7 = (!PyDataType_HASFIELDS(__pyx_v_child));
+    __pyx_t_7 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0);
     if (__pyx_t_7) {
 
       /* "numpy.pxd":821
@@ -2470,8 +2624,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  */
       __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
-      __Pyx_XDECREF(__pyx_v_t);
-      __pyx_v_t = __pyx_t_3;
+      __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_3);
       __pyx_t_3 = 0;
 
       /* "numpy.pxd":822
@@ -2481,7 +2634,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  *                 raise RuntimeError(u"Format string allocated too short.")
  * 
  */
-      __pyx_t_7 = ((__pyx_v_end - __pyx_v_f) < 5);
+      __pyx_t_7 = (((__pyx_v_end - __pyx_v_f) < 5) != 0);
       if (__pyx_t_7) {
 
         /* "numpy.pxd":823
@@ -2903,6 +3056,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a
   PyObject *__pyx_v_baseptr;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
+  int __pyx_t_2;
   __Pyx_RefNannySetupContext("set_array_base", 0);
 
   /* "numpy.pxd":967
@@ -2913,7 +3067,8 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a
  *      else:
  */
   __pyx_t_1 = (__pyx_v_base == Py_None);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
     /* "numpy.pxd":968
  *      cdef PyObject* baseptr
@@ -2989,7 +3144,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py
  *         return None
  *     else:
  */
-  __pyx_t_1 = (__pyx_v_arr->base == NULL);
+  __pyx_t_1 = ((__pyx_v_arr->base == NULL) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":977
@@ -3032,7 +3187,11 @@ static PyMethodDef __pyx_methods[] = {
 
 #if PY_MAJOR_VERSION >= 3
 static struct PyModuleDef __pyx_moduledef = {
+  #if PY_VERSION_HEX < 0x03020000
+    { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
+  #else
     PyModuleDef_HEAD_INIT,
+  #endif
     __Pyx_NAMESTR("fastcrc"),
     0, /* m_doc */
     -1, /* m_size */
@@ -3063,6 +3222,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s____contact__, __pyx_k____contact__, sizeof(__pyx_k____contact__), 0, 0, 1, 1},
   {&__pyx_n_s____date__, __pyx_k____date__, sizeof(__pyx_k____date__), 0, 0, 1, 1},
   {&__pyx_n_s____doc__, __pyx_k____doc__, sizeof(__pyx_k____doc__), 0, 0, 1, 1},
+  {&__pyx_n_s____import__, __pyx_k____import__, sizeof(__pyx_k____import__), 0, 0, 1, 1},
   {&__pyx_n_s____license__, __pyx_k____license__, sizeof(__pyx_k____license__), 0, 0, 1, 1},
   {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
   {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
@@ -3076,9 +3236,9 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {0, 0, 0, 0, 0, 0, 0}
 };
 static int __Pyx_InitCachedBuiltins(void) {
-  __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   return 0;
   __pyx_L1_error:;
   return -1;
@@ -3095,11 +3255,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
  */
-  __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_2 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_1)); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_2);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_kp_u_1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_1));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2));
 
   /* "numpy.pxd":219
@@ -3109,11 +3266,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *             info.buf = PyArray_DATA(self)
  */
-  __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_4 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_3)); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_4);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_3));
-  PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_kp_u_3));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4));
 
   /* "numpy.pxd":257
@@ -3123,11 +3277,8 @@ static int __Pyx_InitCachedConstants(void) {
  *                 if   t == NPY_BYTE:        f = "b"
  *                 elif t == NPY_UBYTE:       f = "B"
  */
-  __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_6 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_5)); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_6);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_5));
-  PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_kp_u_5));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6));
 
   /* "numpy.pxd":799
@@ -3137,11 +3288,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *         if ((child.byteorder == c'>' and little_endian) or
  */
-  __pyx_k_tuple_9 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_9 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_8)); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_9);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_8));
-  PyTuple_SET_ITEM(__pyx_k_tuple_9, 0, ((PyObject *)__pyx_kp_u_8));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_8));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9));
 
   /* "numpy.pxd":803
@@ -3151,11 +3299,8 @@ static int __Pyx_InitCachedConstants(void) {
  *             # One could encode it in the format string and have Cython
  *             # complain instead, BUT: < and > in format strings also imply
  */
-  __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_10 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_5)); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_10);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_5));
-  PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_kp_u_5));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10));
 
   /* "numpy.pxd":823
@@ -3165,11 +3310,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *             # Until ticket #99 is fixed, use integers to avoid warnings
  */
-  __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_12 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_11)); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_12);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_11));
-  PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_u_11));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_11));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12));
 
   /* "fastcrc.pyx":41
@@ -3179,14 +3321,8 @@ static int __Pyx_InitCachedConstants(void) {
  *     """
  *     Calculate the CRC32 checksum of a numpy array
  */
-  __pyx_k_tuple_18 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_18 = PyTuple_Pack(2, ((PyObject *)__pyx_n_s__data), ((PyObject *)__pyx_n_s__size)); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_18);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__data));
-  PyTuple_SET_ITEM(__pyx_k_tuple_18, 0, ((PyObject *)__pyx_n_s__data));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__data));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__size));
-  PyTuple_SET_ITEM(__pyx_k_tuple_18, 1, ((PyObject *)__pyx_n_s__size));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__size));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18));
   __pyx_k_codeobj_19 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_18, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_20, __pyx_n_s__crc32, 41, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_RefNannyFinishContext();
@@ -3213,6 +3349,9 @@ PyMODINIT_FUNC PyInit_fastcrc(void)
 #endif
 {
   PyObject *__pyx_t_1 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannyDeclarations
   #if CYTHON_REFNANNY
   __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
@@ -3250,6 +3389,16 @@ PyMODINIT_FUNC PyInit_fastcrc(void)
   __pyx_m = PyModule_Create(&__pyx_moduledef);
   #endif
   if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  Py_INCREF(__pyx_d);
+  #if PY_MAJOR_VERSION >= 3
+  {
+    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (!PyDict_GetItemString(modules, "fastcrc")) {
+      if (unlikely(PyDict_SetItemString(modules, "fastcrc", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    }
+  }
+  #endif
   __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   #if CYTHON_COMPILING_IN_PYPY
   Py_INCREF(__pyx_b);
@@ -3257,6 +3406,9 @@ PyMODINIT_FUNC PyInit_fastcrc(void)
   if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
   /*--- Initialize various global constants etc. ---*/
   if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
+  if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  #endif
   if (__pyx_module_is_main_fastcrc) {
     if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
   }
@@ -3292,7 +3444,7 @@ PyMODINIT_FUNC PyInit_fastcrc(void)
  * __date__ = "19-11-2012"
  * __contact__ = "Jerome.kieffer at esrf.fr"
  */
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____author__, ((PyObject *)__pyx_kp_s_13)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s____author__, ((PyObject *)__pyx_kp_s_13)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   /* "fastcrc.pyx":28
  * 
@@ -3301,7 +3453,7 @@ PyMODINIT_FUNC PyInit_fastcrc(void)
  * __contact__ = "Jerome.kieffer at esrf.fr"
  * __license__ = "GPL v3+"
  */
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____date__, ((PyObject *)__pyx_kp_s_14)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s____date__, ((PyObject *)__pyx_kp_s_14)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   /* "fastcrc.pyx":29
  * __author__ = "Jerome Kieffer"
@@ -3310,7 +3462,7 @@ PyMODINIT_FUNC PyInit_fastcrc(void)
  * __license__ = "GPL v3+"
  * __doc__ = """
  */
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____contact__, ((PyObject *)__pyx_kp_s_15)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s____contact__, ((PyObject *)__pyx_kp_s_15)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   /* "fastcrc.pyx":30
  * __date__ = "19-11-2012"
@@ -3319,7 +3471,7 @@ PyMODINIT_FUNC PyInit_fastcrc(void)
  * __doc__ = """
  * Simple Cython module for doing CRC32 for checksums, possibly with SSE4 acceleration
  */
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____license__, ((PyObject *)__pyx_kp_s_16)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s____license__, ((PyObject *)__pyx_kp_s_16)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   /* "fastcrc.pyx":31
  * __contact__ = "Jerome.kieffer at esrf.fr"
@@ -3328,7 +3480,7 @@ PyMODINIT_FUNC PyInit_fastcrc(void)
  * Simple Cython module for doing CRC32 for checksums, possibly with SSE4 acceleration
  * """
  */
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____doc__, ((PyObject *)__pyx_kp_s_17)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s____doc__, ((PyObject *)__pyx_kp_s_17)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   /* "fastcrc.pyx":37
  * import cython
@@ -3339,7 +3491,7 @@ PyMODINIT_FUNC PyInit_fastcrc(void)
  */
   __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__numpy, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s__numpy, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
   /* "fastcrc.pyx":41
@@ -3351,7 +3503,7 @@ PyMODINIT_FUNC PyInit_fastcrc(void)
  */
   __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7fastcrc_1crc32, NULL, __pyx_n_s__fastcrc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__crc32, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s__crc32, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
   /* "fastcrc.pyx":1
@@ -3361,7 +3513,7 @@ PyMODINIT_FUNC PyInit_fastcrc(void)
  */
   __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
   /* "numpy.pxd":975
@@ -3426,17 +3578,15 @@ static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed
     return 0;
 }
 
-static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
-    PyObject *result;
-    result = PyObject_GetAttr(dict, name);
-    if (!result) {
-        if (dict != __pyx_b) {
-            PyErr_Clear();
-            result = PyObject_GetAttr(__pyx_b, name);
-        }
-        if (!result) {
-            PyErr_SetObject(PyExc_NameError, name);
-        }
+static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
+    PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
+    if (unlikely(!result)) {
+        PyErr_Format(PyExc_NameError,
+#if PY_MAJOR_VERSION >= 3
+            "name '%U' is not defined", name);
+#else
+            "name '%s' is not defined", PyString_AS_STRING(name));
+#endif
     }
     return result;
 }
@@ -3510,24 +3660,23 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
         }
         value = type;
         #if PY_VERSION_HEX < 0x02050000
-            if (PyInstance_Check(type)) {
-                type = (PyObject*) ((PyInstanceObject*)type)->in_class;
-                Py_INCREF(type);
-            }
-            else {
-                type = 0;
-                PyErr_SetString(PyExc_TypeError,
-                    "raise: exception must be an old-style class or instance");
-                goto raise_error;
-            }
-        #else
-            type = (PyObject*) Py_TYPE(type);
+        if (PyInstance_Check(type)) {
+            type = (PyObject*) ((PyInstanceObject*)type)->in_class;
             Py_INCREF(type);
-            if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
-                PyErr_SetString(PyExc_TypeError,
-                    "raise: exception class must be a subclass of BaseException");
-                goto raise_error;
-            }
+        } else {
+            type = 0;
+            PyErr_SetString(PyExc_TypeError,
+                "raise: exception must be an old-style class or instance");
+            goto raise_error;
+        }
+        #else
+        type = (PyObject*) Py_TYPE(type);
+        Py_INCREF(type);
+        if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
+            PyErr_SetString(PyExc_TypeError,
+                "raise: exception class must be a subclass of BaseException");
+            goto raise_error;
+        }
         #endif
     }
     __Pyx_ErrRestore(type, value, tb);
@@ -3559,46 +3708,62 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject
         value = type;
         type = (PyObject*) Py_TYPE(value);
     } else if (PyExceptionClass_Check(type)) {
-        PyObject *args;
-        if (!value)
-            args = PyTuple_New(0);
-        else if (PyTuple_Check(value)) {
-            Py_INCREF(value);
-            args = value;
+        PyObject *instance_class = NULL;
+        if (value && PyExceptionInstance_Check(value)) {
+            instance_class = (PyObject*) Py_TYPE(value);
+            if (instance_class != type) {
+                if (PyObject_IsSubclass(instance_class, type)) {
+                    type = instance_class;
+                } else {
+                    instance_class = NULL;
+                }
+            }
         }
-        else
-            args = PyTuple_Pack(1, value);
-        if (!args)
-            goto bad;
-        owned_instance = PyEval_CallObject(type, args);
-        Py_DECREF(args);
-        if (!owned_instance)
-            goto bad;
-        value = owned_instance;
-        if (!PyExceptionInstance_Check(value)) {
-            PyErr_Format(PyExc_TypeError,
-                         "calling %R should have returned an instance of "
-                         "BaseException, not %R",
-                         type, Py_TYPE(value));
-            goto bad;
+        if (!instance_class) {
+            PyObject *args;
+            if (!value)
+                args = PyTuple_New(0);
+            else if (PyTuple_Check(value)) {
+                Py_INCREF(value);
+                args = value;
+            } else
+                args = PyTuple_Pack(1, value);
+            if (!args)
+                goto bad;
+            owned_instance = PyObject_Call(type, args, NULL);
+            Py_DECREF(args);
+            if (!owned_instance)
+                goto bad;
+            value = owned_instance;
+            if (!PyExceptionInstance_Check(value)) {
+                PyErr_Format(PyExc_TypeError,
+                             "calling %R should have returned an instance of "
+                             "BaseException, not %R",
+                             type, Py_TYPE(value));
+                goto bad;
+            }
         }
     } else {
         PyErr_SetString(PyExc_TypeError,
             "raise: exception class must be a subclass of BaseException");
         goto bad;
     }
+#if PY_VERSION_HEX >= 0x03030000
+    if (cause) {
+#else
     if (cause && cause != Py_None) {
+#endif
         PyObject *fixed_cause;
-        if (PyExceptionClass_Check(cause)) {
+        if (cause == Py_None) {
+            fixed_cause = NULL;
+        } else if (PyExceptionClass_Check(cause)) {
             fixed_cause = PyObject_CallObject(cause, NULL);
             if (fixed_cause == NULL)
                 goto bad;
-        }
-        else if (PyExceptionInstance_Check(cause)) {
+        } else if (PyExceptionInstance_Check(cause)) {
             fixed_cause = cause;
             Py_INCREF(fixed_cause);
-        }
-        else {
+        } else {
             PyErr_SetString(PyExc_TypeError,
                             "exception causes must derive from "
                             "BaseException");
@@ -3694,16 +3859,18 @@ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
     return 0;
 }
 
-static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) {
-    PyObject *py_import = 0;
+static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
     PyObject *empty_list = 0;
     PyObject *module = 0;
     PyObject *global_dict = 0;
     PyObject *empty_dict = 0;
     PyObject *list;
-    py_import = __Pyx_GetAttrString(__pyx_b, "__import__");
+    #if PY_VERSION_HEX < 0x03030000
+    PyObject *py_import;
+    py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s____import__);
     if (!py_import)
         goto bad;
+    #endif
     if (from_list)
         list = from_list;
     else {
@@ -3723,13 +3890,17 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) {
         #if PY_MAJOR_VERSION >= 3
         if (level == -1) {
             if (strchr(__Pyx_MODULE_NAME, '.')) {
-                /* try package relative import first */
+                #if PY_VERSION_HEX < 0x03030000
                 PyObject *py_level = PyInt_FromLong(1);
                 if (!py_level)
                     goto bad;
                 module = PyObject_CallFunctionObjArgs(py_import,
                     name, global_dict, empty_dict, list, py_level, NULL);
                 Py_DECREF(py_level);
+                #else
+                module = PyImport_ImportModuleLevelObject(
+                    name, global_dict, empty_dict, list, 1);
+                #endif
                 if (!module) {
                     if (!PyErr_ExceptionMatches(PyExc_ImportError))
                         goto bad;
@@ -3740,12 +3911,17 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) {
         }
         #endif
         if (!module) {
+            #if PY_VERSION_HEX < 0x03030000
             PyObject *py_level = PyInt_FromLong(level);
             if (!py_level)
                 goto bad;
             module = PyObject_CallFunctionObjArgs(py_import,
                 name, global_dict, empty_dict, list, py_level, NULL);
             Py_DECREF(py_level);
+            #else
+            module = PyImport_ImportModuleLevelObject(
+                name, global_dict, empty_dict, list, level);
+            #endif
         }
     }
     #else
@@ -3757,8 +3933,10 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) {
         name, global_dict, empty_dict, list, NULL);
     #endif
 bad:
-    Py_XDECREF(empty_list);
+    #if PY_VERSION_HEX < 0x03030000
     Py_XDECREF(py_import);
+    #endif
+    Py_XDECREF(empty_list);
     Py_XDECREF(empty_dict);
     return module;
 }
@@ -3792,9 +3970,13 @@ static CYTHON_INLINE npy_uint32 __Pyx_PyInt_from_py_npy_uint32(PyObject* x) {
         else
             return (npy_uint32)__Pyx_PyInt_AsSignedLongLong(x);
     }  else {
+        #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
+        PyErr_SetString(PyExc_RuntimeError,
+                        "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
+        #else
         npy_uint32 val;
         PyObject *v = __Pyx_PyNumber_Int(x);
-        #if PY_VERSION_HEX < 0x03000000
+        #if PY_MAJOR_VERSION < 3
         if (likely(v) && !PyLong_Check(v)) {
             PyObject *tmp = v;
             v = PyNumber_Long(tmp);
@@ -3811,6 +3993,7 @@ static CYTHON_INLINE npy_uint32 __Pyx_PyInt_from_py_npy_uint32(PyObject* x) {
             if (likely(!ret))
                 return val;
         }
+        #endif
         return (npy_uint32)-1;
     }
 }
@@ -4270,10 +4453,15 @@ static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) {
     return (int)__Pyx_PyInt_AsLong(x);
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
     const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -4286,6 +4474,16 @@ static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(unsigned long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (unsigned long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to unsigned long");
@@ -4293,6 +4491,17 @@ static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
             }
             return (unsigned long)PyLong_AsUnsignedLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(unsigned long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(unsigned long) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(unsigned long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (unsigned long)PyLong_AsLong(x);
         }
     } else {
@@ -4305,10 +4514,15 @@ static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
     }
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
     const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -4321,6 +4535,16 @@ static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObje
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to unsigned PY_LONG_LONG");
@@ -4328,6 +4552,17 @@ static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObje
             }
             return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x);
         }
     } else {
@@ -4340,10 +4575,15 @@ static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObje
     }
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
     const long neg_one = (long)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -4356,6 +4596,16 @@ static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to long");
@@ -4363,6 +4613,17 @@ static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
             }
             return (long)PyLong_AsUnsignedLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(long) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (long)PyLong_AsLong(x);
         }
     } else {
@@ -4375,10 +4636,15 @@ static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
     }
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
     const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -4391,6 +4657,16 @@ static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to PY_LONG_LONG");
@@ -4398,6 +4674,17 @@ static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
             }
             return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (PY_LONG_LONG)PyLong_AsLongLong(x);
         }
     } else {
@@ -4410,10 +4697,15 @@ static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
     }
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
     const signed long neg_one = (signed long)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -4426,6 +4718,16 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(signed long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (signed long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to signed long");
@@ -4433,6 +4735,17 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
             }
             return (signed long)PyLong_AsUnsignedLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(signed long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(signed long) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(signed long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (signed long)PyLong_AsLong(x);
         }
     } else {
@@ -4445,10 +4758,15 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
     }
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
     const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -4461,6 +4779,16 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject*
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to signed PY_LONG_LONG");
@@ -4468,6 +4796,17 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject*
             }
             return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (signed PY_LONG_LONG)PyLong_AsLongLong(x);
         }
     } else {
@@ -4525,6 +4864,10 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class
     PyObject *result = 0;
     PyObject *py_name = 0;
     char warning[200];
+    Py_ssize_t basicsize;
+#ifdef Py_LIMITED_API
+    PyObject *py_basicsize;
+#endif
     py_module = __Pyx_ImportModule(module_name);
     if (!py_module)
         goto bad;
@@ -4544,7 +4887,19 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class
             module_name, class_name);
         goto bad;
     }
-    if (!strict && (size_t)((PyTypeObject *)result)->tp_basicsize > size) {
+#ifndef Py_LIMITED_API
+    basicsize = ((PyTypeObject *)result)->tp_basicsize;
+#else
+    py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
+    if (!py_basicsize)
+        goto bad;
+    basicsize = PyLong_AsSsize_t(py_basicsize);
+    Py_DECREF(py_basicsize);
+    py_basicsize = 0;
+    if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
+        goto bad;
+#endif
+    if (!strict && (size_t)basicsize > size) {
         PyOS_snprintf(warning, sizeof(warning),
             "%s.%s size changed, may indicate binary incompatibility",
             module_name, class_name);
@@ -4554,7 +4909,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class
         if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
         #endif
     }
-    else if ((size_t)((PyTypeObject *)result)->tp_basicsize != size) {
+    else if ((size_t)basicsize != size) {
         PyErr_Format(PyExc_ValueError,
             "%s.%s has the wrong size, try recompiling",
             module_name, class_name);
@@ -4760,27 +5115,82 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
     return 0;
 }
 
-
-/* Type Conversion Functions */
-
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char* c_str) {
+    return __Pyx_PyUnicode_FromStringAndSize(c_str, strlen(c_str));
+}
+static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
+    Py_ssize_t ignore;
+    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
+}
+static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
+    if (
+#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+            __Pyx_sys_getdefaultencoding_not_ascii &&
+#endif
+            PyUnicode_Check(o)) {
+#if PY_VERSION_HEX < 0x03030000
+        char* defenc_c;
+        PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
+        if (!defenc) return NULL;
+        defenc_c = PyBytes_AS_STRING(defenc);
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+        {
+            char* end = defenc_c + PyBytes_GET_SIZE(defenc);
+            char* c;
+            for (c = defenc_c; c < end; c++) {
+                if ((unsigned char) (*c) >= 128) {
+                    PyUnicode_AsASCIIString(o);
+                    return NULL;
+                }
+            }
+        }
+#endif /*__PYX_DEFAULT_STRING_ENCODING_IS_ASCII*/
+        *length = PyBytes_GET_SIZE(defenc);
+        return defenc_c;
+#else /* PY_VERSION_HEX < 0x03030000 */
+        if (PyUnicode_READY(o) == -1) return NULL;
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+        if (PyUnicode_IS_ASCII(o)) {
+            *length = PyUnicode_GET_DATA_SIZE(o);
+            return PyUnicode_AsUTF8(o);
+        } else {
+            PyUnicode_AsASCIIString(o);
+            return NULL;
+        }
+#else /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
+        return PyUnicode_AsUTF8AndSize(o, length);
+#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
+#endif /* PY_VERSION_HEX < 0x03030000 */
+    } else
+#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII  || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT */
+    {
+        char* result;
+        int r = PyBytes_AsStringAndSize(o, &result, length);
+        if (r < 0) {
+            return NULL;
+        } else {
+            return result;
+        }
+    }
+}
 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
    int is_true = x == Py_True;
    if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
    else return PyObject_IsTrue(x);
 }
-
 static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
   PyNumberMethods *m;
   const char *name = NULL;
   PyObject *res = NULL;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
   if (PyInt_Check(x) || PyLong_Check(x))
 #else
   if (PyLong_Check(x))
 #endif
     return Py_INCREF(x), x;
   m = Py_TYPE(x)->tp_as_number;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
   if (m && m->nb_int) {
     name = "int";
     res = PyNumber_Int(x);
@@ -4796,7 +5206,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
   }
 #endif
   if (res) {
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (!PyInt_Check(res) && !PyLong_Check(res)) {
 #else
     if (!PyLong_Check(res)) {
@@ -4814,7 +5224,6 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
   }
   return res;
 }
-
 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
   Py_ssize_t ival;
   PyObject* x = PyNumber_Index(b);
@@ -4823,7 +5232,6 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
   Py_DECREF(x);
   return ival;
 }
-
 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
 #if PY_VERSION_HEX < 0x02050000
    if (ival <= LONG_MAX)
@@ -4837,14 +5245,12 @@ static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
    return PyInt_FromSize_t(ival);
 #endif
 }
-
 static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
    unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
-   if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) {
-       return (size_t)-1;
-   } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
-       PyErr_SetString(PyExc_OverflowError,
-                       "value too large to convert to size_t");
+   if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
+       if ((val != (unsigned PY_LONG_LONG)-1) || !PyErr_Occurred())
+           PyErr_SetString(PyExc_OverflowError,
+                           "value too large to convert to size_t");
        return (size_t)-1;
    }
    return (size_t)val;
diff --git a/src/histogram.c b/src/histogram.c
index ba17b06..b2fe3aa 100644
--- a/src/histogram.c
+++ b/src/histogram.c
@@ -1,4 +1,4 @@
-/* Generated by Cython 0.19 on Thu Jul 11 09:13:37 2013 */
+/* Generated by Cython 0.19.2 on Mon Jan  6 15:01:35 2014 */
 
 #define PY_SSIZE_T_CLEAN
 #ifndef CYTHON_USE_PYLONG_INTERNALS
@@ -261,6 +261,17 @@
     #define CYTHON_INLINE
   #endif
 #endif
+#ifndef CYTHON_RESTRICT
+  #if defined(__GNUC__)
+    #define CYTHON_RESTRICT __restrict__
+  #elif defined(_MSC_VER) && _MSC_VER >= 1400
+    #define CYTHON_RESTRICT __restrict
+  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+    #define CYTHON_RESTRICT restrict
+  #else
+    #define CYTHON_RESTRICT
+  #endif
+#endif
 #ifdef NAN
 #define __PYX_NAN() ((float) NAN)
 #else
@@ -1008,6 +1019,14 @@ static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice;
   #define __Pyx_XGOTREF(r)
   #define __Pyx_XGIVEREF(r)
 #endif /* CYTHON_REFNANNY */
+#define __Pyx_XDECREF_SET(r, v) do {                            \
+        PyObject *tmp = (PyObject *) r;                         \
+        r = v; __Pyx_XDECREF(tmp);                              \
+    } while (0)
+#define __Pyx_DECREF_SET(r, v) do {                             \
+        PyObject *tmp = (PyObject *) r;                         \
+        r = v; __Pyx_DECREF(tmp);                               \
+    } while (0)
 #define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
 #define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
 
@@ -1184,6 +1203,11 @@ static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
 static CYTHON_INLINE long __Pyx_div_long(long, long); /* proto */
 
 static PyObject *__pyx_memoryviewslice__get__base(PyObject *__pyx_v_self); /*proto*/
+static void __Pyx_WriteUnraisable(const char *name, int clineno,
+                                  int lineno, const char *filename); /*proto*/
+
+static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
+
 static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
 static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
 
@@ -1373,13 +1397,8 @@ static int __Pyx_ValidateAndInit_memviewslice(
 
 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_double(PyObject *);
 
-static void __Pyx_WriteUnraisable(const char *name, int clineno,
-                                  int lineno, const char *filename); /*proto*/
-
 static int __Pyx_check_binary_version(void);
 
-static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
-
 #if !defined(__Pyx_PyIdentifier_FromString)
 #if PY_MAJOR_VERSION < 3
   #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
@@ -1448,9 +1467,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, cha
 /* Module declarations from 'openmp' */
 
 /* Module declarations from 'histogram' */
+static PyTypeObject *__pyx_memoryview_type = 0;
 static PyTypeObject *__pyx_array_type = 0;
 static PyTypeObject *__pyx_MemviewEnum_type = 0;
-static PyTypeObject *__pyx_memoryview_type = 0;
 static PyTypeObject *__pyx_memoryviewslice_type = 0;
 static PyObject *generic = 0;
 static PyObject *strided = 0;
@@ -1465,7 +1484,7 @@ static PyObject *_unellipsify(PyObject *, int); /*proto*/
 static PyObject *assert_direct_dimensions(Py_ssize_t *, int); /*proto*/
 static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/
 static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int, int); /*proto*/
-static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, int); /*proto*/
+static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/
 static int __pyx_memslice_transpose(__Pyx_memviewslice *); /*proto*/
 static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice, int, PyObject *(*)(char *), int (*)(char *, PyObject *), int); /*proto*/
 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
@@ -1541,9 +1560,9 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_20copy(struct __pyx_me
 static PyObject *__pyx_memoryview_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
 static void __pyx_memoryviewslice_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
 static PyObject *__pyx_memoryviewslice__get__base_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
+static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
 static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
 static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
 static char __pyx_k_2[] = "ndarray is not C contiguous";
 static char __pyx_k_4[] = "ndarray is not Fortran contiguous";
@@ -1551,35 +1570,34 @@ static char __pyx_k_6[] = "Non-native byte order not supported";
 static char __pyx_k_8[] = "unknown dtype code in numpy.pxd (%d)";
 static char __pyx_k_9[] = "Format string allocated too short, see comment in numpy.pxd";
 static char __pyx_k_12[] = "Format string allocated too short.";
-static char __pyx_k_14[] = "unknown dtype code substructure in numpy.pxd (%d)";
-static char __pyx_k_15[] = "Empty shape tuple for cython.array";
-static char __pyx_k_17[] = "itemsize <= 0 for cython.array";
-static char __pyx_k_20[] = "unable to allocate shape or strides.";
-static char __pyx_k_22[] = "Invalid shape in axis %d: %d.";
-static char __pyx_k_23[] = "Invalid mode, expected 'c' or 'fortran', got %s";
-static char __pyx_k_25[] = "unable to allocate array data.";
-static char __pyx_k_27[] = "Can only create a buffer that is contiguous in memory.";
-static char __pyx_k_29[] = "Unable to convert item to object";
-static char __pyx_k_31[] = "Buffer view does not expose strides";
-static char __pyx_k_33[] = "<MemoryView of %r at 0x%x>";
-static char __pyx_k_34[] = "<MemoryView of %r object>";
-static char __pyx_k_37[] = "Cannot index with type '%s'";
-static char __pyx_k_39[] = "Indirect dimensions not supported";
-static char __pyx_k_41[] = "Index out of bounds (axis %d)";
-static char __pyx_k_42[] = "Step may not be zero (axis %d)";
-static char __pyx_k_43[] = "All dimensions preceding dimension %d must be indexed and not sliced";
-static char __pyx_k_44[] = "Out of bounds on buffer access (axis %d)";
-static char __pyx_k_45[] = "Cannot transpose memoryview with indirect dimensions";
-static char __pyx_k_46[] = "got differing extents in dimension %d (got %d and %d)";
-static char __pyx_k_47[] = "Dimension %d is not direct";
-static char __pyx_k_48[] = "Jerome Kieffer";
-static char __pyx_k_51[] = "/users/kieffer/workspace-ssd/pyFAI/src/histogram.pyx";
-static char __pyx_k_54[] = "getbuffer(obj, view, flags)";
-static char __pyx_k_55[] = "<strided and direct or indirect>";
-static char __pyx_k_57[] = "<strided and direct>";
-static char __pyx_k_59[] = "<strided and indirect>";
-static char __pyx_k_61[] = "<contiguous and direct>";
-static char __pyx_k_63[] = "<contiguous and indirect>";
+static char __pyx_k_14[] = "Empty shape tuple for cython.array";
+static char __pyx_k_16[] = "itemsize <= 0 for cython.array";
+static char __pyx_k_19[] = "unable to allocate shape or strides.";
+static char __pyx_k_21[] = "Invalid shape in axis %d: %d.";
+static char __pyx_k_22[] = "Invalid mode, expected 'c' or 'fortran', got %s";
+static char __pyx_k_24[] = "unable to allocate array data.";
+static char __pyx_k_26[] = "Can only create a buffer that is contiguous in memory.";
+static char __pyx_k_28[] = "Unable to convert item to object";
+static char __pyx_k_30[] = "Buffer view does not expose strides";
+static char __pyx_k_32[] = "<MemoryView of %r at 0x%x>";
+static char __pyx_k_33[] = "<MemoryView of %r object>";
+static char __pyx_k_36[] = "Cannot index with type '%s'";
+static char __pyx_k_38[] = "Indirect dimensions not supported";
+static char __pyx_k_40[] = "Index out of bounds (axis %d)";
+static char __pyx_k_41[] = "Step may not be zero (axis %d)";
+static char __pyx_k_42[] = "All dimensions preceding dimension %d must be indexed and not sliced";
+static char __pyx_k_43[] = "Out of bounds on buffer access (axis %d)";
+static char __pyx_k_44[] = "Cannot transpose memoryview with indirect dimensions";
+static char __pyx_k_45[] = "got differing extents in dimension %d (got %d and %d)";
+static char __pyx_k_46[] = "Dimension %d is not direct";
+static char __pyx_k_47[] = "Jerome Kieffer";
+static char __pyx_k_50[] = "/users/kieffer/workspace-ssd/pyFAI/src/histogram.pyx";
+static char __pyx_k_53[] = "getbuffer(obj, view, flags)";
+static char __pyx_k_54[] = "<strided and direct or indirect>";
+static char __pyx_k_56[] = "<strided and direct>";
+static char __pyx_k_58[] = "<strided and indirect>";
+static char __pyx_k_60[] = "<contiguous and direct>";
+static char __pyx_k_62[] = "<contiguous and indirect>";
 static char __pyx_k__B[] = "B";
 static char __pyx_k__H[] = "H";
 static char __pyx_k__I[] = "I";
@@ -1611,7 +1629,6 @@ static char __pyx_k__eps[] = "eps";
 static char __pyx_k__idx[] = "idx";
 static char __pyx_k__max[] = "max";
 static char __pyx_k__min[] = "min";
-static char __pyx_k__num[] = "num";
 static char __pyx_k__obj[] = "obj";
 static char __pyx_k__pos[] = "pos";
 static char __pyx_k__sys[] = "sys";
@@ -1725,6 +1742,7 @@ static char __pyx_k__RuntimeError[] = "RuntimeError";
 static char __pyx_k__bin_edge_max[] = "bin_edge_max";
 static char __pyx_k__bin_edge_min[] = "bin_edge_min";
 static char __pyx_k__inv_bin_width[] = "inv_bin_width";
+static char __pyx_k____pyx_vtable__[] = "__pyx_vtable__";
 static char __pyx_k____pyx_getbuffer[] = "__pyx_getbuffer";
 static char __pyx_k__allocate_buffer[] = "allocate_buffer";
 static char __pyx_k__dtype_is_object[] = "dtype_is_object";
@@ -1732,32 +1750,31 @@ static char __pyx_k__pixelSize_in_Pos[] = "pixelSize_in_Pos";
 static char __pyx_k__ascontiguousarray[] = "ascontiguousarray";
 static char __pyx_k____pyx_releasebuffer[] = "__pyx_releasebuffer";
 static PyObject *__pyx_kp_u_12;
-static PyObject *__pyx_kp_u_14;
-static PyObject *__pyx_kp_s_15;
-static PyObject *__pyx_kp_s_17;
+static PyObject *__pyx_kp_s_14;
+static PyObject *__pyx_kp_s_16;
+static PyObject *__pyx_kp_s_19;
 static PyObject *__pyx_kp_u_2;
-static PyObject *__pyx_kp_s_20;
+static PyObject *__pyx_kp_s_21;
 static PyObject *__pyx_kp_s_22;
-static PyObject *__pyx_kp_s_23;
-static PyObject *__pyx_kp_s_25;
-static PyObject *__pyx_kp_s_27;
-static PyObject *__pyx_kp_s_29;
-static PyObject *__pyx_kp_s_31;
+static PyObject *__pyx_kp_s_24;
+static PyObject *__pyx_kp_s_26;
+static PyObject *__pyx_kp_s_28;
+static PyObject *__pyx_kp_s_30;
+static PyObject *__pyx_kp_s_32;
 static PyObject *__pyx_kp_s_33;
-static PyObject *__pyx_kp_s_34;
-static PyObject *__pyx_kp_s_37;
-static PyObject *__pyx_kp_s_39;
+static PyObject *__pyx_kp_s_36;
+static PyObject *__pyx_kp_s_38;
 static PyObject *__pyx_kp_u_4;
-static PyObject *__pyx_kp_s_44;
-static PyObject *__pyx_kp_s_46;
-static PyObject *__pyx_kp_s_48;
-static PyObject *__pyx_kp_s_51;
-static PyObject *__pyx_kp_s_55;
-static PyObject *__pyx_kp_s_57;
-static PyObject *__pyx_kp_s_59;
+static PyObject *__pyx_kp_s_43;
+static PyObject *__pyx_kp_s_45;
+static PyObject *__pyx_kp_s_47;
+static PyObject *__pyx_kp_s_50;
+static PyObject *__pyx_kp_s_54;
+static PyObject *__pyx_kp_s_56;
+static PyObject *__pyx_kp_s_58;
 static PyObject *__pyx_kp_u_6;
-static PyObject *__pyx_kp_s_61;
-static PyObject *__pyx_kp_s_63;
+static PyObject *__pyx_kp_s_60;
+static PyObject *__pyx_kp_s_62;
 static PyObject *__pyx_kp_u_8;
 static PyObject *__pyx_kp_u_9;
 static PyObject *__pyx_kp_s__20130711;
@@ -1778,6 +1795,7 @@ static PyObject *__pyx_n_s____main__;
 static PyObject *__pyx_n_s____name__;
 static PyObject *__pyx_n_s____pyx_getbuffer;
 static PyObject *__pyx_n_s____pyx_releasebuffer;
+static PyObject *__pyx_n_s____pyx_vtable__;
 static PyObject *__pyx_n_s____test__;
 static PyObject *__pyx_n_s__a;
 static PyObject *__pyx_n_s__aera;
@@ -1867,7 +1885,6 @@ static PyObject *__pyx_n_s__mode;
 static PyObject *__pyx_n_s__name;
 static PyObject *__pyx_n_s__ndim;
 static PyObject *__pyx_n_s__nthread;
-static PyObject *__pyx_n_s__num;
 static PyObject *__pyx_n_s__numpy;
 static PyObject *__pyx_n_s__obj;
 static PyObject *__pyx_n_s__outCount;
@@ -1911,28 +1928,28 @@ static PyObject *__pyx_k_tuple_7;
 static PyObject *__pyx_k_tuple_10;
 static PyObject *__pyx_k_tuple_11;
 static PyObject *__pyx_k_tuple_13;
-static PyObject *__pyx_k_tuple_16;
+static PyObject *__pyx_k_tuple_15;
+static PyObject *__pyx_k_tuple_17;
 static PyObject *__pyx_k_tuple_18;
-static PyObject *__pyx_k_tuple_19;
-static PyObject *__pyx_k_tuple_21;
-static PyObject *__pyx_k_tuple_24;
-static PyObject *__pyx_k_tuple_26;
-static PyObject *__pyx_k_tuple_28;
-static PyObject *__pyx_k_tuple_30;
-static PyObject *__pyx_k_tuple_32;
+static PyObject *__pyx_k_tuple_20;
+static PyObject *__pyx_k_tuple_23;
+static PyObject *__pyx_k_tuple_25;
+static PyObject *__pyx_k_tuple_27;
+static PyObject *__pyx_k_tuple_29;
+static PyObject *__pyx_k_tuple_31;
+static PyObject *__pyx_k_tuple_34;
 static PyObject *__pyx_k_tuple_35;
-static PyObject *__pyx_k_tuple_36;
-static PyObject *__pyx_k_tuple_38;
-static PyObject *__pyx_k_tuple_40;
-static PyObject *__pyx_k_tuple_49;
-static PyObject *__pyx_k_tuple_52;
-static PyObject *__pyx_k_tuple_56;
-static PyObject *__pyx_k_tuple_58;
-static PyObject *__pyx_k_tuple_60;
-static PyObject *__pyx_k_tuple_62;
-static PyObject *__pyx_k_tuple_64;
-static PyObject *__pyx_k_codeobj_50;
-static PyObject *__pyx_k_codeobj_53;
+static PyObject *__pyx_k_tuple_37;
+static PyObject *__pyx_k_tuple_39;
+static PyObject *__pyx_k_tuple_48;
+static PyObject *__pyx_k_tuple_51;
+static PyObject *__pyx_k_tuple_55;
+static PyObject *__pyx_k_tuple_57;
+static PyObject *__pyx_k_tuple_59;
+static PyObject *__pyx_k_tuple_61;
+static PyObject *__pyx_k_tuple_63;
+static PyObject *__pyx_k_codeobj_49;
+static PyObject *__pyx_k_codeobj_52;
 
 /* Python wrapper */
 static PyObject *__pyx_pw_9histogram_1histogram(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
@@ -2154,8 +2171,8 @@ static PyObject *__pyx_pf_9histogram_histogram(CYTHON_UNUSED PyObject *__pyx_sel
   PyArrayObject *__pyx_t_11 = NULL;
   PyArrayObject *__pyx_t_12 = NULL;
   PyArrayObject *__pyx_t_13 = NULL;
-  double __pyx_t_14;
-  int __pyx_t_15;
+  int __pyx_t_14;
+  double __pyx_t_15;
   int __pyx_t_16;
   int __pyx_t_17;
   long __pyx_t_18;
@@ -2220,7 +2237,7 @@ static PyObject *__pyx_pf_9histogram_histogram(CYTHON_UNUSED PyObject *__pyx_sel
  *     cdef double[:] cpos = numpy.ascontiguousarray(pos.ravel(),dtype=numpy.float64)
  */
   #ifndef CYTHON_WITHOUT_ASSERTIONS
-  if (unlikely(!(__pyx_v_bins > 1))) {
+  if (unlikely(!((__pyx_v_bins > 1) != 0))) {
     PyErr_SetNone(PyExc_AssertionError);
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
@@ -2497,7 +2514,8 @@ static PyObject *__pyx_pf_9histogram_histogram(CYTHON_UNUSED PyObject *__pyx_sel
  *         bin_edge_max = bin_range[1] * EPS32
  */
   __pyx_t_4 = (__pyx_v_bin_range != Py_None);
-  if (__pyx_t_4) {
+  __pyx_t_14 = (__pyx_t_4 != 0);
+  if (__pyx_t_14) {
 
     /* "histogram.pyx":75
  *     cdef double bin_edge_min, bin_edge_max
@@ -2508,9 +2526,9 @@ static PyObject *__pyx_pf_9histogram_histogram(CYTHON_UNUSED PyObject *__pyx_sel
  */
     __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_t_15 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_15 == (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;
+    __pyx_v_bin_edge_min = __pyx_t_15;
 
     /* "histogram.pyx":76
  *     if bin_range is not None:
@@ -2527,9 +2545,9 @@ static PyObject *__pyx_pf_9histogram_histogram(CYTHON_UNUSED PyObject *__pyx_sel
     __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_t_15 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_15 == (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;
+    __pyx_v_bin_edge_max = __pyx_t_15;
     goto __pyx_L3;
   }
   /*else*/ {
@@ -2546,9 +2564,9 @@ static PyObject *__pyx_pf_9histogram_histogram(CYTHON_UNUSED PyObject *__pyx_sel
     __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_t_15 = __pyx_PyFloat_AsDouble(__pyx_t_6); if (unlikely((__pyx_t_15 == (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;
+    __pyx_v_bin_edge_min = __pyx_t_15;
 
     /* "histogram.pyx":79
  *     else:
@@ -2568,9 +2586,9 @@ static PyObject *__pyx_pf_9histogram_histogram(CYTHON_UNUSED PyObject *__pyx_sel
     __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_t_15 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_15 == (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_v_bin_edge_max = __pyx_t_15;
   }
   __pyx_L3:;
 
@@ -2716,7 +2734,8 @@ static PyObject *__pyx_pf_9histogram_histogram(CYTHON_UNUSED PyObject *__pyx_sel
  *         if isinstance(nthread, int) and (nthread > 0):
  *             omp_set_num_threads(< int > nthread)
  */
-  __pyx_t_4 = (__pyx_v_nthread != Py_None);
+  __pyx_t_14 = (__pyx_v_nthread != Py_None);
+  __pyx_t_4 = (__pyx_t_14 != 0);
   if (__pyx_t_4) {
 
     /* "histogram.pyx":97
@@ -2729,9 +2748,9 @@ static PyObject *__pyx_pf_9histogram_histogram(CYTHON_UNUSED PyObject *__pyx_sel
     __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_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_14 < 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;
+      __pyx_t_16 = __pyx_t_14;
     } else {
       __pyx_t_16 = __pyx_t_4;
     }
@@ -2809,7 +2828,8 @@ static PyObject *__pyx_pf_9histogram_histogram(CYTHON_UNUSED PyObject *__pyx_sel
  *         inv_dbin2 = 4.0
  */
   __pyx_t_16 = (__pyx_v_pixelSize_in_Pos == Py_None);
-  if (__pyx_t_16) {
+  __pyx_t_4 = (__pyx_t_16 != 0);
+  if (__pyx_t_4) {
 
     /* "histogram.pyx":105
  *     cdef double * bigData = < double *> calloc(bins * omp_get_max_threads(), sizeof(double))
@@ -2840,15 +2860,16 @@ static PyObject *__pyx_pf_9histogram_histogram(CYTHON_UNUSED PyObject *__pyx_sel
  */
   __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;
+  __pyx_t_4 = PyInt_Check(__pyx_t_1); 
+  if (!__pyx_t_4) {
+    __pyx_t_16 = PyFloat_Check(__pyx_t_1); 
+    __pyx_t_14 = __pyx_t_16;
   } else {
-    __pyx_t_15 = __pyx_t_16;
+    __pyx_t_14 = __pyx_t_4;
   }
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (__pyx_t_15) {
+  __pyx_t_4 = (__pyx_t_14 != 0);
+  if (__pyx_t_4) {
 
     /* "histogram.pyx":108
  *         inv_dbin2 = 4.0
@@ -2857,8 +2878,8 @@ static PyObject *__pyx_pf_9histogram_histogram(CYTHON_UNUSED PyObject *__pyx_sel
  *         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);
+    __pyx_t_15 = __pyx_PyFloat_AsDouble(__pyx_v_pixelSize_in_Pos); if (unlikely((__pyx_t_15 == (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_15)) * __pyx_v_inv_bin_width);
 
     /* "histogram.pyx":109
  *     elif isinstance(pixelSize_in_Pos, (int, float)):
@@ -2867,8 +2888,8 @@ static PyObject *__pyx_pf_9histogram_histogram(CYTHON_UNUSED PyObject *__pyx_sel
  *             inv_dbin2 = 1 / dbin / dbin
  *         else:
  */
-    __pyx_t_15 = (__pyx_v_dbin > 0.0);
-    if (__pyx_t_15) {
+    __pyx_t_4 = ((__pyx_v_dbin > 0.0) != 0);
+    if (__pyx_t_4) {
 
       /* "histogram.pyx":110
  *         dbin = 0.5 * (< double > pixelSize_in_Pos) * inv_bin_width
@@ -2902,8 +2923,9 @@ static PyObject *__pyx_pf_9histogram_histogram(CYTHON_UNUSED PyObject *__pyx_sel
  *         pass #TODO
  * 
  */
-  __pyx_t_15 = __Pyx_TypeCheck(__pyx_v_pixelSize_in_Pos, ((PyObject*)__pyx_ptype_5numpy_ndarray)); 
-  if (__pyx_t_15) {
+  __pyx_t_4 = __Pyx_TypeCheck(__pyx_v_pixelSize_in_Pos, ((PyObject*)__pyx_ptype_5numpy_ndarray)); 
+  __pyx_t_14 = (__pyx_t_4 != 0);
+  if (__pyx_t_14) {
     goto __pyx_L7;
   }
   __pyx_L7:;
@@ -2931,9 +2953,9 @@ static PyObject *__pyx_pf_9histogram_histogram(CYTHON_UNUSED PyObject *__pyx_sel
   __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_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_14 < 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) {
+  if (!__pyx_t_14) {
     __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;}
@@ -2950,13 +2972,13 @@ static PyObject *__pyx_pf_9histogram_histogram(CYTHON_UNUSED PyObject *__pyx_sel
     __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_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 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;
+    __pyx_t_16 = __pyx_t_4;
   } else {
-    __pyx_t_4 = __pyx_t_15;
+    __pyx_t_16 = __pyx_t_14;
   }
-  if (__pyx_t_4) {
+  if (__pyx_t_16) {
 
     /* "histogram.pyx":117
  * 
@@ -3013,26 +3035,26 @@ static PyObject *__pyx_pf_9histogram_histogram(CYTHON_UNUSED PyObject *__pyx_sel
             if (__pyx_t_19 > 0)
             {
                 #ifdef _OPENMP
-                #pragma omp parallel private(__pyx_t_4, __pyx_t_20, __pyx_t_16, __pyx_t_21, __pyx_t_15, __pyx_t_22)
+                #pragma omp parallel private(__pyx_t_14, __pyx_t_4, __pyx_t_20, __pyx_t_16, __pyx_t_21, __pyx_t_22)
                 #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)
+                    #pragma omp for lastprivate(__pyx_v_dtmp) lastprivate(__pyx_v_ffbin) lastprivate(__pyx_v_dest) lastprivate(__pyx_v_fbin) lastprivate(__pyx_v_dIntR) lastprivate(__pyx_v_a) lastprivate(__pyx_v_bin) lastprivate(__pyx_v_d) lastprivate(__pyx_v_dIntL) lastprivate(__pyx_v_dInt) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i)
                     #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_dest = ((long)0xbad0bad0);
                             __pyx_v_fbin = ((double)__PYX_NAN());
-                            __pyx_v_bin = ((long)0xbad0bad0);
                             __pyx_v_dIntR = ((double)__PYX_NAN());
+                            __pyx_v_a = ((double)__PYX_NAN());
+                            __pyx_v_bin = ((long)0xbad0bad0);
                             __pyx_v_d = ((double)__PYX_NAN());
-                            __pyx_v_dInt = ((double)__PYX_NAN());
-                            __pyx_v_dest = ((long)0xbad0bad0);
                             __pyx_v_dIntL = ((double)__PYX_NAN());
+                            __pyx_v_dInt = ((double)__PYX_NAN());
 
                             /* "histogram.pyx":122
  *     with nogil:
@@ -3061,14 +3083,14 @@ static PyObject *__pyx_pf_9histogram_histogram(CYTHON_UNUSED PyObject *__pyx_sel
  *                 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;
+                            __pyx_t_16 = ((__pyx_v_a < __pyx_v_bin_edge_min) != 0);
+                            if (!__pyx_t_16) {
+                              __pyx_t_14 = ((__pyx_v_a > __pyx_v_bin_edge_max) != 0);
+                              __pyx_t_4 = __pyx_t_14;
                             } else {
-                              __pyx_t_16 = __pyx_t_4;
+                              __pyx_t_4 = __pyx_t_16;
                             }
-                            if (__pyx_t_16) {
+                            if (__pyx_t_4) {
 
                               /* "histogram.pyx":125
  *             a = cpos[i]
@@ -3134,8 +3156,8 @@ static PyObject *__pyx_pf_9histogram_histogram(CYTHON_UNUSED PyObject *__pyx_sel
  *                 dtmp = ffbin - (fbin - dbin)
  *                 if dtmp > 0:
  */
-                            __pyx_t_16 = (__pyx_v_bin > 0);
-                            if (__pyx_t_16) {
+                            __pyx_t_4 = ((__pyx_v_bin > 0) != 0);
+                            if (__pyx_t_4) {
 
                               /* "histogram.pyx":132
  *             dInt = 1.0
@@ -3153,8 +3175,8 @@ static PyObject *__pyx_pf_9histogram_histogram(CYTHON_UNUSED PyObject *__pyx_sel
  *                     dIntL = 0.5 * dtmp * dtmp * inv_dbin2
  *                     dInt = dInt - dIntL
  */
-                              __pyx_t_16 = (__pyx_v_dtmp > 0.0);
-                              if (__pyx_t_16) {
+                              __pyx_t_4 = ((__pyx_v_dtmp > 0.0) != 0);
+                              if (__pyx_t_4) {
 
                                 /* "histogram.pyx":134
  *                 dtmp = ffbin - (fbin - dbin)
@@ -3207,8 +3229,8 @@ static PyObject *__pyx_pf_9histogram_histogram(CYTHON_UNUSED PyObject *__pyx_sel
  *                 dtmp = fbin + dbin - ffbin - 1
  *                 if dtmp > 0 :
  */
-                            __pyx_t_16 = (__pyx_v_bin < (__pyx_v_bins - 1));
-                            if (__pyx_t_16) {
+                            __pyx_t_4 = ((__pyx_v_bin < (__pyx_v_bins - 1)) != 0);
+                            if (__pyx_t_4) {
 
                               /* "histogram.pyx":140
  * 
@@ -3226,8 +3248,8 @@ static PyObject *__pyx_pf_9histogram_histogram(CYTHON_UNUSED PyObject *__pyx_sel
  *                     dIntR = 0.5 * dtmp * dtmp * inv_dbin2
  *                     dInt = dInt - dIntR
  */
-                              __pyx_t_16 = (__pyx_v_dtmp > 0.0);
-                              if (__pyx_t_16) {
+                              __pyx_t_4 = ((__pyx_v_dtmp > 0.0) != 0);
+                              if (__pyx_t_4) {
 
                                 /* "histogram.pyx":142
  *                 dtmp = fbin + dbin - ffbin - 1
@@ -3328,11 +3350,11 @@ static PyObject *__pyx_pf_9histogram_histogram(CYTHON_UNUSED PyObject *__pyx_sel
             if (__pyx_t_5 > 0)
             {
                 #ifdef _OPENMP
-                #pragma omp parallel reduction(+:__pyx_v_tmp_count) reduction(+:__pyx_v_tmp_data) private(__pyx_t_26, __pyx_t_23, __pyx_t_17, __pyx_t_27, __pyx_t_24, __pyx_t_16, __pyx_t_25, __pyx_t_22)
+                #pragma omp parallel reduction(+:__pyx_v_tmp_count) reduction(+:__pyx_v_tmp_data) private(__pyx_t_26, __pyx_t_27, __pyx_t_23, __pyx_t_17, __pyx_t_4, __pyx_t_24, __pyx_t_25, __pyx_t_22)
                 #endif /* _OPENMP */
                 {
                     #ifdef _OPENMP
-                    #pragma omp for firstprivate(__pyx_v_idx) lastprivate(__pyx_v_idx) lastprivate(__pyx_v_t) lastprivate(__pyx_v_dest)
+                    #pragma omp for lastprivate(__pyx_v_t) firstprivate(__pyx_v_idx) lastprivate(__pyx_v_idx) lastprivate(__pyx_v_dest)
                     #endif /* _OPENMP */
                     for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_5; __pyx_t_18++){
                         {
@@ -3436,8 +3458,8 @@ static PyObject *__pyx_pf_9histogram_histogram(CYTHON_UNUSED PyObject *__pyx_sel
  *             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) {
+                            __pyx_t_4 = (((*__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) != 0);
+                            if (__pyx_t_4) {
 
                               /* "histogram.pyx":160
  *             outData[idx] += tmp_data
@@ -4087,7 +4109,7 @@ static PyObject *__pyx_pf_9histogram_2histogram2d(CYTHON_UNUSED PyObject *__pyx_
  *         bin0 = 1
  *     if bin1 <= 0:
  */
-  __pyx_t_4 = (__pyx_v_bin0 <= 0);
+  __pyx_t_4 = ((__pyx_v_bin0 <= 0) != 0);
   if (__pyx_t_4) {
 
     /* "histogram.pyx":202
@@ -4109,7 +4131,7 @@ static PyObject *__pyx_pf_9histogram_2histogram2d(CYTHON_UNUSED PyObject *__pyx_
  *         bin1 = 1
  *     cdef int csplit = split
  */
-  __pyx_t_4 = (__pyx_v_bin1 <= 0);
+  __pyx_t_4 = ((__pyx_v_bin1 <= 0) != 0);
   if (__pyx_t_4) {
 
     /* "histogram.pyx":204
@@ -4647,7 +4669,8 @@ static PyObject *__pyx_pf_9histogram_2histogram2d(CYTHON_UNUSED PyObject *__pyx_
  *             omp_set_num_threads(< int > nthread)
  */
   __pyx_t_4 = (__pyx_v_nthread != Py_None);
-  if (__pyx_t_4) {
+  __pyx_t_22 = (__pyx_t_4 != 0);
+  if (__pyx_t_22) {
 
     /* "histogram.pyx":226
  *     edges1 = numpy.linspace(min1+(0.5/idp1),max1-(0.5/idp1),bin1)
@@ -4656,14 +4679,14 @@ static PyObject *__pyx_pf_9histogram_2histogram2d(CYTHON_UNUSED PyObject *__pyx_
  *             omp_set_num_threads(< int > nthread)
  *     with nogil:
  */
-    __pyx_t_4 = PyInt_Check(__pyx_v_nthread); 
-    if (__pyx_t_4) {
+    __pyx_t_22 = PyInt_Check(__pyx_v_nthread); 
+    if (__pyx_t_22) {
       __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_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_4 < 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;
+    } else {
+      __pyx_t_23 = __pyx_t_22;
     }
     if (__pyx_t_23) {
 
@@ -4781,7 +4804,7 @@ static PyObject *__pyx_pf_9histogram_2histogram2d(CYTHON_UNUSED PyObject *__pyx_
  *                 b0 = bin0 - 1
  *                 fbin0 = (< double > bin0) - 0.5
  */
-          __pyx_t_23 = (__pyx_v_b0 == __pyx_v_bin0);
+          __pyx_t_23 = ((__pyx_v_b0 == __pyx_v_bin0) != 0);
           if (__pyx_t_23) {
 
             /* "histogram.pyx":238
@@ -4811,7 +4834,7 @@ static PyObject *__pyx_pf_9histogram_2histogram2d(CYTHON_UNUSED PyObject *__pyx_
  *                 fbin0 = 0.5
  *             if b1 == bin1:
  */
-          __pyx_t_23 = (__pyx_v_b0 == 0);
+          __pyx_t_23 = ((__pyx_v_b0 == 0) != 0);
           if (__pyx_t_23) {
 
             /* "histogram.pyx":241
@@ -4833,7 +4856,7 @@ static PyObject *__pyx_pf_9histogram_2histogram2d(CYTHON_UNUSED PyObject *__pyx_
  *                 b1 = bin1 - 1
  *                 fbin1 = (< double > bin1) - 0.5
  */
-          __pyx_t_23 = (__pyx_v_b1 == __pyx_v_bin1);
+          __pyx_t_23 = ((__pyx_v_b1 == __pyx_v_bin1) != 0);
           if (__pyx_t_23) {
 
             /* "histogram.pyx":243
@@ -4863,7 +4886,7 @@ static PyObject *__pyx_pf_9histogram_2histogram2d(CYTHON_UNUSED PyObject *__pyx_
  *                 fbin1 = 0.5
  * 
  */
-          __pyx_t_23 = (__pyx_v_b1 == 0);
+          __pyx_t_23 = ((__pyx_v_b1 == 0) != 0);
           if (__pyx_t_23) {
 
             /* "histogram.pyx":246
@@ -4930,7 +4953,7 @@ static PyObject *__pyx_pf_9histogram_2histogram2d(CYTHON_UNUSED PyObject *__pyx_
  *                 if delta0l < 0 and b0 > 0:
  *                     if delta1l < 0 and b1 > 0:
  */
-          __pyx_t_23 = (__pyx_v_csplit == 1);
+          __pyx_t_23 = ((__pyx_v_csplit == 1) != 0);
           if (__pyx_t_23) {
 
             /* "histogram.pyx":254
@@ -4940,14 +4963,14 @@ static PyObject *__pyx_pf_9histogram_2histogram2d(CYTHON_UNUSED PyObject *__pyx_
  *                     if delta1l < 0 and b1 > 0:
  *                         area = delta0l * delta1l
  */
-            __pyx_t_23 = (__pyx_v_delta0l < 0.0);
+            __pyx_t_23 = ((__pyx_v_delta0l < 0.0) != 0);
             if (__pyx_t_23) {
-              __pyx_t_4 = (__pyx_v_b0 > 0);
-              __pyx_t_22 = __pyx_t_4;
+              __pyx_t_22 = ((__pyx_v_b0 > 0) != 0);
+              __pyx_t_4 = __pyx_t_22;
             } else {
-              __pyx_t_22 = __pyx_t_23;
+              __pyx_t_4 = __pyx_t_23;
             }
-            if (__pyx_t_22) {
+            if (__pyx_t_4) {
 
               /* "histogram.pyx":255
  *             if csplit == 1:
@@ -4956,14 +4979,14 @@ static PyObject *__pyx_pf_9histogram_2histogram2d(CYTHON_UNUSED PyObject *__pyx_
  *                         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;
+              __pyx_t_4 = ((__pyx_v_delta1l < 0.0) != 0);
+              if (__pyx_t_4) {
+                __pyx_t_23 = ((__pyx_v_b1 > 0) != 0);
+                __pyx_t_22 = __pyx_t_23;
               } else {
-                __pyx_t_4 = __pyx_t_22;
+                __pyx_t_22 = __pyx_t_4;
               }
-              if (__pyx_t_4) {
+              if (__pyx_t_22) {
 
                 /* "histogram.pyx":256
  *                 if delta0l < 0 and b0 > 0:
@@ -5094,12 +5117,12 @@ static PyObject *__pyx_pf_9histogram_2histogram2d(CYTHON_UNUSED PyObject *__pyx_
  *                         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_22 = ((__pyx_v_delta1r > 0.0) != 0);
+              if (__pyx_t_22) {
+                __pyx_t_4 = ((__pyx_v_b1 < (__pyx_v_bin1 - 1)) != 0);
                 __pyx_t_23 = __pyx_t_4;
+              } else {
+                __pyx_t_23 = __pyx_t_22;
               }
               if (__pyx_t_23) {
 
@@ -5235,14 +5258,14 @@ static PyObject *__pyx_pf_9histogram_2histogram2d(CYTHON_UNUSED PyObject *__pyx_
  *                     if delta1l < 0 and b1 > 0:
  *                         area = -delta0r * delta1l
  */
-            __pyx_t_23 = (__pyx_v_delta0r > 0.0);
+            __pyx_t_23 = ((__pyx_v_delta0r > 0.0) != 0);
             if (__pyx_t_23) {
-              __pyx_t_4 = (__pyx_v_b0 < (__pyx_v_bin0 - 1));
-              __pyx_t_22 = __pyx_t_4;
+              __pyx_t_22 = ((__pyx_v_b0 < (__pyx_v_bin0 - 1)) != 0);
+              __pyx_t_4 = __pyx_t_22;
             } else {
-              __pyx_t_22 = __pyx_t_23;
+              __pyx_t_4 = __pyx_t_23;
             }
-            if (__pyx_t_22) {
+            if (__pyx_t_4) {
 
               /* "histogram.pyx":287
  *                         outData[b0 , b1 + 1 ] += area * d
@@ -5251,14 +5274,14 @@ static PyObject *__pyx_pf_9histogram_2histogram2d(CYTHON_UNUSED PyObject *__pyx_
  *                         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;
+              __pyx_t_4 = ((__pyx_v_delta1l < 0.0) != 0);
+              if (__pyx_t_4) {
+                __pyx_t_23 = ((__pyx_v_b1 > 0) != 0);
+                __pyx_t_22 = __pyx_t_23;
               } else {
-                __pyx_t_4 = __pyx_t_22;
+                __pyx_t_22 = __pyx_t_4;
               }
-              if (__pyx_t_4) {
+              if (__pyx_t_22) {
 
                 /* "histogram.pyx":288
  *                 elif delta0r > 0 and b0 < bin0 - 1:
@@ -5389,12 +5412,12 @@ static PyObject *__pyx_pf_9histogram_2histogram2d(CYTHON_UNUSED PyObject *__pyx_
  *                         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_22 = ((__pyx_v_delta1r > 0.0) != 0);
+              if (__pyx_t_22) {
+                __pyx_t_4 = ((__pyx_v_b1 < (__pyx_v_bin1 - 1)) != 0);
                 __pyx_t_23 = __pyx_t_4;
+              } else {
+                __pyx_t_23 = __pyx_t_22;
               }
               if (__pyx_t_23) {
 
@@ -5570,7 +5593,7 @@ static PyObject *__pyx_pf_9histogram_2histogram2d(CYTHON_UNUSED PyObject *__pyx_
             if (__pyx_t_79 > 0)
             {
                 #ifdef _OPENMP
-                #pragma omp parallel private(__pyx_t_86, __pyx_t_91, __pyx_t_83, __pyx_t_88, __pyx_t_23, __pyx_t_87, __pyx_t_80, __pyx_t_89, __pyx_t_84, __pyx_t_81, __pyx_t_85, __pyx_t_82, __pyx_t_90)
+                #pragma omp parallel private(__pyx_t_86, __pyx_t_83, __pyx_t_88, __pyx_t_23, __pyx_t_87, __pyx_t_91, __pyx_t_80, __pyx_t_89, __pyx_t_84, __pyx_t_81, __pyx_t_85, __pyx_t_82, __pyx_t_90)
                 #endif /* _OPENMP */
                 {
                     #ifdef _OPENMP
@@ -5602,7 +5625,7 @@ static PyObject *__pyx_pf_9histogram_2histogram2d(CYTHON_UNUSED PyObject *__pyx_
  */
                               __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);
+                              __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) != 0);
                               if (__pyx_t_23) {
 
                                 /* "histogram.pyx":324
@@ -5789,7 +5812,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  * 
  *             cdef int copy_shape, i, ndim
  */
-  __pyx_t_1 = (__pyx_v_info == NULL);
+  __pyx_t_1 = ((__pyx_v_info == NULL) != 0);
   if (__pyx_t_1) {
     __pyx_r = 0;
     goto __pyx_L0;
@@ -5831,7 +5854,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 copy_shape = 1
  *             else:
  */
-  __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t)));
+  __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":209
@@ -5864,7 +5887,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
  *                 raise ValueError(u"ndarray is not C contiguous")
  */
-  __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS);
+  __pyx_t_1 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":214
@@ -5874,7 +5897,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 raise ValueError(u"ndarray is not C contiguous")
  * 
  */
-    __pyx_t_2 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS));
+    __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS) != 0)) != 0);
     __pyx_t_3 = __pyx_t_2;
   } else {
     __pyx_t_3 = __pyx_t_1;
@@ -5904,7 +5927,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
  *                 raise ValueError(u"ndarray is not Fortran contiguous")
  */
-  __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS);
+  __pyx_t_3 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0);
   if (__pyx_t_3) {
 
     /* "numpy.pxd":218
@@ -5914,7 +5937,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 raise ValueError(u"ndarray is not Fortran contiguous")
  * 
  */
-    __pyx_t_1 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS));
+    __pyx_t_1 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS) != 0)) != 0);
     __pyx_t_2 = __pyx_t_1;
   } else {
     __pyx_t_2 = __pyx_t_3;
@@ -5962,7 +5985,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 # Allocate new buffer for strides and shape info.
  *                 # This is allocated as one block, strides first.
  */
-  if (__pyx_v_copy_shape) {
+  __pyx_t_2 = (__pyx_v_copy_shape != 0);
+  if (__pyx_t_2) {
 
     /* "numpy.pxd":226
  *                 # Allocate new buffer for strides and shape info.
@@ -6060,7 +6084,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  * 
  *             cdef int t
  */
-  __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self));
+  __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0));
 
   /* "numpy.pxd":239
  * 
@@ -6086,34 +6110,27 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
   /* "numpy.pxd":244
  *             cdef int offset
  * 
- *             cdef bint hasfields = PyDataType_HASFIELDS(descr) or descr.type_num == NPY_VOID             # <<<<<<<<<<<<<<
+ *             cdef bint hasfields = PyDataType_HASFIELDS(descr)             # <<<<<<<<<<<<<<
  * 
  *             if not hasfields and not copy_shape:
  */
-  __pyx_t_2 = PyDataType_HASFIELDS(__pyx_v_descr);
-  if (!__pyx_t_2) {
-    __pyx_t_3 = (__pyx_v_descr->type_num == NPY_VOID);
-    __pyx_t_1 = __pyx_t_3;
-  } else {
-    __pyx_t_1 = __pyx_t_2;
-  }
-  __pyx_v_hasfields = __pyx_t_1;
+  __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr);
 
   /* "numpy.pxd":246
- *             cdef bint hasfields = PyDataType_HASFIELDS(descr) or descr.type_num == NPY_VOID
+ *             cdef bint hasfields = PyDataType_HASFIELDS(descr)
  * 
  *             if not hasfields and not copy_shape:             # <<<<<<<<<<<<<<
  *                 # do not call releasebuffer
  *                 info.obj = None
  */
-  __pyx_t_1 = (!__pyx_v_hasfields);
-  if (__pyx_t_1) {
-    __pyx_t_2 = (!__pyx_v_copy_shape);
-    __pyx_t_3 = __pyx_t_2;
+  __pyx_t_2 = ((!(__pyx_v_hasfields != 0)) != 0);
+  if (__pyx_t_2) {
+    __pyx_t_3 = ((!(__pyx_v_copy_shape != 0)) != 0);
+    __pyx_t_1 = __pyx_t_3;
   } else {
-    __pyx_t_3 = __pyx_t_1;
+    __pyx_t_1 = __pyx_t_2;
   }
-  if (__pyx_t_3) {
+  if (__pyx_t_1) {
 
     /* "numpy.pxd":248
  *             if not hasfields and not copy_shape:
@@ -6153,8 +6170,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 t = descr.type_num
  *                 if ((descr.byteorder == c'>' and little_endian) or
  */
-  __pyx_t_3 = (!__pyx_v_hasfields);
-  if (__pyx_t_3) {
+  __pyx_t_1 = ((!(__pyx_v_hasfields != 0)) != 0);
+  if (__pyx_t_1) {
 
     /* "numpy.pxd":254
  * 
@@ -6173,13 +6190,13 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                     (descr.byteorder == c'<' and not little_endian)):
  *                     raise ValueError(u"Non-native byte order not supported")
  */
-    __pyx_t_3 = (__pyx_v_descr->byteorder == '>');
-    if (__pyx_t_3) {
-      __pyx_t_1 = __pyx_v_little_endian;
+    __pyx_t_1 = ((__pyx_v_descr->byteorder == '>') != 0);
+    if (__pyx_t_1) {
+      __pyx_t_2 = (__pyx_v_little_endian != 0);
     } else {
-      __pyx_t_1 = __pyx_t_3;
+      __pyx_t_2 = __pyx_t_1;
     }
-    if (!__pyx_t_1) {
+    if (!__pyx_t_2) {
 
       /* "numpy.pxd":256
  *                 t = descr.type_num
@@ -6188,18 +6205,18 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                     raise ValueError(u"Non-native byte order not supported")
  *                 if   t == NPY_BYTE:        f = "b"
  */
-      __pyx_t_3 = (__pyx_v_descr->byteorder == '<');
-      if (__pyx_t_3) {
-        __pyx_t_2 = (!__pyx_v_little_endian);
-        __pyx_t_7 = __pyx_t_2;
-      } else {
+      __pyx_t_1 = ((__pyx_v_descr->byteorder == '<') != 0);
+      if (__pyx_t_1) {
+        __pyx_t_3 = ((!(__pyx_v_little_endian != 0)) != 0);
         __pyx_t_7 = __pyx_t_3;
+      } else {
+        __pyx_t_7 = __pyx_t_1;
       }
-      __pyx_t_3 = __pyx_t_7;
+      __pyx_t_1 = __pyx_t_7;
     } else {
-      __pyx_t_3 = __pyx_t_1;
+      __pyx_t_1 = __pyx_t_2;
     }
-    if (__pyx_t_3) {
+    if (__pyx_t_1) {
 
       /* "numpy.pxd":257
  *                 if ((descr.byteorder == c'>' and little_endian) or
@@ -6562,7 +6579,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s
  *                 stdlib.free(info.format)
  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
  */
-  __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self);
+  __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":290
@@ -6584,7 +6601,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s
  *                 stdlib.free(info.strides)
  *                 # info.shape was stored after info.strides in the same block
  */
-  __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t)));
+  __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":292
@@ -6827,16 +6844,12 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__
 
 static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) {
   PyArray_Descr *__pyx_v_child = 0;
-  int __pyx_v_size;
-  int __pyx_v_idx;
   int __pyx_v_endian_detector;
   int __pyx_v_little_endian;
   PyObject *__pyx_v_fields = 0;
   PyObject *__pyx_v_childname = NULL;
   PyObject *__pyx_v_new_offset = NULL;
   PyObject *__pyx_v_t = NULL;
-  PyObject *__pyx_v_shape = NULL;
-  long __pyx_v_val;
   char *__pyx_r;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -6850,18 +6863,14 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
   int __pyx_t_9;
   int __pyx_t_10;
   long __pyx_t_11;
-  Py_ssize_t __pyx_t_12;
-  PyObject *(*__pyx_t_13)(PyObject *);
-  int __pyx_t_14;
-  int __pyx_t_15;
-  char *__pyx_t_16;
+  char *__pyx_t_12;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("_util_dtypestring", 0);
 
   /* "numpy.pxd":790
- *     cdef int delta_offset, size, idx
+ *     cdef int delta_offset
  *     cdef tuple i
  *     cdef int endian_detector = 1             # <<<<<<<<<<<<<<
  *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
@@ -6897,8 +6906,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
     #else
     __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     #endif
-    __Pyx_XDECREF(__pyx_v_childname);
-    __pyx_v_childname = __pyx_t_3;
+    __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3);
     __pyx_t_3 = 0;
 
     /* "numpy.pxd":795
@@ -6911,8 +6919,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
     __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_XDECREF(((PyObject *)__pyx_v_fields));
-    __pyx_v_fields = ((PyObject*)__pyx_t_3);
+    __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3));
     __pyx_t_3 = 0;
 
     /* "numpy.pxd":796
@@ -6969,11 +6976,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
       __pyx_L6_unpacking_done:;
     }
     if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_XDECREF(((PyObject *)__pyx_v_child));
-    __pyx_v_child = ((PyArray_Descr *)__pyx_t_3);
+    __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3));
     __pyx_t_3 = 0;
-    __Pyx_XDECREF(__pyx_v_new_offset);
-    __pyx_v_new_offset = __pyx_t_4;
+    __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4);
     __pyx_t_4 = 0;
 
     /* "numpy.pxd":798
@@ -7023,9 +7028,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  *             (child.byteorder == c'<' and not little_endian)):
  *             raise ValueError(u"Non-native byte order not supported")
  */
-    __pyx_t_7 = (__pyx_v_child->byteorder == '>');
+    __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0);
     if (__pyx_t_7) {
-      __pyx_t_8 = __pyx_v_little_endian;
+      __pyx_t_8 = (__pyx_v_little_endian != 0);
     } else {
       __pyx_t_8 = __pyx_t_7;
     }
@@ -7038,9 +7043,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  *             raise ValueError(u"Non-native byte order not supported")
  *             # One could encode it in the format string and have Cython
  */
-      __pyx_t_7 = (__pyx_v_child->byteorder == '<');
+      __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0);
       if (__pyx_t_7) {
-        __pyx_t_9 = (!__pyx_v_little_endian);
+        __pyx_t_9 = ((!(__pyx_v_little_endian != 0)) != 0);
         __pyx_t_10 = __pyx_t_9;
       } else {
         __pyx_t_10 = __pyx_t_7;
@@ -7129,7 +7134,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  *             t = child.type_num
  *             if end - f < 5:
  */
-    __pyx_t_7 = (!PyDataType_HASFIELDS(__pyx_v_child));
+    __pyx_t_7 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0);
     if (__pyx_t_7) {
 
       /* "numpy.pxd":821
@@ -7141,8 +7146,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  */
       __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
-      __Pyx_XDECREF(__pyx_v_t);
-      __pyx_v_t = __pyx_t_3;
+      __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_3);
       __pyx_t_3 = 0;
 
       /* "numpy.pxd":822
@@ -7152,7 +7156,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  *                 raise RuntimeError(u"Format string allocated too short.")
  * 
  */
-      __pyx_t_7 = ((__pyx_v_end - __pyx_v_f) < 5);
+      __pyx_t_7 = (((__pyx_v_end - __pyx_v_f) < 5) != 0);
       if (__pyx_t_7) {
 
         /* "numpy.pxd":823
@@ -7450,7 +7454,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
  *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg             # <<<<<<<<<<<<<<
  *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
- *             elif t == NPY_VOID:
+ *             else:
  */
       __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
@@ -7469,8 +7473,8 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
  *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
  *             elif t == NPY_OBJECT:      f[0] = 79 #"O"             # <<<<<<<<<<<<<<
- *             elif t == NPY_VOID:
- *                 shape =  child.shape
+ *             else:
+ *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
  */
       __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
@@ -7482,441 +7486,32 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
         (__pyx_v_f[0]) = 79;
         goto __pyx_L13;
       }
-
-      /* "numpy.pxd":843
- *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
- *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
- *             elif t == NPY_VOID:             # <<<<<<<<<<<<<<
- *                 shape =  child.shape
- *                 size = 1
- */
-      __pyx_t_5 = PyInt_FromLong(NPY_VOID); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
-      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      if (__pyx_t_7) {
+      /*else*/ {
 
         /* "numpy.pxd":844
  *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
- *             elif t == NPY_VOID:
- *                 shape =  child.shape             # <<<<<<<<<<<<<<
- *                 size = 1
- *                 for idx in shape: size*=idx
- */
-        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_child), __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_3);
-        __Pyx_XDECREF(__pyx_v_shape);
-        __pyx_v_shape = __pyx_t_3;
-        __pyx_t_3 = 0;
-
-        /* "numpy.pxd":845
- *             elif t == NPY_VOID:
- *                 shape =  child.shape
- *                 size = 1             # <<<<<<<<<<<<<<
- *                 for idx in shape: size*=idx
- *                 t = child.base.num
- */
-        __pyx_v_size = 1;
-
-        /* "numpy.pxd":846
- *                 shape =  child.shape
- *                 size = 1
- *                 for idx in shape: size*=idx             # <<<<<<<<<<<<<<
- *                 t = child.base.num
- *                 if   t == NPY_BYTE:        val =  98 #"b"
- */
-        if (PyList_CheckExact(__pyx_v_shape) || PyTuple_CheckExact(__pyx_v_shape)) {
-          __pyx_t_3 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_3); __pyx_t_12 = 0;
-          __pyx_t_13 = NULL;
-        } else {
-          __pyx_t_12 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_3);
-          __pyx_t_13 = Py_TYPE(__pyx_t_3)->tp_iternext;
-        }
-        for (;;) {
-          if (!__pyx_t_13 && PyList_CheckExact(__pyx_t_3)) {
-            if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_3)) break;
-            #if CYTHON_COMPILING_IN_CPYTHON
-            __pyx_t_5 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_12); __Pyx_INCREF(__pyx_t_5); __pyx_t_12++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-            #else
-            __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-            #endif
-          } else if (!__pyx_t_13 && PyTuple_CheckExact(__pyx_t_3)) {
-            if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
-            #if CYTHON_COMPILING_IN_CPYTHON
-            __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_12); __Pyx_INCREF(__pyx_t_5); __pyx_t_12++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-            #else
-            __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-            #endif
-          } else {
-            __pyx_t_5 = __pyx_t_13(__pyx_t_3);
-            if (unlikely(!__pyx_t_5)) {
-              if (PyErr_Occurred()) {
-                if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
-                else {__pyx_filename = __pyx_f[1]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-              }
-              break;
-            }
-            __Pyx_GOTREF(__pyx_t_5);
-          }
-          __pyx_t_14 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-          __pyx_v_idx = __pyx_t_14;
-          __pyx_v_size = (__pyx_v_size * __pyx_v_idx);
-        }
-        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-
-        /* "numpy.pxd":847
- *                 size = 1
- *                 for idx in shape: size*=idx
- *                 t = child.base.num             # <<<<<<<<<<<<<<
- *                 if   t == NPY_BYTE:        val =  98 #"b"
- *                 elif t == NPY_UBYTE:       val =  66 #"B"
- */
-        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_child), __pyx_n_s__base); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_3);
-        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__num); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_5);
-        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-        __Pyx_DECREF(__pyx_v_t);
-        __pyx_v_t = __pyx_t_5;
-        __pyx_t_5 = 0;
-
-        /* "numpy.pxd":848
- *                 for idx in shape: size*=idx
- *                 t = child.base.num
- *                 if   t == NPY_BYTE:        val =  98 #"b"             # <<<<<<<<<<<<<<
- *                 elif t == NPY_UBYTE:       val =  66 #"B"
- *                 elif t == NPY_SHORT:       val = 104 #"h"
- */
-        __pyx_t_5 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_5);
-        __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-        if (__pyx_t_7) {
-          __pyx_v_val = 98;
-          goto __pyx_L16;
-        }
-
-        /* "numpy.pxd":849
- *                 t = child.base.num
- *                 if   t == NPY_BYTE:        val =  98 #"b"
- *                 elif t == NPY_UBYTE:       val =  66 #"B"             # <<<<<<<<<<<<<<
- *                 elif t == NPY_SHORT:       val = 104 #"h"
- *                 elif t == NPY_USHORT:      val =  72 #"H"
- */
-        __pyx_t_3 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_3);
-        __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-        if (__pyx_t_7) {
-          __pyx_v_val = 66;
-          goto __pyx_L16;
-        }
-
-        /* "numpy.pxd":850
- *                 if   t == NPY_BYTE:        val =  98 #"b"
- *                 elif t == NPY_UBYTE:       val =  66 #"B"
- *                 elif t == NPY_SHORT:       val = 104 #"h"             # <<<<<<<<<<<<<<
- *                 elif t == NPY_USHORT:      val =  72 #"H"
- *                 elif t == NPY_INT:         val = 105 #"i"
- */
-        __pyx_t_5 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_5);
-        __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-        if (__pyx_t_7) {
-          __pyx_v_val = 104;
-          goto __pyx_L16;
-        }
-
-        /* "numpy.pxd":851
- *                 elif t == NPY_UBYTE:       val =  66 #"B"
- *                 elif t == NPY_SHORT:       val = 104 #"h"
- *                 elif t == NPY_USHORT:      val =  72 #"H"             # <<<<<<<<<<<<<<
- *                 elif t == NPY_INT:         val = 105 #"i"
- *                 elif t == NPY_UINT:        val =  73 #"I"
- */
-        __pyx_t_3 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_3);
-        __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-        if (__pyx_t_7) {
-          __pyx_v_val = 72;
-          goto __pyx_L16;
-        }
-
-        /* "numpy.pxd":852
- *                 elif t == NPY_SHORT:       val = 104 #"h"
- *                 elif t == NPY_USHORT:      val =  72 #"H"
- *                 elif t == NPY_INT:         val = 105 #"i"             # <<<<<<<<<<<<<<
- *                 elif t == NPY_UINT:        val =  73 #"I"
- *                 elif t == NPY_LONG:        val = 108 #"l"
- */
-        __pyx_t_5 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_5);
-        __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-        if (__pyx_t_7) {
-          __pyx_v_val = 105;
-          goto __pyx_L16;
-        }
-
-        /* "numpy.pxd":853
- *                 elif t == NPY_USHORT:      val =  72 #"H"
- *                 elif t == NPY_INT:         val = 105 #"i"
- *                 elif t == NPY_UINT:        val =  73 #"I"             # <<<<<<<<<<<<<<
- *                 elif t == NPY_LONG:        val = 108 #"l"
- *                 elif t == NPY_ULONG:       val = 76  #"L"
- */
-        __pyx_t_3 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_3);
-        __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-        if (__pyx_t_7) {
-          __pyx_v_val = 73;
-          goto __pyx_L16;
-        }
-
-        /* "numpy.pxd":854
- *                 elif t == NPY_INT:         val = 105 #"i"
- *                 elif t == NPY_UINT:        val =  73 #"I"
- *                 elif t == NPY_LONG:        val = 108 #"l"             # <<<<<<<<<<<<<<
- *                 elif t == NPY_ULONG:       val = 76  #"L"
- *                 elif t == NPY_LONGLONG:    val = 113 #"q"
- */
-        __pyx_t_5 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_5);
-        __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-        if (__pyx_t_7) {
-          __pyx_v_val = 108;
-          goto __pyx_L16;
-        }
-
-        /* "numpy.pxd":855
- *                 elif t == NPY_UINT:        val =  73 #"I"
- *                 elif t == NPY_LONG:        val = 108 #"l"
- *                 elif t == NPY_ULONG:       val = 76  #"L"             # <<<<<<<<<<<<<<
- *                 elif t == NPY_LONGLONG:    val = 113 #"q"
- *                 elif t == NPY_ULONGLONG:   val = 81  #"Q"
- */
-        __pyx_t_3 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_3);
-        __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-        if (__pyx_t_7) {
-          __pyx_v_val = 76;
-          goto __pyx_L16;
-        }
-
-        /* "numpy.pxd":856
- *                 elif t == NPY_LONG:        val = 108 #"l"
- *                 elif t == NPY_ULONG:       val = 76  #"L"
- *                 elif t == NPY_LONGLONG:    val = 113 #"q"             # <<<<<<<<<<<<<<
- *                 elif t == NPY_ULONGLONG:   val = 81  #"Q"
- *                 elif t == NPY_FLOAT:       val = 102 #"f"
- */
-        __pyx_t_5 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_5);
-        __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-        if (__pyx_t_7) {
-          __pyx_v_val = 113;
-          goto __pyx_L16;
-        }
-
-        /* "numpy.pxd":857
- *                 elif t == NPY_ULONG:       val = 76  #"L"
- *                 elif t == NPY_LONGLONG:    val = 113 #"q"
- *                 elif t == NPY_ULONGLONG:   val = 81  #"Q"             # <<<<<<<<<<<<<<
- *                 elif t == NPY_FLOAT:       val = 102 #"f"
- *                 elif t == NPY_DOUBLE:      val = 100 #"d"
- */
-        __pyx_t_3 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_3);
-        __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-        if (__pyx_t_7) {
-          __pyx_v_val = 81;
-          goto __pyx_L16;
-        }
-
-        /* "numpy.pxd":858
- *                 elif t == NPY_LONGLONG:    val = 113 #"q"
- *                 elif t == NPY_ULONGLONG:   val = 81  #"Q"
- *                 elif t == NPY_FLOAT:       val = 102 #"f"             # <<<<<<<<<<<<<<
- *                 elif t == NPY_DOUBLE:      val = 100 #"d"
- *                 elif t == NPY_LONGDOUBLE:  val = 103 #"g"
- */
-        __pyx_t_5 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_5);
-        __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-        if (__pyx_t_7) {
-          __pyx_v_val = 102;
-          goto __pyx_L16;
-        }
-
-        /* "numpy.pxd":859
- *                 elif t == NPY_ULONGLONG:   val = 81  #"Q"
- *                 elif t == NPY_FLOAT:       val = 102 #"f"
- *                 elif t == NPY_DOUBLE:      val = 100 #"d"             # <<<<<<<<<<<<<<
- *                 elif t == NPY_LONGDOUBLE:  val = 103 #"g"
- *                 elif t == NPY_OBJECT:      val = 79 #"O"
- */
-        __pyx_t_3 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_3);
-        __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-        if (__pyx_t_7) {
-          __pyx_v_val = 100;
-          goto __pyx_L16;
-        }
-
-        /* "numpy.pxd":860
- *                 elif t == NPY_FLOAT:       val = 102 #"f"
- *                 elif t == NPY_DOUBLE:      val = 100 #"d"
- *                 elif t == NPY_LONGDOUBLE:  val = 103 #"g"             # <<<<<<<<<<<<<<
- *                 elif t == NPY_OBJECT:      val = 79 #"O"
- *                 else:
- */
-        __pyx_t_5 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_5);
-        __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-        if (__pyx_t_7) {
-          __pyx_v_val = 103;
-          goto __pyx_L16;
-        }
-
-        /* "numpy.pxd":861
- *                 elif t == NPY_DOUBLE:      val = 100 #"d"
- *                 elif t == NPY_LONGDOUBLE:  val = 103 #"g"
- *                 elif t == NPY_OBJECT:      val = 79 #"O"             # <<<<<<<<<<<<<<
- *                 else:
- *                     raise ValueError(u"unknown dtype code substructure in numpy.pxd (%d)" % t)
- */
-        __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_3);
-        __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-        if (__pyx_t_7) {
-          __pyx_v_val = 79;
-          goto __pyx_L16;
-        }
-        /*else*/ {
-
-          /* "numpy.pxd":863
- *                 elif t == NPY_OBJECT:      val = 79 #"O"
- *                 else:
- *                     raise ValueError(u"unknown dtype code substructure in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
- *                 for idx in range(size):
- *                     f[idx] = val
- */
-          __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_14), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(((PyObject *)__pyx_t_5));
-          __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_3);
-          PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5));
-          __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
-          __pyx_t_5 = 0;
-          __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_5);
-          __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-          __Pyx_Raise(__pyx_t_5, 0, 0, 0);
-          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-          {__pyx_filename = __pyx_f[1]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        }
-        __pyx_L16:;
-
-        /* "numpy.pxd":864
- *                 else:
- *                     raise ValueError(u"unknown dtype code substructure in numpy.pxd (%d)" % t)
- *                 for idx in range(size):             # <<<<<<<<<<<<<<
- *                     f[idx] = val
- *                 f+=size-1
- */
-        __pyx_t_14 = __pyx_v_size;
-        for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
-          __pyx_v_idx = __pyx_t_15;
-
-          /* "numpy.pxd":865
- *                     raise ValueError(u"unknown dtype code substructure in numpy.pxd (%d)" % t)
- *                 for idx in range(size):
- *                     f[idx] = val             # <<<<<<<<<<<<<<
- *                 f+=size-1
- *             else:
- */
-          (__pyx_v_f[__pyx_v_idx]) = __pyx_v_val;
-        }
-
-        /* "numpy.pxd":866
- *                 for idx in range(size):
- *                     f[idx] = val
- *                 f+=size-1             # <<<<<<<<<<<<<<
- *             else:
- *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
- */
-        __pyx_v_f = (__pyx_v_f + (__pyx_v_size - 1));
-        goto __pyx_L13;
-      }
-      /*else*/ {
-
-        /* "numpy.pxd":868
- *                 f+=size-1
  *             else:
  *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
  *             f += 1
  *         else:
  */
-        __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_8), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_8), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(((PyObject *)__pyx_t_5));
-        __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_3);
         PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5));
         __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
         __pyx_t_5 = 0;
-        __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_5);
         __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
         __Pyx_Raise(__pyx_t_5, 0, 0, 0);
         __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-        {__pyx_filename = __pyx_f[1]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       }
       __pyx_L13:;
 
-      /* "numpy.pxd":869
+      /* "numpy.pxd":845
  *             else:
  *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
  *             f += 1             # <<<<<<<<<<<<<<
@@ -7928,21 +7523,21 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
     }
     /*else*/ {
 
-      /* "numpy.pxd":873
+      /* "numpy.pxd":849
  *             # Cython ignores struct boundary information ("T{...}"),
  *             # so don't output it
  *             f = _util_dtypestring(child, f, end, offset)             # <<<<<<<<<<<<<<
  *     return f
  * 
  */
-      __pyx_t_16 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_16 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_v_f = __pyx_t_16;
+      __pyx_t_12 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_v_f = __pyx_t_12;
     }
     __pyx_L11:;
   }
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "numpy.pxd":874
+  /* "numpy.pxd":850
  *             # so don't output it
  *             f = _util_dtypestring(child, f, end, offset)
  *     return f             # <<<<<<<<<<<<<<
@@ -7967,12 +7562,11 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
   __Pyx_XDECREF(__pyx_v_childname);
   __Pyx_XDECREF(__pyx_v_new_offset);
   __Pyx_XDECREF(__pyx_v_t);
-  __Pyx_XDECREF(__pyx_v_shape);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "numpy.pxd":989
+/* "numpy.pxd":965
  * 
  * 
  * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
@@ -7984,9 +7578,10 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a
   PyObject *__pyx_v_baseptr;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
+  int __pyx_t_2;
   __Pyx_RefNannySetupContext("set_array_base", 0);
 
-  /* "numpy.pxd":991
+  /* "numpy.pxd":967
  * cdef inline void set_array_base(ndarray arr, object base):
  *      cdef PyObject* baseptr
  *      if base is None:             # <<<<<<<<<<<<<<
@@ -7994,9 +7589,10 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a
  *      else:
  */
   __pyx_t_1 = (__pyx_v_base == Py_None);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
-    /* "numpy.pxd":992
+    /* "numpy.pxd":968
  *      cdef PyObject* baseptr
  *      if base is None:
  *          baseptr = NULL             # <<<<<<<<<<<<<<
@@ -8008,7 +7604,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a
   }
   /*else*/ {
 
-    /* "numpy.pxd":994
+    /* "numpy.pxd":970
  *          baseptr = NULL
  *      else:
  *          Py_INCREF(base) # important to do this before decref below!             # <<<<<<<<<<<<<<
@@ -8017,7 +7613,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a
  */
     Py_INCREF(__pyx_v_base);
 
-    /* "numpy.pxd":995
+    /* "numpy.pxd":971
  *      else:
  *          Py_INCREF(base) # important to do this before decref below!
  *          baseptr = <PyObject*>base             # <<<<<<<<<<<<<<
@@ -8028,7 +7624,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a
   }
   __pyx_L3:;
 
-  /* "numpy.pxd":996
+  /* "numpy.pxd":972
  *          Py_INCREF(base) # important to do this before decref below!
  *          baseptr = <PyObject*>base
  *      Py_XDECREF(arr.base)             # <<<<<<<<<<<<<<
@@ -8037,7 +7633,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a
  */
   Py_XDECREF(__pyx_v_arr->base);
 
-  /* "numpy.pxd":997
+  /* "numpy.pxd":973
  *          baseptr = <PyObject*>base
  *      Py_XDECREF(arr.base)
  *      arr.base = baseptr             # <<<<<<<<<<<<<<
@@ -8049,7 +7645,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a
   __Pyx_RefNannyFinishContext();
 }
 
-/* "numpy.pxd":999
+/* "numpy.pxd":975
  *      arr.base = baseptr
  * 
  * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
@@ -8063,17 +7659,17 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py
   int __pyx_t_1;
   __Pyx_RefNannySetupContext("get_array_base", 0);
 
-  /* "numpy.pxd":1000
+  /* "numpy.pxd":976
  * 
  * cdef inline object get_array_base(ndarray arr):
  *     if arr.base is NULL:             # <<<<<<<<<<<<<<
  *         return None
  *     else:
  */
-  __pyx_t_1 = (__pyx_v_arr->base == NULL);
+  __pyx_t_1 = ((__pyx_v_arr->base == NULL) != 0);
   if (__pyx_t_1) {
 
-    /* "numpy.pxd":1001
+    /* "numpy.pxd":977
  * cdef inline object get_array_base(ndarray arr):
  *     if arr.base is NULL:
  *         return None             # <<<<<<<<<<<<<<
@@ -8088,7 +7684,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py
   }
   /*else*/ {
 
-    /* "numpy.pxd":1003
+    /* "numpy.pxd":979
  *         return None
  *     else:
  *         return <object>arr.base             # <<<<<<<<<<<<<<
@@ -8254,7 +7850,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
   /* "View.MemoryView":120
  *         cdef PyObject **p
  * 
- *         self.ndim = len(shape)             # <<<<<<<<<<<<<<
+ *         self.ndim = <int> len(shape)             # <<<<<<<<<<<<<<
  *         self.itemsize = itemsize
  * 
  */
@@ -8263,11 +7859,11 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   __pyx_t_1 = PyTuple_GET_SIZE(((PyObject *)__pyx_v_shape)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_self->ndim = __pyx_t_1;
+  __pyx_v_self->ndim = ((int)__pyx_t_1);
 
   /* "View.MemoryView":121
  * 
- *         self.ndim = len(shape)
+ *         self.ndim = <int> len(shape)
  *         self.itemsize = itemsize             # <<<<<<<<<<<<<<
  * 
  *         if not self.ndim:
@@ -8281,7 +7877,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             raise ValueError("Empty shape tuple for cython.array")
  * 
  */
-  __pyx_t_2 = (!__pyx_v_self->ndim);
+  __pyx_t_2 = ((!(__pyx_v_self->ndim != 0)) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":124
@@ -8291,7 +7887,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  *         if self.itemsize <= 0:
  */
-    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_16), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_15), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
@@ -8307,7 +7903,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             raise ValueError("itemsize <= 0 for cython.array")
  * 
  */
-  __pyx_t_2 = (__pyx_v_self->itemsize <= 0);
+  __pyx_t_2 = ((__pyx_v_self->itemsize <= 0) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":127
@@ -8317,7 +7913,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  *         encode = getattr(format, 'encode', None)
  */
-    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_18), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_17), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
@@ -8355,10 +7951,9 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *         self._format = format
  *         self.format = self._format
  */
-    __pyx_t_3 = PyObject_Call(__pyx_v_encode, ((PyObject *)__pyx_k_tuple_19), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Call(__pyx_v_encode, ((PyObject *)__pyx_k_tuple_18), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_v_format);
-    __pyx_v_format = __pyx_t_3;
+    __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_3);
     __pyx_t_3 = 0;
     goto __pyx_L5;
   }
@@ -8413,9 +8008,9 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             free(self._shape)
  *             free(self._strides)
  */
-  __pyx_t_2 = (!(__pyx_v_self->_shape != 0));
+  __pyx_t_2 = ((!(__pyx_v_self->_shape != 0)) != 0);
   if (!__pyx_t_2) {
-    __pyx_t_5 = (!(__pyx_v_self->_strides != 0));
+    __pyx_t_5 = ((!(__pyx_v_self->_strides != 0)) != 0);
     __pyx_t_6 = __pyx_t_5;
   } else {
     __pyx_t_6 = __pyx_t_2;
@@ -8447,7 +8042,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  * 
  */
-    __pyx_t_3 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_21), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_20), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
@@ -8481,8 +8076,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
     #else
     __pyx_t_8 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     #endif
-    __Pyx_XDECREF(__pyx_v_dim);
-    __pyx_v_dim = __pyx_t_8;
+    __Pyx_XDECREF_SET(__pyx_v_dim, __pyx_t_8);
     __pyx_t_8 = 0;
     __pyx_v_idx = __pyx_t_7;
     __pyx_t_7 = (__pyx_t_7 + 1);
@@ -8516,7 +8110,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
       PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_dim);
       __Pyx_GIVEREF(__pyx_v_dim);
       __pyx_t_8 = 0;
-      __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_22), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_21), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_8));
       __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
       __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -8576,7 +8170,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
     __pyx_t_5 = ((int)__pyx_t_6);
   }
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_6 = __pyx_t_5;
+  __pyx_t_6 = (__pyx_t_5 != 0);
   if (__pyx_t_6) {
 
     /* "View.MemoryView":153
@@ -8586,7 +8180,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  *         cdef char order
  */
-    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_23), __pyx_v_mode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_22), __pyx_v_mode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_3));
     __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_8);
@@ -8676,10 +8270,9 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *         self.mode = mode
  * 
  */
-    __pyx_t_3 = PyObject_Call(__pyx_v_decode, ((PyObject *)__pyx_k_tuple_24), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Call(__pyx_v_decode, ((PyObject *)__pyx_k_tuple_23), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_v_mode);
-    __pyx_v_mode = __pyx_t_3;
+    __Pyx_DECREF_SET(__pyx_v_mode, __pyx_t_3);
     __pyx_t_3 = 0;
     goto __pyx_L12;
   }
@@ -8727,7 +8320,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             self.data = <char *>malloc(self.len)
  *             if not self.data:
  */
-  if (__pyx_v_allocate_buffer) {
+  __pyx_t_6 = (__pyx_v_allocate_buffer != 0);
+  if (__pyx_t_6) {
 
     /* "View.MemoryView":172
  *         self.dtype_is_object = format == b'O'
@@ -8745,7 +8339,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *                 raise MemoryError("unable to allocate array data.")
  * 
  */
-    __pyx_t_6 = (!(__pyx_v_self->data != 0));
+    __pyx_t_6 = ((!(__pyx_v_self->data != 0)) != 0);
     if (__pyx_t_6) {
 
       /* "View.MemoryView":174
@@ -8755,7 +8349,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  *             if self.dtype_is_object:
  */
-      __pyx_t_3 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_26), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_25), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
@@ -8771,7 +8365,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *                 p = <PyObject **> self.data
  *                 for i in range(self.len / itemsize):
  */
-    if (__pyx_v_self->dtype_is_object) {
+    __pyx_t_6 = (__pyx_v_self->dtype_is_object != 0);
+    if (__pyx_t_6) {
 
       /* "View.MemoryView":177
  * 
@@ -8880,11 +8475,12 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
-  PyObject *__pyx_t_2 = NULL;
-  char *__pyx_t_3;
-  Py_ssize_t __pyx_t_4;
-  int __pyx_t_5;
-  Py_ssize_t *__pyx_t_6;
+  int __pyx_t_2;
+  PyObject *__pyx_t_3 = NULL;
+  char *__pyx_t_4;
+  Py_ssize_t __pyx_t_5;
+  int __pyx_t_6;
+  Py_ssize_t *__pyx_t_7;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -8911,7 +8507,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         elif self.mode == b"fortran":
  */
   __pyx_t_1 = (__Pyx_PyUnicode_Equals(((PyObject *)__pyx_v_self->mode), ((PyObject *)__pyx_n_b__c), Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":186
  *         cdef int bufmode = -1
@@ -8931,7 +8528,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
  *         if not (flags & bufmode):
  */
-  __pyx_t_1 = (__Pyx_PyUnicode_Equals(((PyObject *)__pyx_v_self->mode), ((PyObject *)__pyx_n_b__fortran), Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = (__Pyx_PyUnicode_Equals(((PyObject *)__pyx_v_self->mode), ((PyObject *)__pyx_n_b__fortran), Py_EQ)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = (__pyx_t_2 != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":188
@@ -8953,7 +8551,7 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
  *         info.buf = self.data
  */
-  __pyx_t_1 = (!(__pyx_v_flags & __pyx_v_bufmode));
+  __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":190
@@ -8963,10 +8561,10 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.buf = self.data
  *         info.len = self.len
  */
-    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_28), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_27), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L4;
   }
@@ -8979,8 +8577,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.len = self.len
  *         info.ndim = self.ndim
  */
-  __pyx_t_3 = __pyx_v_self->data;
-  __pyx_v_info->buf = __pyx_t_3;
+  __pyx_t_4 = __pyx_v_self->data;
+  __pyx_v_info->buf = __pyx_t_4;
 
   /* "View.MemoryView":192
  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
@@ -8989,8 +8587,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.ndim = self.ndim
  *         info.shape = self._shape
  */
-  __pyx_t_4 = __pyx_v_self->len;
-  __pyx_v_info->len = __pyx_t_4;
+  __pyx_t_5 = __pyx_v_self->len;
+  __pyx_v_info->len = __pyx_t_5;
 
   /* "View.MemoryView":193
  *         info.buf = self.data
@@ -8999,8 +8597,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.shape = self._shape
  *         info.strides = self._strides
  */
-  __pyx_t_5 = __pyx_v_self->ndim;
-  __pyx_v_info->ndim = __pyx_t_5;
+  __pyx_t_6 = __pyx_v_self->ndim;
+  __pyx_v_info->ndim = __pyx_t_6;
 
   /* "View.MemoryView":194
  *         info.len = self.len
@@ -9009,8 +8607,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.strides = self._strides
  *         info.suboffsets = NULL
  */
-  __pyx_t_6 = __pyx_v_self->_shape;
-  __pyx_v_info->shape = __pyx_t_6;
+  __pyx_t_7 = __pyx_v_self->_shape;
+  __pyx_v_info->shape = __pyx_t_7;
 
   /* "View.MemoryView":195
  *         info.ndim = self.ndim
@@ -9019,8 +8617,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.suboffsets = NULL
  *         info.itemsize = self.itemsize
  */
-  __pyx_t_6 = __pyx_v_self->_strides;
-  __pyx_v_info->strides = __pyx_t_6;
+  __pyx_t_7 = __pyx_v_self->_strides;
+  __pyx_v_info->strides = __pyx_t_7;
 
   /* "View.MemoryView":196
  *         info.shape = self._shape
@@ -9038,8 +8636,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.readonly = 0
  * 
  */
-  __pyx_t_4 = __pyx_v_self->itemsize;
-  __pyx_v_info->itemsize = __pyx_t_4;
+  __pyx_t_5 = __pyx_v_self->itemsize;
+  __pyx_v_info->itemsize = __pyx_t_5;
 
   /* "View.MemoryView":198
  *         info.suboffsets = NULL
@@ -9057,8 +8655,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *             info.format = self.format
  *         else:
  */
-  __pyx_t_5 = (__pyx_v_flags & PyBUF_FORMAT);
-  if (__pyx_t_5) {
+  __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
+  if (__pyx_t_1) {
 
     /* "View.MemoryView":201
  * 
@@ -9067,8 +8665,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         else:
  *             info.format = NULL
  */
-    __pyx_t_3 = __pyx_v_self->format;
-    __pyx_v_info->format = __pyx_t_3;
+    __pyx_t_4 = __pyx_v_self->format;
+    __pyx_v_info->format = __pyx_t_4;
     goto __pyx_L5;
   }
   /*else*/ {
@@ -9100,7 +8698,7 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
   __pyx_r = 0;
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_2);
+  __Pyx_XDECREF(__pyx_t_3);
   __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) {
@@ -9147,7 +8745,7 @@ static void __pyx_array_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *_
  *             self.callback_free_data(self.data)
  *         elif self.free_data:
  */
-  __pyx_t_1 = (__pyx_v_self->callback_free_data != NULL);
+  __pyx_t_1 = ((__pyx_v_self->callback_free_data != NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":211
@@ -9168,7 +8766,8 @@ static void __pyx_array_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *_
  *             if self.dtype_is_object:
  *                 refcount_objects_in_slice(self.data, self._shape,
  */
-  if (__pyx_v_self->free_data) {
+  __pyx_t_1 = (__pyx_v_self->free_data != 0);
+  if (__pyx_t_1) {
 
     /* "View.MemoryView":213
  *             self.callback_free_data(self.data)
@@ -9177,7 +8776,8 @@ static void __pyx_array_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *_
  *                 refcount_objects_in_slice(self.data, self._shape,
  *                                           self._strides, self.ndim, False)
  */
-    if (__pyx_v_self->dtype_is_object) {
+    __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
+    if (__pyx_t_1) {
 
       /* "View.MemoryView":215
  *             if self.dtype_is_object:
@@ -9506,7 +9106,7 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize
  *         result = array(shape, itemsize, format, mode.decode('ASCII'))
  *     else:
  */
-  __pyx_t_1 = (__pyx_v_buf == NULL);
+  __pyx_t_1 = ((__pyx_v_buf == NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":245
@@ -9795,7 +9395,7 @@ static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment)
  *         aligned_p += alignment - offset
  * 
  */
-  __pyx_t_1 = (__pyx_v_offset > 0);
+  __pyx_t_1 = ((__pyx_v_offset > 0) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":303
@@ -9951,11 +9551,11 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor
  *             if <PyObject *> self.view.obj == NULL:
  */
   __pyx_t_1 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)((PyObject *)__pyx_memoryview_type)));
-  if (!__pyx_t_1) {
+  if (!(__pyx_t_1 != 0)) {
     __pyx_t_2 = (__pyx_v_obj != Py_None);
-    __pyx_t_3 = __pyx_t_2;
+    __pyx_t_3 = (__pyx_t_2 != 0);
   } else {
-    __pyx_t_3 = __pyx_t_1;
+    __pyx_t_3 = (__pyx_t_1 != 0);
   }
   if (__pyx_t_3) {
 
@@ -9975,7 +9575,7 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor
  *                 (<__pyx_buffer *> &self.view).obj = Py_None
  *                 Py_INCREF(Py_None)
  */
-    __pyx_t_3 = (((PyObject *)__pyx_v_self->view.obj) == NULL);
+    __pyx_t_3 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0);
     if (__pyx_t_3) {
 
       /* "View.MemoryView":329
@@ -10018,7 +9618,7 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor
  *             raise MemoryError
  * 
  */
-  __pyx_t_3 = (__pyx_v_self->lock == NULL);
+  __pyx_t_3 = ((__pyx_v_self->lock == NULL) != 0);
   if (__pyx_t_3) {
 
     /* "View.MemoryView":334
@@ -10040,8 +9640,8 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor
  *             self.dtype_is_object = self.view.format == b'O'
  *         else:
  */
-  __pyx_t_4 = (__pyx_v_flags & PyBUF_FORMAT);
-  if (__pyx_t_4) {
+  __pyx_t_3 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
+  if (__pyx_t_3) {
 
     /* "View.MemoryView":337
  * 
@@ -10122,6 +9722,7 @@ static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) {
 static void __pyx_memoryview_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) {
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
+  int __pyx_t_2;
   __Pyx_RefNannySetupContext("__dealloc__", 0);
 
   /* "View.MemoryView":346
@@ -10132,7 +9733,8 @@ static void __pyx_memoryview_MemoryView_10memoryview_2__dealloc__(struct __pyx_m
  * 
  */
   __pyx_t_1 = (__pyx_v_self->obj != Py_None);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":347
  *     def __dealloc__(memoryview self):
@@ -10153,8 +9755,8 @@ static void __pyx_memoryview_MemoryView_10memoryview_2__dealloc__(struct __pyx_m
  *             PyThread_free_lock(self.lock)
  * 
  */
-  __pyx_t_1 = (__pyx_v_self->lock != NULL);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((__pyx_v_self->lock != NULL) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":350
  * 
@@ -10248,8 +9850,7 @@ static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__py
       }
       __Pyx_GOTREF(__pyx_t_5);
     }
-    __Pyx_XDECREF(__pyx_v_idx);
-    __pyx_v_idx = __pyx_t_5;
+    __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5);
     __pyx_t_5 = 0;
     __pyx_v_dim = __pyx_t_1;
     __pyx_t_1 = (__pyx_t_1 + 1);
@@ -10316,12 +9917,13 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
-  PyObject *__pyx_t_2 = NULL;
+  int __pyx_t_2;
   PyObject *__pyx_t_3 = NULL;
   PyObject *__pyx_t_4 = NULL;
   PyObject *__pyx_t_5 = NULL;
-  PyObject *(*__pyx_t_6)(PyObject *);
-  char *__pyx_t_7;
+  PyObject *__pyx_t_6 = NULL;
+  PyObject *(*__pyx_t_7)(PyObject *);
+  char *__pyx_t_8;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -10335,7 +9937,8 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  * 
  */
   __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":364
  *     def __getitem__(memoryview self, object index):
@@ -10359,10 +9962,10 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  * 
  *         cdef char *itemp
  */
-  __pyx_t_2 = ((PyObject *)_unellipsify(__pyx_v_index, __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  if (likely(PyTuple_CheckExact(__pyx_t_2))) {
-    PyObject* sequence = __pyx_t_2;
+  __pyx_t_3 = ((PyObject *)_unellipsify(__pyx_v_index, __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  if (likely(PyTuple_CheckExact(__pyx_t_3))) {
+    PyObject* sequence = __pyx_t_3;
     #if CYTHON_COMPILING_IN_CPYTHON
     Py_ssize_t size = Py_SIZE(sequence);
     #else
@@ -10374,45 +9977,45 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
       {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     #if CYTHON_COMPILING_IN_CPYTHON
-    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
-    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
-    __Pyx_INCREF(__pyx_t_3);
+    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
+    __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
     __Pyx_INCREF(__pyx_t_4);
+    __Pyx_INCREF(__pyx_t_5);
     #else
-    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
     #endif
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   } else if (1) {
     __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   } else
   {
     Py_ssize_t index = -1;
-    __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
-    index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L4_unpacking_failed;
-    __Pyx_GOTREF(__pyx_t_3);
-    index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed;
+    __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
+    index = 0; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed;
     __Pyx_GOTREF(__pyx_t_4);
-    if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_6 = NULL;
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L4_unpacking_failed;
+    __Pyx_GOTREF(__pyx_t_5);
+    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = NULL;
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
     goto __pyx_L5_unpacking_done;
     __pyx_L4_unpacking_failed:;
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_6 = NULL;
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __pyx_t_7 = NULL;
     if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_L5_unpacking_done:;
   }
-  __pyx_v_have_slices = __pyx_t_3;
-  __pyx_t_3 = 0;
-  __pyx_v_indices = __pyx_t_4;
+  __pyx_v_have_slices = __pyx_t_4;
   __pyx_t_4 = 0;
+  __pyx_v_indices = __pyx_t_5;
+  __pyx_t_5 = 0;
 
   /* "View.MemoryView":369
  * 
@@ -10421,8 +10024,8 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  *             return memview_slice(self, indices)
  *         else:
  */
-  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__pyx_t_1) {
+  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":370
  *         cdef char *itemp
@@ -10432,10 +10035,10 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  *             itemp = self.get_item_pointer(indices)
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_2 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_r = __pyx_t_2;
-    __pyx_t_2 = 0;
+    __pyx_t_3 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_r = __pyx_t_3;
+    __pyx_t_3 = 0;
     goto __pyx_L0;
     goto __pyx_L6;
   }
@@ -10448,8 +10051,8 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  *             return self.convert_item_to_object(itemp)
  * 
  */
-    __pyx_t_7 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_v_itemp = __pyx_t_7;
+    __pyx_t_8 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_8 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_v_itemp = __pyx_t_8;
 
     /* "View.MemoryView":373
  *         else:
@@ -10459,10 +10062,10 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  *     def __setitem__(memoryview self, object index, object value):
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_r = __pyx_t_2;
-    __pyx_t_2 = 0;
+    __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_r = __pyx_t_3;
+    __pyx_t_3 = 0;
     goto __pyx_L0;
   }
   __pyx_L6:;
@@ -10470,10 +10073,10 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_5);
+  __Pyx_XDECREF(__pyx_t_6);
   __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
@@ -10579,8 +10182,7 @@ static int __pyx_memoryview_MemoryView_10memoryview_6__setitem__(struct __pyx_me
   }
   __pyx_v_have_slices = __pyx_t_2;
   __pyx_t_2 = 0;
-  __Pyx_DECREF(__pyx_v_index);
-  __pyx_v_index = __pyx_t_3;
+  __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_3);
   __pyx_t_3 = 0;
 
   /* "View.MemoryView":378
@@ -10716,7 +10318,7 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
  *                 obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS,
  */
   __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, ((PyObject *)__pyx_memoryview_type)); 
-  __pyx_t_2 = (!__pyx_t_1);
+  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":389
@@ -10766,8 +10368,7 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
         __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject *)__pyx_memoryview_type)), ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
         __Pyx_GOTREF(__pyx_t_7);
         __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
-        __Pyx_DECREF(__pyx_v_obj);
-        __pyx_v_obj = __pyx_t_7;
+        __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7);
         __pyx_t_7 = 0;
       }
       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
@@ -10985,7 +10586,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor
  *             tmp = malloc(self.view.itemsize)
  *             if tmp == NULL:
  */
-  __pyx_t_1 = (((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array)));
+  __pyx_t_1 = ((((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":414
@@ -11004,7 +10605,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor
  *                 raise MemoryError
  *             item = tmp
  */
-    __pyx_t_1 = (__pyx_v_tmp == NULL);
+    __pyx_t_1 = ((__pyx_v_tmp == NULL) != 0);
     if (__pyx_t_1) {
 
       /* "View.MemoryView":416
@@ -11049,7 +10650,8 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor
  *             (<PyObject **> item)[0] = <PyObject *> value
  *         else:
  */
-  if (__pyx_v_self->dtype_is_object) {
+  __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
+  if (__pyx_t_1) {
 
     /* "View.MemoryView":422
  * 
@@ -11159,7 +10761,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor
  *             assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
  *         slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
  */
-  __pyx_t_1 = (__pyx_v_self->view.suboffsets != NULL);
+  __pyx_t_1 = ((__pyx_v_self->view.suboffsets != NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":433
@@ -11363,7 +10965,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview
  *             return result
  */
       __pyx_t_7 = strlen(__pyx_v_self->view.format); 
-      __pyx_t_8 = (__pyx_t_7 == 1);
+      __pyx_t_8 = ((__pyx_t_7 == 1) != 0);
       if (__pyx_t_8) {
 
         /* "View.MemoryView":455
@@ -11429,7 +11031,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview
  *         else:
  *             if len(self.view.format) == 1:
  */
-      __pyx_t_10 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_30), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
+      __pyx_t_10 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_29), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
       __Pyx_GOTREF(__pyx_t_10);
       __Pyx_Raise(__pyx_t_10, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
@@ -11494,15 +11096,16 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
   int __pyx_t_2;
-  PyObject *__pyx_t_3 = NULL;
+  int __pyx_t_3;
   PyObject *__pyx_t_4 = NULL;
   PyObject *__pyx_t_5 = NULL;
-  Py_ssize_t __pyx_t_6;
-  PyObject *__pyx_t_7 = NULL;
-  char *__pyx_t_8;
+  PyObject *__pyx_t_6 = NULL;
+  Py_ssize_t __pyx_t_7;
+  PyObject *__pyx_t_8 = NULL;
   char *__pyx_t_9;
   char *__pyx_t_10;
   char *__pyx_t_11;
+  char *__pyx_t_12;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -11528,7 +11131,8 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  *         else:
  */
   __pyx_t_2 = PyTuple_Check(__pyx_v_value); 
-  if (__pyx_t_2) {
+  __pyx_t_3 = (__pyx_t_2 != 0);
+  if (__pyx_t_3) {
 
     /* "View.MemoryView":467
  * 
@@ -11539,26 +11143,26 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  */
     __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s__pack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
-    __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
-    __pyx_t_3 = 0;
-    __pyx_t_3 = PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-    __pyx_t_5 = PyNumber_Add(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+    __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4));
+    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
+    __pyx_t_4 = 0;
+    __pyx_t_4 = PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+    __pyx_t_6 = PyNumber_Add(((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
+    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-    __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
-    if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_v_bytesvalue = ((PyObject*)__pyx_t_3);
-    __pyx_t_3 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+    if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_4)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
+    __pyx_t_4 = 0;
     goto __pyx_L3;
   }
   /*else*/ {
@@ -11570,25 +11174,25 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  * 
  *         for i, c in enumerate(bytesvalue):
  */
-    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s__pack); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s__pack); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
     __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_5));
-    __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
+    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_6));
+    __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
     __Pyx_INCREF(__pyx_v_value);
     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_value);
     __Pyx_GIVEREF(__pyx_v_value);
-    __pyx_t_5 = 0;
-    __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __pyx_t_6 = 0;
+    __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-    if (!(likely(PyBytes_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_5)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_v_bytesvalue = ((PyObject*)__pyx_t_5);
-    __pyx_t_5 = 0;
+    if (!(likely(PyBytes_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_6)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_v_bytesvalue = ((PyObject*)__pyx_t_6);
+    __pyx_t_6 = 0;
   }
   __pyx_L3:;
 
@@ -11599,18 +11203,18 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  *             itemp[i] = c
  * 
  */
-  __pyx_t_6 = 0;
+  __pyx_t_7 = 0;
   if (unlikely(((PyObject *)__pyx_v_bytesvalue) == Py_None)) {
     PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   __Pyx_INCREF(((PyObject *)__pyx_v_bytesvalue));
-  __pyx_t_7 = __pyx_v_bytesvalue;
-  __pyx_t_9 = PyBytes_AS_STRING(__pyx_t_7);
-  __pyx_t_10 = (__pyx_t_9 + PyBytes_GET_SIZE(__pyx_t_7));
-  for (__pyx_t_11 = __pyx_t_9; __pyx_t_11 < __pyx_t_10; __pyx_t_11++) {
-    __pyx_t_8 = __pyx_t_11;
-    __pyx_v_c = (__pyx_t_8[0]);
+  __pyx_t_8 = __pyx_v_bytesvalue;
+  __pyx_t_10 = PyBytes_AS_STRING(__pyx_t_8);
+  __pyx_t_11 = (__pyx_t_10 + PyBytes_GET_SIZE(__pyx_t_8));
+  for (__pyx_t_12 = __pyx_t_10; __pyx_t_12 < __pyx_t_11; __pyx_t_12++) {
+    __pyx_t_9 = __pyx_t_12;
+    __pyx_v_c = (__pyx_t_9[0]);
 
     /* "View.MemoryView":472
  * 
@@ -11619,7 +11223,7 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  * 
  *     @cname('getbuffer')
  */
-    __pyx_v_i = __pyx_t_6;
+    __pyx_v_i = __pyx_t_7;
 
     /* "View.MemoryView":471
  *             bytesvalue = struct.pack(self.view.format, value)
@@ -11628,7 +11232,7 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  *             itemp[i] = c
  * 
  */
-    __pyx_t_6 = (__pyx_t_6 + 1);
+    __pyx_t_7 = (__pyx_t_7 + 1);
 
     /* "View.MemoryView":472
  * 
@@ -11639,16 +11243,16 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  */
     (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c;
   }
-  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_5);
-  __Pyx_XDECREF(((PyObject *)__pyx_t_7));
+  __Pyx_XDECREF(__pyx_t_6);
+  __Pyx_XDECREF(((PyObject *)__pyx_t_8));
   __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
@@ -11685,7 +11289,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
   Py_ssize_t *__pyx_t_2;
   char *__pyx_t_3;
   void *__pyx_t_4;
-  Py_ssize_t __pyx_t_5;
+  int __pyx_t_5;
+  Py_ssize_t __pyx_t_6;
   __Pyx_RefNannySetupContext("__getbuffer__", 0);
   if (__pyx_v_info != NULL) {
     __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
@@ -11699,7 +11304,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *             info.shape = self.view.shape
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_flags & PyBUF_STRIDES);
+  __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":477
@@ -11733,7 +11338,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *             info.strides = self.view.strides
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_flags & PyBUF_STRIDES);
+  __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":482
@@ -11767,7 +11372,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *             info.suboffsets = self.view.suboffsets
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_flags & PyBUF_INDIRECT);
+  __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":487
@@ -11801,7 +11406,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *             info.format = self.view.format
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_flags & PyBUF_FORMAT);
+  __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":492
@@ -11845,8 +11450,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         info.itemsize = self.view.itemsize
  *         info.len = self.view.len
  */
-  __pyx_t_1 = __pyx_v_self->view.ndim;
-  __pyx_v_info->ndim = __pyx_t_1;
+  __pyx_t_5 = __pyx_v_self->view.ndim;
+  __pyx_v_info->ndim = __pyx_t_5;
 
   /* "View.MemoryView":498
  *         info.buf = self.view.buf
@@ -11855,8 +11460,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         info.len = self.view.len
  *         info.readonly = 0
  */
-  __pyx_t_5 = __pyx_v_self->view.itemsize;
-  __pyx_v_info->itemsize = __pyx_t_5;
+  __pyx_t_6 = __pyx_v_self->view.itemsize;
+  __pyx_v_info->itemsize = __pyx_t_6;
 
   /* "View.MemoryView":499
  *         info.ndim = self.view.ndim
@@ -11865,8 +11470,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         info.readonly = 0
  *         info.obj = self
  */
-  __pyx_t_5 = __pyx_v_self->view.len;
-  __pyx_v_info->len = __pyx_t_5;
+  __pyx_t_6 = __pyx_v_self->view.len;
+  __pyx_v_info->len = __pyx_t_6;
 
   /* "View.MemoryView":500
  *         info.itemsize = self.view.itemsize
@@ -12129,7 +11734,7 @@ static PyObject *__pyx_memoryview_get_strides_MemoryView_10memoryview_7strides__
  * 
  *                 raise ValueError("Buffer view does not expose strides")
  */
-  __pyx_t_1 = (__pyx_v_self->view.strides == NULL);
+  __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":528
@@ -12139,7 +11744,7 @@ static PyObject *__pyx_memoryview_get_strides_MemoryView_10memoryview_7strides__
  * 
  *             return tuple([self.view.strides[i] for i in xrange(self.view.ndim)])
  */
-    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_32), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_31), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
@@ -12226,7 +11831,7 @@ static PyObject *__pyx_memoryview_get_suboffsets_MemoryView_10memoryview_10subof
  *                 return [-1] * self.view.ndim
  * 
  */
-  __pyx_t_1 = (__pyx_v_self->view.suboffsets == NULL);
+  __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":536
@@ -12488,10 +12093,11 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
-  PyObject *__pyx_t_2 = NULL;
+  int __pyx_t_2;
   PyObject *__pyx_t_3 = NULL;
-  Py_ssize_t __pyx_t_4;
-  PyObject *(*__pyx_t_5)(PyObject *);
+  PyObject *__pyx_t_4 = NULL;
+  Py_ssize_t __pyx_t_5;
+  PyObject *(*__pyx_t_6)(PyObject *);
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -12505,7 +12111,8 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__
  * 
  */
   __pyx_t_1 = (__pyx_v_self->_size == Py_None);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":559
  *         def __get__(self):
@@ -12524,46 +12131,45 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__
  *                     result *= length
  * 
  */
-    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
-      __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
-      __pyx_t_5 = NULL;
+    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) {
+      __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
+      __pyx_t_6 = NULL;
     } else {
-      __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext;
+      __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_4);
+      __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext;
     }
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     for (;;) {
-      if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_3)) {
-        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
+      if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_4)) {
+        if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
         #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         #else
-        __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         #endif
-      } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_3)) {
-        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
+      } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_4)) {
+        if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
         #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         #else
-        __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         #endif
       } else {
-        __pyx_t_2 = __pyx_t_5(__pyx_t_3);
-        if (unlikely(!__pyx_t_2)) {
+        __pyx_t_3 = __pyx_t_6(__pyx_t_4);
+        if (unlikely(!__pyx_t_3)) {
           if (PyErr_Occurred()) {
             if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
             else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           }
           break;
         }
-        __Pyx_GOTREF(__pyx_t_2);
+        __Pyx_GOTREF(__pyx_t_3);
       }
-      __Pyx_XDECREF(__pyx_v_length);
-      __pyx_v_length = __pyx_t_2;
-      __pyx_t_2 = 0;
+      __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_3);
+      __pyx_t_3 = 0;
 
       /* "View.MemoryView":562
  * 
@@ -12572,13 +12178,12 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__
  * 
  *                 self._size = result
  */
-      __pyx_t_2 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(__pyx_v_result);
-      __pyx_v_result = __pyx_t_2;
-      __pyx_t_2 = 0;
+      __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_3);
+      __pyx_t_3 = 0;
     }
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
     /* "View.MemoryView":564
  *                     result *= length
@@ -12611,8 +12216,8 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
+  __Pyx_XDECREF(__pyx_t_4);
   __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
@@ -12655,7 +12260,7 @@ static Py_ssize_t __pyx_memoryview_MemoryView_10memoryview_10__len__(struct __py
  *             return self.view.shape[0]
  * 
  */
-  __pyx_t_1 = (__pyx_v_self->view.ndim >= 1);
+  __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":570
@@ -12757,7 +12362,7 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_12__repr__(struct __py
   __Pyx_GIVEREF(__pyx_t_3);
   __pyx_t_1 = 0;
   __pyx_t_3 = 0;
-  __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_33), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_32), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_3));
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __pyx_r = ((PyObject *)__pyx_t_3);
@@ -12828,7 +12433,7 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_14__str__(struct __pyx
   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
   __pyx_t_1 = 0;
-  __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_34), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_33), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __pyx_r = ((PyObject *)__pyx_t_1);
@@ -13307,7 +12912,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *     else:
  */
   __pyx_t_1 = PyTuple_Check(__pyx_v_index); 
-  __pyx_t_2 = (!__pyx_t_1);
+  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":633
@@ -13416,12 +13021,10 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
       }
       __Pyx_GOTREF(__pyx_t_7);
     }
-    __Pyx_XDECREF(__pyx_v_item);
-    __pyx_v_item = __pyx_t_7;
+    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7);
     __pyx_t_7 = 0;
     __Pyx_INCREF(__pyx_t_3);
-    __Pyx_XDECREF(__pyx_v_idx);
-    __pyx_v_idx = __pyx_t_3;
+    __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3);
     __pyx_t_7 = PyNumber_Add(__pyx_t_3, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
     __Pyx_DECREF(__pyx_t_3);
@@ -13436,7 +13039,8 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
  */
     __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis);
-    if (__pyx_t_2) {
+    __pyx_t_1 = (__pyx_t_2 != 0);
+    if (__pyx_t_1) {
 
       /* "View.MemoryView":642
  *     for idx, item in enumerate(tup):
@@ -13445,8 +13049,8 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
  *                 seen_ellipsis = True
  */
-      __pyx_t_2 = (!__pyx_v_seen_ellipsis);
-      if (__pyx_t_2) {
+      __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0);
+      if (__pyx_t_1) {
 
         /* "View.MemoryView":643
  *         if item is Ellipsis:
@@ -13457,7 +13061,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  */
         __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_result), __pyx_n_s__extend); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_7);
-        __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_35), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_34), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_8);
         __pyx_t_9 = PyObject_Length(__pyx_v_tup); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __pyx_t_10 = PyList_New(1 * ((((__pyx_v_ndim - __pyx_t_9) + 1)<0) ? 0:((__pyx_v_ndim - __pyx_t_9) + 1))); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -13500,7 +13104,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *             have_slices = True
  *         else:
  */
-        __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_36), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_35), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_10);
         __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_10); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
@@ -13516,8 +13120,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  */
       __pyx_t_10 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_10);
-      __Pyx_DECREF(__pyx_v_have_slices);
-      __pyx_v_have_slices = __pyx_t_10;
+      __Pyx_DECREF_SET(__pyx_v_have_slices, __pyx_t_10);
       __pyx_t_10 = 0;
       goto __pyx_L6;
     }
@@ -13530,13 +13133,13 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *                 raise TypeError("Cannot index with type '%s'" % type(item))
  * 
  */
-      __pyx_t_2 = PySlice_Check(__pyx_v_item); 
-      __pyx_t_1 = (!__pyx_t_2);
-      if (__pyx_t_1) {
-        __pyx_t_2 = (!__Pyx_PyIndex_Check(__pyx_v_item));
-        __pyx_t_12 = __pyx_t_2;
-      } else {
+      __pyx_t_1 = PySlice_Check(__pyx_v_item); 
+      __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
+      if (__pyx_t_2) {
+        __pyx_t_1 = ((!(__Pyx_PyIndex_Check(__pyx_v_item) != 0)) != 0);
         __pyx_t_12 = __pyx_t_1;
+      } else {
+        __pyx_t_12 = __pyx_t_2;
       }
       if (__pyx_t_12) {
 
@@ -13547,7 +13150,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  * 
  *             have_slices = have_slices or isinstance(item, slice)
  */
-        __pyx_t_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_37), ((PyObject *)Py_TYPE(__pyx_v_item))); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_36), ((PyObject *)Py_TYPE(__pyx_v_item))); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(((PyObject *)__pyx_t_10));
         __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_8);
@@ -13582,8 +13185,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
         __Pyx_INCREF(__pyx_v_have_slices);
         __pyx_t_8 = __pyx_v_have_slices;
       }
-      __Pyx_DECREF(__pyx_v_have_slices);
-      __pyx_v_have_slices = __pyx_t_8;
+      __Pyx_DECREF_SET(__pyx_v_have_slices, __pyx_t_8);
       __pyx_t_8 = 0;
 
       /* "View.MemoryView":653
@@ -13632,7 +13234,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  */
     __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_result), __pyx_n_s__extend); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_38), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_37), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_8);
@@ -13749,7 +13351,7 @@ static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __
  *             raise ValueError("Indirect dimensions not supported")
  * 
  */
-    __pyx_t_3 = ((__pyx_v_suboffsets[__pyx_v_i]) >= 0);
+    __pyx_t_3 = (((__pyx_v_suboffsets[__pyx_v_i]) >= 0) != 0);
     if (__pyx_t_3) {
 
       /* "View.MemoryView":665
@@ -13759,7 +13361,7 @@ static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __
  * 
  * 
  */
-      __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_40), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_39), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_4);
       __Pyx_Raise(__pyx_t_4, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
@@ -13809,16 +13411,17 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
   struct __pyx_memoryview_obj *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
-  struct __pyx_memoryview_obj *__pyx_t_2;
-  char *__pyx_t_3;
-  int __pyx_t_4;
-  PyObject *__pyx_t_5 = NULL;
-  Py_ssize_t __pyx_t_6;
-  PyObject *(*__pyx_t_7)(PyObject *);
-  PyObject *__pyx_t_8 = NULL;
-  int __pyx_t_9;
+  int __pyx_t_2;
+  struct __pyx_memoryview_obj *__pyx_t_3;
+  char *__pyx_t_4;
+  int __pyx_t_5;
+  PyObject *__pyx_t_6 = NULL;
+  Py_ssize_t __pyx_t_7;
+  PyObject *(*__pyx_t_8)(PyObject *);
+  PyObject *__pyx_t_9 = NULL;
   Py_ssize_t __pyx_t_10;
-  PyObject *__pyx_t_11 = NULL;
+  int __pyx_t_11;
+  PyObject *__pyx_t_12 = NULL;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -13851,7 +13454,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *     if isinstance(memview, _memoryviewslice):
  */
   #ifndef CYTHON_WITHOUT_ASSERTIONS
-  if (unlikely(!(__pyx_v_memview->view.ndim > 0))) {
+  if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) {
     PyErr_SetNone(PyExc_AssertionError);
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
@@ -13865,7 +13468,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *         p_src = &memviewsliceobj.from_slice
  */
   __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), ((PyObject *)__pyx_memoryviewslice_type)); 
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":687
  * 
@@ -13917,8 +13521,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *     dst.data = p_src.data
  * 
  */
-  __pyx_t_2 = __pyx_v_p_src->memview;
-  __pyx_v_dst.memview = __pyx_t_2;
+  __pyx_t_3 = __pyx_v_p_src->memview;
+  __pyx_v_dst.memview = __pyx_t_3;
 
   /* "View.MemoryView":698
  * 
@@ -13927,8 +13531,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  * 
  * 
  */
-  __pyx_t_3 = __pyx_v_p_src->data;
-  __pyx_v_dst.data = __pyx_t_3;
+  __pyx_t_4 = __pyx_v_p_src->data;
+  __pyx_v_dst.data = __pyx_t_4;
 
   /* "View.MemoryView":703
  * 
@@ -13955,46 +13559,45 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *         if PyIndex_Check(index):
  *             slice_memviewslice(
  */
-  __pyx_t_4 = 0;
+  __pyx_t_5 = 0;
   if (PyList_CheckExact(__pyx_v_indices) || PyTuple_CheckExact(__pyx_v_indices)) {
-    __pyx_t_5 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_5); __pyx_t_6 = 0;
-    __pyx_t_7 = NULL;
+    __pyx_t_6 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_6); __pyx_t_7 = 0;
+    __pyx_t_8 = NULL;
   } else {
-    __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext;
+    __pyx_t_7 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __pyx_t_8 = Py_TYPE(__pyx_t_6)->tp_iternext;
   }
   for (;;) {
-    if (!__pyx_t_7 && PyList_CheckExact(__pyx_t_5)) {
-      if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break;
+    if (!__pyx_t_8 && PyList_CheckExact(__pyx_t_6)) {
+      if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_6)) break;
       #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_8 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       #else
-      __pyx_t_8 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       #endif
-    } else if (!__pyx_t_7 && PyTuple_CheckExact(__pyx_t_5)) {
-      if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
+    } else if (!__pyx_t_8 && PyTuple_CheckExact(__pyx_t_6)) {
+      if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
       #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       #else
-      __pyx_t_8 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       #endif
     } else {
-      __pyx_t_8 = __pyx_t_7(__pyx_t_5);
-      if (unlikely(!__pyx_t_8)) {
+      __pyx_t_9 = __pyx_t_8(__pyx_t_6);
+      if (unlikely(!__pyx_t_9)) {
         if (PyErr_Occurred()) {
           if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
           else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         }
         break;
       }
-      __Pyx_GOTREF(__pyx_t_8);
+      __Pyx_GOTREF(__pyx_t_9);
     }
-    __Pyx_XDECREF(__pyx_v_index);
-    __pyx_v_index = __pyx_t_8;
-    __pyx_t_8 = 0;
-    __pyx_v_dim = __pyx_t_4;
-    __pyx_t_4 = (__pyx_t_4 + 1);
+    __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9);
+    __pyx_t_9 = 0;
+    __pyx_v_dim = __pyx_t_5;
+    __pyx_t_5 = (__pyx_t_5 + 1);
 
     /* "View.MemoryView":709
  * 
@@ -14003,8 +13606,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             slice_memviewslice(
  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
  */
-    __pyx_t_9 = __Pyx_PyIndex_Check(__pyx_v_index);
-    if (__pyx_t_9) {
+    __pyx_t_2 = (__Pyx_PyIndex_Check(__pyx_v_index) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":713
  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
@@ -14022,7 +13625,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *         elif index is None:
  *             p_dst.shape[new_ndim] = 1
  */
-      __pyx_t_9 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_10, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_10, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L6;
     }
 
@@ -14033,7 +13636,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             p_dst.shape[new_ndim] = 1
  *             p_dst.strides[new_ndim] = 0
  */
-    __pyx_t_1 = (__pyx_v_index == Py_None);
+    __pyx_t_2 = (__pyx_v_index == Py_None);
+    __pyx_t_1 = (__pyx_t_2 != 0);
     if (__pyx_t_1) {
 
       /* "View.MemoryView":717
@@ -14082,19 +13686,19 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             stop = index.stop or 0
  *             step = index.step or 0
  */
-      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_8);
-      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
+      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       if (!__pyx_t_1) {
-        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
         __Pyx_INCREF(__pyx_int_0);
-        __pyx_t_11 = __pyx_int_0;
+        __pyx_t_12 = __pyx_int_0;
       } else {
-        __pyx_t_11 = __pyx_t_8;
-        __pyx_t_8 = 0;
+        __pyx_t_12 = __pyx_t_9;
+        __pyx_t_9 = 0;
       }
-      __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_11); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+      __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_12); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
       __pyx_v_start = __pyx_t_10;
 
       /* "View.MemoryView":723
@@ -14104,19 +13708,19 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             step = index.step or 0
  * 
  */
-      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__stop); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_11);
-      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__stop); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_12);
+      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       if (!__pyx_t_1) {
-        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
         __Pyx_INCREF(__pyx_int_0);
-        __pyx_t_8 = __pyx_int_0;
+        __pyx_t_9 = __pyx_int_0;
       } else {
-        __pyx_t_8 = __pyx_t_11;
-        __pyx_t_11 = 0;
+        __pyx_t_9 = __pyx_t_12;
+        __pyx_t_12 = 0;
       }
-      __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+      __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
       __pyx_v_stop = __pyx_t_10;
 
       /* "View.MemoryView":724
@@ -14126,19 +13730,19 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  * 
  *             have_start = index.start is not None
  */
-      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_8);
-      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
+      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       if (!__pyx_t_1) {
-        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
         __Pyx_INCREF(__pyx_int_0);
-        __pyx_t_11 = __pyx_int_0;
+        __pyx_t_12 = __pyx_int_0;
       } else {
-        __pyx_t_11 = __pyx_t_8;
-        __pyx_t_8 = 0;
+        __pyx_t_12 = __pyx_t_9;
+        __pyx_t_9 = 0;
       }
-      __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_11); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+      __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_12); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
       __pyx_v_step = __pyx_t_10;
 
       /* "View.MemoryView":726
@@ -14148,10 +13752,10 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             have_stop = index.stop is not None
  *             have_step = index.step is not None
  */
-      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_11);
-      __pyx_t_1 = (__pyx_t_11 != Py_None);
-      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_12);
+      __pyx_t_1 = (__pyx_t_12 != Py_None);
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
       __pyx_v_have_start = __pyx_t_1;
 
       /* "View.MemoryView":727
@@ -14161,10 +13765,10 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             have_step = index.step is not None
  * 
  */
-      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__stop); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_11);
-      __pyx_t_1 = (__pyx_t_11 != Py_None);
-      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__stop); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_12);
+      __pyx_t_1 = (__pyx_t_12 != Py_None);
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
       __pyx_v_have_stop = __pyx_t_1;
 
       /* "View.MemoryView":728
@@ -14174,10 +13778,10 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  * 
  *             slice_memviewslice(
  */
-      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_11);
-      __pyx_t_1 = (__pyx_t_11 != Py_None);
-      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_12);
+      __pyx_t_1 = (__pyx_t_12 != Py_None);
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
       __pyx_v_have_step = __pyx_t_1;
 
       /* "View.MemoryView":735
@@ -14187,7 +13791,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             new_ndim += 1
  * 
  */
-      __pyx_t_9 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
       /* "View.MemoryView":736
  *                 have_start, have_stop, have_step,
@@ -14200,7 +13804,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
     }
     __pyx_L6:;
   }
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
 
   /* "View.MemoryView":738
  *             new_ndim += 1
@@ -14210,7 +13814,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *                                     memviewsliceobj.to_object_func,
  */
   __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), ((PyObject *)__pyx_memoryviewslice_type)); 
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":739
  * 
@@ -14237,11 +13842,11 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *     else:
  *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,
  */
-    __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_5);
-    __pyx_t_5 = 0;
+    __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_6);
+    __pyx_t_6 = 0;
     goto __pyx_L0;
     goto __pyx_L7;
   }
@@ -14263,11 +13868,11 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  * 
  * 
  */
-    __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_5);
-    __pyx_t_5 = 0;
+    __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_6);
+    __pyx_t_6 = 0;
     goto __pyx_L0;
   }
   __pyx_L7:;
@@ -14275,9 +13880,9 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
   __pyx_r = ((struct __pyx_memoryview_obj *)Py_None); __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_5);
-  __Pyx_XDECREF(__pyx_t_8);
-  __Pyx_XDECREF(__pyx_t_11);
+  __Pyx_XDECREF(__pyx_t_6);
+  __Pyx_XDECREF(__pyx_t_9);
+  __Pyx_XDECREF(__pyx_t_12);
   __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
@@ -14304,7 +13909,6 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
   int __pyx_t_2;
   int __pyx_t_3;
   int __pyx_t_4;
-  Py_ssize_t __pyx_t_5;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -14316,7 +13920,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  * 
  *         if start < 0:
  */
-  __pyx_t_1 = (!__pyx_v_is_slice);
+  __pyx_t_1 = ((!(__pyx_v_is_slice != 0)) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":791
@@ -14326,7 +13930,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             start += shape
  *         if not 0 <= start < shape:
  */
-    __pyx_t_1 = (__pyx_v_start < 0);
+    __pyx_t_1 = ((__pyx_v_start < 0) != 0);
     if (__pyx_t_1) {
 
       /* "View.MemoryView":792
@@ -14352,7 +13956,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
     if (__pyx_t_1) {
       __pyx_t_1 = (__pyx_v_start < __pyx_v_shape);
     }
-    __pyx_t_2 = (!__pyx_t_1);
+    __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":794
@@ -14362,7 +13966,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *     else:
  * 
  */
-      __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, __pyx_k_41, __pyx_v_dim); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, __pyx_k_40, __pyx_v_dim); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L5;
     }
     __pyx_L5:;
@@ -14393,11 +13997,11 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
  * 
  */
-    if (__pyx_v_have_step) {
+    if ((__pyx_v_have_step != 0)) {
       __pyx_t_4 = (__pyx_v_step == 0);
       __pyx_t_2 = __pyx_t_4;
     } else {
-      __pyx_t_2 = __pyx_v_have_step;
+      __pyx_t_2 = (__pyx_v_have_step != 0);
     }
     if (__pyx_t_2) {
 
@@ -14408,7 +14012,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  * 
  * 
  */
-      __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, __pyx_k_42, __pyx_v_dim); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, __pyx_k_41, __pyx_v_dim); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L6;
     }
     __pyx_L6:;
@@ -14420,7 +14024,8 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             if start < 0:
  *                 start += shape
  */
-    if (__pyx_v_have_start) {
+    __pyx_t_2 = (__pyx_v_have_start != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":804
  * 
@@ -14429,7 +14034,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 start += shape
  *                 if start < 0:
  */
-      __pyx_t_2 = (__pyx_v_start < 0);
+      __pyx_t_2 = ((__pyx_v_start < 0) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":805
@@ -14448,7 +14053,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                     start = 0
  *             elif start >= shape:
  */
-        __pyx_t_2 = (__pyx_v_start < 0);
+        __pyx_t_2 = ((__pyx_v_start < 0) != 0);
         if (__pyx_t_2) {
 
           /* "View.MemoryView":807
@@ -14472,7 +14077,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 if negative_step:
  *                     start = shape - 1
  */
-      __pyx_t_2 = (__pyx_v_start >= __pyx_v_shape);
+      __pyx_t_2 = ((__pyx_v_start >= __pyx_v_shape) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":809
@@ -14482,7 +14087,8 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                     start = shape - 1
  *                 else:
  */
-        if (__pyx_v_negative_step) {
+        __pyx_t_2 = (__pyx_v_negative_step != 0);
+        if (__pyx_t_2) {
 
           /* "View.MemoryView":810
  *             elif start >= shape:
@@ -14520,7 +14126,8 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 start = shape - 1
  *             else:
  */
-      if (__pyx_v_negative_step) {
+      __pyx_t_2 = (__pyx_v_negative_step != 0);
+      if (__pyx_t_2) {
 
         /* "View.MemoryView":815
  *         else:
@@ -14554,7 +14161,8 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             if stop < 0:
  *                 stop += shape
  */
-    if (__pyx_v_have_stop) {
+    __pyx_t_2 = (__pyx_v_have_stop != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":820
  * 
@@ -14563,7 +14171,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 stop += shape
  *                 if stop < 0:
  */
-      __pyx_t_2 = (__pyx_v_stop < 0);
+      __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":821
@@ -14582,7 +14190,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                     stop = 0
  *             elif stop > shape:
  */
-        __pyx_t_2 = (__pyx_v_stop < 0);
+        __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
         if (__pyx_t_2) {
 
           /* "View.MemoryView":823
@@ -14606,7 +14214,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 stop = shape
  *         else:
  */
-      __pyx_t_2 = (__pyx_v_stop > __pyx_v_shape);
+      __pyx_t_2 = ((__pyx_v_stop > __pyx_v_shape) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":825
@@ -14631,7 +14239,8 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 stop = -1
  *             else:
  */
-      if (__pyx_v_negative_step) {
+      __pyx_t_2 = (__pyx_v_negative_step != 0);
+      if (__pyx_t_2) {
 
         /* "View.MemoryView":828
  *         else:
@@ -14665,7 +14274,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             step = 1
  * 
  */
-    __pyx_t_2 = (!__pyx_v_have_step);
+    __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":833
@@ -14696,8 +14305,8 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 new_shape += 1
  * 
  */
-    __pyx_t_5 = ((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape));
-    if (__pyx_t_5) {
+    __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":840
  * 
@@ -14718,7 +14327,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             new_shape = 0
  * 
  */
-    __pyx_t_2 = (__pyx_v_new_shape < 0);
+    __pyx_t_2 = ((__pyx_v_new_shape < 0) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":843
@@ -14769,7 +14378,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *         dst.data += start * stride
  *     else:
  */
-  __pyx_t_2 = ((__pyx_v_suboffset_dim[0]) < 0);
+  __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":852
@@ -14803,7 +14412,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *         if not is_slice:
  *             if new_ndim == 0:
  */
-  __pyx_t_2 = (__pyx_v_suboffset >= 0);
+  __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":857
@@ -14813,7 +14422,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             if new_ndim == 0:
  *                 dst.data = (<char **> dst.data)[0] + suboffset
  */
-    __pyx_t_2 = (!__pyx_v_is_slice);
+    __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":858
@@ -14823,7 +14432,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 dst.data = (<char **> dst.data)[0] + suboffset
  *             else:
  */
-      __pyx_t_2 = (__pyx_v_new_ndim == 0);
+      __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":859
@@ -14845,7 +14454,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *         else:
  *             suboffset_dim[0] = new_ndim
  */
-        __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, __pyx_k_43, __pyx_v_dim); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, __pyx_k_42, __pyx_v_dim); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       }
       __pyx_L22:;
       goto __pyx_L21;
@@ -14897,11 +14506,11 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  * 
  * @cname('__pyx_pybuffer_index')
  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,             # <<<<<<<<<<<<<<
- *                           int dim) except NULL:
+ *                           Py_ssize_t dim) except NULL:
  *     cdef Py_ssize_t shape, stride, suboffset = -1
  */
 
-static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, int __pyx_v_dim) {
+static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) {
   Py_ssize_t __pyx_v_shape;
   Py_ssize_t __pyx_v_stride;
   Py_ssize_t __pyx_v_suboffset;
@@ -14920,7 +14529,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
 
   /* "View.MemoryView":874
  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,
- *                           int dim) except NULL:
+ *                           Py_ssize_t dim) except NULL:
  *     cdef Py_ssize_t shape, stride, suboffset = -1             # <<<<<<<<<<<<<<
  *     cdef Py_ssize_t itemsize = view.itemsize
  *     cdef char *resultp
@@ -14928,7 +14537,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
   __pyx_v_suboffset = -1;
 
   /* "View.MemoryView":875
- *                           int dim) except NULL:
+ *                           Py_ssize_t dim) except NULL:
  *     cdef Py_ssize_t shape, stride, suboffset = -1
  *     cdef Py_ssize_t itemsize = view.itemsize             # <<<<<<<<<<<<<<
  *     cdef char *resultp
@@ -14944,7 +14553,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *         shape = view.len / itemsize
  *         stride = itemsize
  */
-  __pyx_t_2 = (__pyx_v_view->ndim == 0);
+  __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":879
@@ -15013,7 +14622,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *             suboffset = view.suboffsets[dim]
  * 
  */
-    __pyx_t_2 = (__pyx_v_view->suboffsets != NULL);
+    __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":885
@@ -15037,7 +14646,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *         index += view.shape[dim]
  *         if index < 0:
  */
-  __pyx_t_2 = (__pyx_v_index < 0);
+  __pyx_t_2 = ((__pyx_v_index < 0) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":888
@@ -15056,7 +14665,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
  * 
  */
-    __pyx_t_2 = (__pyx_v_index < 0);
+    __pyx_t_2 = ((__pyx_v_index < 0) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":890
@@ -15066,9 +14675,9 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  * 
  *     if index >= shape:
  */
-      __pyx_t_3 = PyInt_FromLong(__pyx_v_dim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_44), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_43), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_4));
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
       __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -15096,7 +14705,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
  * 
  */
-  __pyx_t_2 = (__pyx_v_index >= __pyx_v_shape);
+  __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":893
@@ -15106,9 +14715,9 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  * 
  *     resultp = bufp + index * stride
  */
-    __pyx_t_4 = PyInt_FromLong(__pyx_v_dim); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_44), __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_43), __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_3));
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -15142,7 +14751,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *         resultp = (<char **> resultp)[0] + suboffset
  * 
  */
-  __pyx_t_2 = (__pyx_v_suboffset >= 0);
+  __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":897
@@ -15288,9 +14897,9 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
  * 
  */
-    __pyx_t_6 = ((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0);
+    __pyx_t_6 = (((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0) != 0);
     if (!__pyx_t_6) {
-      __pyx_t_7 = ((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0);
+      __pyx_t_7 = (((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0) != 0);
       __pyx_t_8 = __pyx_t_7;
     } else {
       __pyx_t_8 = __pyx_t_6;
@@ -15304,7 +14913,7 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  * 
  *     return 1
  */
-      __pyx_t_9 = __pyx_memoryview_err(__pyx_builtin_ValueError, __pyx_k_45); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = __pyx_memoryview_err(__pyx_builtin_ValueError, __pyx_k_44); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L5;
     }
     __pyx_L5:;
@@ -15395,7 +15004,7 @@ static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memor
  *             return self.to_object_func(itemp)
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_self->to_object_func != NULL);
+  __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":943
@@ -15469,7 +15078,7 @@ static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memo
  *             self.to_dtype_func(itemp, value)
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_self->to_dtype_func != NULL);
+  __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":949
@@ -15585,7 +15194,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
  *         return None
  * 
  */
-  __pyx_t_1 = (((PyObject *)__pyx_v_memviewslice.memview) == Py_None);
+  __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":972
@@ -15842,6 +15451,7 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p
   __Pyx_memviewslice *__pyx_r;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
+  int __pyx_t_2;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -15855,7 +15465,8 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p
  *         return &obj.from_slice
  */
   __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), ((PyObject *)__pyx_memoryviewslice_type)); 
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":1011
  *     cdef _memoryviewslice obj
@@ -16017,7 +15628,7 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem
  *             dst.suboffsets[dim] = -1
  *         else:
  */
-    __pyx_t_4 = (__pyx_v_suboffsets == NULL);
+    __pyx_t_4 = ((__pyx_v_suboffsets == NULL) != 0);
     if (__pyx_t_4) {
 
       /* "View.MemoryView":1033
@@ -16114,9 +15725,10 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
-  PyObject *(*__pyx_t_2)(char *);
-  int (*__pyx_t_3)(char *, PyObject *);
-  PyObject *__pyx_t_4 = NULL;
+  int __pyx_t_2;
+  PyObject *(*__pyx_t_3)(char *);
+  int (*__pyx_t_4)(char *, PyObject *);
+  PyObject *__pyx_t_5 = NULL;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -16130,7 +15742,8 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview
  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
  */
   __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), ((PyObject *)__pyx_memoryviewslice_type)); 
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":1053
  * 
@@ -16139,8 +15752,8 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview
  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
  *     else:
  */
-    __pyx_t_2 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
-    __pyx_v_to_object_func = __pyx_t_2;
+    __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
+    __pyx_v_to_object_func = __pyx_t_3;
 
     /* "View.MemoryView":1054
  *     if isinstance(memview, _memoryviewslice):
@@ -16149,8 +15762,8 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview
  *     else:
  *         to_object_func = NULL
  */
-    __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
-    __pyx_v_to_dtype_func = __pyx_t_3;
+    __pyx_t_4 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
+    __pyx_v_to_dtype_func = __pyx_t_4;
     goto __pyx_L3;
   }
   /*else*/ {
@@ -16191,16 +15804,16 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview
  * 
  * 
  */
-  __pyx_t_4 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_r = __pyx_t_4;
-  __pyx_t_4 = 0;
+  __pyx_t_5 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
+  __pyx_r = __pyx_t_5;
+  __pyx_t_5 = 0;
   goto __pyx_L0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_4);
+  __Pyx_XDECREF(__pyx_t_5);
   __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
@@ -16228,7 +15841,7 @@ static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) {
  *         return -arg
  *     else:
  */
-  __pyx_t_1 = (__pyx_v_arg < 0);
+  __pyx_t_1 = ((__pyx_v_arg < 0) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":1069
@@ -16313,7 +15926,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _
  *             c_stride = mslice.strides[i]
  *             break
  */
-    __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1);
+    __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":1084
@@ -16357,7 +15970,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _
  *             f_stride = mslice.strides[i]
  *             break
  */
-    __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1);
+    __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":1089
@@ -16390,7 +16003,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _
  *         return 'C'
  *     else:
  */
-  __pyx_t_2 = (abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride));
+  __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":1093
@@ -16487,7 +16100,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v
  *        if (src_stride > 0 and dst_stride > 0 and
  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
  */
-  __pyx_t_1 = (__pyx_v_ndim == 1);
+  __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":1111
@@ -16497,9 +16110,9 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v
  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
  *            memcpy(dst_data, src_data, itemsize * dst_extent)
  */
-    __pyx_t_1 = (__pyx_v_src_stride > 0);
+    __pyx_t_1 = ((__pyx_v_src_stride > 0) != 0);
     if (__pyx_t_1) {
-      __pyx_t_2 = (__pyx_v_dst_stride > 0);
+      __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":1112
@@ -16513,7 +16126,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v
         if (__pyx_t_3) {
           __pyx_t_3 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride));
         }
-        __pyx_t_4 = __pyx_t_3;
+        __pyx_t_4 = (__pyx_t_3 != 0);
       } else {
         __pyx_t_4 = __pyx_t_2;
       }
@@ -16727,7 +16340,7 @@ static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_
  *         for idx in range(ndim):
  *             strides[idx] = stride
  */
-  __pyx_t_1 = (__pyx_v_order == 'F');
+  __pyx_t_1 = ((__pyx_v_order == 'F') != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":1156
@@ -16867,7 +16480,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *         _err(MemoryError, NULL)
  * 
  */
-  __pyx_t_2 = (!(__pyx_v_result != 0));
+  __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":1183
@@ -16958,7 +16571,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *             tmpslice.strides[i] = 0
  * 
  */
-    __pyx_t_2 = ((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1);
+    __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":1198
@@ -16981,7 +16594,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *         memcpy(result, src.data, size)
  *     else:
  */
-  __pyx_t_2 = __pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim);
+  __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":1201
@@ -17081,7 +16694,7 @@ static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent
   __pyx_t_1 = 0;
   __pyx_t_2 = 0;
   __pyx_t_3 = 0;
-  __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_46), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_45), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_3));
   __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
   __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -17210,7 +16823,7 @@ static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) {
  *         raise error(msg.decode('ascii'))
  *     else:
  */
-  __pyx_t_1 = (__pyx_v_msg != NULL);
+  __pyx_t_1 = ((__pyx_v_msg != NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":1222
@@ -17289,6 +16902,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
   int __pyx_t_4;
   int __pyx_t_5;
   void *__pyx_t_6;
+  int __pyx_t_7;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -17346,7 +16960,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *         broadcast_leading(&src, src_ndim, dst_ndim)
  *     elif dst_ndim < src_ndim:
  */
-  __pyx_t_2 = (__pyx_v_src_ndim < __pyx_v_dst_ndim);
+  __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":1244
@@ -17367,7 +16981,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *         broadcast_leading(&dst, dst_ndim, src_ndim)
  * 
  */
-  __pyx_t_2 = (__pyx_v_dst_ndim < __pyx_v_src_ndim);
+  __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":1246
@@ -17391,7 +17005,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  */
   __pyx_t_3 = __pyx_v_dst_ndim;
   __pyx_t_4 = __pyx_v_src_ndim;
-  if ((__pyx_t_3 > __pyx_t_4)) {
+  if (((__pyx_t_3 > __pyx_t_4) != 0)) {
     __pyx_t_5 = __pyx_t_3;
   } else {
     __pyx_t_5 = __pyx_t_4;
@@ -17416,7 +17030,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *             if src.shape[i] == 1:
  *                 broadcasting = True
  */
-    __pyx_t_2 = ((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i]));
+    __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":1252
@@ -17426,7 +17040,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *                 broadcasting = True
  *                 src.strides[i] = 0
  */
-      __pyx_t_2 = ((__pyx_v_src.shape[__pyx_v_i]) == 1);
+      __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":1253
@@ -17471,7 +17085,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *             _err_dim(ValueError, "Dimension %d is not direct", i)
  * 
  */
-    __pyx_t_2 = ((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0);
+    __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":1259
@@ -17481,7 +17095,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  *     if slices_overlap(&src, &dst, ndim, itemsize):
  */
-      __pyx_t_4 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, __pyx_k_47, __pyx_v_i); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, __pyx_k_46, __pyx_v_i); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L8;
     }
     __pyx_L8:;
@@ -17494,7 +17108,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  *         if not slice_is_contig(&src, order, ndim):
  */
-  __pyx_t_2 = __pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize);
+  __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":1263
@@ -17504,7 +17118,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *             order = get_best_order(&dst, ndim)
  * 
  */
-    __pyx_t_2 = (!__pyx_memviewslice_is_contig((&__pyx_v_src), __pyx_v_order, __pyx_v_ndim));
+    __pyx_t_2 = ((!(__pyx_memviewslice_is_contig((&__pyx_v_src), __pyx_v_order, __pyx_v_ndim) != 0)) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":1264
@@ -17548,7 +17162,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  * 
  */
-  __pyx_t_2 = (!__pyx_v_broadcasting);
+  __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":1272
@@ -17558,7 +17172,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *             direct_copy = slice_is_contig(&dst, 'C', ndim)
  *         elif slice_is_contig(&src, 'F', ndim):
  */
-    __pyx_t_2 = __pyx_memviewslice_is_contig((&__pyx_v_src), 'C', __pyx_v_ndim);
+    __pyx_t_2 = (__pyx_memviewslice_is_contig((&__pyx_v_src), 'C', __pyx_v_ndim) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":1273
@@ -17579,7 +17193,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *             direct_copy = slice_is_contig(&dst, 'F', ndim)
  * 
  */
-    __pyx_t_2 = __pyx_memviewslice_is_contig((&__pyx_v_src), 'F', __pyx_v_ndim);
+    __pyx_t_2 = (__pyx_memviewslice_is_contig((&__pyx_v_src), 'F', __pyx_v_ndim) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":1275
@@ -17601,7 +17215,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  *             refcount_copying(&dst, dtype_is_object, ndim, False)
  */
-    if (__pyx_v_direct_copy) {
+    __pyx_t_2 = (__pyx_v_direct_copy != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1279
  *         if direct_copy:
@@ -17657,7 +17272,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
   if (__pyx_t_2) {
     __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
   }
-  if (__pyx_t_2) {
+  __pyx_t_7 = (__pyx_t_2 != 0);
+  if (__pyx_t_7) {
 
     /* "View.MemoryView":1287
  * 
@@ -17854,6 +17470,7 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_slice
  */
 
 static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) {
+  int __pyx_t_1;
 
   /* "View.MemoryView":1324
  * 
@@ -17862,7 +17479,8 @@ static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, i
  *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,
  *                                            dst.strides, ndim, inc)
  */
-  if (__pyx_v_dtype_is_object) {
+  __pyx_t_1 = (__pyx_v_dtype_is_object != 0);
+  if (__pyx_t_1) {
 
     /* "View.MemoryView":1326
  *     if dtype_is_object:
@@ -17942,7 +17560,7 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss
  *             if inc:
  *                 Py_INCREF((<PyObject **> data)[0])
  */
-    __pyx_t_3 = (__pyx_v_ndim == 1);
+    __pyx_t_3 = ((__pyx_v_ndim == 1) != 0);
     if (__pyx_t_3) {
 
       /* "View.MemoryView":1341
@@ -17952,7 +17570,8 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss
  *                 Py_INCREF((<PyObject **> data)[0])
  *             else:
  */
-      if (__pyx_v_inc) {
+      __pyx_t_3 = (__pyx_v_inc != 0);
+      if (__pyx_t_3) {
 
         /* "View.MemoryView":1342
  *         if ndim == 1:
@@ -18084,7 +17703,7 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t
  *         for i in range(extent):
  *             memcpy(data, item, itemsize)
  */
-  __pyx_t_1 = (__pyx_v_ndim == 1);
+  __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":1373
@@ -18153,62 +17772,77 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t
   __pyx_L3:;
 
 }
+static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;
 
-static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
-  struct __pyx_array_obj *p;
+static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
+  struct __pyx_memoryview_obj *p;
   PyObject *o;
   o = (*t->tp_alloc)(t, 0);
   if (unlikely(!o)) return 0;
-  p = ((struct __pyx_array_obj *)o);
-  p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
-  p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
-  if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) {
+  p = ((struct __pyx_memoryview_obj *)o);
+  p->__pyx_vtab = __pyx_vtabptr_memoryview;
+  p->obj = Py_None; Py_INCREF(Py_None);
+  p->_size = Py_None; Py_INCREF(Py_None);
+  p->_array_interface = Py_None; Py_INCREF(Py_None);
+  p->view.obj = NULL;
+  if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) {
     Py_DECREF(o); o = 0;
   }
   return o;
 }
 
-static void __pyx_tp_dealloc_array(PyObject *o) {
-  struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
+static void __pyx_tp_dealloc_memoryview(PyObject *o) {
+  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
   PyObject_GC_UnTrack(o);
   {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
     ++Py_REFCNT(o);
-    __pyx_array___dealloc__(o);
+    __pyx_memoryview___dealloc__(o);
     if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
     --Py_REFCNT(o);
     PyErr_Restore(etype, eval, etb);
   }
-  Py_CLEAR(p->mode);
-  Py_CLEAR(p->_format);
+  Py_CLEAR(p->obj);
+  Py_CLEAR(p->_size);
+  Py_CLEAR(p->_array_interface);
   (*Py_TYPE(o)->tp_free)(o);
 }
 
-static int __pyx_tp_traverse_array(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) {
   int e;
-  struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
-  if (p->mode) {
-    e = (*v)(p->mode, a); if (e) return e;
-  }
-  if (p->_format) {
-    e = (*v)(p->_format, a); if (e) return e;
+  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
+  if (p->obj) {
+    e = (*v)(p->obj, a); if (e) return e;
+  }
+  if (p->_size) {
+    e = (*v)(p->_size, a); if (e) return e;
+  }
+  if (p->_array_interface) {
+    e = (*v)(p->_array_interface, a); if (e) return e;
+  }
+  if (p->view.obj) {
+    e = (*v)(p->view.obj, a); if (e) return e;
   }
   return 0;
 }
 
-static int __pyx_tp_clear_array(PyObject *o) {
-  struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
+static int __pyx_tp_clear_memoryview(PyObject *o) {
+  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
   PyObject* tmp;
-  tmp = ((PyObject*)p->mode);
-  p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
+  tmp = ((PyObject*)p->obj);
+  p->obj = Py_None; Py_INCREF(Py_None);
   Py_XDECREF(tmp);
-  tmp = ((PyObject*)p->_format);
-  p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
+  tmp = ((PyObject*)p->_size);
+  p->_size = Py_None; Py_INCREF(Py_None);
   Py_XDECREF(tmp);
+  tmp = ((PyObject*)p->_array_interface);
+  p->_array_interface = Py_None; Py_INCREF(Py_None);
+  Py_XDECREF(tmp);
+  Py_CLEAR(p->view.obj);
   return 0;
 }
-static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
+static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
   PyObject *r;
   PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
   r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
@@ -18216,9 +17850,9 @@ static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
   return r;
 }
 
-static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) {
+static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) {
   if (v) {
-    return __pyx_array___setitem__(o, i, v);
+    return __pyx_memoryview___setitem__(o, i, v);
   }
   else {
     PyErr_Format(PyExc_NotImplementedError,
@@ -18227,285 +17861,68 @@ static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) {
   }
 }
 
-static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) {
-  PyObject *v = PyObject_GenericGetAttr(o, n);
-  if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
-    PyErr_Clear();
-    v = __pyx_array___getattr__(o, n);
-  }
-  return v;
+static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_transpose(o);
 }
 
-static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) {
-  return get_memview(o);
+static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview__get__base(o);
 }
 
-static PyMethodDef __pyx_methods_array[] = {
-  {__Pyx_NAMESTR("__getattr__"), (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, __Pyx_DOCSTR(0)},
-  {0, 0, 0, 0}
-};
-
-static struct PyGetSetDef __pyx_getsets_array[] = {
-  {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, 0, 0},
-  {0, 0, 0, 0, 0}
-};
-
-static PyNumberMethods __pyx_tp_as_number_array = {
-  0, /*nb_add*/
-  0, /*nb_subtract*/
-  0, /*nb_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_divide*/
-  #endif
-  0, /*nb_remainder*/
-  0, /*nb_divmod*/
-  0, /*nb_power*/
-  0, /*nb_negative*/
-  0, /*nb_positive*/
-  0, /*nb_absolute*/
-  0, /*nb_nonzero*/
-  0, /*nb_invert*/
-  0, /*nb_lshift*/
-  0, /*nb_rshift*/
-  0, /*nb_and*/
-  0, /*nb_xor*/
-  0, /*nb_or*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_coerce*/
-  #endif
-  0, /*nb_int*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_long*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*nb_float*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_oct*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_hex*/
-  #endif
-  0, /*nb_inplace_add*/
-  0, /*nb_inplace_subtract*/
-  0, /*nb_inplace_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_inplace_divide*/
-  #endif
-  0, /*nb_inplace_remainder*/
-  0, /*nb_inplace_power*/
-  0, /*nb_inplace_lshift*/
-  0, /*nb_inplace_rshift*/
-  0, /*nb_inplace_and*/
-  0, /*nb_inplace_xor*/
-  0, /*nb_inplace_or*/
-  0, /*nb_floor_divide*/
-  0, /*nb_true_divide*/
-  0, /*nb_inplace_floor_divide*/
-  0, /*nb_inplace_true_divide*/
-  #if PY_VERSION_HEX >= 0x02050000
-  0, /*nb_index*/
-  #endif
-};
-
-static PySequenceMethods __pyx_tp_as_sequence_array = {
-  0, /*sq_length*/
-  0, /*sq_concat*/
-  0, /*sq_repeat*/
-  __pyx_sq_item_array, /*sq_item*/
-  0, /*sq_slice*/
-  0, /*sq_ass_item*/
-  0, /*sq_ass_slice*/
-  0, /*sq_contains*/
-  0, /*sq_inplace_concat*/
-  0, /*sq_inplace_repeat*/
-};
-
-static PyMappingMethods __pyx_tp_as_mapping_array = {
-  0, /*mp_length*/
-  __pyx_array___getitem__, /*mp_subscript*/
-  __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/
-};
+static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_shape(o);
+}
 
-static PyBufferProcs __pyx_tp_as_buffer_array = {
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getreadbuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getwritebuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getsegcount*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getcharbuffer*/
-  #endif
-  #if PY_VERSION_HEX >= 0x02060000
-  __pyx_array_getbuffer, /*bf_getbuffer*/
-  #endif
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_releasebuffer*/
-  #endif
-};
+static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_strides(o);
+}
 
-static PyTypeObject __pyx_type___pyx_array = {
-  PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("histogram.array"), /*tp_name*/
-  sizeof(struct __pyx_array_obj), /*tp_basicsize*/
-  0, /*tp_itemsize*/
-  __pyx_tp_dealloc_array, /*tp_dealloc*/
-  0, /*tp_print*/
-  0, /*tp_getattr*/
-  0, /*tp_setattr*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*tp_compare*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*tp_repr*/
-  &__pyx_tp_as_number_array, /*tp_as_number*/
-  &__pyx_tp_as_sequence_array, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping_array, /*tp_as_mapping*/
-  0, /*tp_hash*/
-  0, /*tp_call*/
-  0, /*tp_str*/
-  __pyx_tp_getattro_array, /*tp_getattro*/
-  0, /*tp_setattro*/
-  &__pyx_tp_as_buffer_array, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
-  0, /*tp_doc*/
-  __pyx_tp_traverse_array, /*tp_traverse*/
-  __pyx_tp_clear_array, /*tp_clear*/
-  0, /*tp_richcompare*/
-  0, /*tp_weaklistoffset*/
-  0, /*tp_iter*/
-  0, /*tp_iternext*/
-  __pyx_methods_array, /*tp_methods*/
-  0, /*tp_members*/
-  __pyx_getsets_array, /*tp_getset*/
-  0, /*tp_base*/
-  0, /*tp_dict*/
-  0, /*tp_descr_get*/
-  0, /*tp_descr_set*/
-  0, /*tp_dictoffset*/
-  0, /*tp_init*/
-  0, /*tp_alloc*/
-  __pyx_tp_new_array, /*tp_new*/
-  0, /*tp_free*/
-  0, /*tp_is_gc*/
-  0, /*tp_bases*/
-  0, /*tp_mro*/
-  0, /*tp_cache*/
-  0, /*tp_subclasses*/
-  0, /*tp_weaklist*/
-  0, /*tp_del*/
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*tp_version_tag*/
-  #endif
-};
+static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_suboffsets(o);
+}
 
-static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
-  struct __pyx_MemviewEnum_obj *p;
-  PyObject *o;
-  o = (*t->tp_alloc)(t, 0);
-  if (unlikely(!o)) return 0;
-  p = ((struct __pyx_MemviewEnum_obj *)o);
-  p->name = Py_None; Py_INCREF(Py_None);
-  return o;
+static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_ndim(o);
 }
 
-static void __pyx_tp_dealloc_Enum(PyObject *o) {
-  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
-  PyObject_GC_UnTrack(o);
-  Py_CLEAR(p->name);
-  (*Py_TYPE(o)->tp_free)(o);
+static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_itemsize(o);
 }
 
-static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) {
-  int e;
-  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
-  if (p->name) {
-    e = (*v)(p->name, a); if (e) return e;
-  }
-  return 0;
+static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_nbytes(o);
 }
 
-static int __pyx_tp_clear_Enum(PyObject *o) {
-  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
-  PyObject* tmp;
-  tmp = ((PyObject*)p->name);
-  p->name = Py_None; Py_INCREF(Py_None);
-  Py_XDECREF(tmp);
-  return 0;
+static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_size(o);
 }
 
-static PyMethodDef __pyx_methods_Enum[] = {
+static PyMethodDef __pyx_methods_memoryview[] = {
+  {__Pyx_NAMESTR("is_c_contig"), (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, __Pyx_DOCSTR(0)},
+  {__Pyx_NAMESTR("is_f_contig"), (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, __Pyx_DOCSTR(0)},
+  {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, __Pyx_DOCSTR(0)},
+  {__Pyx_NAMESTR("copy_fortran"), (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, __Pyx_DOCSTR(0)},
   {0, 0, 0, 0}
 };
 
-static PyNumberMethods __pyx_tp_as_number_Enum = {
-  0, /*nb_add*/
-  0, /*nb_subtract*/
-  0, /*nb_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_divide*/
-  #endif
-  0, /*nb_remainder*/
-  0, /*nb_divmod*/
-  0, /*nb_power*/
-  0, /*nb_negative*/
-  0, /*nb_positive*/
-  0, /*nb_absolute*/
-  0, /*nb_nonzero*/
-  0, /*nb_invert*/
-  0, /*nb_lshift*/
-  0, /*nb_rshift*/
-  0, /*nb_and*/
-  0, /*nb_xor*/
-  0, /*nb_or*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_coerce*/
-  #endif
-  0, /*nb_int*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_long*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*nb_float*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_oct*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_hex*/
-  #endif
-  0, /*nb_inplace_add*/
-  0, /*nb_inplace_subtract*/
-  0, /*nb_inplace_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_inplace_divide*/
-  #endif
-  0, /*nb_inplace_remainder*/
-  0, /*nb_inplace_power*/
-  0, /*nb_inplace_lshift*/
-  0, /*nb_inplace_rshift*/
-  0, /*nb_inplace_and*/
-  0, /*nb_inplace_xor*/
-  0, /*nb_inplace_or*/
-  0, /*nb_floor_divide*/
-  0, /*nb_true_divide*/
-  0, /*nb_inplace_floor_divide*/
-  0, /*nb_inplace_true_divide*/
-  #if PY_VERSION_HEX >= 0x02050000
-  0, /*nb_index*/
-  #endif
+static struct PyGetSetDef __pyx_getsets_memoryview[] = {
+  {(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, 0, 0},
+  {(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, 0, 0},
+  {(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, 0, 0},
+  {(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, 0, 0},
+  {(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, 0, 0},
+  {(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, 0, 0},
+  {(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, 0, 0},
+  {(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, 0, 0},
+  {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, 0, 0},
+  {0, 0, 0, 0, 0}
 };
 
-static PySequenceMethods __pyx_tp_as_sequence_Enum = {
-  0, /*sq_length*/
+static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
+  __pyx_memoryview___len__, /*sq_length*/
   0, /*sq_concat*/
   0, /*sq_repeat*/
-  0, /*sq_item*/
+  __pyx_sq_item_memoryview, /*sq_item*/
   0, /*sq_slice*/
   0, /*sq_ass_item*/
   0, /*sq_ass_slice*/
@@ -18514,13 +17931,13 @@ static PySequenceMethods __pyx_tp_as_sequence_Enum = {
   0, /*sq_inplace_repeat*/
 };
 
-static PyMappingMethods __pyx_tp_as_mapping_Enum = {
-  0, /*mp_length*/
-  0, /*mp_subscript*/
-  0, /*mp_ass_subscript*/
+static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
+  __pyx_memoryview___len__, /*mp_length*/
+  __pyx_memoryview___getitem__, /*mp_subscript*/
+  __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/
 };
 
-static PyBufferProcs __pyx_tp_as_buffer_Enum = {
+static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
   #if PY_MAJOR_VERSION < 3
   0, /*bf_getreadbuffer*/
   #endif
@@ -18534,19 +17951,19 @@ static PyBufferProcs __pyx_tp_as_buffer_Enum = {
   0, /*bf_getcharbuffer*/
   #endif
   #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_getbuffer*/
+  __pyx_memoryview_getbuffer, /*bf_getbuffer*/
   #endif
   #if PY_VERSION_HEX >= 0x02060000
   0, /*bf_releasebuffer*/
   #endif
 };
 
-static PyTypeObject __pyx_type___pyx_MemviewEnum = {
+static PyTypeObject __pyx_type___pyx_memoryview = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("histogram.Enum"), /*tp_name*/
-  sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/
+  __Pyx_NAMESTR("histogram.memoryview"), /*tp_name*/
+  sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_Enum, /*tp_dealloc*/
+  __pyx_tp_dealloc_memoryview, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -18555,35 +17972,35 @@ static PyTypeObject __pyx_type___pyx_MemviewEnum = {
   #else
   0, /*reserved*/
   #endif
-  __pyx_MemviewEnum___repr__, /*tp_repr*/
-  &__pyx_tp_as_number_Enum, /*tp_as_number*/
-  &__pyx_tp_as_sequence_Enum, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping_Enum, /*tp_as_mapping*/
+  __pyx_memoryview___repr__, /*tp_repr*/
+  0, /*tp_as_number*/
+  &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/
+  &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/
   0, /*tp_hash*/
   0, /*tp_call*/
-  0, /*tp_str*/
+  __pyx_memoryview___str__, /*tp_str*/
   0, /*tp_getattro*/
   0, /*tp_setattro*/
-  &__pyx_tp_as_buffer_Enum, /*tp_as_buffer*/
+  &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/
   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
   0, /*tp_doc*/
-  __pyx_tp_traverse_Enum, /*tp_traverse*/
-  __pyx_tp_clear_Enum, /*tp_clear*/
+  __pyx_tp_traverse_memoryview, /*tp_traverse*/
+  __pyx_tp_clear_memoryview, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
   0, /*tp_iter*/
   0, /*tp_iternext*/
-  __pyx_methods_Enum, /*tp_methods*/
+  __pyx_methods_memoryview, /*tp_methods*/
   0, /*tp_members*/
-  0, /*tp_getset*/
+  __pyx_getsets_memoryview, /*tp_getset*/
   0, /*tp_base*/
   0, /*tp_dict*/
   0, /*tp_descr_get*/
   0, /*tp_descr_set*/
   0, /*tp_dictoffset*/
-  __pyx_MemviewEnum___init__, /*tp_init*/
+  0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_Enum, /*tp_new*/
+  __pyx_tp_new_memoryview, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -18595,78 +18012,66 @@ static PyTypeObject __pyx_type___pyx_MemviewEnum = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
-static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;
 
-static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
-  struct __pyx_memoryview_obj *p;
+static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
+  struct __pyx_array_obj *p;
   PyObject *o;
   o = (*t->tp_alloc)(t, 0);
   if (unlikely(!o)) return 0;
-  p = ((struct __pyx_memoryview_obj *)o);
-  p->__pyx_vtab = __pyx_vtabptr_memoryview;
-  p->obj = Py_None; Py_INCREF(Py_None);
-  p->_size = Py_None; Py_INCREF(Py_None);
-  p->_array_interface = Py_None; Py_INCREF(Py_None);
-  p->view.obj = NULL;
-  if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) {
+  p = ((struct __pyx_array_obj *)o);
+  p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
+  p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
+  if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) {
     Py_DECREF(o); o = 0;
   }
   return o;
 }
 
-static void __pyx_tp_dealloc_memoryview(PyObject *o) {
-  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
+static void __pyx_tp_dealloc_array(PyObject *o) {
+  struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
   PyObject_GC_UnTrack(o);
   {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
     ++Py_REFCNT(o);
-    __pyx_memoryview___dealloc__(o);
+    __pyx_array___dealloc__(o);
     if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
     --Py_REFCNT(o);
     PyErr_Restore(etype, eval, etb);
   }
-  Py_CLEAR(p->obj);
-  Py_CLEAR(p->_size);
-  Py_CLEAR(p->_array_interface);
+  Py_CLEAR(p->mode);
+  Py_CLEAR(p->_format);
   (*Py_TYPE(o)->tp_free)(o);
 }
 
-static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_array(PyObject *o, visitproc v, void *a) {
   int e;
-  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
-  if (p->obj) {
-    e = (*v)(p->obj, a); if (e) return e;
-  }
-  if (p->_size) {
-    e = (*v)(p->_size, a); if (e) return e;
-  }
-  if (p->_array_interface) {
-    e = (*v)(p->_array_interface, a); if (e) return e;
+  struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
+  if (p->mode) {
+    e = (*v)(p->mode, a); if (e) return e;
   }
-  if (p->view.obj) {
-    e = (*v)(p->view.obj, a); if (e) return e;
+  if (p->_format) {
+    e = (*v)(p->_format, a); if (e) return e;
   }
   return 0;
 }
 
-static int __pyx_tp_clear_memoryview(PyObject *o) {
-  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
+static int __pyx_tp_clear_array(PyObject *o) {
+  struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
   PyObject* tmp;
-  tmp = ((PyObject*)p->obj);
-  p->obj = Py_None; Py_INCREF(Py_None);
-  Py_XDECREF(tmp);
-  tmp = ((PyObject*)p->_size);
-  p->_size = Py_None; Py_INCREF(Py_None);
+  tmp = ((PyObject*)p->mode);
+  p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
   Py_XDECREF(tmp);
-  tmp = ((PyObject*)p->_array_interface);
-  p->_array_interface = Py_None; Py_INCREF(Py_None);
+  tmp = ((PyObject*)p->_format);
+  p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
   Py_XDECREF(tmp);
-  Py_CLEAR(p->view.obj);
   return 0;
 }
-static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
+static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
   PyObject *r;
   PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
   r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
@@ -18674,9 +18079,9 @@ static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
   return r;
 }
 
-static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) {
+static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) {
   if (v) {
-    return __pyx_memoryview___setitem__(o, i, v);
+    return __pyx_array___setitem__(o, i, v);
   }
   else {
     PyErr_Format(PyExc_NotImplementedError,
@@ -18685,126 +18090,34 @@ static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject
   }
 }
 
-static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_transpose(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview__get__base(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_shape(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_strides(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_suboffsets(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_ndim(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_itemsize(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_nbytes(o);
+static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) {
+  PyObject *v = PyObject_GenericGetAttr(o, n);
+  if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
+    PyErr_Clear();
+    v = __pyx_array___getattr__(o, n);
+  }
+  return v;
 }
 
-static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_size(o);
+static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) {
+  return get_memview(o);
 }
 
-static PyMethodDef __pyx_methods_memoryview[] = {
-  {__Pyx_NAMESTR("is_c_contig"), (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, __Pyx_DOCSTR(0)},
-  {__Pyx_NAMESTR("is_f_contig"), (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, __Pyx_DOCSTR(0)},
-  {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, __Pyx_DOCSTR(0)},
-  {__Pyx_NAMESTR("copy_fortran"), (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, __Pyx_DOCSTR(0)},
+static PyMethodDef __pyx_methods_array[] = {
+  {__Pyx_NAMESTR("__getattr__"), (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, __Pyx_DOCSTR(0)},
   {0, 0, 0, 0}
 };
 
-static struct PyGetSetDef __pyx_getsets_memoryview[] = {
-  {(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, 0, 0},
-  {(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, 0, 0},
-  {(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, 0, 0},
-  {(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, 0, 0},
-  {(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, 0, 0},
-  {(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, 0, 0},
-  {(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, 0, 0},
-  {(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, 0, 0},
-  {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, 0, 0},
+static struct PyGetSetDef __pyx_getsets_array[] = {
+  {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, 0, 0},
   {0, 0, 0, 0, 0}
 };
 
-static PyNumberMethods __pyx_tp_as_number_memoryview = {
-  0, /*nb_add*/
-  0, /*nb_subtract*/
-  0, /*nb_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_divide*/
-  #endif
-  0, /*nb_remainder*/
-  0, /*nb_divmod*/
-  0, /*nb_power*/
-  0, /*nb_negative*/
-  0, /*nb_positive*/
-  0, /*nb_absolute*/
-  0, /*nb_nonzero*/
-  0, /*nb_invert*/
-  0, /*nb_lshift*/
-  0, /*nb_rshift*/
-  0, /*nb_and*/
-  0, /*nb_xor*/
-  0, /*nb_or*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_coerce*/
-  #endif
-  0, /*nb_int*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_long*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*nb_float*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_oct*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_hex*/
-  #endif
-  0, /*nb_inplace_add*/
-  0, /*nb_inplace_subtract*/
-  0, /*nb_inplace_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_inplace_divide*/
-  #endif
-  0, /*nb_inplace_remainder*/
-  0, /*nb_inplace_power*/
-  0, /*nb_inplace_lshift*/
-  0, /*nb_inplace_rshift*/
-  0, /*nb_inplace_and*/
-  0, /*nb_inplace_xor*/
-  0, /*nb_inplace_or*/
-  0, /*nb_floor_divide*/
-  0, /*nb_true_divide*/
-  0, /*nb_inplace_floor_divide*/
-  0, /*nb_inplace_true_divide*/
-  #if PY_VERSION_HEX >= 0x02050000
-  0, /*nb_index*/
-  #endif
-};
-
-static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
-  __pyx_memoryview___len__, /*sq_length*/
+static PySequenceMethods __pyx_tp_as_sequence_array = {
+  0, /*sq_length*/
   0, /*sq_concat*/
   0, /*sq_repeat*/
-  __pyx_sq_item_memoryview, /*sq_item*/
+  __pyx_sq_item_array, /*sq_item*/
   0, /*sq_slice*/
   0, /*sq_ass_item*/
   0, /*sq_ass_slice*/
@@ -18813,13 +18126,13 @@ static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
   0, /*sq_inplace_repeat*/
 };
 
-static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
-  __pyx_memoryview___len__, /*mp_length*/
-  __pyx_memoryview___getitem__, /*mp_subscript*/
-  __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/
+static PyMappingMethods __pyx_tp_as_mapping_array = {
+  0, /*mp_length*/
+  __pyx_array___getitem__, /*mp_subscript*/
+  __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/
 };
 
-static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
+static PyBufferProcs __pyx_tp_as_buffer_array = {
   #if PY_MAJOR_VERSION < 3
   0, /*bf_getreadbuffer*/
   #endif
@@ -18833,19 +18146,117 @@ static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
   0, /*bf_getcharbuffer*/
   #endif
   #if PY_VERSION_HEX >= 0x02060000
-  __pyx_memoryview_getbuffer, /*bf_getbuffer*/
+  __pyx_array_getbuffer, /*bf_getbuffer*/
+  #endif
+  #if PY_VERSION_HEX >= 0x02060000
+  0, /*bf_releasebuffer*/
+  #endif
+};
+
+static PyTypeObject __pyx_type___pyx_array = {
+  PyVarObject_HEAD_INIT(0, 0)
+  __Pyx_NAMESTR("histogram.array"), /*tp_name*/
+  sizeof(struct __pyx_array_obj), /*tp_basicsize*/
+  0, /*tp_itemsize*/
+  __pyx_tp_dealloc_array, /*tp_dealloc*/
+  0, /*tp_print*/
+  0, /*tp_getattr*/
+  0, /*tp_setattr*/
+  #if PY_MAJOR_VERSION < 3
+  0, /*tp_compare*/
+  #else
+  0, /*reserved*/
+  #endif
+  0, /*tp_repr*/
+  0, /*tp_as_number*/
+  &__pyx_tp_as_sequence_array, /*tp_as_sequence*/
+  &__pyx_tp_as_mapping_array, /*tp_as_mapping*/
+  0, /*tp_hash*/
+  0, /*tp_call*/
+  0, /*tp_str*/
+  __pyx_tp_getattro_array, /*tp_getattro*/
+  0, /*tp_setattro*/
+  &__pyx_tp_as_buffer_array, /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+  0, /*tp_doc*/
+  __pyx_tp_traverse_array, /*tp_traverse*/
+  __pyx_tp_clear_array, /*tp_clear*/
+  0, /*tp_richcompare*/
+  0, /*tp_weaklistoffset*/
+  0, /*tp_iter*/
+  0, /*tp_iternext*/
+  __pyx_methods_array, /*tp_methods*/
+  0, /*tp_members*/
+  __pyx_getsets_array, /*tp_getset*/
+  0, /*tp_base*/
+  0, /*tp_dict*/
+  0, /*tp_descr_get*/
+  0, /*tp_descr_set*/
+  0, /*tp_dictoffset*/
+  0, /*tp_init*/
+  0, /*tp_alloc*/
+  __pyx_tp_new_array, /*tp_new*/
+  0, /*tp_free*/
+  0, /*tp_is_gc*/
+  0, /*tp_bases*/
+  0, /*tp_mro*/
+  0, /*tp_cache*/
+  0, /*tp_subclasses*/
+  0, /*tp_weaklist*/
+  0, /*tp_del*/
+  #if PY_VERSION_HEX >= 0x02060000
+  0, /*tp_version_tag*/
   #endif
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_releasebuffer*/
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
   #endif
 };
 
-static PyTypeObject __pyx_type___pyx_memoryview = {
+static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+  struct __pyx_MemviewEnum_obj *p;
+  PyObject *o;
+  o = (*t->tp_alloc)(t, 0);
+  if (unlikely(!o)) return 0;
+  p = ((struct __pyx_MemviewEnum_obj *)o);
+  p->name = Py_None; Py_INCREF(Py_None);
+  return o;
+}
+
+static void __pyx_tp_dealloc_Enum(PyObject *o) {
+  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
+  PyObject_GC_UnTrack(o);
+  Py_CLEAR(p->name);
+  (*Py_TYPE(o)->tp_free)(o);
+}
+
+static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) {
+  int e;
+  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
+  if (p->name) {
+    e = (*v)(p->name, a); if (e) return e;
+  }
+  return 0;
+}
+
+static int __pyx_tp_clear_Enum(PyObject *o) {
+  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
+  PyObject* tmp;
+  tmp = ((PyObject*)p->name);
+  p->name = Py_None; Py_INCREF(Py_None);
+  Py_XDECREF(tmp);
+  return 0;
+}
+
+static PyMethodDef __pyx_methods_Enum[] = {
+  {0, 0, 0, 0}
+};
+
+static PyTypeObject __pyx_type___pyx_MemviewEnum = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("histogram.memoryview"), /*tp_name*/
-  sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/
+  __Pyx_NAMESTR("histogram.Enum"), /*tp_name*/
+  sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_memoryview, /*tp_dealloc*/
+  __pyx_tp_dealloc_Enum, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -18854,35 +18265,35 @@ static PyTypeObject __pyx_type___pyx_memoryview = {
   #else
   0, /*reserved*/
   #endif
-  __pyx_memoryview___repr__, /*tp_repr*/
-  &__pyx_tp_as_number_memoryview, /*tp_as_number*/
-  &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/
+  __pyx_MemviewEnum___repr__, /*tp_repr*/
+  0, /*tp_as_number*/
+  0, /*tp_as_sequence*/
+  0, /*tp_as_mapping*/
   0, /*tp_hash*/
   0, /*tp_call*/
-  __pyx_memoryview___str__, /*tp_str*/
+  0, /*tp_str*/
   0, /*tp_getattro*/
   0, /*tp_setattro*/
-  &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/
+  0, /*tp_as_buffer*/
   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
   0, /*tp_doc*/
-  __pyx_tp_traverse_memoryview, /*tp_traverse*/
-  __pyx_tp_clear_memoryview, /*tp_clear*/
+  __pyx_tp_traverse_Enum, /*tp_traverse*/
+  __pyx_tp_clear_Enum, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
   0, /*tp_iter*/
   0, /*tp_iternext*/
-  __pyx_methods_memoryview, /*tp_methods*/
+  __pyx_methods_Enum, /*tp_methods*/
   0, /*tp_members*/
-  __pyx_getsets_memoryview, /*tp_getset*/
+  0, /*tp_getset*/
   0, /*tp_base*/
   0, /*tp_dict*/
   0, /*tp_descr_get*/
   0, /*tp_descr_set*/
   0, /*tp_dictoffset*/
-  0, /*tp_init*/
+  __pyx_MemviewEnum___init__, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_memoryview, /*tp_new*/
+  __pyx_tp_new_Enum, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -18894,6 +18305,9 @@ static PyTypeObject __pyx_type___pyx_memoryview = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice;
 
@@ -18959,120 +18373,6 @@ static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = {
   {0, 0, 0, 0, 0}
 };
 
-static PyNumberMethods __pyx_tp_as_number__memoryviewslice = {
-  0, /*nb_add*/
-  0, /*nb_subtract*/
-  0, /*nb_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_divide*/
-  #endif
-  0, /*nb_remainder*/
-  0, /*nb_divmod*/
-  0, /*nb_power*/
-  0, /*nb_negative*/
-  0, /*nb_positive*/
-  0, /*nb_absolute*/
-  0, /*nb_nonzero*/
-  0, /*nb_invert*/
-  0, /*nb_lshift*/
-  0, /*nb_rshift*/
-  0, /*nb_and*/
-  0, /*nb_xor*/
-  0, /*nb_or*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_coerce*/
-  #endif
-  0, /*nb_int*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_long*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*nb_float*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_oct*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_hex*/
-  #endif
-  0, /*nb_inplace_add*/
-  0, /*nb_inplace_subtract*/
-  0, /*nb_inplace_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_inplace_divide*/
-  #endif
-  0, /*nb_inplace_remainder*/
-  0, /*nb_inplace_power*/
-  0, /*nb_inplace_lshift*/
-  0, /*nb_inplace_rshift*/
-  0, /*nb_inplace_and*/
-  0, /*nb_inplace_xor*/
-  0, /*nb_inplace_or*/
-  0, /*nb_floor_divide*/
-  0, /*nb_true_divide*/
-  0, /*nb_inplace_floor_divide*/
-  0, /*nb_inplace_true_divide*/
-  #if PY_VERSION_HEX >= 0x02050000
-  0, /*nb_index*/
-  #endif
-};
-
-static PySequenceMethods __pyx_tp_as_sequence__memoryviewslice = {
-  #if CYTHON_COMPILING_IN_PYPY
-  __pyx_memoryview___len__, /*sq_length*/
-  #else
-  0, /*sq_length*/
-  #endif
-  0, /*sq_concat*/
-  0, /*sq_repeat*/
-  0, /*sq_item*/
-  0, /*sq_slice*/
-  0, /*sq_ass_item*/
-  0, /*sq_ass_slice*/
-  0, /*sq_contains*/
-  0, /*sq_inplace_concat*/
-  0, /*sq_inplace_repeat*/
-};
-
-static PyMappingMethods __pyx_tp_as_mapping__memoryviewslice = {
-  #if CYTHON_COMPILING_IN_PYPY
-  __pyx_memoryview___len__, /*mp_length*/
-  #else
-  0, /*mp_length*/
-  #endif
-  #if CYTHON_COMPILING_IN_PYPY
-  __pyx_memoryview___getitem__, /*mp_subscript*/
-  #else
-  0, /*mp_subscript*/
-  #endif
-  0, /*mp_ass_subscript*/
-};
-
-static PyBufferProcs __pyx_tp_as_buffer__memoryviewslice = {
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getreadbuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getwritebuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getsegcount*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getcharbuffer*/
-  #endif
-  #if CYTHON_COMPILING_IN_PYPY
-  __pyx_memoryview_getbuffer, /*bf_getbuffer*/
-  #else
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_getbuffer*/
-  #endif
-  #endif
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_releasebuffer*/
-  #endif
-};
-
 static PyTypeObject __pyx_type___pyx_memoryviewslice = {
   PyVarObject_HEAD_INIT(0, 0)
   __Pyx_NAMESTR("histogram._memoryviewslice"), /*tp_name*/
@@ -19092,9 +18392,9 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = {
   #else
   0, /*tp_repr*/
   #endif
-  &__pyx_tp_as_number__memoryviewslice, /*tp_as_number*/
-  &__pyx_tp_as_sequence__memoryviewslice, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping__memoryviewslice, /*tp_as_mapping*/
+  0, /*tp_as_number*/
+  0, /*tp_as_sequence*/
+  0, /*tp_as_mapping*/
   0, /*tp_hash*/
   0, /*tp_call*/
   #if CYTHON_COMPILING_IN_PYPY
@@ -19104,7 +18404,7 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = {
   #endif
   0, /*tp_getattro*/
   0, /*tp_setattro*/
-  &__pyx_tp_as_buffer__memoryviewslice, /*tp_as_buffer*/
+  0, /*tp_as_buffer*/
   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
   __Pyx_DOCSTR("Internal class for passing memoryview slices to Python"), /*tp_doc*/
   __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/
@@ -19135,6 +18435,9 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
 static PyMethodDef __pyx_methods[] = {
@@ -19161,32 +18464,31 @@ static struct PyModuleDef __pyx_moduledef = {
 
 static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_kp_u_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 1, 0, 0},
-  {&__pyx_kp_u_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 1, 0, 0},
-  {&__pyx_kp_s_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 1, 0},
-  {&__pyx_kp_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 0},
+  {&__pyx_kp_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 0},
+  {&__pyx_kp_s_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 0, 1, 0},
+  {&__pyx_kp_s_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 0, 1, 0},
   {&__pyx_kp_u_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 1, 0, 0},
-  {&__pyx_kp_s_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 1, 0},
+  {&__pyx_kp_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 0},
   {&__pyx_kp_s_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 0, 1, 0},
-  {&__pyx_kp_s_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 1, 0},
-  {&__pyx_kp_s_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 1, 0},
-  {&__pyx_kp_s_27, __pyx_k_27, sizeof(__pyx_k_27), 0, 0, 1, 0},
-  {&__pyx_kp_s_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 0, 1, 0},
-  {&__pyx_kp_s_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 0, 1, 0},
+  {&__pyx_kp_s_24, __pyx_k_24, sizeof(__pyx_k_24), 0, 0, 1, 0},
+  {&__pyx_kp_s_26, __pyx_k_26, sizeof(__pyx_k_26), 0, 0, 1, 0},
+  {&__pyx_kp_s_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 0, 1, 0},
+  {&__pyx_kp_s_30, __pyx_k_30, sizeof(__pyx_k_30), 0, 0, 1, 0},
+  {&__pyx_kp_s_32, __pyx_k_32, sizeof(__pyx_k_32), 0, 0, 1, 0},
   {&__pyx_kp_s_33, __pyx_k_33, sizeof(__pyx_k_33), 0, 0, 1, 0},
-  {&__pyx_kp_s_34, __pyx_k_34, sizeof(__pyx_k_34), 0, 0, 1, 0},
-  {&__pyx_kp_s_37, __pyx_k_37, sizeof(__pyx_k_37), 0, 0, 1, 0},
-  {&__pyx_kp_s_39, __pyx_k_39, sizeof(__pyx_k_39), 0, 0, 1, 0},
+  {&__pyx_kp_s_36, __pyx_k_36, sizeof(__pyx_k_36), 0, 0, 1, 0},
+  {&__pyx_kp_s_38, __pyx_k_38, sizeof(__pyx_k_38), 0, 0, 1, 0},
   {&__pyx_kp_u_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 1, 0, 0},
-  {&__pyx_kp_s_44, __pyx_k_44, sizeof(__pyx_k_44), 0, 0, 1, 0},
-  {&__pyx_kp_s_46, __pyx_k_46, sizeof(__pyx_k_46), 0, 0, 1, 0},
-  {&__pyx_kp_s_48, __pyx_k_48, sizeof(__pyx_k_48), 0, 0, 1, 0},
-  {&__pyx_kp_s_51, __pyx_k_51, sizeof(__pyx_k_51), 0, 0, 1, 0},
-  {&__pyx_kp_s_55, __pyx_k_55, sizeof(__pyx_k_55), 0, 0, 1, 0},
-  {&__pyx_kp_s_57, __pyx_k_57, sizeof(__pyx_k_57), 0, 0, 1, 0},
-  {&__pyx_kp_s_59, __pyx_k_59, sizeof(__pyx_k_59), 0, 0, 1, 0},
+  {&__pyx_kp_s_43, __pyx_k_43, sizeof(__pyx_k_43), 0, 0, 1, 0},
+  {&__pyx_kp_s_45, __pyx_k_45, sizeof(__pyx_k_45), 0, 0, 1, 0},
+  {&__pyx_kp_s_47, __pyx_k_47, sizeof(__pyx_k_47), 0, 0, 1, 0},
+  {&__pyx_kp_s_50, __pyx_k_50, sizeof(__pyx_k_50), 0, 0, 1, 0},
+  {&__pyx_kp_s_54, __pyx_k_54, sizeof(__pyx_k_54), 0, 0, 1, 0},
+  {&__pyx_kp_s_56, __pyx_k_56, sizeof(__pyx_k_56), 0, 0, 1, 0},
+  {&__pyx_kp_s_58, __pyx_k_58, sizeof(__pyx_k_58), 0, 0, 1, 0},
   {&__pyx_kp_u_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 1, 0, 0},
-  {&__pyx_kp_s_61, __pyx_k_61, sizeof(__pyx_k_61), 0, 0, 1, 0},
-  {&__pyx_kp_s_63, __pyx_k_63, sizeof(__pyx_k_63), 0, 0, 1, 0},
+  {&__pyx_kp_s_60, __pyx_k_60, sizeof(__pyx_k_60), 0, 0, 1, 0},
+  {&__pyx_kp_s_62, __pyx_k_62, sizeof(__pyx_k_62), 0, 0, 1, 0},
   {&__pyx_kp_u_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 1, 0, 0},
   {&__pyx_kp_u_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 1, 0, 0},
   {&__pyx_kp_s__20130711, __pyx_k__20130711, sizeof(__pyx_k__20130711), 0, 0, 1, 0},
@@ -19207,6 +18509,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s____name__, __pyx_k____name__, sizeof(__pyx_k____name__), 0, 0, 1, 1},
   {&__pyx_n_s____pyx_getbuffer, __pyx_k____pyx_getbuffer, sizeof(__pyx_k____pyx_getbuffer), 0, 0, 1, 1},
   {&__pyx_n_s____pyx_releasebuffer, __pyx_k____pyx_releasebuffer, sizeof(__pyx_k____pyx_releasebuffer), 0, 0, 1, 1},
+  {&__pyx_n_s____pyx_vtable__, __pyx_k____pyx_vtable__, sizeof(__pyx_k____pyx_vtable__), 0, 0, 1, 1},
   {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
   {&__pyx_n_s__a, __pyx_k__a, sizeof(__pyx_k__a), 0, 0, 1, 1},
   {&__pyx_n_s__aera, __pyx_k__aera, sizeof(__pyx_k__aera), 0, 0, 1, 1},
@@ -19296,7 +18599,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s__name, __pyx_k__name, sizeof(__pyx_k__name), 0, 0, 1, 1},
   {&__pyx_n_s__ndim, __pyx_k__ndim, sizeof(__pyx_k__ndim), 0, 0, 1, 1},
   {&__pyx_n_s__nthread, __pyx_k__nthread, sizeof(__pyx_k__nthread), 0, 0, 1, 1},
-  {&__pyx_n_s__num, __pyx_k__num, sizeof(__pyx_k__num), 0, 0, 1, 1},
   {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1},
   {&__pyx_n_s__obj, __pyx_k__obj, sizeof(__pyx_k__obj), 0, 0, 1, 1},
   {&__pyx_n_s__outCount, __pyx_k__outCount, sizeof(__pyx_k__outCount), 0, 0, 1, 1},
@@ -19428,9 +18730,9 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *         if self.itemsize <= 0:
  */
-  __pyx_k_tuple_16 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_15)); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_16);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16));
+  __pyx_k_tuple_15 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_14)); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_15);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15));
 
   /* "View.MemoryView":127
  * 
@@ -19439,9 +18741,9 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *         encode = getattr(format, 'encode', None)
  */
-  __pyx_k_tuple_18 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_17)); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_18);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18));
+  __pyx_k_tuple_17 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_17);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17));
 
   /* "View.MemoryView":131
  *         encode = getattr(format, 'encode', None)
@@ -19450,9 +18752,9 @@ static int __Pyx_InitCachedConstants(void) {
  *         self._format = format
  *         self.format = self._format
  */
-  __pyx_k_tuple_19 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__ASCII)); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_19);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_19));
+  __pyx_k_tuple_18 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__ASCII)); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_18);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18));
 
   /* "View.MemoryView":141
  *             free(self._shape)
@@ -19461,9 +18763,9 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  * 
  */
-  __pyx_k_tuple_21 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_20)); if (unlikely(!__pyx_k_tuple_21)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_21);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_21));
+  __pyx_k_tuple_20 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_19)); if (unlikely(!__pyx_k_tuple_20)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_20);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_20));
 
   /* "View.MemoryView":166
  *         decode = getattr(mode, 'decode', None)
@@ -19472,9 +18774,9 @@ static int __Pyx_InitCachedConstants(void) {
  *         self.mode = mode
  * 
  */
-  __pyx_k_tuple_24 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__ASCII)); if (unlikely(!__pyx_k_tuple_24)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_24);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_24));
+  __pyx_k_tuple_23 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__ASCII)); if (unlikely(!__pyx_k_tuple_23)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_23);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_23));
 
   /* "View.MemoryView":174
  *             self.data = <char *>malloc(self.len)
@@ -19483,9 +18785,9 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *             if self.dtype_is_object:
  */
-  __pyx_k_tuple_26 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_25)); if (unlikely(!__pyx_k_tuple_26)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_26);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_26));
+  __pyx_k_tuple_25 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_24)); if (unlikely(!__pyx_k_tuple_25)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_25);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_25));
 
   /* "View.MemoryView":190
  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
@@ -19494,9 +18796,9 @@ static int __Pyx_InitCachedConstants(void) {
  *         info.buf = self.data
  *         info.len = self.len
  */
-  __pyx_k_tuple_28 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_27)); if (unlikely(!__pyx_k_tuple_28)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_28);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_28));
+  __pyx_k_tuple_27 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_26)); if (unlikely(!__pyx_k_tuple_27)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_27);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_27));
 
   /* "View.MemoryView":452
  *             result = struct.unpack(self.view.format, bytesitem)
@@ -19505,9 +18807,9 @@ static int __Pyx_InitCachedConstants(void) {
  *         else:
  *             if len(self.view.format) == 1:
  */
-  __pyx_k_tuple_30 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_29)); if (unlikely(!__pyx_k_tuple_30)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_30);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_30));
+  __pyx_k_tuple_29 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_28)); if (unlikely(!__pyx_k_tuple_29)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_29);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_29));
 
   /* "View.MemoryView":528
  *             if self.view.strides == NULL:
@@ -19516,9 +18818,9 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *             return tuple([self.view.strides[i] for i in xrange(self.view.ndim)])
  */
-  __pyx_k_tuple_32 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_31)); if (unlikely(!__pyx_k_tuple_32)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_32);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_32));
+  __pyx_k_tuple_31 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_30)); if (unlikely(!__pyx_k_tuple_31)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_31);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_31));
 
   /* "View.MemoryView":643
  *         if item is Ellipsis:
@@ -19527,9 +18829,9 @@ static int __Pyx_InitCachedConstants(void) {
  *                 seen_ellipsis = True
  *             else:
  */
-  __pyx_k_tuple_35 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_k_tuple_35)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_35);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_35));
+  __pyx_k_tuple_34 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_k_tuple_34)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_34);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_34));
 
   /* "View.MemoryView":646
  *                 seen_ellipsis = True
@@ -19538,9 +18840,9 @@ static int __Pyx_InitCachedConstants(void) {
  *             have_slices = True
  *         else:
  */
-  __pyx_k_tuple_36 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_k_tuple_36)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_36);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_36));
+  __pyx_k_tuple_35 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_k_tuple_35)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_35);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_35));
 
   /* "View.MemoryView":657
  *     nslices = ndim - len(result)
@@ -19549,9 +18851,9 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *     return have_slices or nslices, tuple(result)
  */
-  __pyx_k_tuple_38 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_k_tuple_38)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_38);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_38));
+  __pyx_k_tuple_37 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_k_tuple_37)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_37);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_37));
 
   /* "View.MemoryView":665
  *     for i in range(ndim):
@@ -19560,9 +18862,9 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  * 
  */
-  __pyx_k_tuple_40 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_39)); if (unlikely(!__pyx_k_tuple_40)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_40);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_40));
+  __pyx_k_tuple_39 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_38)); if (unlikely(!__pyx_k_tuple_39)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_39);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_39));
 
   /* "histogram.pyx":44
  * @cython.boundscheck(False)
@@ -19571,10 +18873,10 @@ static int __Pyx_InitCachedConstants(void) {
  *               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 *)__p [...]
-  __Pyx_GOTREF(__pyx_k_tuple_49);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_49));
-  __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;}
+  __pyx_k_tuple_48 = 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 *)__p [...]
+  __Pyx_GOTREF(__pyx_k_tuple_48);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_48));
+  __pyx_k_codeobj_49 = (PyObject*)__Pyx_PyCode_New(7, 0, 38, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_48, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_50, __pyx_n_s__histogram, 44, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_49)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   /* "histogram.pyx":172
  * @cython.boundscheck(False)
@@ -19583,10 +18885,10 @@ static int __Pyx_InitCachedConstants(void) {
  *                 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 [...]
-  __Pyx_GOTREF(__pyx_k_tuple_52);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_52));
-  __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;}
+  __pyx_k_tuple_51 = 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 [...]
+  __Pyx_GOTREF(__pyx_k_tuple_51);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_51));
+  __pyx_k_codeobj_52 = (PyObject*)__Pyx_PyCode_New(7, 0, 44, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_51, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_50, __pyx_n_s__histogram2d, 172, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_52)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   /* "View.MemoryView":282
  *         return self.name
@@ -19595,9 +18897,9 @@ static int __Pyx_InitCachedConstants(void) {
  * cdef strided = Enum("<strided and direct>") # default
  * cdef indirect = Enum("<strided and indirect>")
  */
-  __pyx_k_tuple_56 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_55)); if (unlikely(!__pyx_k_tuple_56)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_56);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_56));
+  __pyx_k_tuple_55 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_54)); if (unlikely(!__pyx_k_tuple_55)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_55);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_55));
 
   /* "View.MemoryView":283
  * 
@@ -19606,9 +18908,9 @@ static int __Pyx_InitCachedConstants(void) {
  * cdef indirect = Enum("<strided and indirect>")
  * 
  */
-  __pyx_k_tuple_58 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_57)); if (unlikely(!__pyx_k_tuple_58)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_58);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_58));
+  __pyx_k_tuple_57 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_56)); if (unlikely(!__pyx_k_tuple_57)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_57);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_57));
 
   /* "View.MemoryView":284
  * cdef generic = Enum("<strided and direct or indirect>")
@@ -19617,9 +18919,9 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  * 
  */
-  __pyx_k_tuple_60 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_59)); if (unlikely(!__pyx_k_tuple_60)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_60);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_60));
+  __pyx_k_tuple_59 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_58)); if (unlikely(!__pyx_k_tuple_59)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_59);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_59));
 
   /* "View.MemoryView":287
  * 
@@ -19628,9 +18930,9 @@ static int __Pyx_InitCachedConstants(void) {
  * cdef indirect_contiguous = Enum("<contiguous and indirect>")
  * 
  */
-  __pyx_k_tuple_62 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_61)); if (unlikely(!__pyx_k_tuple_62)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_62);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_62));
+  __pyx_k_tuple_61 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_60)); if (unlikely(!__pyx_k_tuple_61)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_61);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_61));
 
   /* "View.MemoryView":288
  * 
@@ -19639,9 +18941,9 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  * 
  */
-  __pyx_k_tuple_64 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_63)); if (unlikely(!__pyx_k_tuple_64)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_64);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_64));
+  __pyx_k_tuple_63 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_62)); if (unlikely(!__pyx_k_tuple_63)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_63);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_63));
   __Pyx_RefNannyFinishContext();
   return 0;
   __pyx_L1_error:;
@@ -19755,12 +19057,6 @@ PyMODINIT_FUNC PyInit_histogram(void)
   /*--- Variable export code ---*/
   /*--- Function export code ---*/
   /*--- Type init code ---*/
-  if (PyType_Ready(&__pyx_type___pyx_array) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "array", (PyObject *)&__pyx_type___pyx_array) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_array_type = &__pyx_type___pyx_array;
-  if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "Enum", (PyObject *)&__pyx_type___pyx_MemviewEnum) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
   __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview;
   __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer;
   __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice;
@@ -19771,8 +19067,11 @@ PyMODINIT_FUNC PyInit_histogram(void)
   __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object;
   if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "memoryview", (PyObject *)&__pyx_type___pyx_memoryview) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_memoryview_type = &__pyx_type___pyx_memoryview;
+  if (PyType_Ready(&__pyx_type___pyx_array) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_array_type = &__pyx_type___pyx_array;
+  if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
   __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice;
   __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview;
   __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object;
@@ -19780,7 +19079,6 @@ PyMODINIT_FUNC PyInit_histogram(void)
   __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type;
   if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "_memoryviewslice", (PyObject *)&__pyx_type___pyx_memoryviewslice) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice;
   /*--- Type import code ---*/
   __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", 
@@ -19794,7 +19092,7 @@ PyMODINIT_FUNC PyInit_histogram(void)
   __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 885; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   /*--- Variable import code ---*/
   /*--- Function import code ---*/
   /*--- Execution code ---*/
@@ -19806,7 +19104,7 @@ PyMODINIT_FUNC PyInit_histogram(void)
  * __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;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s____author__, ((PyObject *)__pyx_kp_s_47)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   /* "histogram.pyx":28
  * 
@@ -19933,7 +19231,7 @@ PyMODINIT_FUNC PyInit_histogram(void)
  * 
  *     def __dealloc__(array self):
  */
-  __pyx_t_4 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), __pyx_k_54); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), __pyx_k_53); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   if (PyDict_SetItem(__pyx_array_type->tp_dict, __pyx_n_s____pyx_getbuffer, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
@@ -19946,12 +19244,11 @@ PyMODINIT_FUNC PyInit_histogram(void)
  * cdef strided = Enum("<strided and direct>") # default
  * cdef indirect = Enum("<strided and indirect>")
  */
-  __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_56), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_55), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_XGOTREF(generic);
-  __Pyx_DECREF(generic);
+  __Pyx_DECREF_SET(generic, __pyx_t_4);
   __Pyx_GIVEREF(__pyx_t_4);
-  generic = __pyx_t_4;
   __pyx_t_4 = 0;
 
   /* "View.MemoryView":283
@@ -19961,12 +19258,11 @@ PyMODINIT_FUNC PyInit_histogram(void)
  * cdef indirect = Enum("<strided and indirect>")
  * 
  */
-  __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_58), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_57), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_XGOTREF(strided);
-  __Pyx_DECREF(strided);
+  __Pyx_DECREF_SET(strided, __pyx_t_4);
   __Pyx_GIVEREF(__pyx_t_4);
-  strided = __pyx_t_4;
   __pyx_t_4 = 0;
 
   /* "View.MemoryView":284
@@ -19976,12 +19272,11 @@ PyMODINIT_FUNC PyInit_histogram(void)
  * 
  * 
  */
-  __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_60), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_59), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_XGOTREF(indirect);
-  __Pyx_DECREF(indirect);
+  __Pyx_DECREF_SET(indirect, __pyx_t_4);
   __Pyx_GIVEREF(__pyx_t_4);
-  indirect = __pyx_t_4;
   __pyx_t_4 = 0;
 
   /* "View.MemoryView":287
@@ -19991,12 +19286,11 @@ PyMODINIT_FUNC PyInit_histogram(void)
  * cdef indirect_contiguous = Enum("<contiguous and indirect>")
  * 
  */
-  __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_62), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_61), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_XGOTREF(contiguous);
-  __Pyx_DECREF(contiguous);
+  __Pyx_DECREF_SET(contiguous, __pyx_t_4);
   __Pyx_GIVEREF(__pyx_t_4);
-  contiguous = __pyx_t_4;
   __pyx_t_4 = 0;
 
   /* "View.MemoryView":288
@@ -20006,12 +19300,11 @@ PyMODINIT_FUNC PyInit_histogram(void)
  * 
  * 
  */
-  __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_64), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_63), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_XGOTREF(indirect_contiguous);
-  __Pyx_DECREF(indirect_contiguous);
+  __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_4);
   __Pyx_GIVEREF(__pyx_t_4);
-  indirect_contiguous = __pyx_t_4;
   __pyx_t_4 = 0;
 
   /* "View.MemoryView":503
@@ -20021,7 +19314,7 @@ PyMODINIT_FUNC PyInit_histogram(void)
  * 
  * 
  */
-  __pyx_t_4 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), __pyx_k_54); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), __pyx_k_53); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   if (PyDict_SetItem(__pyx_memoryview_type->tp_dict, __pyx_n_s____pyx_getbuffer, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
@@ -20034,7 +19327,7 @@ PyMODINIT_FUNC PyInit_histogram(void)
  * 
  * 
  */
-  __pyx_t_4 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), __pyx_k_54); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), __pyx_k_53); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   if (PyDict_SetItem(__pyx_memoryviewslice_type->tp_dict, __pyx_n_s____pyx_getbuffer, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
@@ -21281,27 +20574,40 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject
         value = type;
         type = (PyObject*) Py_TYPE(value);
     } else if (PyExceptionClass_Check(type)) {
-        PyObject *args;
-        if (!value)
-            args = PyTuple_New(0);
-        else if (PyTuple_Check(value)) {
-            Py_INCREF(value);
-            args = value;
-        } else
-            args = PyTuple_Pack(1, value);
-        if (!args)
-            goto bad;
-        owned_instance = PyEval_CallObject(type, args);
-        Py_DECREF(args);
-        if (!owned_instance)
-            goto bad;
-        value = owned_instance;
-        if (!PyExceptionInstance_Check(value)) {
-            PyErr_Format(PyExc_TypeError,
-                         "calling %R should have returned an instance of "
-                         "BaseException, not %R",
-                         type, Py_TYPE(value));
-            goto bad;
+        PyObject *instance_class = NULL;
+        if (value && PyExceptionInstance_Check(value)) {
+            instance_class = (PyObject*) Py_TYPE(value);
+            if (instance_class != type) {
+                if (PyObject_IsSubclass(instance_class, type)) {
+                    type = instance_class;
+                } else {
+                    instance_class = NULL;
+                }
+            }
+        }
+        if (!instance_class) {
+            PyObject *args;
+            if (!value)
+                args = PyTuple_New(0);
+            else if (PyTuple_Check(value)) {
+                Py_INCREF(value);
+                args = value;
+            } else
+                args = PyTuple_Pack(1, value);
+            if (!args)
+                goto bad;
+            owned_instance = PyObject_Call(type, args, NULL);
+            Py_DECREF(args);
+            if (!owned_instance)
+                goto bad;
+            value = owned_instance;
+            if (!PyExceptionInstance_Check(value)) {
+                PyErr_Format(PyExc_TypeError,
+                             "calling %R should have returned an instance of "
+                             "BaseException, not %R",
+                             type, Py_TYPE(value));
+                goto bad;
+            }
         }
     } else {
         PyErr_SetString(PyExc_TypeError,
@@ -21463,6 +20769,42 @@ static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
     return q;
 }
 
+static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
+                                  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename) {
+    PyObject *old_exc, *old_val, *old_tb;
+    PyObject *ctx;
+    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
+    #if PY_MAJOR_VERSION < 3
+    ctx = PyString_FromString(name);
+    #else
+    ctx = PyUnicode_FromString(name);
+    #endif
+    __Pyx_ErrRestore(old_exc, old_val, old_tb);
+    if (!ctx) {
+        PyErr_WriteUnraisable(Py_None);
+    } else {
+        PyErr_WriteUnraisable(ctx);
+        Py_DECREF(ctx);
+    }
+}
+
+static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
+#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
+    PyObject *ob = PyCapsule_New(vtable, 0, 0);
+#else
+    PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
+#endif
+    if (!ob)
+        goto bad;
+    if (PyDict_SetItem(dict, __pyx_n_s____pyx_vtable__, ob) < 0)
+        goto bad;
+    Py_DECREF(ob);
+    return 0;
+bad:
+    Py_XDECREF(ob);
+    return -1;
+}
+
 static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
 #if CYTHON_COMPILING_IN_CPYTHON
     PyThreadState *tstate = PyThreadState_GET();
@@ -21969,7 +21311,7 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
     }
     __Pyx_GOTREF(shape_tuple);
     for(i = 0; i < ndim; i++) {
-        temp_int = PyInt_FromLong(from_mvs->shape[i]);
+        temp_int = PyInt_FromSsize_t(from_mvs->shape[i]);
         if(unlikely(!temp_int)) {
             goto fail;
         } else {
@@ -22817,25 +22159,6 @@ __pyx_fail:
     return result;
 }
 
-static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
-                                  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename) {
-    PyObject *old_exc, *old_val, *old_tb;
-    PyObject *ctx;
-    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
-    #if PY_MAJOR_VERSION < 3
-    ctx = PyString_FromString(name);
-    #else
-    ctx = PyUnicode_FromString(name);
-    #endif
-    __Pyx_ErrRestore(old_exc, old_val, old_tb);
-    if (!ctx) {
-        PyErr_WriteUnraisable(Py_None);
-    } else {
-        PyErr_WriteUnraisable(ctx);
-        Py_DECREF(ctx);
-    }
-}
-
 static int __Pyx_check_binary_version(void) {
     char ctversion[4], rtversion[4];
     PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
@@ -22855,23 +22178,6 @@ static int __Pyx_check_binary_version(void) {
     return 0;
 }
 
-static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
-#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
-    PyObject *ob = PyCapsule_New(vtable, 0, 0);
-#else
-    PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
-#endif
-    if (!ob)
-        goto bad;
-    if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0)
-        goto bad;
-    Py_DECREF(ob);
-    return 0;
-bad:
-    Py_XDECREF(ob);
-    return -1;
-}
-
 #ifndef __PYX_HAVE_RT_ImportModule
 #define __PYX_HAVE_RT_ImportModule
 static PyObject *__Pyx_ImportModule(const char *name) {
diff --git a/src/fastcrc.c b/src/marchingsquares_.c
similarity index 62%
copy from src/fastcrc.c
copy to src/marchingsquares_.c
index a9c741d..ce692f1 100644
--- a/src/fastcrc.c
+++ b/src/marchingsquares_.c
@@ -1,4 +1,4 @@
-/* Generated by Cython 0.17.1 on Tue Dec 11 13:42:42 2012 */
+/* Generated by Cython 0.17 on Wed Oct 23 21:35:44 2013 */
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
@@ -246,14 +246,13 @@
 #define _USE_MATH_DEFINES
 #endif
 #include <math.h>
-#define __PYX_HAVE__fastcrc
-#define __PYX_HAVE_API__fastcrc
+#define __PYX_HAVE__marchingsquares_
+#define __PYX_HAVE_API__marchingsquares_
 #include "stdio.h"
 #include "stdlib.h"
 #include "numpy/arrayobject.h"
 #include "numpy/ufuncobject.h"
-#include "stdint.h"
-#include "crc32.h"
+#include "math.h"
 #ifdef _OPENMP
 #include <omp.h>
 #endif /* _OPENMP */
@@ -361,10 +360,45 @@ static const char *__pyx_filename;
 
 
 static const char *__pyx_f[] = {
-  "fastcrc.pyx",
+  "marchingsquares_.pyx",
   "numpy.pxd",
   "type.pxd",
 };
+#define IS_UNSIGNED(type) (((type) -1) > 0)
+struct __Pyx_StructField_;
+#define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
+typedef struct {
+  const char* name; /* for error messages only */
+  struct __Pyx_StructField_* fields;
+  size_t size;     /* sizeof(type) */
+  size_t arraysize[8]; /* length of array in each dimension */
+  int ndim;
+  char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject, c_H_ar */
+  char is_unsigned;
+  int flags;
+} __Pyx_TypeInfo;
+typedef struct __Pyx_StructField_ {
+  __Pyx_TypeInfo* type;
+  const char* name;
+  size_t offset;
+} __Pyx_StructField;
+typedef struct {
+  __Pyx_StructField* field;
+  size_t parent_offset;
+} __Pyx_BufFmt_StackElem;
+typedef struct {
+  __Pyx_StructField root;
+  __Pyx_BufFmt_StackElem* head;
+  size_t fmt_offset;
+  size_t new_count, enc_count;
+  size_t struct_alignment;
+  int is_complex;
+  char enc_type;
+  char new_packmode;
+  char enc_packmode;
+  char is_valid_array;
+} __Pyx_BufFmt_Context;
+
 
 /* "numpy.pxd":723
  * # in Cython to enable them only on the right systems.
@@ -554,6 +588,42 @@ typedef npy_double __pyx_t_5numpy_double_t;
  * ctypedef npy_cfloat      cfloat_t
  */
 typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
+
+/* "marchingsquares_.pyx":14
+ * 
+ * # Type defs, we support float32 and float64
+ * ctypedef np.float32_t FLOAT32_T             # <<<<<<<<<<<<<<
+ * ctypedef np.float64_t FLOAT64_T
+ * ctypedef np.int32_t INT32_T
+ */
+typedef __pyx_t_5numpy_float32_t __pyx_t_16marchingsquares__FLOAT32_T;
+
+/* "marchingsquares_.pyx":15
+ * # Type defs, we support float32 and float64
+ * ctypedef np.float32_t FLOAT32_T
+ * ctypedef np.float64_t FLOAT64_T             # <<<<<<<<<<<<<<
+ * ctypedef np.int32_t INT32_T
+ * ctypedef np.int8_t INT8_T
+ */
+typedef __pyx_t_5numpy_float64_t __pyx_t_16marchingsquares__FLOAT64_T;
+
+/* "marchingsquares_.pyx":16
+ * ctypedef np.float32_t FLOAT32_T
+ * ctypedef np.float64_t FLOAT64_T
+ * ctypedef np.int32_t INT32_T             # <<<<<<<<<<<<<<
+ * ctypedef np.int8_t INT8_T
+ * FLOAT32 = np.float32
+ */
+typedef __pyx_t_5numpy_int32_t __pyx_t_16marchingsquares__INT32_T;
+
+/* "marchingsquares_.pyx":17
+ * ctypedef np.float64_t FLOAT64_T
+ * ctypedef np.int32_t INT32_T
+ * ctypedef np.int8_t INT8_T             # <<<<<<<<<<<<<<
+ * FLOAT32 = np.float32
+ * FLOAT64 = np.float64
+ */
+typedef __pyx_t_5numpy_int8_t __pyx_t_16marchingsquares__INT8_T;
 #if CYTHON_CCOMPLEX
   #ifdef __cplusplus
     typedef ::std::complex< float > __pyx_t_float_complex;
@@ -666,11 +736,110 @@ typedef npy_cdouble __pyx_t_5numpy_complex_t;
 #define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
 #define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
 
-static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
-    const char *name, int exact); /*proto*/
-
 static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
 
+static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
+    Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/
+
+static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/
+
+static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \
+    PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \
+    const char* function_name); /*proto*/
+
+static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/
+
+static CYTHON_INLINE int  __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj,
+    __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack);
+static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);
+
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
+    PyObject *r;
+    if (!j) return NULL;
+    r = PyObject_GetItem(o, j);
+    Py_DECREF(j);
+    return r;
+}
+#define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
+                                                    __Pyx_GetItemInt_List_Fast(o, i) : \
+                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) {
+#if CYTHON_COMPILING_IN_CPYTHON
+    if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
+        PyObject *r = PyList_GET_ITEM(o, i);
+        Py_INCREF(r);
+        return r;
+    }
+    else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
+        PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
+        Py_INCREF(r);
+        return r;
+    }
+    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+#else
+    return PySequence_GetItem(o, i);
+#endif
+}
+#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
+                                                    __Pyx_GetItemInt_Tuple_Fast(o, i) : \
+                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) {
+#if CYTHON_COMPILING_IN_CPYTHON
+    if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
+        PyObject *r = PyTuple_GET_ITEM(o, i);
+        Py_INCREF(r);
+        return r;
+    }
+    else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
+        PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
+        Py_INCREF(r);
+        return r;
+    }
+    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+#else
+    return PySequence_GetItem(o, i);
+#endif
+}
+#define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
+                                                    __Pyx_GetItemInt_Fast(o, i) : \
+                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) {
+#if CYTHON_COMPILING_IN_CPYTHON
+    if (PyList_CheckExact(o)) {
+        Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
+        if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) {
+            PyObject *r = PyList_GET_ITEM(o, n);
+            Py_INCREF(r);
+            return r;
+        }
+    }
+    else if (PyTuple_CheckExact(o)) {
+        Py_ssize_t n = (likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
+        if (likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
+            PyObject *r = PyTuple_GET_ITEM(o, n);
+            Py_INCREF(r);
+            return r;
+        }
+    } else {  /* inlined PySequence_GetItem() */
+        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
+        if (likely(m && m->sq_item)) {
+            if (unlikely(i < 0) && likely(m->sq_length)) {
+                Py_ssize_t l = m->sq_length(o);
+                if (unlikely(l < 0)) return NULL;
+                i += l;
+            }
+            return m->sq_item(o, i);
+        }
+    }
+#else
+    if (PySequence_Check(o)) {
+        return PySequence_GetItem(o, i);
+    }
+#endif
+    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+}
+
+#define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1)
 static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
 static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
 
@@ -686,13 +855,34 @@ static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/
 
 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/
 
-static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/
+typedef struct {
+  Py_ssize_t shape, strides, suboffsets;
+} __Pyx_Buf_DimInfo;
+typedef struct {
+  size_t refcount;
+  Py_buffer pybuffer;
+} __Pyx_Buffer;
+typedef struct {
+  __Pyx_Buffer *rcbuffer;
+  char *data;
+  __Pyx_Buf_DimInfo diminfo[8];
+} __Pyx_LocalBuf_ND;
+
+#if PY_MAJOR_VERSION < 3
+    static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
+    static void __Pyx_ReleaseBuffer(Py_buffer *view);
+#else
+    #define __Pyx_GetBuffer PyObject_GetBuffer
+    #define __Pyx_ReleaseBuffer PyBuffer_Release
+#endif
 
-static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/
 
-static CYTHON_INLINE npy_uint32 __Pyx_PyInt_from_py_npy_uint32(PyObject *);
+static Py_ssize_t __Pyx_zeros[] = {0, 0, 0, 0, 0, 0, 0, 0};
+static Py_ssize_t __Pyx_minusones[] = {-1, -1, -1, -1, -1, -1, -1, -1};
 
-static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint32_t(uint32_t);
+static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/
+
+static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_int8(npy_int8);
 
 #if CYTHON_CCOMPLEX
   #ifdef __cplusplus
@@ -858,8 +1048,6 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line,
 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
 
 
-/* Module declarations from 'cython' */
-
 /* Module declarations from 'cpython.buffer' */
 
 /* Module declarations from 'cpython.ref' */
@@ -885,33 +1073,30 @@ static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
 static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
 static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/
 
-/* Module declarations from 'libc.stdint' */
-
-/* Module declarations from 'crc32' */
+/* Module declarations from 'cython' */
 
-/* Module declarations from 'fastcrc' */
-#define __Pyx_MODULE_NAME "fastcrc"
-int __pyx_module_is_main_fastcrc = 0;
+/* Module declarations from 'marchingsquares_' */
+static double __pyx_v_16marchingsquares__pi;
+static CYTHON_INLINE double __pyx_f_16marchingsquares__fabs(double); /*proto*/
+static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_16marchingsquares__INT8_T = { "INT8_T", NULL, sizeof(__pyx_t_16marchingsquares__INT8_T), { 0 }, 0, IS_UNSIGNED(__pyx_t_16marchingsquares__INT8_T) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_16marchingsquares__INT8_T), 0 };
+static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_16marchingsquares__FLOAT32_T = { "FLOAT32_T", NULL, sizeof(__pyx_t_16marchingsquares__FLOAT32_T), { 0 }, 0, 'R', 0, 0 };
+#define __Pyx_MODULE_NAME "marchingsquares_"
+int __pyx_module_is_main_marchingsquares_ = 0;
 
-/* Implementation of 'fastcrc' */
-static PyObject *__pyx_builtin_ValueError;
+/* Implementation of 'marchingsquares_' */
 static PyObject *__pyx_builtin_range;
+static PyObject *__pyx_builtin_ValueError;
 static PyObject *__pyx_builtin_RuntimeError;
-static PyObject *__pyx_pf_7fastcrc_crc32(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_data); /* proto */
+static PyObject *__pyx_pf_16marchingsquares__marching_squares(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_im, PyObject *__pyx_v_isovalue, PyObject *__pyx_v_cellToEdge, PyObject *__pyx_v_edgeToRelativePosX, PyObject *__pyx_v_edgeToRelativePosY); /* proto */
 static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
 static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */
-static char __pyx_k_1[] = "ndarray is not C contiguous";
-static char __pyx_k_3[] = "ndarray is not Fortran contiguous";
-static char __pyx_k_5[] = "Non-native byte order not supported";
-static char __pyx_k_7[] = "unknown dtype code in numpy.pxd (%d)";
-static char __pyx_k_8[] = "Format string allocated too short, see comment in numpy.pxd";
-static char __pyx_k_11[] = "Format string allocated too short.";
-static char __pyx_k_13[] = "Jerome Kieffer";
-static char __pyx_k_14[] = "19-11-2012";
-static char __pyx_k_15[] = "Jerome.kieffer at esrf.fr";
-static char __pyx_k_16[] = "GPL v3+";
-static char __pyx_k_17[] = "\nSimple Cython module for doing CRC32 for checksums, possibly with SSE4 acceleration\n";
-static char __pyx_k_20[] = "/users/kieffer/workspace-ssd/pyFAI/src/fastcrc.pyx";
+static char __pyx_k_2[] = "ndarray is not C contiguous";
+static char __pyx_k_4[] = "ndarray is not Fortran contiguous";
+static char __pyx_k_6[] = "Non-native byte order not supported";
+static char __pyx_k_8[] = "unknown dtype code in numpy.pxd (%d)";
+static char __pyx_k_9[] = "Format string allocated too short, see comment in numpy.pxd";
+static char __pyx_k_12[] = "Format string allocated too short.";
+static char __pyx_k_16[] = "/home/jerome/workspace/pyFAI/src/marchingsquares_.pyx";
 static char __pyx_k__B[] = "B";
 static char __pyx_k__H[] = "H";
 static char __pyx_k__I[] = "I";
@@ -924,122 +1109,1047 @@ static char __pyx_k__f[] = "f";
 static char __pyx_k__g[] = "g";
 static char __pyx_k__h[] = "h";
 static char __pyx_k__i[] = "i";
+static char __pyx_k__j[] = "j";
+static char __pyx_k__k[] = "k";
 static char __pyx_k__l[] = "l";
 static char __pyx_k__q[] = "q";
+static char __pyx_k__x[] = "x";
+static char __pyx_k__y[] = "y";
+static char __pyx_k__z[] = "z";
 static char __pyx_k__Zd[] = "Zd";
 static char __pyx_k__Zf[] = "Zf";
 static char __pyx_k__Zg[] = "Zg";
-static char __pyx_k__data[] = "data";
+static char __pyx_k__ff[] = "ff";
+static char __pyx_k__fx[] = "fx";
+static char __pyx_k__fy[] = "fy";
+static char __pyx_k__fz[] = "fz";
+static char __pyx_k__im[] = "im";
+static char __pyx_k__np[] = "np";
+static char __pyx_k__dx1[] = "dx1";
+static char __pyx_k__dx2[] = "dx2";
+static char __pyx_k__dy1[] = "dy1";
+static char __pyx_k__dy2[] = "dy2";
+static char __pyx_k__dz1[] = "dz1";
+static char __pyx_k__dz2[] = "dz2";
+static char __pyx_k__im_[] = "im_";
+static char __pyx_k__INT8[] = "INT8";
+static char __pyx_k__int8[] = "int8";
 static char __pyx_k__size[] = "size";
-static char __pyx_k__crc32[] = "crc32";
+static char __pyx_k__tmpf[] = "tmpf";
+static char __pyx_k__INT32[] = "INT32";
+static char __pyx_k__edges[] = "edges";
+static char __pyx_k__index[] = "index";
 static char __pyx_k__numpy[] = "numpy";
 static char __pyx_k__range[] = "range";
-static char __pyx_k__nbytes[] = "nbytes";
-static char __pyx_k____doc__[] = "__doc__";
-static char __pyx_k__fastcrc[] = "fastcrc";
-static char __pyx_k____date__[] = "__date__";
+static char __pyx_k__shape[] = "shape";
+static char __pyx_k__tmpf1[] = "tmpf1";
+static char __pyx_k__tmpf2[] = "tmpf2";
+static char __pyx_k__zeros[] = "zeros";
+static char __pyx_k__edges_[] = "edges_";
+static char __pyx_k__FLOAT32[] = "FLOAT32";
+static char __pyx_k__FLOAT64[] = "FLOAT64";
+static char __pyx_k__float32[] = "float32";
+static char __pyx_k__float64[] = "float64";
 static char __pyx_k____main__[] = "__main__";
 static char __pyx_k____test__[] = "__test__";
+static char __pyx_k__isovalue[] = "isovalue";
+static char __pyx_k__edgeCount[] = "edgeCount";
+static char __pyx_k__isovalue_[] = "isovalue_";
 static char __pyx_k__ValueError[] = "ValueError";
-static char __pyx_k____author__[] = "__author__";
-static char __pyx_k____contact__[] = "__contact__";
-static char __pyx_k____license__[] = "__license__";
+static char __pyx_k__cellToEdge[] = "cellToEdge";
+static char __pyx_k__cellToEdge_[] = "cellToEdge_";
 static char __pyx_k__RuntimeError[] = "RuntimeError";
-static PyObject *__pyx_kp_u_1;
-static PyObject *__pyx_kp_u_11;
-static PyObject *__pyx_kp_s_13;
-static PyObject *__pyx_kp_s_14;
-static PyObject *__pyx_kp_s_15;
+static char __pyx_k__marching_squares[] = "marching_squares";
+static char __pyx_k__marchingsquares_[] = "marchingsquares_";
+static char __pyx_k__edgeToRelativePosX[] = "edgeToRelativePosX";
+static char __pyx_k__edgeToRelativePosY[] = "edgeToRelativePosY";
+static char __pyx_k__edgeToRelativePosX_[] = "edgeToRelativePosX_";
+static char __pyx_k__edgeToRelativePosY_[] = "edgeToRelativePosY_";
+static PyObject *__pyx_kp_u_12;
 static PyObject *__pyx_kp_s_16;
-static PyObject *__pyx_kp_s_17;
-static PyObject *__pyx_kp_s_20;
-static PyObject *__pyx_kp_u_3;
-static PyObject *__pyx_kp_u_5;
-static PyObject *__pyx_kp_u_7;
+static PyObject *__pyx_kp_u_2;
+static PyObject *__pyx_kp_u_4;
+static PyObject *__pyx_kp_u_6;
 static PyObject *__pyx_kp_u_8;
+static PyObject *__pyx_kp_u_9;
+static PyObject *__pyx_n_s__FLOAT32;
+static PyObject *__pyx_n_s__FLOAT64;
+static PyObject *__pyx_n_s__INT32;
+static PyObject *__pyx_n_s__INT8;
 static PyObject *__pyx_n_s__RuntimeError;
 static PyObject *__pyx_n_s__ValueError;
-static PyObject *__pyx_n_s____author__;
-static PyObject *__pyx_n_s____contact__;
-static PyObject *__pyx_n_s____date__;
-static PyObject *__pyx_n_s____doc__;
-static PyObject *__pyx_n_s____license__;
 static PyObject *__pyx_n_s____main__;
 static PyObject *__pyx_n_s____test__;
-static PyObject *__pyx_n_s__crc32;
-static PyObject *__pyx_n_s__data;
-static PyObject *__pyx_n_s__fastcrc;
-static PyObject *__pyx_n_s__nbytes;
+static PyObject *__pyx_n_s__cellToEdge;
+static PyObject *__pyx_n_s__cellToEdge_;
+static PyObject *__pyx_n_s__dx1;
+static PyObject *__pyx_n_s__dx2;
+static PyObject *__pyx_n_s__dy1;
+static PyObject *__pyx_n_s__dy2;
+static PyObject *__pyx_n_s__dz1;
+static PyObject *__pyx_n_s__dz2;
+static PyObject *__pyx_n_s__edgeCount;
+static PyObject *__pyx_n_s__edgeToRelativePosX;
+static PyObject *__pyx_n_s__edgeToRelativePosX_;
+static PyObject *__pyx_n_s__edgeToRelativePosY;
+static PyObject *__pyx_n_s__edgeToRelativePosY_;
+static PyObject *__pyx_n_s__edges;
+static PyObject *__pyx_n_s__edges_;
+static PyObject *__pyx_n_s__ff;
+static PyObject *__pyx_n_s__float32;
+static PyObject *__pyx_n_s__float64;
+static PyObject *__pyx_n_s__fx;
+static PyObject *__pyx_n_s__fy;
+static PyObject *__pyx_n_s__fz;
+static PyObject *__pyx_n_s__i;
+static PyObject *__pyx_n_s__im;
+static PyObject *__pyx_n_s__im_;
+static PyObject *__pyx_n_s__index;
+static PyObject *__pyx_n_s__int8;
+static PyObject *__pyx_n_s__isovalue;
+static PyObject *__pyx_n_s__isovalue_;
+static PyObject *__pyx_n_s__j;
+static PyObject *__pyx_n_s__k;
+static PyObject *__pyx_n_s__marching_squares;
+static PyObject *__pyx_n_s__marchingsquares_;
+static PyObject *__pyx_n_s__np;
 static PyObject *__pyx_n_s__numpy;
 static PyObject *__pyx_n_s__range;
+static PyObject *__pyx_n_s__shape;
 static PyObject *__pyx_n_s__size;
+static PyObject *__pyx_n_s__tmpf;
+static PyObject *__pyx_n_s__tmpf1;
+static PyObject *__pyx_n_s__tmpf2;
+static PyObject *__pyx_n_s__x;
+static PyObject *__pyx_n_s__y;
+static PyObject *__pyx_n_s__z;
+static PyObject *__pyx_n_s__zeros;
+static PyObject *__pyx_int_0;
+static PyObject *__pyx_int_1;
+static PyObject *__pyx_int_2;
 static PyObject *__pyx_int_15;
-static PyObject *__pyx_k_tuple_2;
-static PyObject *__pyx_k_tuple_4;
-static PyObject *__pyx_k_tuple_6;
-static PyObject *__pyx_k_tuple_9;
+static PyObject *__pyx_k_slice_1;
+static PyObject *__pyx_k_tuple_3;
+static PyObject *__pyx_k_tuple_5;
+static PyObject *__pyx_k_tuple_7;
 static PyObject *__pyx_k_tuple_10;
-static PyObject *__pyx_k_tuple_12;
-static PyObject *__pyx_k_tuple_18;
-static PyObject *__pyx_k_codeobj_19;
+static PyObject *__pyx_k_tuple_11;
+static PyObject *__pyx_k_tuple_13;
+static PyObject *__pyx_k_tuple_14;
+static PyObject *__pyx_k_codeobj_15;
 
-/* Python wrapper */
-static PyObject *__pyx_pw_7fastcrc_1crc32(PyObject *__pyx_self, PyObject *__pyx_v_data); /*proto*/
-static char __pyx_doc_7fastcrc_crc32[] = "\n    Calculate the CRC32 checksum of a numpy array\n    @param data: a numpy array\n    @return unsigned integer\n    ";
-static PyMethodDef __pyx_mdef_7fastcrc_1crc32 = {__Pyx_NAMESTR("crc32"), (PyCFunction)__pyx_pw_7fastcrc_1crc32, METH_O, __Pyx_DOCSTR(__pyx_doc_7fastcrc_crc32)};
-static PyObject *__pyx_pw_7fastcrc_1crc32(PyObject *__pyx_self, PyObject *__pyx_v_data) {
-  PyObject *__pyx_r = 0;
+/* "marchingsquares_.pyx":24
+ * 
+ * # Floor operator (deal with negative numbers)
+ * cdef inline int floor(double a): return <int>a if a>=0.0 else (<int>a)-1             # <<<<<<<<<<<<<<
+ * 
+ * cdef inline double fabs(double a): return a if a>=0 else -a
+ */
+
+static CYTHON_INLINE int __pyx_f_16marchingsquares__floor(double __pyx_v_a) {
+  int __pyx_r;
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("crc32 (wrapper)", 0);
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), __pyx_ptype_5numpy_ndarray, 0, "data", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_r = __pyx_pf_7fastcrc_crc32(__pyx_self, ((PyArrayObject *)__pyx_v_data));
+  long __pyx_t_1;
+  __Pyx_RefNannySetupContext("floor", 0);
+  if ((__pyx_v_a >= 0.0)) {
+    __pyx_t_1 = ((int)__pyx_v_a);
+  } else {
+    __pyx_t_1 = (((int)__pyx_v_a) - 1);
+  }
+  __pyx_r = __pyx_t_1;
   goto __pyx_L0;
-  __pyx_L1_error:;
-  __pyx_r = NULL;
+
+  __pyx_r = 0;
   __pyx_L0:;
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "fastcrc.pyx":41
- * from crc32 cimport crc32 as C_crc32
+/* "marchingsquares_.pyx":26
+ * cdef inline int floor(double a): return <int>a if a>=0.0 else (<int>a)-1
+ * 
+ * cdef inline double fabs(double a): return a if a>=0 else -a             # <<<<<<<<<<<<<<
+ * 
+ * 
+ */
+
+static CYTHON_INLINE double __pyx_f_16marchingsquares__fabs(double __pyx_v_a) {
+  double __pyx_r;
+  __Pyx_RefNannyDeclarations
+  double __pyx_t_1;
+  __Pyx_RefNannySetupContext("fabs", 0);
+  if ((__pyx_v_a >= 0.0)) {
+    __pyx_t_1 = __pyx_v_a;
+  } else {
+    __pyx_t_1 = (-__pyx_v_a);
+  }
+  __pyx_r = __pyx_t_1;
+  goto __pyx_L0;
+
+  __pyx_r = 0;
+  __pyx_L0:;
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_pw_16marchingsquares__1marching_squares(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_16marchingsquares__1marching_squares = {__Pyx_NAMESTR("marching_squares"), (PyCFunction)__pyx_pw_16marchingsquares__1marching_squares, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pw_16marchingsquares__1marching_squares(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  PyObject *__pyx_v_im = 0;
+  PyObject *__pyx_v_isovalue = 0;
+  PyObject *__pyx_v_cellToEdge = 0;
+  PyObject *__pyx_v_edgeToRelativePosX = 0;
+  PyObject *__pyx_v_edgeToRelativePosY = 0;
+  PyObject *__pyx_r = 0;
+  __Pyx_RefNannyDeclarations
+  __Pyx_RefNannySetupContext("marching_squares (wrapper)", 0);
+  {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__im,&__pyx_n_s__isovalue,&__pyx_n_s__cellToEdge,&__pyx_n_s__edgeToRelativePosX,&__pyx_n_s__edgeToRelativePosY,0};
+    PyObject* values[5] = {0,0,0,0,0};
+    if (unlikely(__pyx_kwds)) {
+      Py_ssize_t kw_args;
+      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+      switch (pos_args) {
+        case  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__im)) != 0)) kw_args--;
+        else goto __pyx_L5_argtuple_error;
+        case  1:
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__isovalue)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("marching_squares", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+        case  2:
+        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__cellToEdge)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("marching_squares", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+        case  3:
+        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__edgeToRelativePosX)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("marching_squares", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+        case  4:
+        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__edgeToRelativePosY)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("marching_squares", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+      }
+      if (unlikely(kw_args > 0)) {
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "marching_squares") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      }
+    } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
+      goto __pyx_L5_argtuple_error;
+    } else {
+      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
+      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
+    }
+    __pyx_v_im = values[0];
+    __pyx_v_isovalue = values[1];
+    __pyx_v_cellToEdge = values[2];
+    __pyx_v_edgeToRelativePosX = values[3];
+    __pyx_v_edgeToRelativePosY = values[4];
+  }
+  goto __pyx_L4_argument_unpacking_done;
+  __pyx_L5_argtuple_error:;
+  __Pyx_RaiseArgtupleInvalid("marching_squares", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __pyx_L3_error:;
+  __Pyx_AddTraceback("marchingsquares_.marching_squares", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_RefNannyFinishContext();
+  return NULL;
+  __pyx_L4_argument_unpacking_done:;
+  __pyx_r = __pyx_pf_16marchingsquares__marching_squares(__pyx_self, __pyx_v_im, __pyx_v_isovalue, __pyx_v_cellToEdge, __pyx_v_edgeToRelativePosX, __pyx_v_edgeToRelativePosY);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "marchingsquares_.pyx":34
+ * @cython.boundscheck(False)
+ * @cython.wraparound(False)
+ * def marching_squares(im, isovalue,             # <<<<<<<<<<<<<<
+ *                         cellToEdge, edgeToRelativePosX, edgeToRelativePosY):
  * 
- * def crc32(numpy.ndarray data not None):             # <<<<<<<<<<<<<<
- *     """
- *     Calculate the CRC32 checksum of a numpy array
  */
 
-static PyObject *__pyx_pf_7fastcrc_crc32(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_data) {
-  __pyx_t_5numpy_uint32_t __pyx_v_size;
+static PyObject *__pyx_pf_16marchingsquares__marching_squares(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_im, PyObject *__pyx_v_isovalue, PyObject *__pyx_v_cellToEdge, PyObject *__pyx_v_edgeToRelativePosX, PyObject *__pyx_v_edgeToRelativePosY) {
+  PyObject *__pyx_v_edges = NULL;
+  PyArrayObject *__pyx_v_edgeToRelativePosX_ = 0;
+  PyArrayObject *__pyx_v_edgeToRelativePosY_ = 0;
+  PyArrayObject *__pyx_v_cellToEdge_ = 0;
+  PyArrayObject *__pyx_v_im_ = 0;
+  PyArrayObject *__pyx_v_edges_ = 0;
+  int __pyx_v_x;
+  int __pyx_v_y;
+  int __pyx_v_dx1;
+  int __pyx_v_dy1;
+  int __pyx_v_dx2;
+  int __pyx_v_dy2;
+  double __pyx_v_fx;
+  double __pyx_v_fy;
+  double __pyx_v_ff;
+  int __pyx_v_i;
+  int __pyx_v_j;
+  int __pyx_v_k;
+  int __pyx_v_index;
+  double __pyx_v_tmpf;
+  double __pyx_v_tmpf1;
+  double __pyx_v_tmpf2;
+  double __pyx_v_isovalue_;
+  double __pyx_v_edgeCount;
+  __Pyx_LocalBuf_ND __pyx_pybuffernd_cellToEdge_;
+  __Pyx_Buffer __pyx_pybuffer_cellToEdge_;
+  __Pyx_LocalBuf_ND __pyx_pybuffernd_edgeToRelativePosX_;
+  __Pyx_Buffer __pyx_pybuffer_edgeToRelativePosX_;
+  __Pyx_LocalBuf_ND __pyx_pybuffernd_edgeToRelativePosY_;
+  __Pyx_Buffer __pyx_pybuffer_edgeToRelativePosY_;
+  __Pyx_LocalBuf_ND __pyx_pybuffernd_edges_;
+  __Pyx_Buffer __pyx_pybuffer_edges_;
+  __Pyx_LocalBuf_ND __pyx_pybuffernd_im_;
+  __Pyx_Buffer __pyx_pybuffer_im_;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
-  __pyx_t_5numpy_uint32_t __pyx_t_2;
+  PyObject *__pyx_t_2 = NULL;
+  PyObject *__pyx_t_3 = NULL;
+  PyArrayObject *__pyx_t_4 = NULL;
+  PyArrayObject *__pyx_t_5 = NULL;
+  PyArrayObject *__pyx_t_6 = NULL;
+  PyArrayObject *__pyx_t_7 = NULL;
+  PyArrayObject *__pyx_t_8 = NULL;
+  double __pyx_t_9;
+  long __pyx_t_10;
+  int __pyx_t_11;
+  long __pyx_t_12;
+  int __pyx_t_13;
+  int __pyx_t_14;
+  int __pyx_t_15;
+  int __pyx_t_16;
+  int __pyx_t_17;
+  long __pyx_t_18;
+  long __pyx_t_19;
+  long __pyx_t_20;
+  long __pyx_t_21;
+  int __pyx_t_22;
+  int __pyx_t_23;
+  int __pyx_t_24;
+  int __pyx_t_25;
+  int __pyx_t_26;
+  long __pyx_t_27;
+  __pyx_t_16marchingsquares__INT8_T __pyx_t_28;
+  int __pyx_t_29;
+  int __pyx_t_30;
+  long __pyx_t_31;
+  int __pyx_t_32;
+  long __pyx_t_33;
+  __pyx_t_16marchingsquares__INT8_T __pyx_t_34;
+  int __pyx_t_35;
+  long __pyx_t_36;
+  __pyx_t_16marchingsquares__INT8_T __pyx_t_37;
+  int __pyx_t_38;
+  long __pyx_t_39;
+  int __pyx_t_40;
+  long __pyx_t_41;
+  int __pyx_t_42;
+  int __pyx_t_43;
+  int __pyx_t_44;
+  int __pyx_t_45;
+  double __pyx_t_46;
+  double __pyx_t_47;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
-  __Pyx_RefNannySetupContext("crc32", 0);
+  __Pyx_RefNannySetupContext("marching_squares", 0);
+  __pyx_pybuffer_edgeToRelativePosX_.pybuffer.buf = NULL;
+  __pyx_pybuffer_edgeToRelativePosX_.refcount = 0;
+  __pyx_pybuffernd_edgeToRelativePosX_.data = NULL;
+  __pyx_pybuffernd_edgeToRelativePosX_.rcbuffer = &__pyx_pybuffer_edgeToRelativePosX_;
+  __pyx_pybuffer_edgeToRelativePosY_.pybuffer.buf = NULL;
+  __pyx_pybuffer_edgeToRelativePosY_.refcount = 0;
+  __pyx_pybuffernd_edgeToRelativePosY_.data = NULL;
+  __pyx_pybuffernd_edgeToRelativePosY_.rcbuffer = &__pyx_pybuffer_edgeToRelativePosY_;
+  __pyx_pybuffer_cellToEdge_.pybuffer.buf = NULL;
+  __pyx_pybuffer_cellToEdge_.refcount = 0;
+  __pyx_pybuffernd_cellToEdge_.data = NULL;
+  __pyx_pybuffernd_cellToEdge_.rcbuffer = &__pyx_pybuffer_cellToEdge_;
+  __pyx_pybuffer_im_.pybuffer.buf = NULL;
+  __pyx_pybuffer_im_.refcount = 0;
+  __pyx_pybuffernd_im_.data = NULL;
+  __pyx_pybuffernd_im_.rcbuffer = &__pyx_pybuffer_im_;
+  __pyx_pybuffer_edges_.pybuffer.buf = NULL;
+  __pyx_pybuffer_edges_.refcount = 0;
+  __pyx_pybuffernd_edges_.data = NULL;
+  __pyx_pybuffernd_edges_.rcbuffer = &__pyx_pybuffer_edges_;
+
+  /* "marchingsquares_.pyx":38
+ * 
+ *     # Create array for result
+ *     edges = np.zeros((im.size,2), 'float32')             # <<<<<<<<<<<<<<
+ * 
+ *     # Define maps as array types
+ */
+  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_im, __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
+  __Pyx_GIVEREF(__pyx_t_1);
+  __Pyx_INCREF(__pyx_int_2);
+  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_2);
+  __Pyx_GIVEREF(__pyx_int_2);
+  __pyx_t_1 = 0;
+  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_3));
+  __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__float32));
+  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_n_s__float32));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__float32));
+  __pyx_t_3 = 0;
+  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+  __pyx_v_edges = __pyx_t_3;
+  __pyx_t_3 = 0;
+
+  /* "marchingsquares_.pyx":41
+ * 
+ *     # Define maps as array types
+ *     cdef np.ndarray[INT8_T, ndim=2] edgeToRelativePosX_ = edgeToRelativePosX             # <<<<<<<<<<<<<<
+ *     cdef np.ndarray[INT8_T, ndim=2] edgeToRelativePosY_ = edgeToRelativePosY
+ *     cdef np.ndarray[INT8_T, ndim=2] cellToEdge_ = cellToEdge
+ */
+  if (!(likely(((__pyx_v_edgeToRelativePosX) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_edgeToRelativePosX, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = ((PyArrayObject *)__pyx_v_edgeToRelativePosX);
+  {
+    __Pyx_BufFmt_StackElem __pyx_stack[1];
+    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_edgeToRelativePosX_.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_16marchingsquares__INT8_T, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
+      __pyx_v_edgeToRelativePosX_ = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_edgeToRelativePosX_.rcbuffer->pybuffer.buf = NULL;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    } else {__pyx_pybuffernd_edgeToRelativePosX_.diminfo[0].strides = __pyx_pybuffernd_edgeToRelativePosX_.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_edgeToRelativePosX_.diminfo[0].shape = __pyx_pybuffernd_edgeToRelativePosX_.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_edgeToRelativePosX_.diminfo[1].strides = __pyx_pybuffernd_edgeToRelativePosX_.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_edgeToRelativePosX_.diminfo[1].shape = __pyx_pybuffernd_edgeToRelativePosX_.rcbuffer->pyb [...]
+    }
+  }
+  __pyx_t_4 = 0;
+  __Pyx_INCREF(__pyx_v_edgeToRelativePosX);
+  __pyx_v_edgeToRelativePosX_ = ((PyArrayObject *)__pyx_v_edgeToRelativePosX);
+
+  /* "marchingsquares_.pyx":42
+ *     # Define maps as array types
+ *     cdef np.ndarray[INT8_T, ndim=2] edgeToRelativePosX_ = edgeToRelativePosX
+ *     cdef np.ndarray[INT8_T, ndim=2] edgeToRelativePosY_ = edgeToRelativePosY             # <<<<<<<<<<<<<<
+ *     cdef np.ndarray[INT8_T, ndim=2] cellToEdge_ = cellToEdge
+ * 
+ */
+  if (!(likely(((__pyx_v_edgeToRelativePosY) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_edgeToRelativePosY, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = ((PyArrayObject *)__pyx_v_edgeToRelativePosY);
+  {
+    __Pyx_BufFmt_StackElem __pyx_stack[1];
+    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_edgeToRelativePosY_.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_16marchingsquares__INT8_T, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
+      __pyx_v_edgeToRelativePosY_ = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_edgeToRelativePosY_.rcbuffer->pybuffer.buf = NULL;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    } else {__pyx_pybuffernd_edgeToRelativePosY_.diminfo[0].strides = __pyx_pybuffernd_edgeToRelativePosY_.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_edgeToRelativePosY_.diminfo[0].shape = __pyx_pybuffernd_edgeToRelativePosY_.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_edgeToRelativePosY_.diminfo[1].strides = __pyx_pybuffernd_edgeToRelativePosY_.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_edgeToRelativePosY_.diminfo[1].shape = __pyx_pybuffernd_edgeToRelativePosY_.rcbuffer->pyb [...]
+    }
+  }
+  __pyx_t_5 = 0;
+  __Pyx_INCREF(__pyx_v_edgeToRelativePosY);
+  __pyx_v_edgeToRelativePosY_ = ((PyArrayObject *)__pyx_v_edgeToRelativePosY);
+
+  /* "marchingsquares_.pyx":43
+ *     cdef np.ndarray[INT8_T, ndim=2] edgeToRelativePosX_ = edgeToRelativePosX
+ *     cdef np.ndarray[INT8_T, ndim=2] edgeToRelativePosY_ = edgeToRelativePosY
+ *     cdef np.ndarray[INT8_T, ndim=2] cellToEdge_ = cellToEdge             # <<<<<<<<<<<<<<
+ * 
+ *     # Define other arrays
+ */
+  if (!(likely(((__pyx_v_cellToEdge) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_cellToEdge, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = ((PyArrayObject *)__pyx_v_cellToEdge);
+  {
+    __Pyx_BufFmt_StackElem __pyx_stack[1];
+    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cellToEdge_.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_16marchingsquares__INT8_T, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
+      __pyx_v_cellToEdge_ = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_cellToEdge_.rcbuffer->pybuffer.buf = NULL;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    } else {__pyx_pybuffernd_cellToEdge_.diminfo[0].strides = __pyx_pybuffernd_cellToEdge_.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cellToEdge_.diminfo[0].shape = __pyx_pybuffernd_cellToEdge_.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_cellToEdge_.diminfo[1].strides = __pyx_pybuffernd_cellToEdge_.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_cellToEdge_.diminfo[1].shape = __pyx_pybuffernd_cellToEdge_.rcbuffer->pybuffer.shape[1];
+    }
+  }
+  __pyx_t_6 = 0;
+  __Pyx_INCREF(__pyx_v_cellToEdge);
+  __pyx_v_cellToEdge_ = ((PyArrayObject *)__pyx_v_cellToEdge);
+
+  /* "marchingsquares_.pyx":46
+ * 
+ *     # Define other arrays
+ *     cdef np.ndarray[FLOAT32_T, ndim=2] im_ = im             # <<<<<<<<<<<<<<
+ *     cdef np.ndarray[FLOAT32_T, ndim=2] edges_ = edges
+ * 
+ */
+  if (!(likely(((__pyx_v_im) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_im, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = ((PyArrayObject *)__pyx_v_im);
+  {
+    __Pyx_BufFmt_StackElem __pyx_stack[1];
+    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_im_.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_16marchingsquares__FLOAT32_T, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
+      __pyx_v_im_ = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_im_.rcbuffer->pybuffer.buf = NULL;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    } else {__pyx_pybuffernd_im_.diminfo[0].strides = __pyx_pybuffernd_im_.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_im_.diminfo[0].shape = __pyx_pybuffernd_im_.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_im_.diminfo[1].strides = __pyx_pybuffernd_im_.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_im_.diminfo[1].shape = __pyx_pybuffernd_im_.rcbuffer->pybuffer.shape[1];
+    }
+  }
+  __pyx_t_7 = 0;
+  __Pyx_INCREF(__pyx_v_im);
+  __pyx_v_im_ = ((PyArrayObject *)__pyx_v_im);
+
+  /* "marchingsquares_.pyx":47
+ *     # Define other arrays
+ *     cdef np.ndarray[FLOAT32_T, ndim=2] im_ = im
+ *     cdef np.ndarray[FLOAT32_T, ndim=2] edges_ = edges             # <<<<<<<<<<<<<<
+ * 
+ *     cdef int x, y, z
+ */
+  if (!(likely(((__pyx_v_edges) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_edges, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_8 = ((PyArrayObject *)__pyx_v_edges);
+  {
+    __Pyx_BufFmt_StackElem __pyx_stack[1];
+    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_edges_.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_16marchingsquares__FLOAT32_T, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
+      __pyx_v_edges_ = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_edges_.rcbuffer->pybuffer.buf = NULL;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    } else {__pyx_pybuffernd_edges_.diminfo[0].strides = __pyx_pybuffernd_edges_.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_edges_.diminfo[0].shape = __pyx_pybuffernd_edges_.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_edges_.diminfo[1].strides = __pyx_pybuffernd_edges_.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_edges_.diminfo[1].shape = __pyx_pybuffernd_edges_.rcbuffer->pybuffer.shape[1];
+    }
+  }
+  __pyx_t_8 = 0;
+  __Pyx_INCREF(__pyx_v_edges);
+  __pyx_v_edges_ = ((PyArrayObject *)__pyx_v_edges);
+
+  /* "marchingsquares_.pyx":55
+ *     cdef int index
+ *     cdef double tmpf, tmpf1, tmpf2
+ *     cdef double isovalue_ = isovalue             # <<<<<<<<<<<<<<
+ * 
+ *     cdef double edgeCount = 0
+ */
+  __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_v_isovalue); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_v_isovalue_ = __pyx_t_9;
 
-  /* "fastcrc.pyx":47
- *     @return unsigned integer
- *     """
- *     cdef numpy.uint32_t size = data.nbytes             # <<<<<<<<<<<<<<
- *     return C_crc32(<char *> data.data, size)
+  /* "marchingsquares_.pyx":57
+ *     cdef double isovalue_ = isovalue
+ * 
+ *     cdef double edgeCount = 0             # <<<<<<<<<<<<<<
+ * 
+ *     for y in range(im.shape[0]-1):
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_data), __pyx_n_s__nbytes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_v_edgeCount = 0.0;
+
+  /* "marchingsquares_.pyx":59
+ *     cdef double edgeCount = 0
+ * 
+ *     for y in range(im.shape[0]-1):             # <<<<<<<<<<<<<<
+ *         for x in range(im.shape[1]-1):
+ * 
+ */
+  __pyx_t_3 = PyObject_GetAttr(__pyx_v_im, __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_PyInt_from_py_npy_uint32(__pyx_t_1); if (unlikely((__pyx_t_2 == (npy_uint32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_v_size = __pyx_t_2;
+  __pyx_t_10 = __Pyx_PyInt_AsLong(__pyx_t_3); if (unlikely((__pyx_t_10 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
+    __pyx_v_y = __pyx_t_11;
 
-  /* "fastcrc.pyx":48
- *     """
- *     cdef numpy.uint32_t size = data.nbytes
- *     return C_crc32(<char *> data.data, size)             # <<<<<<<<<<<<<<
+    /* "marchingsquares_.pyx":60
+ * 
+ *     for y in range(im.shape[0]-1):
+ *         for x in range(im.shape[1]-1):             # <<<<<<<<<<<<<<
+ * 
+ *             # Calculate index.
+ */
+    __pyx_t_3 = PyObject_GetAttr(__pyx_v_im, __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_12 = __Pyx_PyInt_AsLong(__pyx_t_3); if (unlikely((__pyx_t_12 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
+      __pyx_v_x = __pyx_t_13;
+
+      /* "marchingsquares_.pyx":63
+ * 
+ *             # Calculate index.
+ *             index = 0             # <<<<<<<<<<<<<<
+ *             if im_[y, x] > isovalue_:
+ *                 index += 1
+ */
+      __pyx_v_index = 0;
+
+      /* "marchingsquares_.pyx":64
+ *             # Calculate index.
+ *             index = 0
+ *             if im_[y, x] > isovalue_:             # <<<<<<<<<<<<<<
+ *                 index += 1
+ *             if im_[y, x+1] > isovalue_:
+ */
+      __pyx_t_14 = __pyx_v_y;
+      __pyx_t_15 = __pyx_v_x;
+      __pyx_t_16 = ((*__Pyx_BufPtrStrided2d(__pyx_t_16marchingsquares__FLOAT32_T *, __pyx_pybuffernd_im_.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_im_.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_im_.diminfo[1].strides)) > __pyx_v_isovalue_);
+      if (__pyx_t_16) {
+
+        /* "marchingsquares_.pyx":65
+ *             index = 0
+ *             if im_[y, x] > isovalue_:
+ *                 index += 1             # <<<<<<<<<<<<<<
+ *             if im_[y, x+1] > isovalue_:
+ *                 index += 2
+ */
+        __pyx_v_index = (__pyx_v_index + 1);
+        goto __pyx_L7;
+      }
+      __pyx_L7:;
+
+      /* "marchingsquares_.pyx":66
+ *             if im_[y, x] > isovalue_:
+ *                 index += 1
+ *             if im_[y, x+1] > isovalue_:             # <<<<<<<<<<<<<<
+ *                 index += 2
+ *             if im_[y+1, x+1] > isovalue_:
+ */
+      __pyx_t_17 = __pyx_v_y;
+      __pyx_t_18 = (__pyx_v_x + 1);
+      __pyx_t_16 = ((*__Pyx_BufPtrStrided2d(__pyx_t_16marchingsquares__FLOAT32_T *, __pyx_pybuffernd_im_.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_im_.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_im_.diminfo[1].strides)) > __pyx_v_isovalue_);
+      if (__pyx_t_16) {
+
+        /* "marchingsquares_.pyx":67
+ *                 index += 1
+ *             if im_[y, x+1] > isovalue_:
+ *                 index += 2             # <<<<<<<<<<<<<<
+ *             if im_[y+1, x+1] > isovalue_:
+ *                 index += 4
+ */
+        __pyx_v_index = (__pyx_v_index + 2);
+        goto __pyx_L8;
+      }
+      __pyx_L8:;
+
+      /* "marchingsquares_.pyx":68
+ *             if im_[y, x+1] > isovalue_:
+ *                 index += 2
+ *             if im_[y+1, x+1] > isovalue_:             # <<<<<<<<<<<<<<
+ *                 index += 4
+ *             if im_[y+1, x] > isovalue_:
+ */
+      __pyx_t_19 = (__pyx_v_y + 1);
+      __pyx_t_20 = (__pyx_v_x + 1);
+      __pyx_t_16 = ((*__Pyx_BufPtrStrided2d(__pyx_t_16marchingsquares__FLOAT32_T *, __pyx_pybuffernd_im_.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_im_.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_im_.diminfo[1].strides)) > __pyx_v_isovalue_);
+      if (__pyx_t_16) {
+
+        /* "marchingsquares_.pyx":69
+ *                 index += 2
+ *             if im_[y+1, x+1] > isovalue_:
+ *                 index += 4             # <<<<<<<<<<<<<<
+ *             if im_[y+1, x] > isovalue_:
+ *                 index += 8
+ */
+        __pyx_v_index = (__pyx_v_index + 4);
+        goto __pyx_L9;
+      }
+      __pyx_L9:;
+
+      /* "marchingsquares_.pyx":70
+ *             if im_[y+1, x+1] > isovalue_:
+ *                 index += 4
+ *             if im_[y+1, x] > isovalue_:             # <<<<<<<<<<<<<<
+ *                 index += 8
+ * 
+ */
+      __pyx_t_21 = (__pyx_v_y + 1);
+      __pyx_t_22 = __pyx_v_x;
+      __pyx_t_16 = ((*__Pyx_BufPtrStrided2d(__pyx_t_16marchingsquares__FLOAT32_T *, __pyx_pybuffernd_im_.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_im_.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_im_.diminfo[1].strides)) > __pyx_v_isovalue_);
+      if (__pyx_t_16) {
+
+        /* "marchingsquares_.pyx":71
+ *                 index += 4
+ *             if im_[y+1, x] > isovalue_:
+ *                 index += 8             # <<<<<<<<<<<<<<
+ * 
+ *             # Resolve ambiguity
+ */
+        __pyx_v_index = (__pyx_v_index + 8);
+        goto __pyx_L10;
+      }
+      __pyx_L10:;
+
+      /* "marchingsquares_.pyx":74
+ * 
+ *             # Resolve ambiguity
+ *             if index == 5 or index == 10:             # <<<<<<<<<<<<<<
+ *                 # Calculate value of cell center (i.e. average of corners)
+ *                 tmpf = 0.0
+ */
+      switch (__pyx_v_index) {
+        case 5:
+        case 10:
+
+        /* "marchingsquares_.pyx":76
+ *             if index == 5 or index == 10:
+ *                 # Calculate value of cell center (i.e. average of corners)
+ *                 tmpf = 0.0             # <<<<<<<<<<<<<<
+ *                 for dy1 in range(2):
+ *                     for dx1 in range(2):
+ */
+        __pyx_v_tmpf = 0.0;
+
+        /* "marchingsquares_.pyx":77
+ *                 # Calculate value of cell center (i.e. average of corners)
+ *                 tmpf = 0.0
+ *                 for dy1 in range(2):             # <<<<<<<<<<<<<<
+ *                     for dx1 in range(2):
+ *                         tmpf += im_[y+dy1,x+dx1]
+ */
+        for (__pyx_t_23 = 0; __pyx_t_23 < 2; __pyx_t_23+=1) {
+          __pyx_v_dy1 = __pyx_t_23;
+
+          /* "marchingsquares_.pyx":78
+ *                 tmpf = 0.0
+ *                 for dy1 in range(2):
+ *                     for dx1 in range(2):             # <<<<<<<<<<<<<<
+ *                         tmpf += im_[y+dy1,x+dx1]
+ *                 tmpf /= 4
+ */
+          for (__pyx_t_24 = 0; __pyx_t_24 < 2; __pyx_t_24+=1) {
+            __pyx_v_dx1 = __pyx_t_24;
+
+            /* "marchingsquares_.pyx":79
+ *                 for dy1 in range(2):
+ *                     for dx1 in range(2):
+ *                         tmpf += im_[y+dy1,x+dx1]             # <<<<<<<<<<<<<<
+ *                 tmpf /= 4
+ *                 # If below isovalue, swap
+ */
+            __pyx_t_25 = (__pyx_v_y + __pyx_v_dy1);
+            __pyx_t_26 = (__pyx_v_x + __pyx_v_dx1);
+            __pyx_v_tmpf = (__pyx_v_tmpf + (*__Pyx_BufPtrStrided2d(__pyx_t_16marchingsquares__FLOAT32_T *, __pyx_pybuffernd_im_.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_im_.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_im_.diminfo[1].strides)));
+          }
+        }
+
+        /* "marchingsquares_.pyx":80
+ *                     for dx1 in range(2):
+ *                         tmpf += im_[y+dy1,x+dx1]
+ *                 tmpf /= 4             # <<<<<<<<<<<<<<
+ *                 # If below isovalue, swap
+ *                 if tmpf <= isovalue_:
+ */
+        __pyx_v_tmpf = (__pyx_v_tmpf / 4.0);
+
+        /* "marchingsquares_.pyx":82
+ *                 tmpf /= 4
+ *                 # If below isovalue, swap
+ *                 if tmpf <= isovalue_:             # <<<<<<<<<<<<<<
+ *                     if index == 5:
+ *                         index = 10
+ */
+        __pyx_t_16 = (__pyx_v_tmpf <= __pyx_v_isovalue_);
+        if (__pyx_t_16) {
+
+          /* "marchingsquares_.pyx":83
+ *                 # If below isovalue, swap
+ *                 if tmpf <= isovalue_:
+ *                     if index == 5:             # <<<<<<<<<<<<<<
+ *                         index = 10
+ *                     else:
+ */
+          __pyx_t_16 = (__pyx_v_index == 5);
+          if (__pyx_t_16) {
+
+            /* "marchingsquares_.pyx":84
+ *                 if tmpf <= isovalue_:
+ *                     if index == 5:
+ *                         index = 10             # <<<<<<<<<<<<<<
+ *                     else:
+ *                         index = 5
+ */
+            __pyx_v_index = 10;
+            goto __pyx_L16;
+          }
+          /*else*/ {
+
+            /* "marchingsquares_.pyx":86
+ *                         index = 10
+ *                     else:
+ *                         index = 5             # <<<<<<<<<<<<<<
+ * 
+ *             # For each edge ...
+ */
+            __pyx_v_index = 5;
+          }
+          __pyx_L16:;
+          goto __pyx_L15;
+        }
+        __pyx_L15:;
+        break;
+      }
+
+      /* "marchingsquares_.pyx":89
+ * 
+ *             # For each edge ...
+ *             for i in range(cellToEdge_[index,0]):             # <<<<<<<<<<<<<<
+ *                 # For both ends of the edge ...
+ *                 for j in range(2):
+ */
+      __pyx_t_23 = __pyx_v_index;
+      __pyx_t_27 = 0;
+      __pyx_t_28 = (*__Pyx_BufPtrStrided2d(__pyx_t_16marchingsquares__INT8_T *, __pyx_pybuffernd_cellToEdge_.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_cellToEdge_.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_cellToEdge_.diminfo[1].strides));
+      for (__pyx_t_24 = 0; __pyx_t_24 < __pyx_t_28; __pyx_t_24+=1) {
+        __pyx_v_i = __pyx_t_24;
+
+        /* "marchingsquares_.pyx":91
+ *             for i in range(cellToEdge_[index,0]):
+ *                 # For both ends of the edge ...
+ *                 for j in range(2):             # <<<<<<<<<<<<<<
+ *                     # Get edge index
+ *                     k = cellToEdge_[index, 1+i*2+j]
+ */
+        for (__pyx_t_29 = 0; __pyx_t_29 < 2; __pyx_t_29+=1) {
+          __pyx_v_j = __pyx_t_29;
+
+          /* "marchingsquares_.pyx":93
+ *                 for j in range(2):
+ *                     # Get edge index
+ *                     k = cellToEdge_[index, 1+i*2+j]             # <<<<<<<<<<<<<<
+ *                     # Use these to look up the relative positions of the pixels to interpolate
+ *                     dx1, dy1 = edgeToRelativePosX_[k,0], edgeToRelativePosY_[k,0]
+ */
+          __pyx_t_30 = __pyx_v_index;
+          __pyx_t_31 = ((1 + (__pyx_v_i * 2)) + __pyx_v_j);
+          __pyx_v_k = (*__Pyx_BufPtrStrided2d(__pyx_t_16marchingsquares__INT8_T *, __pyx_pybuffernd_cellToEdge_.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_cellToEdge_.diminfo[0].strides, __pyx_t_31, __pyx_pybuffernd_cellToEdge_.diminfo[1].strides));
+
+          /* "marchingsquares_.pyx":95
+ *                     k = cellToEdge_[index, 1+i*2+j]
+ *                     # Use these to look up the relative positions of the pixels to interpolate
+ *                     dx1, dy1 = edgeToRelativePosX_[k,0], edgeToRelativePosY_[k,0]             # <<<<<<<<<<<<<<
+ *                     dx2, dy2 = edgeToRelativePosX_[k,1], edgeToRelativePosY_[k,1]
+ *                     # Define "strength" of each corner of the cube that we need
+ */
+          __pyx_t_32 = __pyx_v_k;
+          __pyx_t_33 = 0;
+          __pyx_t_34 = (*__Pyx_BufPtrStrided2d(__pyx_t_16marchingsquares__INT8_T *, __pyx_pybuffernd_edgeToRelativePosX_.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_edgeToRelativePosX_.diminfo[0].strides, __pyx_t_33, __pyx_pybuffernd_edgeToRelativePosX_.diminfo[1].strides));
+          __pyx_t_35 = __pyx_v_k;
+          __pyx_t_36 = 0;
+          __pyx_t_37 = (*__Pyx_BufPtrStrided2d(__pyx_t_16marchingsquares__INT8_T *, __pyx_pybuffernd_edgeToRelativePosY_.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_edgeToRelativePosY_.diminfo[0].strides, __pyx_t_36, __pyx_pybuffernd_edgeToRelativePosY_.diminfo[1].strides));
+          __pyx_v_dx1 = __pyx_t_34;
+          __pyx_v_dy1 = __pyx_t_37;
+
+          /* "marchingsquares_.pyx":96
+ *                     # Use these to look up the relative positions of the pixels to interpolate
+ *                     dx1, dy1 = edgeToRelativePosX_[k,0], edgeToRelativePosY_[k,0]
+ *                     dx2, dy2 = edgeToRelativePosX_[k,1], edgeToRelativePosY_[k,1]             # <<<<<<<<<<<<<<
+ *                     # Define "strength" of each corner of the cube that we need
+ *                     tmpf1 = 1.0 / (0.0001 + fabs( im_[y+dy1,x+dx1] - isovalue_))
+ */
+          __pyx_t_38 = __pyx_v_k;
+          __pyx_t_39 = 1;
+          __pyx_t_37 = (*__Pyx_BufPtrStrided2d(__pyx_t_16marchingsquares__INT8_T *, __pyx_pybuffernd_edgeToRelativePosX_.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_edgeToRelativePosX_.diminfo[0].strides, __pyx_t_39, __pyx_pybuffernd_edgeToRelativePosX_.diminfo[1].strides));
+          __pyx_t_40 = __pyx_v_k;
+          __pyx_t_41 = 1;
+          __pyx_t_34 = (*__Pyx_BufPtrStrided2d(__pyx_t_16marchingsquares__INT8_T *, __pyx_pybuffernd_edgeToRelativePosY_.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_edgeToRelativePosY_.diminfo[0].strides, __pyx_t_41, __pyx_pybuffernd_edgeToRelativePosY_.diminfo[1].strides));
+          __pyx_v_dx2 = __pyx_t_37;
+          __pyx_v_dy2 = __pyx_t_34;
+
+          /* "marchingsquares_.pyx":98
+ *                     dx2, dy2 = edgeToRelativePosX_[k,1], edgeToRelativePosY_[k,1]
+ *                     # Define "strength" of each corner of the cube that we need
+ *                     tmpf1 = 1.0 / (0.0001 + fabs( im_[y+dy1,x+dx1] - isovalue_))             # <<<<<<<<<<<<<<
+ *                     tmpf2 = 1.0 / (0.0001 + fabs( im_[y+dy2,x+dx2] - isovalue_))
+ *                     # Apply a kind of center-of-mass method
+ */
+          __pyx_t_42 = (__pyx_v_y + __pyx_v_dy1);
+          __pyx_t_43 = (__pyx_v_x + __pyx_v_dx1);
+          __pyx_t_9 = (0.0001 + __pyx_f_16marchingsquares__fabs(((*__Pyx_BufPtrStrided2d(__pyx_t_16marchingsquares__FLOAT32_T *, __pyx_pybuffernd_im_.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_im_.diminfo[0].strides, __pyx_t_43, __pyx_pybuffernd_im_.diminfo[1].strides)) - __pyx_v_isovalue_)));
+          if (unlikely(__pyx_t_9 == 0)) {
+            PyErr_Format(PyExc_ZeroDivisionError, "float division");
+            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          }
+          __pyx_v_tmpf1 = (1.0 / __pyx_t_9);
+
+          /* "marchingsquares_.pyx":99
+ *                     # Define "strength" of each corner of the cube that we need
+ *                     tmpf1 = 1.0 / (0.0001 + fabs( im_[y+dy1,x+dx1] - isovalue_))
+ *                     tmpf2 = 1.0 / (0.0001 + fabs( im_[y+dy2,x+dx2] - isovalue_))             # <<<<<<<<<<<<<<
+ *                     # Apply a kind of center-of-mass method
+ *                     fx, fy, ff = 0.0, 0.0, 0.0
+ */
+          __pyx_t_44 = (__pyx_v_y + __pyx_v_dy2);
+          __pyx_t_45 = (__pyx_v_x + __pyx_v_dx2);
+          __pyx_t_9 = (0.0001 + __pyx_f_16marchingsquares__fabs(((*__Pyx_BufPtrStrided2d(__pyx_t_16marchingsquares__FLOAT32_T *, __pyx_pybuffernd_im_.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_im_.diminfo[0].strides, __pyx_t_45, __pyx_pybuffernd_im_.diminfo[1].strides)) - __pyx_v_isovalue_)));
+          if (unlikely(__pyx_t_9 == 0)) {
+            PyErr_Format(PyExc_ZeroDivisionError, "float division");
+            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          }
+          __pyx_v_tmpf2 = (1.0 / __pyx_t_9);
+
+          /* "marchingsquares_.pyx":101
+ *                     tmpf2 = 1.0 / (0.0001 + fabs( im_[y+dy2,x+dx2] - isovalue_))
+ *                     # Apply a kind of center-of-mass method
+ *                     fx, fy, ff = 0.0, 0.0, 0.0             # <<<<<<<<<<<<<<
+ *                     fx += <double>dx1 * tmpf1;  fy += <double>dy1 * tmpf1;  ff += tmpf1
+ *                     fx += <double>dx2 * tmpf2;  fy += <double>dy2 * tmpf2;  ff += tmpf2
+ */
+          __pyx_t_9 = 0.0;
+          __pyx_t_46 = 0.0;
+          __pyx_t_47 = 0.0;
+          __pyx_v_fx = __pyx_t_9;
+          __pyx_v_fy = __pyx_t_46;
+          __pyx_v_ff = __pyx_t_47;
+
+          /* "marchingsquares_.pyx":102
+ *                     # Apply a kind of center-of-mass method
+ *                     fx, fy, ff = 0.0, 0.0, 0.0
+ *                     fx += <double>dx1 * tmpf1;  fy += <double>dy1 * tmpf1;  ff += tmpf1             # <<<<<<<<<<<<<<
+ *                     fx += <double>dx2 * tmpf2;  fy += <double>dy2 * tmpf2;  ff += tmpf2
+ *                     #
+ */
+          __pyx_v_fx = (__pyx_v_fx + (((double)__pyx_v_dx1) * __pyx_v_tmpf1));
+          __pyx_v_fy = (__pyx_v_fy + (((double)__pyx_v_dy1) * __pyx_v_tmpf1));
+          __pyx_v_ff = (__pyx_v_ff + __pyx_v_tmpf1);
+
+          /* "marchingsquares_.pyx":103
+ *                     fx, fy, ff = 0.0, 0.0, 0.0
+ *                     fx += <double>dx1 * tmpf1;  fy += <double>dy1 * tmpf1;  ff += tmpf1
+ *                     fx += <double>dx2 * tmpf2;  fy += <double>dy2 * tmpf2;  ff += tmpf2             # <<<<<<<<<<<<<<
+ *                     #
+ *                     fx /= ff
+ */
+          __pyx_v_fx = (__pyx_v_fx + (((double)__pyx_v_dx2) * __pyx_v_tmpf2));
+          __pyx_v_fy = (__pyx_v_fy + (((double)__pyx_v_dy2) * __pyx_v_tmpf2));
+          __pyx_v_ff = (__pyx_v_ff + __pyx_v_tmpf2);
+
+          /* "marchingsquares_.pyx":105
+ *                     fx += <double>dx2 * tmpf2;  fy += <double>dy2 * tmpf2;  ff += tmpf2
+ *                     #
+ *                     fx /= ff             # <<<<<<<<<<<<<<
+ *                     fy /= ff
+ *                     # Append point
+ */
+          if (unlikely(__pyx_v_ff == 0)) {
+            PyErr_Format(PyExc_ZeroDivisionError, "float division");
+            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          }
+          __pyx_v_fx = (__pyx_v_fx / __pyx_v_ff);
+
+          /* "marchingsquares_.pyx":106
+ *                     #
+ *                     fx /= ff
+ *                     fy /= ff             # <<<<<<<<<<<<<<
+ *                     # Append point
+ *                     edges_[edgeCount,0] = <double>x + fx
+ */
+          if (unlikely(__pyx_v_ff == 0)) {
+            PyErr_Format(PyExc_ZeroDivisionError, "float division");
+            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          }
+          __pyx_v_fy = (__pyx_v_fy / __pyx_v_ff);
+
+          /* "marchingsquares_.pyx":108
+ *                     fy /= ff
+ *                     # Append point
+ *                     edges_[edgeCount,0] = <double>x + fx             # <<<<<<<<<<<<<<
+ *                     edges_[edgeCount,1] = <double>y + fy
+ *                     edgeCount += 1
+ */
+          __pyx_t_3 = PyFloat_FromDouble((((double)__pyx_v_x) + __pyx_v_fx)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_3);
+          __pyx_t_1 = PyFloat_FromDouble(__pyx_v_edgeCount); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_1);
+          __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_2);
+          PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
+          __Pyx_GIVEREF(__pyx_t_1);
+          __Pyx_INCREF(__pyx_int_0);
+          PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_0);
+          __Pyx_GIVEREF(__pyx_int_0);
+          __pyx_t_1 = 0;
+          if (PyObject_SetItem(((PyObject *)__pyx_v_edges_), ((PyObject *)__pyx_t_2), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+
+          /* "marchingsquares_.pyx":109
+ *                     # Append point
+ *                     edges_[edgeCount,0] = <double>x + fx
+ *                     edges_[edgeCount,1] = <double>y + fy             # <<<<<<<<<<<<<<
+ *                     edgeCount += 1
+ * 
+ */
+          __pyx_t_3 = PyFloat_FromDouble((((double)__pyx_v_y) + __pyx_v_fy)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_3);
+          __pyx_t_2 = PyFloat_FromDouble(__pyx_v_edgeCount); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_2);
+          __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __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_INCREF(__pyx_int_1);
+          PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_1);
+          __Pyx_GIVEREF(__pyx_int_1);
+          __pyx_t_2 = 0;
+          if (PyObject_SetItem(((PyObject *)__pyx_v_edges_), ((PyObject *)__pyx_t_1), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+
+          /* "marchingsquares_.pyx":110
+ *                     edges_[edgeCount,0] = <double>x + fx
+ *                     edges_[edgeCount,1] = <double>y + fy
+ *                     edgeCount += 1             # <<<<<<<<<<<<<<
+ * 
+ *     # Done
+ */
+          __pyx_v_edgeCount = (__pyx_v_edgeCount + 1.0);
+        }
+      }
+    }
+  }
+
+  /* "marchingsquares_.pyx":113
+ * 
+ *     # Done
+ *     return edges[:edgeCount,:]             # <<<<<<<<<<<<<<
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(crc32(((char *)__pyx_v_data->data), __pyx_v_size)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_edgeCount); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_1 = PySlice_New(Py_None, __pyx_t_3, Py_None); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
+  __Pyx_GIVEREF(__pyx_t_1);
+  __Pyx_INCREF(__pyx_k_slice_1);
+  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_k_slice_1);
+  __Pyx_GIVEREF(__pyx_k_slice_1);
+  __pyx_t_1 = 0;
+  __pyx_t_1 = PyObject_GetItem(__pyx_v_edges, ((PyObject *)__pyx_t_3)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
   goto __pyx_L0;
@@ -1048,9 +2158,32 @@ static PyObject *__pyx_pf_7fastcrc_crc32(CYTHON_UNUSED PyObject *__pyx_self, PyA
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("fastcrc.crc32", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_XDECREF(__pyx_t_2);
+  __Pyx_XDECREF(__pyx_t_3);
+  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
+    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
+    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cellToEdge_.rcbuffer->pybuffer);
+    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_edgeToRelativePosX_.rcbuffer->pybuffer);
+    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_edgeToRelativePosY_.rcbuffer->pybuffer);
+    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_edges_.rcbuffer->pybuffer);
+    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_im_.rcbuffer->pybuffer);
+  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
+  __Pyx_AddTraceback("marchingsquares_.marching_squares", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
+  goto __pyx_L2;
   __pyx_L0:;
+  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cellToEdge_.rcbuffer->pybuffer);
+  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_edgeToRelativePosX_.rcbuffer->pybuffer);
+  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_edgeToRelativePosY_.rcbuffer->pybuffer);
+  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_edges_.rcbuffer->pybuffer);
+  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_im_.rcbuffer->pybuffer);
+  __pyx_L2:;
+  __Pyx_XDECREF(__pyx_v_edges);
+  __Pyx_XDECREF((PyObject *)__pyx_v_edgeToRelativePosX_);
+  __Pyx_XDECREF((PyObject *)__pyx_v_edgeToRelativePosY_);
+  __Pyx_XDECREF((PyObject *)__pyx_v_cellToEdge_);
+  __Pyx_XDECREF((PyObject *)__pyx_v_im_);
+  __Pyx_XDECREF((PyObject *)__pyx_v_edges_);
   __Pyx_XGIVEREF(__pyx_r);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
@@ -1212,7 +2345,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  * 
  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
  */
-    __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __Pyx_Raise(__pyx_t_4, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
@@ -1252,7 +2385,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  * 
  *             info.buf = PyArray_DATA(self)
  */
-    __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __Pyx_Raise(__pyx_t_4, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
@@ -1522,7 +2655,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 if   t == NPY_BYTE:        f = "b"
  *                 elif t == NPY_UBYTE:       f = "B"
  */
-      __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_7), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_4);
       __Pyx_Raise(__pyx_t_4, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
@@ -1762,7 +2895,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  */
       __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_7), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_8), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_8));
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
       __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -2336,7 +3469,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  * 
  *         if ((child.byteorder == c'>' and little_endian) or
  */
-      __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_9), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
       __Pyx_Raise(__pyx_t_5, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
@@ -2387,7 +3520,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  *             # One could encode it in the format string and have Cython
  *             # complain instead, BUT: < and > in format strings also imply
  */
-      __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_11), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
       __Pyx_Raise(__pyx_t_5, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
@@ -2491,7 +3624,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  * 
  *             # Until ticket #99 is fixed, use integers to avoid warnings
  */
-        __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_13), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_3);
         __Pyx_Raise(__pyx_t_3, 0, 0, 0);
         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
@@ -2820,7 +3953,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  *             f += 1
  *         else:
  */
-        __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_7), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_8), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(((PyObject *)__pyx_t_5));
         __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_3);
@@ -3033,7 +4166,7 @@ static PyMethodDef __pyx_methods[] = {
 #if PY_MAJOR_VERSION >= 3
 static struct PyModuleDef __pyx_moduledef = {
     PyModuleDef_HEAD_INIT,
-    __Pyx_NAMESTR("fastcrc"),
+    __Pyx_NAMESTR("marchingsquares_"),
     0, /* m_doc */
     -1, /* m_size */
     __pyx_methods /* m_methods */,
@@ -3045,39 +4178,70 @@ static struct PyModuleDef __pyx_moduledef = {
 #endif
 
 static __Pyx_StringTabEntry __pyx_string_tab[] = {
-  {&__pyx_kp_u_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 1, 0, 0},
-  {&__pyx_kp_u_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 1, 0, 0},
-  {&__pyx_kp_s_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 0, 1, 0},
-  {&__pyx_kp_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 0},
-  {&__pyx_kp_s_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 1, 0},
+  {&__pyx_kp_u_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 1, 0, 0},
   {&__pyx_kp_s_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 0, 1, 0},
-  {&__pyx_kp_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 0},
-  {&__pyx_kp_s_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 1, 0},
-  {&__pyx_kp_u_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 1, 0, 0},
-  {&__pyx_kp_u_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 1, 0, 0},
-  {&__pyx_kp_u_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 1, 0, 0},
+  {&__pyx_kp_u_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 1, 0, 0},
+  {&__pyx_kp_u_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 1, 0, 0},
+  {&__pyx_kp_u_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 1, 0, 0},
   {&__pyx_kp_u_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 1, 0, 0},
+  {&__pyx_kp_u_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 1, 0, 0},
+  {&__pyx_n_s__FLOAT32, __pyx_k__FLOAT32, sizeof(__pyx_k__FLOAT32), 0, 0, 1, 1},
+  {&__pyx_n_s__FLOAT64, __pyx_k__FLOAT64, sizeof(__pyx_k__FLOAT64), 0, 0, 1, 1},
+  {&__pyx_n_s__INT32, __pyx_k__INT32, sizeof(__pyx_k__INT32), 0, 0, 1, 1},
+  {&__pyx_n_s__INT8, __pyx_k__INT8, sizeof(__pyx_k__INT8), 0, 0, 1, 1},
   {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1},
   {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1},
-  {&__pyx_n_s____author__, __pyx_k____author__, sizeof(__pyx_k____author__), 0, 0, 1, 1},
-  {&__pyx_n_s____contact__, __pyx_k____contact__, sizeof(__pyx_k____contact__), 0, 0, 1, 1},
-  {&__pyx_n_s____date__, __pyx_k____date__, sizeof(__pyx_k____date__), 0, 0, 1, 1},
-  {&__pyx_n_s____doc__, __pyx_k____doc__, sizeof(__pyx_k____doc__), 0, 0, 1, 1},
-  {&__pyx_n_s____license__, __pyx_k____license__, sizeof(__pyx_k____license__), 0, 0, 1, 1},
   {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
   {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
-  {&__pyx_n_s__crc32, __pyx_k__crc32, sizeof(__pyx_k__crc32), 0, 0, 1, 1},
-  {&__pyx_n_s__data, __pyx_k__data, sizeof(__pyx_k__data), 0, 0, 1, 1},
-  {&__pyx_n_s__fastcrc, __pyx_k__fastcrc, sizeof(__pyx_k__fastcrc), 0, 0, 1, 1},
-  {&__pyx_n_s__nbytes, __pyx_k__nbytes, sizeof(__pyx_k__nbytes), 0, 0, 1, 1},
+  {&__pyx_n_s__cellToEdge, __pyx_k__cellToEdge, sizeof(__pyx_k__cellToEdge), 0, 0, 1, 1},
+  {&__pyx_n_s__cellToEdge_, __pyx_k__cellToEdge_, sizeof(__pyx_k__cellToEdge_), 0, 0, 1, 1},
+  {&__pyx_n_s__dx1, __pyx_k__dx1, sizeof(__pyx_k__dx1), 0, 0, 1, 1},
+  {&__pyx_n_s__dx2, __pyx_k__dx2, sizeof(__pyx_k__dx2), 0, 0, 1, 1},
+  {&__pyx_n_s__dy1, __pyx_k__dy1, sizeof(__pyx_k__dy1), 0, 0, 1, 1},
+  {&__pyx_n_s__dy2, __pyx_k__dy2, sizeof(__pyx_k__dy2), 0, 0, 1, 1},
+  {&__pyx_n_s__dz1, __pyx_k__dz1, sizeof(__pyx_k__dz1), 0, 0, 1, 1},
+  {&__pyx_n_s__dz2, __pyx_k__dz2, sizeof(__pyx_k__dz2), 0, 0, 1, 1},
+  {&__pyx_n_s__edgeCount, __pyx_k__edgeCount, sizeof(__pyx_k__edgeCount), 0, 0, 1, 1},
+  {&__pyx_n_s__edgeToRelativePosX, __pyx_k__edgeToRelativePosX, sizeof(__pyx_k__edgeToRelativePosX), 0, 0, 1, 1},
+  {&__pyx_n_s__edgeToRelativePosX_, __pyx_k__edgeToRelativePosX_, sizeof(__pyx_k__edgeToRelativePosX_), 0, 0, 1, 1},
+  {&__pyx_n_s__edgeToRelativePosY, __pyx_k__edgeToRelativePosY, sizeof(__pyx_k__edgeToRelativePosY), 0, 0, 1, 1},
+  {&__pyx_n_s__edgeToRelativePosY_, __pyx_k__edgeToRelativePosY_, sizeof(__pyx_k__edgeToRelativePosY_), 0, 0, 1, 1},
+  {&__pyx_n_s__edges, __pyx_k__edges, sizeof(__pyx_k__edges), 0, 0, 1, 1},
+  {&__pyx_n_s__edges_, __pyx_k__edges_, sizeof(__pyx_k__edges_), 0, 0, 1, 1},
+  {&__pyx_n_s__ff, __pyx_k__ff, sizeof(__pyx_k__ff), 0, 0, 1, 1},
+  {&__pyx_n_s__float32, __pyx_k__float32, sizeof(__pyx_k__float32), 0, 0, 1, 1},
+  {&__pyx_n_s__float64, __pyx_k__float64, sizeof(__pyx_k__float64), 0, 0, 1, 1},
+  {&__pyx_n_s__fx, __pyx_k__fx, sizeof(__pyx_k__fx), 0, 0, 1, 1},
+  {&__pyx_n_s__fy, __pyx_k__fy, sizeof(__pyx_k__fy), 0, 0, 1, 1},
+  {&__pyx_n_s__fz, __pyx_k__fz, sizeof(__pyx_k__fz), 0, 0, 1, 1},
+  {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1},
+  {&__pyx_n_s__im, __pyx_k__im, sizeof(__pyx_k__im), 0, 0, 1, 1},
+  {&__pyx_n_s__im_, __pyx_k__im_, sizeof(__pyx_k__im_), 0, 0, 1, 1},
+  {&__pyx_n_s__index, __pyx_k__index, sizeof(__pyx_k__index), 0, 0, 1, 1},
+  {&__pyx_n_s__int8, __pyx_k__int8, sizeof(__pyx_k__int8), 0, 0, 1, 1},
+  {&__pyx_n_s__isovalue, __pyx_k__isovalue, sizeof(__pyx_k__isovalue), 0, 0, 1, 1},
+  {&__pyx_n_s__isovalue_, __pyx_k__isovalue_, sizeof(__pyx_k__isovalue_), 0, 0, 1, 1},
+  {&__pyx_n_s__j, __pyx_k__j, sizeof(__pyx_k__j), 0, 0, 1, 1},
+  {&__pyx_n_s__k, __pyx_k__k, sizeof(__pyx_k__k), 0, 0, 1, 1},
+  {&__pyx_n_s__marching_squares, __pyx_k__marching_squares, sizeof(__pyx_k__marching_squares), 0, 0, 1, 1},
+  {&__pyx_n_s__marchingsquares_, __pyx_k__marchingsquares_, sizeof(__pyx_k__marchingsquares_), 0, 0, 1, 1},
+  {&__pyx_n_s__np, __pyx_k__np, sizeof(__pyx_k__np), 0, 0, 1, 1},
   {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1},
   {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1},
+  {&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1},
   {&__pyx_n_s__size, __pyx_k__size, sizeof(__pyx_k__size), 0, 0, 1, 1},
+  {&__pyx_n_s__tmpf, __pyx_k__tmpf, sizeof(__pyx_k__tmpf), 0, 0, 1, 1},
+  {&__pyx_n_s__tmpf1, __pyx_k__tmpf1, sizeof(__pyx_k__tmpf1), 0, 0, 1, 1},
+  {&__pyx_n_s__tmpf2, __pyx_k__tmpf2, sizeof(__pyx_k__tmpf2), 0, 0, 1, 1},
+  {&__pyx_n_s__x, __pyx_k__x, sizeof(__pyx_k__x), 0, 0, 1, 1},
+  {&__pyx_n_s__y, __pyx_k__y, sizeof(__pyx_k__y), 0, 0, 1, 1},
+  {&__pyx_n_s__z, __pyx_k__z, sizeof(__pyx_k__z), 0, 0, 1, 1},
+  {&__pyx_n_s__zeros, __pyx_k__zeros, sizeof(__pyx_k__zeros), 0, 0, 1, 1},
   {0, 0, 0, 0, 0, 0, 0}
 };
 static int __Pyx_InitCachedBuiltins(void) {
+  __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   return 0;
   __pyx_L1_error:;
@@ -3088,6 +4252,15 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
 
+  /* "marchingsquares_.pyx":113
+ * 
+ *     # Done
+ *     return edges[:edgeCount,:]             # <<<<<<<<<<<<<<
+ */
+  __pyx_k_slice_1 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_slice_1);
+  __Pyx_GIVEREF(__pyx_k_slice_1);
+
   /* "numpy.pxd":215
  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
  *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
@@ -3095,12 +4268,12 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
  */
-  __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_2);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_kp_u_1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2));
+  __pyx_k_tuple_3 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_3);
+  __Pyx_INCREF(((PyObject *)__pyx_kp_u_2));
+  PyTuple_SET_ITEM(__pyx_k_tuple_3, 0, ((PyObject *)__pyx_kp_u_2));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_2));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_3));
 
   /* "numpy.pxd":219
  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
@@ -3109,12 +4282,12 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *             info.buf = PyArray_DATA(self)
  */
-  __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_4);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_3));
-  PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_kp_u_3));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4));
+  __pyx_k_tuple_5 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_5);
+  __Pyx_INCREF(((PyObject *)__pyx_kp_u_4));
+  PyTuple_SET_ITEM(__pyx_k_tuple_5, 0, ((PyObject *)__pyx_kp_u_4));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_4));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5));
 
   /* "numpy.pxd":257
  *                 if ((descr.byteorder == c'>' and little_endian) or
@@ -3123,12 +4296,12 @@ static int __Pyx_InitCachedConstants(void) {
  *                 if   t == NPY_BYTE:        f = "b"
  *                 elif t == NPY_UBYTE:       f = "B"
  */
-  __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_6);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_5));
-  PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_kp_u_5));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6));
+  __pyx_k_tuple_7 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_7);
+  __Pyx_INCREF(((PyObject *)__pyx_kp_u_6));
+  PyTuple_SET_ITEM(__pyx_k_tuple_7, 0, ((PyObject *)__pyx_kp_u_6));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_6));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_7));
 
   /* "numpy.pxd":799
  * 
@@ -3137,12 +4310,12 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *         if ((child.byteorder == c'>' and little_endian) or
  */
-  __pyx_k_tuple_9 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_9);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_8));
-  PyTuple_SET_ITEM(__pyx_k_tuple_9, 0, ((PyObject *)__pyx_kp_u_8));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_8));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9));
+  __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_10);
+  __Pyx_INCREF(((PyObject *)__pyx_kp_u_9));
+  PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_kp_u_9));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_9));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10));
 
   /* "numpy.pxd":803
  *         if ((child.byteorder == c'>' and little_endian) or
@@ -3151,12 +4324,12 @@ static int __Pyx_InitCachedConstants(void) {
  *             # One could encode it in the format string and have Cython
  *             # complain instead, BUT: < and > in format strings also imply
  */
-  __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_10);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_5));
-  PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_kp_u_5));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10));
+  __pyx_k_tuple_11 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_11);
+  __Pyx_INCREF(((PyObject *)__pyx_kp_u_6));
+  PyTuple_SET_ITEM(__pyx_k_tuple_11, 0, ((PyObject *)__pyx_kp_u_6));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_6));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11));
 
   /* "numpy.pxd":823
  *             t = child.type_num
@@ -3165,30 +4338,123 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *             # Until ticket #99 is fixed, use integers to avoid warnings
  */
-  __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_12);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_11));
-  PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_u_11));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_11));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12));
-
-  /* "fastcrc.pyx":41
- * from crc32 cimport crc32 as C_crc32
- * 
- * def crc32(numpy.ndarray data not None):             # <<<<<<<<<<<<<<
- *     """
- *     Calculate the CRC32 checksum of a numpy array
- */
-  __pyx_k_tuple_18 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_18);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__data));
-  PyTuple_SET_ITEM(__pyx_k_tuple_18, 0, ((PyObject *)__pyx_n_s__data));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__data));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__size));
-  PyTuple_SET_ITEM(__pyx_k_tuple_18, 1, ((PyObject *)__pyx_n_s__size));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__size));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18));
-  __pyx_k_codeobj_19 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_18, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_20, __pyx_n_s__crc32, 41, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_13 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_13);
+  __Pyx_INCREF(((PyObject *)__pyx_kp_u_12));
+  PyTuple_SET_ITEM(__pyx_k_tuple_13, 0, ((PyObject *)__pyx_kp_u_12));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_12));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_13));
+
+  /* "marchingsquares_.pyx":34
+ * @cython.boundscheck(False)
+ * @cython.wraparound(False)
+ * def marching_squares(im, isovalue,             # <<<<<<<<<<<<<<
+ *                         cellToEdge, edgeToRelativePosX, edgeToRelativePosY):
+ * 
+ */
+  __pyx_k_tuple_14 = PyTuple_New(33); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_14);
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__im));
+  PyTuple_SET_ITEM(__pyx_k_tuple_14, 0, ((PyObject *)__pyx_n_s__im));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__im));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__isovalue));
+  PyTuple_SET_ITEM(__pyx_k_tuple_14, 1, ((PyObject *)__pyx_n_s__isovalue));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__isovalue));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__cellToEdge));
+  PyTuple_SET_ITEM(__pyx_k_tuple_14, 2, ((PyObject *)__pyx_n_s__cellToEdge));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cellToEdge));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__edgeToRelativePosX));
+  PyTuple_SET_ITEM(__pyx_k_tuple_14, 3, ((PyObject *)__pyx_n_s__edgeToRelativePosX));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__edgeToRelativePosX));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__edgeToRelativePosY));
+  PyTuple_SET_ITEM(__pyx_k_tuple_14, 4, ((PyObject *)__pyx_n_s__edgeToRelativePosY));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__edgeToRelativePosY));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__edges));
+  PyTuple_SET_ITEM(__pyx_k_tuple_14, 5, ((PyObject *)__pyx_n_s__edges));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__edges));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__edgeToRelativePosX_));
+  PyTuple_SET_ITEM(__pyx_k_tuple_14, 6, ((PyObject *)__pyx_n_s__edgeToRelativePosX_));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__edgeToRelativePosX_));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__edgeToRelativePosY_));
+  PyTuple_SET_ITEM(__pyx_k_tuple_14, 7, ((PyObject *)__pyx_n_s__edgeToRelativePosY_));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__edgeToRelativePosY_));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__cellToEdge_));
+  PyTuple_SET_ITEM(__pyx_k_tuple_14, 8, ((PyObject *)__pyx_n_s__cellToEdge_));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cellToEdge_));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__im_));
+  PyTuple_SET_ITEM(__pyx_k_tuple_14, 9, ((PyObject *)__pyx_n_s__im_));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__im_));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__edges_));
+  PyTuple_SET_ITEM(__pyx_k_tuple_14, 10, ((PyObject *)__pyx_n_s__edges_));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__edges_));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__x));
+  PyTuple_SET_ITEM(__pyx_k_tuple_14, 11, ((PyObject *)__pyx_n_s__x));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__y));
+  PyTuple_SET_ITEM(__pyx_k_tuple_14, 12, ((PyObject *)__pyx_n_s__y));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__y));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__z));
+  PyTuple_SET_ITEM(__pyx_k_tuple_14, 13, ((PyObject *)__pyx_n_s__z));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__z));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__dx1));
+  PyTuple_SET_ITEM(__pyx_k_tuple_14, 14, ((PyObject *)__pyx_n_s__dx1));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dx1));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__dy1));
+  PyTuple_SET_ITEM(__pyx_k_tuple_14, 15, ((PyObject *)__pyx_n_s__dy1));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dy1));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__dz1));
+  PyTuple_SET_ITEM(__pyx_k_tuple_14, 16, ((PyObject *)__pyx_n_s__dz1));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dz1));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__dx2));
+  PyTuple_SET_ITEM(__pyx_k_tuple_14, 17, ((PyObject *)__pyx_n_s__dx2));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dx2));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__dy2));
+  PyTuple_SET_ITEM(__pyx_k_tuple_14, 18, ((PyObject *)__pyx_n_s__dy2));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dy2));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__dz2));
+  PyTuple_SET_ITEM(__pyx_k_tuple_14, 19, ((PyObject *)__pyx_n_s__dz2));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dz2));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__fx));
+  PyTuple_SET_ITEM(__pyx_k_tuple_14, 20, ((PyObject *)__pyx_n_s__fx));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fx));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__fy));
+  PyTuple_SET_ITEM(__pyx_k_tuple_14, 21, ((PyObject *)__pyx_n_s__fy));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fy));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__fz));
+  PyTuple_SET_ITEM(__pyx_k_tuple_14, 22, ((PyObject *)__pyx_n_s__fz));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fz));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__ff));
+  PyTuple_SET_ITEM(__pyx_k_tuple_14, 23, ((PyObject *)__pyx_n_s__ff));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ff));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
+  PyTuple_SET_ITEM(__pyx_k_tuple_14, 24, ((PyObject *)__pyx_n_s__i));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
+  PyTuple_SET_ITEM(__pyx_k_tuple_14, 25, ((PyObject *)__pyx_n_s__j));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__k));
+  PyTuple_SET_ITEM(__pyx_k_tuple_14, 26, ((PyObject *)__pyx_n_s__k));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__index));
+  PyTuple_SET_ITEM(__pyx_k_tuple_14, 27, ((PyObject *)__pyx_n_s__index));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__index));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__tmpf));
+  PyTuple_SET_ITEM(__pyx_k_tuple_14, 28, ((PyObject *)__pyx_n_s__tmpf));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tmpf));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__tmpf1));
+  PyTuple_SET_ITEM(__pyx_k_tuple_14, 29, ((PyObject *)__pyx_n_s__tmpf1));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tmpf1));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__tmpf2));
+  PyTuple_SET_ITEM(__pyx_k_tuple_14, 30, ((PyObject *)__pyx_n_s__tmpf2));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tmpf2));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__isovalue_));
+  PyTuple_SET_ITEM(__pyx_k_tuple_14, 31, ((PyObject *)__pyx_n_s__isovalue_));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__isovalue_));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__edgeCount));
+  PyTuple_SET_ITEM(__pyx_k_tuple_14, 32, ((PyObject *)__pyx_n_s__edgeCount));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__edgeCount));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14));
+  __pyx_k_codeobj_15 = (PyObject*)__Pyx_PyCode_New(5, 0, 33, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_16, __pyx_n_s__marching_squares, 34, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_RefNannyFinishContext();
   return 0;
   __pyx_L1_error:;
@@ -3198,6 +4464,9 @@ static int __Pyx_InitCachedConstants(void) {
 
 static int __Pyx_InitGlobals(void) {
   if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
   __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
   return 0;
   __pyx_L1_error:;
@@ -3205,14 +4474,15 @@ static int __Pyx_InitGlobals(void) {
 }
 
 #if PY_MAJOR_VERSION < 3
-PyMODINIT_FUNC initfastcrc(void); /*proto*/
-PyMODINIT_FUNC initfastcrc(void)
+PyMODINIT_FUNC initmarchingsquares_(void); /*proto*/
+PyMODINIT_FUNC initmarchingsquares_(void)
 #else
-PyMODINIT_FUNC PyInit_fastcrc(void); /*proto*/
-PyMODINIT_FUNC PyInit_fastcrc(void)
+PyMODINIT_FUNC PyInit_marchingsquares_(void); /*proto*/
+PyMODINIT_FUNC PyInit_marchingsquares_(void)
 #endif
 {
   PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
   __Pyx_RefNannyDeclarations
   #if CYTHON_REFNANNY
   __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
@@ -3223,7 +4493,7 @@ PyMODINIT_FUNC PyInit_fastcrc(void)
           Py_FatalError("failed to import 'refnanny' module");
   }
   #endif
-  __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_fastcrc(void)", 0);
+  __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_marchingsquares_(void)", 0);
   if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -3245,7 +4515,7 @@ PyMODINIT_FUNC PyInit_fastcrc(void)
   #endif
   /*--- Module creation code ---*/
   #if PY_MAJOR_VERSION < 3
-  __pyx_m = Py_InitModule4(__Pyx_NAMESTR("fastcrc"), __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
+  __pyx_m = Py_InitModule4(__Pyx_NAMESTR("marchingsquares_"), __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
   #else
   __pyx_m = PyModule_Create(&__pyx_moduledef);
   #endif
@@ -3257,7 +4527,7 @@ PyMODINIT_FUNC PyInit_fastcrc(void)
   if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
   /*--- Initialize various global constants etc. ---*/
   if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__pyx_module_is_main_fastcrc) {
+  if (__pyx_module_is_main_marchingsquares_) {
     if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
   }
   /*--- Builtin init code ---*/
@@ -3285,79 +4555,103 @@ PyMODINIT_FUNC PyInit_fastcrc(void)
   /*--- Function import code ---*/
   /*--- Execution code ---*/
 
-  /* "fastcrc.pyx":27
- * #
+  /* "marchingsquares_.pyx":5
  * 
- * __author__ = "Jerome Kieffer"             # <<<<<<<<<<<<<<
- * __date__ = "19-11-2012"
- * __contact__ = "Jerome.kieffer at esrf.fr"
+ * # Cython specific imports
+ * import numpy as np             # <<<<<<<<<<<<<<
+ * cimport numpy as np
+ * import cython
  */
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____author__, ((PyObject *)__pyx_kp_s_13)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "fastcrc.pyx":28
+  /* "marchingsquares_.pyx":9
+ * import cython
  * 
- * __author__ = "Jerome Kieffer"
- * __date__ = "19-11-2012"             # <<<<<<<<<<<<<<
- * __contact__ = "Jerome.kieffer at esrf.fr"
- * __license__ = "GPL v3+"
- */
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____date__, ((PyObject *)__pyx_kp_s_14)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
-  /* "fastcrc.pyx":29
- * __author__ = "Jerome Kieffer"
- * __date__ = "19-11-2012"
- * __contact__ = "Jerome.kieffer at esrf.fr"             # <<<<<<<<<<<<<<
- * __license__ = "GPL v3+"
- * __doc__ = """
+ * cdef double pi = 3.1415926535897931             # <<<<<<<<<<<<<<
+ * cdef extern from "math.h":
+ *     double sin(double val)
  */
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____contact__, ((PyObject *)__pyx_kp_s_15)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_v_16marchingsquares__pi = 3.1415926535897931;
 
-  /* "fastcrc.pyx":30
- * __date__ = "19-11-2012"
- * __contact__ = "Jerome.kieffer at esrf.fr"
- * __license__ = "GPL v3+"             # <<<<<<<<<<<<<<
- * __doc__ = """
- * Simple Cython module for doing CRC32 for checksums, possibly with SSE4 acceleration
+  /* "marchingsquares_.pyx":18
+ * ctypedef np.int32_t INT32_T
+ * ctypedef np.int8_t INT8_T
+ * FLOAT32 = np.float32             # <<<<<<<<<<<<<<
+ * FLOAT64 = np.float64
+ * INT32 = np.float32
  */
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____license__, ((PyObject *)__pyx_kp_s_16)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__FLOAT32, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+  /* "marchingsquares_.pyx":19
+ * ctypedef np.int8_t INT8_T
+ * FLOAT32 = np.float32
+ * FLOAT64 = np.float64             # <<<<<<<<<<<<<<
+ * INT32 = np.float32
+ * INT8 = np.int8
+ */
+  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__float64); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__FLOAT64, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "fastcrc.pyx":31
- * __contact__ = "Jerome.kieffer at esrf.fr"
- * __license__ = "GPL v3+"
- * __doc__ = """             # <<<<<<<<<<<<<<
- * Simple Cython module for doing CRC32 for checksums, possibly with SSE4 acceleration
- * """
+  /* "marchingsquares_.pyx":20
+ * FLOAT32 = np.float32
+ * FLOAT64 = np.float64
+ * INT32 = np.float32             # <<<<<<<<<<<<<<
+ * INT8 = np.int8
+ * 
  */
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____doc__, ((PyObject *)__pyx_kp_s_17)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__INT32, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-  /* "fastcrc.pyx":37
- * import cython
- * cimport numpy
- * import numpy             # <<<<<<<<<<<<<<
+  /* "marchingsquares_.pyx":21
+ * FLOAT64 = np.float64
+ * INT32 = np.float32
+ * INT8 = np.int8             # <<<<<<<<<<<<<<
  * 
- * from crc32 cimport crc32 as C_crc32
+ * # Floor operator (deal with negative numbers)
  */
-  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__int8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__numpy, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__INT8, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "fastcrc.pyx":41
- * from crc32 cimport crc32 as C_crc32
+  /* "marchingsquares_.pyx":34
+ * @cython.boundscheck(False)
+ * @cython.wraparound(False)
+ * def marching_squares(im, isovalue,             # <<<<<<<<<<<<<<
+ *                         cellToEdge, edgeToRelativePosX, edgeToRelativePosY):
  * 
- * def crc32(numpy.ndarray data not None):             # <<<<<<<<<<<<<<
- *     """
- *     Calculate the CRC32 checksum of a numpy array
  */
-  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7fastcrc_1crc32, NULL, __pyx_n_s__fastcrc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_16marchingsquares__1marching_squares, NULL, __pyx_n_s__marchingsquares_); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__crc32, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__marching_squares, __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;
 
-  /* "fastcrc.pyx":1
- * #!/usr/bin/env python             # <<<<<<<<<<<<<<
- * # -*- coding: utf-8 -*-
- * #
+  /* "marchingsquares_.pyx":1
+ * # -*- coding: utf-8 -*-             # <<<<<<<<<<<<<<
+ * # Copyright (C) 2012, Almar Klein
+ * 
  */
   __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
@@ -3374,11 +4668,12 @@ PyMODINIT_FUNC PyInit_fastcrc(void)
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_XDECREF(__pyx_t_2);
   if (__pyx_m) {
-    __Pyx_AddTraceback("init fastcrc", __pyx_clineno, __pyx_lineno, __pyx_filename);
+    __Pyx_AddTraceback("init marchingsquares_", __pyx_clineno, __pyx_lineno, __pyx_filename);
     Py_DECREF(__pyx_m); __pyx_m = 0;
   } else if (!PyErr_Occurred()) {
-    PyErr_SetString(PyExc_ImportError, "init fastcrc");
+    PyErr_SetString(PyExc_ImportError, "init marchingsquares_");
   }
   __pyx_L0:;
   __Pyx_RefNannyFinishContext();
@@ -3406,26 +4701,6 @@ end:
 }
 #endif /* CYTHON_REFNANNY */
 
-static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
-    const char *name, int exact)
-{
-    if (!type) {
-        PyErr_Format(PyExc_SystemError, "Missing type object");
-        return 0;
-    }
-    if (none_allowed && obj == Py_None) return 1;
-    else if (exact) {
-        if (Py_TYPE(obj) == type) return 1;
-    }
-    else {
-        if (PyObject_TypeCheck(obj, type)) return 1;
-    }
-    PyErr_Format(PyExc_TypeError,
-        "Argument '%s' has incorrect type (expected %s, got %s)",
-        name, type->tp_name, Py_TYPE(obj)->tp_name);
-    return 0;
-}
-
 static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
     PyObject *result;
     result = PyObject_GetAttr(dict, name);
@@ -3441,6 +4716,700 @@ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
     return result;
 }
 
+static void __Pyx_RaiseArgtupleInvalid(
+    const char* func_name,
+    int exact,
+    Py_ssize_t num_min,
+    Py_ssize_t num_max,
+    Py_ssize_t num_found)
+{
+    Py_ssize_t num_expected;
+    const char *more_or_less;
+    if (num_found < num_min) {
+        num_expected = num_min;
+        more_or_less = "at least";
+    } else {
+        num_expected = num_max;
+        more_or_less = "at most";
+    }
+    if (exact) {
+        more_or_less = "exactly";
+    }
+    PyErr_Format(PyExc_TypeError,
+                 "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)",
+                 func_name, more_or_less, num_expected,
+                 (num_expected == 1) ? "" : "s", num_found);
+}
+
+static void __Pyx_RaiseDoubleKeywordsError(
+    const char* func_name,
+    PyObject* kw_name)
+{
+    PyErr_Format(PyExc_TypeError,
+        #if PY_MAJOR_VERSION >= 3
+        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
+        #else
+        "%s() got multiple values for keyword argument '%s'", func_name,
+        PyString_AsString(kw_name));
+        #endif
+}
+
+static int __Pyx_ParseOptionalKeywords(
+    PyObject *kwds,
+    PyObject **argnames[],
+    PyObject *kwds2,
+    PyObject *values[],
+    Py_ssize_t num_pos_args,
+    const char* function_name)
+{
+    PyObject *key = 0, *value = 0;
+    Py_ssize_t pos = 0;
+    PyObject*** name;
+    PyObject*** first_kw_arg = argnames + num_pos_args;
+    while (PyDict_Next(kwds, &pos, &key, &value)) {
+        name = first_kw_arg;
+        while (*name && (**name != key)) name++;
+        if (*name) {
+            values[name-argnames] = value;
+            continue;
+        }
+        name = first_kw_arg;
+        #if PY_MAJOR_VERSION < 3
+        if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
+            while (*name) {
+                if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
+                        && _PyString_Eq(**name, key)) {
+                    values[name-argnames] = value;
+                    break;
+                }
+                name++;
+            }
+            if (*name) continue;
+            else {
+                PyObject*** argname = argnames;
+                while (argname != first_kw_arg) {
+                    if ((**argname == key) || (
+                            (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
+                             && _PyString_Eq(**argname, key))) {
+                        goto arg_passed_twice;
+                    }
+                    argname++;
+                }
+            }
+        } else
+        #endif
+        if (likely(PyUnicode_Check(key))) {
+            while (*name) {
+                int cmp = (**name == key) ? 0 :
+                #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
+                    (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
+                #endif
+                    PyUnicode_Compare(**name, key);
+                if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
+                if (cmp == 0) {
+                    values[name-argnames] = value;
+                    break;
+                }
+                name++;
+            }
+            if (*name) continue;
+            else {
+                PyObject*** argname = argnames;
+                while (argname != first_kw_arg) {
+                    int cmp = (**argname == key) ? 0 :
+                    #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
+                        (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
+                    #endif
+                        PyUnicode_Compare(**argname, key);
+                    if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
+                    if (cmp == 0) goto arg_passed_twice;
+                    argname++;
+                }
+            }
+        } else
+            goto invalid_keyword_type;
+        if (kwds2) {
+            if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
+        } else {
+            goto invalid_keyword;
+        }
+    }
+    return 0;
+arg_passed_twice:
+    __Pyx_RaiseDoubleKeywordsError(function_name, key);
+    goto bad;
+invalid_keyword_type:
+    PyErr_Format(PyExc_TypeError,
+        "%s() keywords must be strings", function_name);
+    goto bad;
+invalid_keyword:
+    PyErr_Format(PyExc_TypeError,
+    #if PY_MAJOR_VERSION < 3
+        "%s() got an unexpected keyword argument '%s'",
+        function_name, PyString_AsString(key));
+    #else
+        "%s() got an unexpected keyword argument '%U'",
+        function_name, key);
+    #endif
+bad:
+    return -1;
+}
+
+static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
+    if (unlikely(!type)) {
+        PyErr_Format(PyExc_SystemError, "Missing type object");
+        return 0;
+    }
+    if (likely(PyObject_TypeCheck(obj, type)))
+        return 1;
+    PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
+                 Py_TYPE(obj)->tp_name, type->tp_name);
+    return 0;
+}
+
+static CYTHON_INLINE int __Pyx_IsLittleEndian(void) {
+  unsigned int n = 1;
+  return *(unsigned char*)(&n) != 0;
+}
+static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
+                              __Pyx_BufFmt_StackElem* stack,
+                              __Pyx_TypeInfo* type) {
+  stack[0].field = &ctx->root;
+  stack[0].parent_offset = 0;
+  ctx->root.type = type;
+  ctx->root.name = "buffer dtype";
+  ctx->root.offset = 0;
+  ctx->head = stack;
+  ctx->head->field = &ctx->root;
+  ctx->fmt_offset = 0;
+  ctx->head->parent_offset = 0;
+  ctx->new_packmode = '@';
+  ctx->enc_packmode = '@';
+  ctx->new_count = 1;
+  ctx->enc_count = 0;
+  ctx->enc_type = 0;
+  ctx->is_complex = 0;
+  ctx->is_valid_array = 0;
+  ctx->struct_alignment = 0;
+  while (type->typegroup == 'S') {
+    ++ctx->head;
+    ctx->head->field = type->fields;
+    ctx->head->parent_offset = 0;
+    type = type->fields->type;
+  }
+}
+static int __Pyx_BufFmt_ParseNumber(const char** ts) {
+    int count;
+    const char* t = *ts;
+    if (*t < '0' || *t > '9') {
+      return -1;
+    } else {
+        count = *t++ - '0';
+        while (*t >= '0' && *t < '9') {
+            count *= 10;
+            count += *t++ - '0';
+        }
+    }
+    *ts = t;
+    return count;
+}
+static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
+    int number = __Pyx_BufFmt_ParseNumber(ts);
+    if (number == -1) /* First char was not a digit */
+        PyErr_Format(PyExc_ValueError,\
+                     "Does not understand character buffer dtype format string ('%c')", **ts);
+    return number;
+}
+static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
+  PyErr_Format(PyExc_ValueError,
+               "Unexpected format string character: '%c'", ch);
+}
+static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
+  switch (ch) {
+    case 'c': return "'char'";
+    case 'b': return "'signed char'";
+    case 'B': return "'unsigned char'";
+    case 'h': return "'short'";
+    case 'H': return "'unsigned short'";
+    case 'i': return "'int'";
+    case 'I': return "'unsigned int'";
+    case 'l': return "'long'";
+    case 'L': return "'unsigned long'";
+    case 'q': return "'long long'";
+    case 'Q': return "'unsigned long long'";
+    case 'f': return (is_complex ? "'complex float'" : "'float'");
+    case 'd': return (is_complex ? "'complex double'" : "'double'");
+    case 'g': return (is_complex ? "'complex long double'" : "'long double'");
+    case 'T': return "a struct";
+    case 'O': return "Python object";
+    case 'P': return "a pointer";
+    case 's': case 'p': return "a string";
+    case 0: return "end";
+    default: return "unparseable format string";
+  }
+}
+static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
+  switch (ch) {
+    case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
+    case 'h': case 'H': return 2;
+    case 'i': case 'I': case 'l': case 'L': return 4;
+    case 'q': case 'Q': return 8;
+    case 'f': return (is_complex ? 8 : 4);
+    case 'd': return (is_complex ? 16 : 8);
+    case 'g': {
+      PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
+      return 0;
+    }
+    case 'O': case 'P': return sizeof(void*);
+    default:
+      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
+      return 0;
+    }
+}
+static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
+  switch (ch) {
+    case 'c': case 'b': case 'B': case 's': case 'p': return 1;
+    case 'h': case 'H': return sizeof(short);
+    case 'i': case 'I': return sizeof(int);
+    case 'l': case 'L': return sizeof(long);
+    #ifdef HAVE_LONG_LONG
+    case 'q': case 'Q': return sizeof(PY_LONG_LONG);
+    #endif
+    case 'f': return sizeof(float) * (is_complex ? 2 : 1);
+    case 'd': return sizeof(double) * (is_complex ? 2 : 1);
+    case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
+    case 'O': case 'P': return sizeof(void*);
+    default: {
+      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
+      return 0;
+    }
+  }
+}
+typedef struct { char c; short x; } __Pyx_st_short;
+typedef struct { char c; int x; } __Pyx_st_int;
+typedef struct { char c; long x; } __Pyx_st_long;
+typedef struct { char c; float x; } __Pyx_st_float;
+typedef struct { char c; double x; } __Pyx_st_double;
+typedef struct { char c; long double x; } __Pyx_st_longdouble;
+typedef struct { char c; void *x; } __Pyx_st_void_p;
+#ifdef HAVE_LONG_LONG
+typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
+#endif
+static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
+  switch (ch) {
+    case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
+    case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
+    case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
+    case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
+#ifdef HAVE_LONG_LONG
+    case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
+#endif
+    case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
+    case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
+    case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
+    case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
+    default:
+      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
+      return 0;
+    }
+}
+/* These are for computing the padding at the end of the struct to align
+   on the first member of the struct. This will probably the same as above,
+   but we don't have any guarantees.
+ */
+typedef struct { short x; char c; } __Pyx_pad_short;
+typedef struct { int x; char c; } __Pyx_pad_int;
+typedef struct { long x; char c; } __Pyx_pad_long;
+typedef struct { float x; char c; } __Pyx_pad_float;
+typedef struct { double x; char c; } __Pyx_pad_double;
+typedef struct { long double x; char c; } __Pyx_pad_longdouble;
+typedef struct { void *x; char c; } __Pyx_pad_void_p;
+#ifdef HAVE_LONG_LONG
+typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
+#endif
+static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
+  switch (ch) {
+    case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
+    case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
+    case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
+    case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
+#ifdef HAVE_LONG_LONG
+    case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
+#endif
+    case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
+    case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
+    case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
+    case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
+    default:
+      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
+      return 0;
+    }
+}
+static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
+  switch (ch) {
+    case 'c':
+        return 'H';
+    case 'b': case 'h': case 'i':
+    case 'l': case 'q': case 's': case 'p':
+        return 'I';
+    case 'B': case 'H': case 'I': case 'L': case 'Q':
+        return 'U';
+    case 'f': case 'd': case 'g':
+        return (is_complex ? 'C' : 'R');
+    case 'O':
+        return 'O';
+    case 'P':
+        return 'P';
+    default: {
+      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
+      return 0;
+    }
+  }
+}
+static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
+  if (ctx->head == NULL || ctx->head->field == &ctx->root) {
+    const char* expected;
+    const char* quote;
+    if (ctx->head == NULL) {
+      expected = "end";
+      quote = "";
+    } else {
+      expected = ctx->head->field->type->name;
+      quote = "'";
+    }
+    PyErr_Format(PyExc_ValueError,
+                 "Buffer dtype mismatch, expected %s%s%s but got %s",
+                 quote, expected, quote,
+                 __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
+  } else {
+    __Pyx_StructField* field = ctx->head->field;
+    __Pyx_StructField* parent = (ctx->head - 1)->field;
+    PyErr_Format(PyExc_ValueError,
+                 "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
+                 field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
+                 parent->type->name, field->name);
+  }
+}
+static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
+  char group;
+  size_t size, offset, arraysize = 1;
+  if (ctx->enc_type == 0) return 0;
+  if (ctx->head->field->type->arraysize[0]) {
+    int i, ndim = 0;
+    if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
+        ctx->is_valid_array = ctx->head->field->type->ndim == 1;
+        ndim = 1;
+        if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
+            PyErr_Format(PyExc_ValueError,
+                         "Expected a dimension of size %zu, got %zu",
+                         ctx->head->field->type->arraysize[0], ctx->enc_count);
+            return -1;
+        }
+    }
+    if (!ctx->is_valid_array) {
+      PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
+                   ctx->head->field->type->ndim, ndim);
+      return -1;
+    }
+    for (i = 0; i < ctx->head->field->type->ndim; i++) {
+      arraysize *= ctx->head->field->type->arraysize[i];
+    }
+    ctx->is_valid_array = 0;
+    ctx->enc_count = 1;
+  }
+  group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
+  do {
+    __Pyx_StructField* field = ctx->head->field;
+    __Pyx_TypeInfo* type = field->type;
+    if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
+      size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
+    } else {
+      size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
+    }
+    if (ctx->enc_packmode == '@') {
+      size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
+      size_t align_mod_offset;
+      if (align_at == 0) return -1;
+      align_mod_offset = ctx->fmt_offset % align_at;
+      if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
+      if (ctx->struct_alignment == 0)
+          ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
+                                                                 ctx->is_complex);
+    }
+    if (type->size != size || type->typegroup != group) {
+      if (type->typegroup == 'C' && type->fields != NULL) {
+        size_t parent_offset = ctx->head->parent_offset + field->offset;
+        ++ctx->head;
+        ctx->head->field = type->fields;
+        ctx->head->parent_offset = parent_offset;
+        continue;
+      }
+      if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
+      } else {
+          __Pyx_BufFmt_RaiseExpected(ctx);
+          return -1;
+      }
+    }
+    offset = ctx->head->parent_offset + field->offset;
+    if (ctx->fmt_offset != offset) {
+      PyErr_Format(PyExc_ValueError,
+                   "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
+                   (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
+      return -1;
+    }
+    ctx->fmt_offset += size;
+    if (arraysize)
+      ctx->fmt_offset += (arraysize - 1) * size;
+    --ctx->enc_count; /* Consume from buffer string */
+    while (1) {
+      if (field == &ctx->root) {
+        ctx->head = NULL;
+        if (ctx->enc_count != 0) {
+          __Pyx_BufFmt_RaiseExpected(ctx);
+          return -1;
+        }
+        break; /* breaks both loops as ctx->enc_count == 0 */
+      }
+      ctx->head->field = ++field;
+      if (field->type == NULL) {
+        --ctx->head;
+        field = ctx->head->field;
+        continue;
+      } else if (field->type->typegroup == 'S') {
+        size_t parent_offset = ctx->head->parent_offset + field->offset;
+        if (field->type->fields->type == NULL) continue; /* empty struct */
+        field = field->type->fields;
+        ++ctx->head;
+        ctx->head->field = field;
+        ctx->head->parent_offset = parent_offset;
+        break;
+      } else {
+        break;
+      }
+    }
+  } while (ctx->enc_count);
+  ctx->enc_type = 0;
+  ctx->is_complex = 0;
+  return 0;
+}
+static CYTHON_INLINE PyObject *
+__pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
+{
+    const char *ts = *tsp;
+    int i = 0, number;
+    int ndim = ctx->head->field->type->ndim;
+;
+    ++ts;
+    if (ctx->new_count != 1) {
+        PyErr_SetString(PyExc_ValueError,
+                        "Cannot handle repeated arrays in format string");
+        return NULL;
+    }
+    if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
+    while (*ts && *ts != ')') {
+        if (isspace(*ts))
+            continue;
+        number = __Pyx_BufFmt_ExpectNumber(&ts);
+        if (number == -1) return NULL;
+        if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i])
+            return PyErr_Format(PyExc_ValueError,
+                        "Expected a dimension of size %zu, got %d",
+                        ctx->head->field->type->arraysize[i], number);
+        if (*ts != ',' && *ts != ')')
+            return PyErr_Format(PyExc_ValueError,
+                                "Expected a comma in format string, got '%c'", *ts);
+        if (*ts == ',') ts++;
+        i++;
+    }
+    if (i != ndim)
+        return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
+                            ctx->head->field->type->ndim, i);
+    if (!*ts) {
+        PyErr_SetString(PyExc_ValueError,
+                        "Unexpected end of format string, expected ')'");
+        return NULL;
+    }
+    ctx->is_valid_array = 1;
+    ctx->new_count = 1;
+    *tsp = ++ts;
+    return Py_None;
+}
+static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
+  int got_Z = 0;
+  while (1) {
+    switch(*ts) {
+      case 0:
+        if (ctx->enc_type != 0 && ctx->head == NULL) {
+          __Pyx_BufFmt_RaiseExpected(ctx);
+          return NULL;
+        }
+        if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
+        if (ctx->head != NULL) {
+          __Pyx_BufFmt_RaiseExpected(ctx);
+          return NULL;
+        }
+                return ts;
+      case ' ':
+      case 10:
+      case 13:
+        ++ts;
+        break;
+      case '<':
+        if (!__Pyx_IsLittleEndian()) {
+          PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
+          return NULL;
+        }
+        ctx->new_packmode = '=';
+        ++ts;
+        break;
+      case '>':
+      case '!':
+        if (__Pyx_IsLittleEndian()) {
+          PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
+          return NULL;
+        }
+        ctx->new_packmode = '=';
+        ++ts;
+        break;
+      case '=':
+      case '@':
+      case '^':
+        ctx->new_packmode = *ts++;
+        break;
+      case 'T': /* substruct */
+        {
+          const char* ts_after_sub;
+          size_t i, struct_count = ctx->new_count;
+          size_t struct_alignment = ctx->struct_alignment;
+          ctx->new_count = 1;
+          ++ts;
+          if (*ts != '{') {
+            PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
+            return NULL;
+          }
+          if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
+          ctx->enc_type = 0; /* Erase processed last struct element */
+          ctx->enc_count = 0;
+          ctx->struct_alignment = 0;
+          ++ts;
+          ts_after_sub = ts;
+          for (i = 0; i != struct_count; ++i) {
+            ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
+            if (!ts_after_sub) return NULL;
+          }
+          ts = ts_after_sub;
+          if (struct_alignment) ctx->struct_alignment = struct_alignment;
+        }
+        break;
+      case '}': /* end of substruct; either repeat or move on */
+        {
+          size_t alignment = ctx->struct_alignment;
+          ++ts;
+          if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
+          ctx->enc_type = 0; /* Erase processed last struct element */
+          if (alignment && ctx->fmt_offset % alignment) {
+            ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
+          }
+        }
+        return ts;
+      case 'x':
+        if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
+        ctx->fmt_offset += ctx->new_count;
+        ctx->new_count = 1;
+        ctx->enc_count = 0;
+        ctx->enc_type = 0;
+        ctx->enc_packmode = ctx->new_packmode;
+        ++ts;
+        break;
+      case 'Z':
+        got_Z = 1;
+        ++ts;
+        if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
+          __Pyx_BufFmt_RaiseUnexpectedChar('Z');
+          return NULL;
+        }        /* fall through */
+      case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
+      case 'l': case 'L': case 'q': case 'Q':
+      case 'f': case 'd': case 'g':
+      case 'O': case 's': case 'p':
+        if (ctx->enc_type == *ts && got_Z == ctx->is_complex &&
+            ctx->enc_packmode == ctx->new_packmode) {
+          ctx->enc_count += ctx->new_count;
+        } else {
+          if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
+          ctx->enc_count = ctx->new_count;
+          ctx->enc_packmode = ctx->new_packmode;
+          ctx->enc_type = *ts;
+          ctx->is_complex = got_Z;
+        }
+        ++ts;
+        ctx->new_count = 1;
+        got_Z = 0;
+        break;
+      case ':':
+        ++ts;
+        while(*ts != ':') ++ts;
+        ++ts;
+        break;
+      case '(':
+        if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
+        break;
+      default:
+        {
+          int number = __Pyx_BufFmt_ExpectNumber(&ts);
+          if (number == -1) return NULL;
+          ctx->new_count = (size_t)number;
+        }
+    }
+  }
+}
+static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) {
+  buf->buf = NULL;
+  buf->obj = NULL;
+  buf->strides = __Pyx_zeros;
+  buf->shape = __Pyx_zeros;
+  buf->suboffsets = __Pyx_minusones;
+}
+static CYTHON_INLINE int __Pyx_GetBufferAndValidate(
+        Py_buffer* buf, PyObject* obj,  __Pyx_TypeInfo* dtype, int flags,
+        int nd, int cast, __Pyx_BufFmt_StackElem* stack)
+{
+  if (obj == Py_None || obj == NULL) {
+    __Pyx_ZeroBuffer(buf);
+    return 0;
+  }
+  buf->buf = NULL;
+  if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail;
+  if (buf->ndim != nd) {
+    PyErr_Format(PyExc_ValueError,
+                 "Buffer has wrong number of dimensions (expected %d, got %d)",
+                 nd, buf->ndim);
+    goto fail;
+  }
+  if (!cast) {
+    __Pyx_BufFmt_Context ctx;
+    __Pyx_BufFmt_Init(&ctx, stack, dtype);
+    if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
+  }
+  if ((unsigned)buf->itemsize != dtype->size) {
+    PyErr_Format(PyExc_ValueError,
+      "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)",
+      buf->itemsize, (buf->itemsize > 1) ? "s" : "",
+      dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : "");
+    goto fail;
+  }
+  if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
+  return 0;
+fail:;
+  __Pyx_ZeroBuffer(buf);
+  return -1;
+}
+static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
+  if (info->buf == NULL) return;
+  if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
+  __Pyx_ReleaseBuffer(info);
+}
+
 static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
 #if CYTHON_COMPILING_IN_CPYTHON
     PyObject *tmp_type, *tmp_value, *tmp_tb;
@@ -3682,19 +5651,80 @@ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
     return 0;
 }
 
-static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
-    if (unlikely(!type)) {
-        PyErr_Format(PyExc_SystemError, "Missing type object");
-        return 0;
+#if PY_MAJOR_VERSION < 3
+static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
+    CYTHON_UNUSED PyObject *getbuffer_cobj;
+  #if PY_VERSION_HEX >= 0x02060000
+    if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
+  #endif
+        if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags);
+  #if PY_VERSION_HEX < 0x02060000
+    if (obj->ob_type->tp_dict &&
+        (getbuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict,
+                                             "__pyx_getbuffer"))) {
+        getbufferproc func;
+      #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0)
+        func = (getbufferproc) PyCapsule_GetPointer(getbuffer_cobj, "getbuffer(obj, view, flags)");
+      #else
+        func = (getbufferproc) PyCObject_AsVoidPtr(getbuffer_cobj);
+      #endif
+        Py_DECREF(getbuffer_cobj);
+        if (!func)
+            goto fail;
+        return func(obj, view, flags);
+    } else {
+        PyErr_Clear();
     }
-    if (likely(PyObject_TypeCheck(obj, type)))
-        return 1;
-    PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
-                 Py_TYPE(obj)->tp_name, type->tp_name);
-    return 0;
+  #endif
+    PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
+#if PY_VERSION_HEX < 0x02060000
+fail:
+#endif
+    return -1;
 }
+static void __Pyx_ReleaseBuffer(Py_buffer *view) {
+    PyObject *obj = view->obj;
+    CYTHON_UNUSED PyObject *releasebuffer_cobj;
+    if (!obj) return;
+  #if PY_VERSION_HEX >= 0x02060000
+    if (PyObject_CheckBuffer(obj)) {
+        PyBuffer_Release(view);
+        return;
+    }
+  #endif
+        if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) { __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view); return; }
+  #if PY_VERSION_HEX < 0x02060000
+    if (obj->ob_type->tp_dict &&
+        (releasebuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict,
+                                                      "__pyx_releasebuffer"))) {
+        releasebufferproc func;
+      #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0)
+        func = (releasebufferproc) PyCapsule_GetPointer(releasebuffer_cobj, "releasebuffer(obj, view)");
+      #else
+        func = (releasebufferproc) PyCObject_AsVoidPtr(releasebuffer_cobj);
+      #endif
+        Py_DECREF(releasebuffer_cobj);
+        if (!func)
+            goto fail;
+        func(obj, view);
+        return;
+    } else {
+        PyErr_Clear();
+    }
+  #endif
+    goto nofail;
+#if PY_VERSION_HEX < 0x02060000
+fail:
+#endif
+    PyErr_WriteUnraisable(obj);
+nofail:
+    Py_DECREF(obj);
+    view->obj = NULL;
+}
+#endif /*  PY_MAJOR_VERSION < 3 */
+
 
-static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) {
+    static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) {
     PyObject *py_import = 0;
     PyObject *empty_list = 0;
     PyObject *module = 0;
@@ -3763,71 +5793,19 @@ bad:
     return module;
 }
 
-static CYTHON_INLINE npy_uint32 __Pyx_PyInt_from_py_npy_uint32(PyObject* x) {
-    const npy_uint32 neg_one = (npy_uint32)-1, const_zero = (npy_uint32)0;
-    const int is_unsigned = const_zero < neg_one;
-    if (sizeof(npy_uint32) == sizeof(char)) {
-        if (is_unsigned)
-            return (npy_uint32)__Pyx_PyInt_AsUnsignedChar(x);
-        else
-            return (npy_uint32)__Pyx_PyInt_AsSignedChar(x);
-    } else if (sizeof(npy_uint32) == sizeof(short)) {
-        if (is_unsigned)
-            return (npy_uint32)__Pyx_PyInt_AsUnsignedShort(x);
-        else
-            return (npy_uint32)__Pyx_PyInt_AsSignedShort(x);
-    } else if (sizeof(npy_uint32) == sizeof(int)) {
-        if (is_unsigned)
-            return (npy_uint32)__Pyx_PyInt_AsUnsignedInt(x);
-        else
-            return (npy_uint32)__Pyx_PyInt_AsSignedInt(x);
-    } else if (sizeof(npy_uint32) == sizeof(long)) {
-        if (is_unsigned)
-            return (npy_uint32)__Pyx_PyInt_AsUnsignedLong(x);
-        else
-            return (npy_uint32)__Pyx_PyInt_AsSignedLong(x);
-    } else if (sizeof(npy_uint32) == sizeof(PY_LONG_LONG)) {
-        if (is_unsigned)
-            return (npy_uint32)__Pyx_PyInt_AsUnsignedLongLong(x);
-        else
-            return (npy_uint32)__Pyx_PyInt_AsSignedLongLong(x);
-    }  else {
-        npy_uint32 val;
-        PyObject *v = __Pyx_PyNumber_Int(x);
-        #if PY_VERSION_HEX < 0x03000000
-        if (likely(v) && !PyLong_Check(v)) {
-            PyObject *tmp = v;
-            v = PyNumber_Long(tmp);
-            Py_DECREF(tmp);
-        }
-        #endif
-        if (likely(v)) {
-            int one = 1; int is_little = (int)*(unsigned char *)&one;
-            unsigned char *bytes = (unsigned char *)&val;
-            int ret = _PyLong_AsByteArray((PyLongObject *)v,
-                                          bytes, sizeof(val),
-                                          is_little, !is_unsigned);
-            Py_DECREF(v);
-            if (likely(!ret))
-                return val;
-        }
-        return (npy_uint32)-1;
-    }
-}
-
-static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint32_t(uint32_t val) {
-    const uint32_t neg_one = (uint32_t)-1, const_zero = (uint32_t)0;
+static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_int8(npy_int8 val) {
+    const npy_int8 neg_one = (npy_int8)-1, const_zero = (npy_int8)0;
     const int is_unsigned = const_zero < neg_one;
-    if ((sizeof(uint32_t) == sizeof(char))  ||
-        (sizeof(uint32_t) == sizeof(short))) {
+    if ((sizeof(npy_int8) == sizeof(char))  ||
+        (sizeof(npy_int8) == sizeof(short))) {
         return PyInt_FromLong((long)val);
-    } else if ((sizeof(uint32_t) == sizeof(int)) ||
-               (sizeof(uint32_t) == sizeof(long))) {
+    } else if ((sizeof(npy_int8) == sizeof(int)) ||
+               (sizeof(npy_int8) == sizeof(long))) {
         if (is_unsigned)
             return PyLong_FromUnsignedLong((unsigned long)val);
         else
             return PyInt_FromLong((long)val);
-    } else if (sizeof(uint32_t) == sizeof(PY_LONG_LONG)) {
+    } else if (sizeof(npy_int8) == sizeof(PY_LONG_LONG)) {
         if (is_unsigned)
             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val);
         else
@@ -3835,7 +5813,7 @@ static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint32_t(uint32_t val) {
     } else {
         int one = 1; int little = (int)*(unsigned char *)&one;
         unsigned char *bytes = (unsigned char *)&val;
-        return _PyLong_FromByteArray(bytes, sizeof(uint32_t),
+        return _PyLong_FromByteArray(bytes, sizeof(npy_int8),
                                      little, !is_unsigned);
     }
 }
diff --git a/src/marchingsquares_.pyx b/src/marchingsquares_.pyx
new file mode 100644
index 0000000..3d29caa
--- /dev/null
+++ b/src/marchingsquares_.pyx
@@ -0,0 +1,113 @@
+# -*- coding: utf-8 -*-
+# Copyright (C) 2012, Almar Klein
+
+# Cython specific imports
+import numpy as np
+cimport numpy as np
+import cython
+
+cdef double pi = 3.1415926535897931
+cdef extern from "math.h":
+    double sin(double val)
+
+# Type defs, we support float32 and float64
+ctypedef np.float32_t FLOAT32_T
+ctypedef np.float64_t FLOAT64_T
+ctypedef np.int32_t INT32_T
+ctypedef np.int8_t INT8_T
+FLOAT32 = np.float32
+FLOAT64 = np.float64
+INT32 = np.float32
+INT8 = np.int8
+
+# Floor operator (deal with negative numbers)
+cdef inline int floor(double a): return <int>a if a>=0.0 else (<int>a)-1
+
+cdef inline double fabs(double a): return a if a>=0 else -a
+
+
+# todo: include functionality to group line pieces that belong to the same contour.
+
+
+ at cython.boundscheck(False)
+ at cython.wraparound(False)
+def marching_squares(im, isovalue,
+                        cellToEdge, edgeToRelativePosX, edgeToRelativePosY):
+
+    # Create array for result
+    edges = np.zeros((im.size,2), 'float32')
+
+    # Define maps as array types
+    cdef np.ndarray[INT8_T, ndim=2] edgeToRelativePosX_ = edgeToRelativePosX
+    cdef np.ndarray[INT8_T, ndim=2] edgeToRelativePosY_ = edgeToRelativePosY
+    cdef np.ndarray[INT8_T, ndim=2] cellToEdge_ = cellToEdge
+
+    # Define other arrays
+    cdef np.ndarray[FLOAT32_T, ndim=2] im_ = im
+    cdef np.ndarray[FLOAT32_T, ndim=2] edges_ = edges
+
+    cdef int x, y, z
+    cdef int dx1, dy1, dz1, dx2, dy2, dz2
+    cdef double fx, fy, fz, ff
+    cdef int i, j, k
+    cdef int index
+    cdef double tmpf, tmpf1, tmpf2
+    cdef double isovalue_ = isovalue
+
+    cdef double edgeCount = 0
+
+    for y in range(im.shape[0]-1):
+        for x in range(im.shape[1]-1):
+
+            # Calculate index.
+            index = 0
+            if im_[y, x] > isovalue_:
+                index += 1
+            if im_[y, x+1] > isovalue_:
+                index += 2
+            if im_[y+1, x+1] > isovalue_:
+                index += 4
+            if im_[y+1, x] > isovalue_:
+                index += 8
+
+            # Resolve ambiguity
+            if index == 5 or index == 10:
+                # Calculate value of cell center (i.e. average of corners)
+                tmpf = 0.0
+                for dy1 in range(2):
+                    for dx1 in range(2):
+                        tmpf += im_[y+dy1,x+dx1]
+                tmpf /= 4
+                # If below isovalue, swap
+                if tmpf <= isovalue_:
+                    if index == 5:
+                        index = 10
+                    else:
+                        index = 5
+
+            # For each edge ...
+            for i in range(cellToEdge_[index,0]):
+                # For both ends of the edge ...
+                for j in range(2):
+                    # Get edge index
+                    k = cellToEdge_[index, 1+i*2+j]
+                    # Use these to look up the relative positions of the pixels to interpolate
+                    dx1, dy1 = edgeToRelativePosX_[k,0], edgeToRelativePosY_[k,0]
+                    dx2, dy2 = edgeToRelativePosX_[k,1], edgeToRelativePosY_[k,1]
+                    # Define "strength" of each corner of the cube that we need
+                    tmpf1 = 1.0 / (0.0001 + fabs( im_[y+dy1,x+dx1] - isovalue_))
+                    tmpf2 = 1.0 / (0.0001 + fabs( im_[y+dy2,x+dx2] - isovalue_))
+                    # Apply a kind of center-of-mass method
+                    fx, fy, ff = 0.0, 0.0, 0.0
+                    fx += <double>dx1 * tmpf1;  fy += <double>dy1 * tmpf1;  ff += tmpf1
+                    fx += <double>dx2 * tmpf2;  fy += <double>dy2 * tmpf2;  ff += tmpf2
+                    #
+                    fx /= ff
+                    fy /= ff
+                    # Append point
+                    edges_[edgeCount,0] = <double>x + fx
+                    edges_[edgeCount,1] = <double>y + fy
+                    edgeCount += 1
+
+    # Done
+    return edges[:edgeCount,:]
diff --git a/src/reconstruct.c b/src/reconstruct.c
index 597e351..f3c963f 100644
--- a/src/reconstruct.c
+++ b/src/reconstruct.c
@@ -1,6 +1,18 @@
-/* Generated by Cython 0.17.1 on Thu Nov 15 14:44:22 2012 */
+/* Generated by Cython 0.19.2 on Mon Jan  6 15:01:35 2014 */
 
 #define PY_SSIZE_T_CLEAN
+#ifndef CYTHON_USE_PYLONG_INTERNALS
+#ifdef PYLONG_BITS_IN_DIGIT
+#define CYTHON_USE_PYLONG_INTERNALS 0
+#else
+#include "pyconfig.h"
+#ifdef PYLONG_BITS_IN_DIGIT
+#define CYTHON_USE_PYLONG_INTERNALS 1
+#else
+#define CYTHON_USE_PYLONG_INTERNALS 0
+#endif
+#endif
+#endif
 #include "Python.h"
 #ifndef Py_PYTHON_H
     #error Python headers needed to compile C extensions, please install development version of Python.
@@ -53,12 +65,15 @@
                                 (PyErr_Format(PyExc_TypeError, \
                                               "expected index value, got %.200s", Py_TYPE(o)->tp_name), \
                                  (PyObject*)0))
-  #define PyIndex_Check(o)     (PyNumber_Check(o) && !PyFloat_Check(o) && !PyComplex_Check(o))
+  #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \
+                                  !PyComplex_Check(o))
+  #define PyIndex_Check __Pyx_PyIndex_Check
   #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
   #define __PYX_BUILD_PY_SSIZE_T "i"
 #else
   #define __PYX_BUILD_PY_SSIZE_T "n"
   #define CYTHON_FORMAT_SSIZE_T "z"
+  #define __Pyx_PyIndex_Check PyIndex_Check
 #endif
 #if PY_VERSION_HEX < 0x02060000
   #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
@@ -113,6 +128,9 @@
 #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
   #define Py_TPFLAGS_HAVE_NEWBUFFER 0
 #endif
+#if PY_VERSION_HEX < 0x02060000
+  #define Py_TPFLAGS_HAVE_VERSION_TAG 0
+#endif
 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
   #define CYTHON_PEP393_ENABLED 1
   #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ? \
@@ -152,6 +170,14 @@
   #define PyBytes_Concat               PyString_Concat
   #define PyBytes_ConcatAndDel         PyString_ConcatAndDel
 #endif
+#if PY_MAJOR_VERSION >= 3
+  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
+  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
+#else
+  #define __Pyx_PyBaseString_Check(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj) || \
+                                         PyString_Check(obj) || PyUnicode_Check(obj))
+  #define __Pyx_PyBaseString_CheckExact(obj) (Py_TYPE(obj) == &PyBaseString_Type)
+#endif
 #if PY_VERSION_HEX < 0x02060000
   #define PySet_Check(obj)             PyObject_TypeCheck(obj, &PySet_Type)
   #define PyFrozenSet_Check(obj)       PyObject_TypeCheck(obj, &PyFrozenSet_Type)
@@ -224,6 +250,40 @@
   #define __Pyx_NAMESTR(n) (n)
   #define __Pyx_DOCSTR(n)  (n)
 #endif
+#ifndef CYTHON_INLINE
+  #if defined(__GNUC__)
+    #define CYTHON_INLINE __inline__
+  #elif defined(_MSC_VER)
+    #define CYTHON_INLINE __inline
+  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+    #define CYTHON_INLINE inline
+  #else
+    #define CYTHON_INLINE
+  #endif
+#endif
+#ifndef CYTHON_RESTRICT
+  #if defined(__GNUC__)
+    #define CYTHON_RESTRICT __restrict__
+  #elif defined(_MSC_VER) && _MSC_VER >= 1400
+    #define CYTHON_RESTRICT __restrict
+  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+    #define CYTHON_RESTRICT restrict
+  #else
+    #define CYTHON_RESTRICT
+  #endif
+#endif
+#ifdef NAN
+#define __PYX_NAN() ((float) NAN)
+#else
+static CYTHON_INLINE float __PYX_NAN() {
+  /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and
+   a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is
+   a quiet NaN. */
+  float value;
+  memset(&value, 0xFF, sizeof(value));
+  return value;
+}
+#endif
 
 
 #if PY_MAJOR_VERSION >= 3
@@ -248,13 +308,13 @@
 #include <math.h>
 #define __PYX_HAVE__reconstruct
 #define __PYX_HAVE_API__reconstruct
+#include "string.h"
 #include "stdio.h"
 #include "stdlib.h"
 #include "numpy/arrayobject.h"
 #include "numpy/ufuncobject.h"
 #include "math.h"
 #include "pythread.h"
-#include "string.h"
 #include "pystate.h"
 #ifdef _OPENMP
 #include <omp.h>
@@ -264,21 +324,6 @@
 #define CYTHON_WITHOUT_ASSERTIONS
 #endif
 
-
-/* inline attribute */
-#ifndef CYTHON_INLINE
-  #if defined(__GNUC__)
-    #define CYTHON_INLINE __inline__
-  #elif defined(_MSC_VER)
-    #define CYTHON_INLINE __inline
-  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
-    #define CYTHON_INLINE inline
-  #else
-    #define CYTHON_INLINE
-  #endif
-#endif
-
-/* unused attribute */
 #ifndef CYTHON_UNUSED
 # if defined(__GNUC__)
 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
@@ -292,30 +337,130 @@
 #   define CYTHON_UNUSED
 # endif
 #endif
-
-typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/
-
-
-/* Type Conversion Predeclarations */
-
-#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
-#define __Pyx_PyBytes_AsUString(s)   ((unsigned char*) PyBytes_AsString(s))
-
+typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding;
+                const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/
+
+#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
+#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
+#define __PYX_DEFAULT_STRING_ENCODING ""
+#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
+#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
+static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
+static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
+#define __Pyx_PyBytes_FromString        PyBytes_FromString
+#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char*);
+#if PY_MAJOR_VERSION < 3
+    #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
+    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
+#else
+    #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
+    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
+#endif
+#define __Pyx_PyObject_AsUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
+#define __Pyx_PyObject_FromUString(s)  __Pyx_PyObject_FromString((char*)s)
+#define __Pyx_PyBytes_FromUString(s)   __Pyx_PyBytes_FromString((char*)s)
+#define __Pyx_PyStr_FromUString(s)     __Pyx_PyStr_FromString((char*)s)
+#define __Pyx_PyUnicode_FromUString(s) __Pyx_PyUnicode_FromString((char*)s)
+#if PY_MAJOR_VERSION < 3
+static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
+{
+    const Py_UNICODE *u_end = u;
+    while (*u_end++) ;
+    return u_end - u - 1;
+}
+#else
+#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
+#endif
+#define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
+#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
+#define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
 #define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
 #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
 static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
-
 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
 static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
-
 #if CYTHON_COMPILING_IN_CPYTHON
 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
 #else
 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
 #endif
 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
+#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+static int __Pyx_sys_getdefaultencoding_not_ascii;
+static int __Pyx_init_sys_getdefaultencoding_params() {
+    PyObject* sys = NULL;
+    PyObject* default_encoding = NULL;
+    PyObject* ascii_chars_u = NULL;
+    PyObject* ascii_chars_b = NULL;
+    sys = PyImport_ImportModule("sys");
+    if (sys == NULL) goto bad;
+    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
+    if (default_encoding == NULL) goto bad;
+    if (strcmp(PyBytes_AsString(default_encoding), "ascii") == 0) {
+        __Pyx_sys_getdefaultencoding_not_ascii = 0;
+    } else {
+        const char* default_encoding_c = PyBytes_AS_STRING(default_encoding);
+        char ascii_chars[128];
+        int c;
+        for (c = 0; c < 128; c++) {
+            ascii_chars[c] = c;
+        }
+        __Pyx_sys_getdefaultencoding_not_ascii = 1;
+        ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
+        if (ascii_chars_u == NULL) goto bad;
+        ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
+        if (ascii_chars_b == NULL || strncmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
+            PyErr_Format(
+                PyExc_ValueError,
+                "This module compiled with c_string_encoding=ascii, but default encoding '%s' is not a superset of ascii.",
+                default_encoding_c);
+            goto bad;
+        }
+    }
+    Py_XDECREF(sys);
+    Py_XDECREF(default_encoding);
+    Py_XDECREF(ascii_chars_u);
+    Py_XDECREF(ascii_chars_b);
+    return 0;
+bad:
+    Py_XDECREF(sys);
+    Py_XDECREF(default_encoding);
+    Py_XDECREF(ascii_chars_u);
+    Py_XDECREF(ascii_chars_b);
+    return -1;
+}
+#endif
+#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
+#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
+#else
+#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
+#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
+static char* __PYX_DEFAULT_STRING_ENCODING;
+static int __Pyx_init_sys_getdefaultencoding_params() {
+    PyObject* sys = NULL;
+    PyObject* default_encoding = NULL;
+    char* default_encoding_c;
+    sys = PyImport_ImportModule("sys");
+    if (sys == NULL) goto bad;
+    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
+    if (default_encoding == NULL) goto bad;
+    default_encoding_c = PyBytes_AS_STRING(default_encoding);
+    __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
+    strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
+    Py_DECREF(sys);
+    Py_DECREF(default_encoding);
+    return 0;
+bad:
+    Py_XDECREF(sys);
+    Py_XDECREF(default_encoding);
+    return -1;
+}
+#endif
+#endif
+
 
 #ifdef __GNUC__
   /* Test for GCC > 2.95 */
@@ -330,8 +475,9 @@ static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
   #define likely(x)   (x)
   #define unlikely(x) (x)
 #endif /* __GNUC__ */
-    
+
 static PyObject *__pyx_m;
+static PyObject *__pyx_d;
 static PyObject *__pyx_b;
 static PyObject *__pyx_empty_tuple;
 static PyObject *__pyx_empty_bytes;
@@ -417,10 +563,9 @@ typedef struct {
     #define CYTHON_ATOMICS 1
 #endif
 #define __pyx_atomic_int_type int
-/* todo: Portland pgcc, maybe OS X's OSAtomicIncrement32,
-   libatomic + autotools-like distutils support? Such a pain... */
-#if CYTHON_ATOMICS && __GNUC__ >= 4 && (__GNUC_MINOR__ > 1 || \
-                    (__GNUC_MINOR__ == 1 && __GNUC_PATHLEVEL >= 2))
+#if CYTHON_ATOMICS && __GNUC__ >= 4 && (__GNUC_MINOR__ > 1 ||           \
+                    (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL >= 2)) && \
+                    !defined(__i386__)
     #define __pyx_atomic_incr_aligned(value, lock) __sync_fetch_and_add(value, 1)
     #define __pyx_atomic_decr_aligned(value, lock) __sync_fetch_and_sub(value, 1)
     #ifdef __PYX_DEBUG_ATOMICS
@@ -873,10 +1018,33 @@ static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice;
   #define __Pyx_XGOTREF(r)
   #define __Pyx_XGIVEREF(r)
 #endif /* CYTHON_REFNANNY */
+#define __Pyx_XDECREF_SET(r, v) do {                            \
+        PyObject *tmp = (PyObject *) r;                         \
+        r = v; __Pyx_XDECREF(tmp);                              \
+    } while (0)
+#define __Pyx_DECREF_SET(r, v) do {                             \
+        PyObject *tmp = (PyObject *) r;                         \
+        r = v; __Pyx_DECREF(tmp);                               \
+    } while (0)
 #define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
 #define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
 
-static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
+    PyTypeObject* tp = Py_TYPE(obj);
+    if (likely(tp->tp_getattro))
+        return tp->tp_getattro(obj, attr_name);
+#if PY_MAJOR_VERSION < 3
+    if (likely(tp->tp_getattr))
+        return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
+#endif
+    return PyObject_GetAttr(obj, attr_name);
+}
+#else
+#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
+#endif
+
+static PyObject *__Pyx_GetBuiltinName(PyObject *name); /*proto*/
 
 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/
 
@@ -890,6 +1058,8 @@ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
 static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
     const char *name, int exact); /*proto*/
 
+static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); /*proto*/
+
 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/
 
 static CYTHON_INLINE int  __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj,
@@ -898,13 +1068,7 @@ static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);
 
 static void __Pyx_RaiseBufferFallbackError(void); /*proto*/
 
-#include <string.h>
-void __pyx_init_nan(void);
-static float __PYX_NAN;
-
 #define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1)
-static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
-
 #define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d
 #define __Pyx_MEMVIEW_DIRECT   1
 #define __Pyx_MEMVIEW_PTR      2
@@ -914,24 +1078,15 @@ static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
 #define __Pyx_MEMVIEW_FOLLOW   32
 #define __Pyx_IS_C_CONTIG 1
 #define __Pyx_IS_F_CONTIG 2
-static int __Pyx_ValidateAndInit_memviewslice(
-                int *axes_specs,
-                int c_or_f_flag,
-                int buf_flags,
-                int ndim,
-                __Pyx_TypeInfo *dtype,
-                __Pyx_BufFmt_StackElem stack[],
-                __Pyx_memviewslice *memviewslice,
-                PyObject *original_obj);
 static int __Pyx_init_memviewslice(
                 struct __pyx_memoryview_obj *memview,
                 int ndim,
                 __Pyx_memviewslice *memviewslice,
                 int memview_is_new_reference);
-static CYTHON_INLINE int __pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
-                                                            PyThread_type_lock lock);
-static CYTHON_INLINE int __pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
-                                                            PyThread_type_lock lock);
+static CYTHON_INLINE int __pyx_add_acquisition_count_locked(
+    __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
+static CYTHON_INLINE int __pyx_sub_acquisition_count_locked(
+    __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
 #define __pyx_get_slice_count_pointer(memview) (memview->acquisition_count_aligned_p)
 #define __pyx_get_slice_count(memview) (*__pyx_get_slice_count_pointer(memview))
 #define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__)
@@ -954,13 +1109,19 @@ static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/
 
 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/
 
+static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); /*proto*/
+
 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); /*proto*/
 
 static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t); /* proto */
 
+#ifndef __PYX_FORCE_INIT_THREADS
+  #define __PYX_FORCE_INIT_THREADS 0
+#endif
+
 #define UNARY_NEG_WOULD_OVERFLOW(x)            (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))
 
-static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
+static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/
 
 static PyObject *get_memview(PyObject *__pyx_v_self); /*proto*/
@@ -973,98 +1134,32 @@ static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
 
 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
 
-static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
-    PyObject *r;
-    if (!j) return NULL;
-    r = PyObject_GetItem(o, j);
-    Py_DECREF(j);
-    return r;
-}
-#define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
-                                                    __Pyx_GetItemInt_List_Fast(o, i) : \
-                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
-static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) {
-#if CYTHON_COMPILING_IN_CPYTHON
-    if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
-        PyObject *r = PyList_GET_ITEM(o, i);
-        Py_INCREF(r);
-        return r;
-    }
-    else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
-        PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
-        Py_INCREF(r);
-        return r;
-    }
-    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
-#else
-    return PySequence_GetItem(o, i);
-#endif
-}
-#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
-                                                    __Pyx_GetItemInt_Tuple_Fast(o, i) : \
-                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
-static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) {
-#if CYTHON_COMPILING_IN_CPYTHON
-    if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
-        PyObject *r = PyTuple_GET_ITEM(o, i);
-        Py_INCREF(r);
-        return r;
-    }
-    else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
-        PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
-        Py_INCREF(r);
-        return r;
-    }
-    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
-#else
-    return PySequence_GetItem(o, i);
-#endif
-}
-#define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
-                                                    __Pyx_GetItemInt_Fast(o, i) : \
-                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
-static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) {
-#if CYTHON_COMPILING_IN_CPYTHON
-    if (PyList_CheckExact(o)) {
-        Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
-        if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) {
-            PyObject *r = PyList_GET_ITEM(o, n);
-            Py_INCREF(r);
-            return r;
-        }
-    }
-    else if (PyTuple_CheckExact(o)) {
-        Py_ssize_t n = (likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
-        if (likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
-            PyObject *r = PyTuple_GET_ITEM(o, n);
-            Py_INCREF(r);
-            return r;
-        }
-    } else {  /* inlined PySequence_GetItem() */
-        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
-        if (likely(m && m->sq_item)) {
-            if (unlikely(i < 0) && likely(m->sq_length)) {
-                Py_ssize_t l = m->sq_length(o);
-                if (unlikely(l < 0)) return NULL;
-                i += l;
-            }
-            return m->sq_item(o, i);
-        }
-    }
-#else
-    if (PySequence_Check(o)) {
-        return PySequence_GetItem(o, i);
-    }
-#endif
-    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
-}
-
-static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
+#define __Pyx_GetItemInt(o, i, size, to_py_func, is_list, wraparound, boundscheck) \
+    (((size) <= sizeof(Py_ssize_t)) ? \
+    __Pyx_GetItemInt_Fast(o, i, is_list, wraparound, boundscheck) : \
+    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
+#define __Pyx_GetItemInt_List(o, i, size, to_py_func, is_list, wraparound, boundscheck) \
+    (((size) <= sizeof(Py_ssize_t)) ? \
+    __Pyx_GetItemInt_List_Fast(o, i, wraparound, boundscheck) : \
+    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
+                                                              int wraparound, int boundscheck);
+#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func, is_list, wraparound, boundscheck) \
+    (((size) <= sizeof(Py_ssize_t)) ? \
+    __Pyx_GetItemInt_Tuple_Fast(o, i, wraparound, boundscheck) : \
+    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
+                                                              int wraparound, int boundscheck);
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
+                                                     int is_list, int wraparound, int boundscheck);
+
+static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
 static PyObject *__pyx_memoryview_transpose(PyObject *__pyx_v_self); /*proto*/
 static PyObject *__pyx_memoryview__get__base(PyObject *__pyx_v_self); /*proto*/
 static PyObject *__pyx_memoryview_get_shape(PyObject *__pyx_v_self); /*proto*/
 #if CYTHON_COMPILING_IN_CPYTHON
-static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
+static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
     PyListObject* L = (PyListObject*) list;
     Py_ssize_t len = Py_SIZE(list);
     if (likely(L->allocated > len)) {
@@ -1076,7 +1171,7 @@ static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
     return PyList_Append(list, x);
 }
 #else
-#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
+#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
 #endif
 
 static PyObject *__pyx_memoryview_get_strides(PyObject *__pyx_v_self); /*proto*/
@@ -1085,15 +1180,32 @@ static PyObject *__pyx_memoryview_get_ndim(PyObject *__pyx_v_self); /*proto*/
 static PyObject *__pyx_memoryview_get_itemsize(PyObject *__pyx_v_self); /*proto*/
 static PyObject *__pyx_memoryview_get_nbytes(PyObject *__pyx_v_self); /*proto*/
 static PyObject *__pyx_memoryview_get_size(PyObject *__pyx_v_self); /*proto*/
-static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
-
-#ifndef __PYX_FORCE_INIT_THREADS
-  #define __PYX_FORCE_INIT_THREADS 0
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
+    PyListObject* L = (PyListObject*) list;
+    Py_ssize_t len = Py_SIZE(list);
+    if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
+        Py_INCREF(x);
+        PyList_SET_ITEM(list, len, x);
+        Py_SIZE(list) = len+1;
+        return 0;
+    }
+    return PyList_Append(list, x);
+}
+#else
+#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
 #endif
 
+static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
+
 static CYTHON_INLINE long __Pyx_div_long(long, long); /* proto */
 
 static PyObject *__pyx_memoryviewslice__get__base(PyObject *__pyx_v_self); /*proto*/
+static void __Pyx_WriteUnraisable(const char *name, int clineno,
+                                  int lineno, const char *filename); /*proto*/
+
+static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
+
 typedef struct {
   Py_ssize_t shape, strides, suboffsets;
 } __Pyx_Buf_DimInfo;
@@ -1119,7 +1231,7 @@ typedef struct {
 static Py_ssize_t __Pyx_zeros[] = {0, 0, 0, 0, 0, 0, 0, 0};
 static Py_ssize_t __Pyx_minusones[] = {-1, -1, -1, -1, -1, -1, -1, -1};
 
-static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/
+static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /*proto*/
 
 static CYTHON_INLINE size_t __Pyx_pow_size_t(size_t, size_t); /* proto */
 
@@ -1271,17 +1383,24 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);
 
 static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);
 
-static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_float(PyObject *);
+static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
+
+static int __Pyx_ValidateAndInit_memviewslice(
+                int *axes_specs,
+                int c_or_f_flag,
+                int buf_flags,
+                int ndim,
+                __Pyx_TypeInfo *dtype,
+                __Pyx_BufFmt_StackElem stack[],
+                __Pyx_memviewslice *memviewslice,
+                PyObject *original_obj);
 
-static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_int(PyObject *);
+static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_float(PyObject *);
 
-static void __Pyx_WriteUnraisable(const char *name, int clineno,
-                                  int lineno, const char *filename); /*proto*/
+static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_int8_t(PyObject *);
 
 static int __Pyx_check_binary_version(void);
 
-static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
-
 #if !defined(__Pyx_PyIdentifier_FromString)
 #if PY_MAJOR_VERSION < 3
   #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
@@ -1322,6 +1441,8 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
 
 /* Module declarations from 'cpython.ref' */
 
+/* Module declarations from 'libc.string' */
+
 /* Module declarations from 'libc.stdio' */
 
 /* Module declarations from 'cpython.object' */
@@ -1346,9 +1467,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, cha
 /* Module declarations from 'libc.math' */
 
 /* Module declarations from 'reconstruct' */
+static PyTypeObject *__pyx_memoryview_type = 0;
 static PyTypeObject *__pyx_array_type = 0;
 static PyTypeObject *__pyx_MemviewEnum_type = 0;
-static PyTypeObject *__pyx_memoryview_type = 0;
 static PyTypeObject *__pyx_memoryviewslice_type = 0;
 static PyObject *generic = 0;
 static PyObject *strided = 0;
@@ -1356,16 +1477,16 @@ static PyObject *indirect = 0;
 static PyObject *contiguous = 0;
 static PyObject *indirect_contiguous = 0;
 static float __pyx_f_11reconstruct_invert_distance(size_t, size_t, size_t, size_t); /*proto*/
-static float __pyx_f_11reconstruct_processPoint(__Pyx_memviewslice, __Pyx_memviewslice, size_t, size_t, size_t, size_t); /*proto*/
+static CYTHON_INLINE float __pyx_f_11reconstruct_processPoint(__Pyx_memviewslice, __Pyx_memviewslice, size_t, size_t, size_t, size_t); /*proto*/
 static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/
 static void *__pyx_align_pointer(void *, size_t); /*proto*/
 static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo *); /*proto*/
-static int __pyx_memoryview_check(PyObject *); /*proto*/
+static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/
 static PyObject *_unellipsify(PyObject *, int); /*proto*/
 static PyObject *assert_direct_dimensions(Py_ssize_t *, int); /*proto*/
 static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/
 static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int, int); /*proto*/
-static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, int); /*proto*/
+static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/
 static int __pyx_memslice_transpose(__Pyx_memviewslice *); /*proto*/
 static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice, int, PyObject *(*)(char *), int (*)(char *, PyObject *), int); /*proto*/
 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
@@ -1391,7 +1512,7 @@ static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size
 static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/
 static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t = { "float32_t", NULL, sizeof(__pyx_t_5numpy_float32_t), { 0 }, 0, 'R', 0, 0 };
 static __Pyx_TypeInfo __Pyx_TypeInfo_float = { "float", NULL, sizeof(float), { 0 }, 0, 'R', 0, 0 };
-static __Pyx_TypeInfo __Pyx_TypeInfo_int = { "bint", NULL, sizeof(int), { 0 }, 0, IS_UNSIGNED(int) ? 'U' : 'I', IS_UNSIGNED(int), 0 };
+static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t = { "int8_t", NULL, sizeof(__pyx_t_5numpy_int8_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_5numpy_int8_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_5numpy_int8_t), 0 };
 #define __Pyx_MODULE_NAME "reconstruct"
 int __pyx_module_is_main_reconstruct = 0;
 
@@ -1441,39 +1562,43 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_20copy(struct __pyx_me
 static PyObject *__pyx_memoryview_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
 static void __pyx_memoryviewslice_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
 static PyObject *__pyx_memoryviewslice__get__base_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
-static char __pyx_k_2[] = "ndarray is not C contiguous";
-static char __pyx_k_4[] = "ndarray is not Fortran contiguous";
-static char __pyx_k_6[] = "Non-native byte order not supported";
-static char __pyx_k_8[] = "unknown dtype code in numpy.pxd (%d)";
-static char __pyx_k_9[] = "Format string allocated too short, see comment in numpy.pxd";
-static char __pyx_k_12[] = "Format string allocated too short.";
-static char __pyx_k_14[] = "Empty shape tuple for cython.array";
-static char __pyx_k_16[] = "itemsize <= 0 for cython.array";
-static char __pyx_k_19[] = "unable to allocate shape or strides.";
-static char __pyx_k_21[] = "Invalid shape in axis %d: %d.";
-static char __pyx_k_22[] = "Invalid mode, expected 'c' or 'fortran', got %s";
-static char __pyx_k_24[] = "unable to allocate array data.";
-static char __pyx_k_26[] = "Can only create a buffer that is contiguous in memory.";
-static char __pyx_k_28[] = "Unable to convert item to object";
-static char __pyx_k_30[] = "Buffer view does not expose strides";
-static char __pyx_k_32[] = "<MemoryView of %r at 0x%x>";
-static char __pyx_k_33[] = "<MemoryView of %r object>";
-static char __pyx_k_36[] = "Cannot index with type '%s'";
-static char __pyx_k_38[] = "Indirect dimensions not supported";
-static char __pyx_k_40[] = "Index out of bounds (axis %d)";
-static char __pyx_k_41[] = "Step may not be zero (axis %d)";
-static char __pyx_k_42[] = "All dimensions preceding dimension %d must be indexed and not sliced";
-static char __pyx_k_43[] = "Out of bounds on buffer access (axis %d)";
-static char __pyx_k_44[] = "Cannot transpose memoryview with indirect dimensions";
-static char __pyx_k_45[] = "got differing extents in dimension %d (got %d and %d)";
-static char __pyx_k_46[] = "Dimension %d is not direct";
-static char __pyx_k_49[] = "/users/kieffer/workspace-ssd/pyFAI/src/reconstruct.pyx";
-static char __pyx_k_50[] = "getbuffer(obj, view, flags)";
-static char __pyx_k_51[] = "<strided and direct or indirect>";
-static char __pyx_k_53[] = "<strided and direct>";
-static char __pyx_k_55[] = "<strided and indirect>";
-static char __pyx_k_57[] = "<contiguous and direct>";
-static char __pyx_k_59[] = "<contiguous and indirect>";
+static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static char __pyx_k_1[] = "ndarray is not C contiguous";
+static char __pyx_k_3[] = "ndarray is not Fortran contiguous";
+static char __pyx_k_5[] = "Non-native byte order not supported";
+static char __pyx_k_7[] = "unknown dtype code in numpy.pxd (%d)";
+static char __pyx_k_8[] = "Format string allocated too short, see comment in numpy.pxd";
+static char __pyx_k_11[] = "Format string allocated too short.";
+static char __pyx_k_13[] = "Empty shape tuple for cython.array";
+static char __pyx_k_15[] = "itemsize <= 0 for cython.array";
+static char __pyx_k_18[] = "unable to allocate shape or strides.";
+static char __pyx_k_20[] = "Invalid shape in axis %d: %d.";
+static char __pyx_k_21[] = "Invalid mode, expected 'c' or 'fortran', got %s";
+static char __pyx_k_23[] = "unable to allocate array data.";
+static char __pyx_k_25[] = "Can only create a buffer that is contiguous in memory.";
+static char __pyx_k_27[] = "Unable to convert item to object";
+static char __pyx_k_29[] = "Buffer view does not expose strides";
+static char __pyx_k_31[] = "<MemoryView of %r at 0x%x>";
+static char __pyx_k_32[] = "<MemoryView of %r object>";
+static char __pyx_k_35[] = "Cannot index with type '%s'";
+static char __pyx_k_37[] = "Indirect dimensions not supported";
+static char __pyx_k_39[] = "Index out of bounds (axis %d)";
+static char __pyx_k_40[] = "Step may not be zero (axis %d)";
+static char __pyx_k_41[] = "All dimensions preceding dimension %d must be indexed and not sliced";
+static char __pyx_k_42[] = "Out of bounds on buffer access (axis %d)";
+static char __pyx_k_43[] = "Cannot transpose memoryview with indirect dimensions";
+static char __pyx_k_44[] = "got differing extents in dimension %d (got %d and %d)";
+static char __pyx_k_45[] = "Dimension %d is not direct";
+static char __pyx_k_48[] = "/users/kieffer/workspace-ssd/pyFAI/src/reconstruct.pyx";
+static char __pyx_k_49[] = "getbuffer(obj, view, flags)";
+static char __pyx_k_50[] = "<strided and direct or indirect>";
+static char __pyx_k_52[] = "<strided and direct>";
+static char __pyx_k_54[] = "<strided and indirect>";
+static char __pyx_k_56[] = "<contiguous and direct>";
+static char __pyx_k_58[] = "<contiguous and indirect>";
 static char __pyx_k__B[] = "B";
 static char __pyx_k__H[] = "H";
 static char __pyx_k__I[] = "I";
@@ -1517,7 +1642,6 @@ static char __pyx_k__dtype[] = "dtype";
 static char __pyx_k__dummy[] = "dummy";
 static char __pyx_k__error[] = "error";
 static char __pyx_k__flags[] = "flags";
-static char __pyx_k__int32[] = "int32";
 static char __pyx_k__numpy[] = "numpy";
 static char __pyx_k__range[] = "range";
 static char __pyx_k__shape[] = "shape";
@@ -1544,42 +1668,45 @@ static char __pyx_k____class__[] = "__class__";
 static char __pyx_k__enumerate[] = "enumerate";
 static char __pyx_k__IndexError[] = "IndexError";
 static char __pyx_k__ValueError[] = "ValueError";
+static char __pyx_k____import__[] = "__import__";
 static char __pyx_k__zeros_like[] = "zeros_like";
 static char __pyx_k__MemoryError[] = "MemoryError";
 static char __pyx_k__delta_dummy[] = "delta_dummy";
 static char __pyx_k__reconstruct[] = "reconstruct";
 static char __pyx_k__RuntimeError[] = "RuntimeError";
+static char __pyx_k____pyx_vtable__[] = "__pyx_vtable__";
 static char __pyx_k____pyx_getbuffer[] = "__pyx_getbuffer";
 static char __pyx_k__allocate_buffer[] = "allocate_buffer";
 static char __pyx_k__dtype_is_object[] = "dtype_is_object";
 static char __pyx_k__ascontiguousarray[] = "ascontiguousarray";
-static PyObject *__pyx_kp_u_12;
-static PyObject *__pyx_kp_s_14;
-static PyObject *__pyx_kp_s_16;
-static PyObject *__pyx_kp_s_19;
-static PyObject *__pyx_kp_u_2;
+static char __pyx_k____pyx_releasebuffer[] = "__pyx_releasebuffer";
+static PyObject *__pyx_kp_u_1;
+static PyObject *__pyx_kp_u_11;
+static PyObject *__pyx_kp_s_13;
+static PyObject *__pyx_kp_s_15;
+static PyObject *__pyx_kp_s_18;
+static PyObject *__pyx_kp_s_20;
 static PyObject *__pyx_kp_s_21;
-static PyObject *__pyx_kp_s_22;
-static PyObject *__pyx_kp_s_24;
-static PyObject *__pyx_kp_s_26;
-static PyObject *__pyx_kp_s_28;
-static PyObject *__pyx_kp_s_30;
+static PyObject *__pyx_kp_s_23;
+static PyObject *__pyx_kp_s_25;
+static PyObject *__pyx_kp_s_27;
+static PyObject *__pyx_kp_s_29;
+static PyObject *__pyx_kp_u_3;
+static PyObject *__pyx_kp_s_31;
 static PyObject *__pyx_kp_s_32;
-static PyObject *__pyx_kp_s_33;
-static PyObject *__pyx_kp_s_36;
-static PyObject *__pyx_kp_s_38;
-static PyObject *__pyx_kp_u_4;
-static PyObject *__pyx_kp_s_43;
-static PyObject *__pyx_kp_s_45;
-static PyObject *__pyx_kp_s_49;
-static PyObject *__pyx_kp_s_51;
-static PyObject *__pyx_kp_s_53;
-static PyObject *__pyx_kp_s_55;
-static PyObject *__pyx_kp_s_57;
-static PyObject *__pyx_kp_s_59;
-static PyObject *__pyx_kp_u_6;
+static PyObject *__pyx_kp_s_35;
+static PyObject *__pyx_kp_s_37;
+static PyObject *__pyx_kp_s_42;
+static PyObject *__pyx_kp_s_44;
+static PyObject *__pyx_kp_s_48;
+static PyObject *__pyx_kp_u_5;
+static PyObject *__pyx_kp_s_50;
+static PyObject *__pyx_kp_s_52;
+static PyObject *__pyx_kp_s_54;
+static PyObject *__pyx_kp_s_56;
+static PyObject *__pyx_kp_s_58;
+static PyObject *__pyx_kp_u_7;
 static PyObject *__pyx_kp_u_8;
-static PyObject *__pyx_kp_u_9;
 static PyObject *__pyx_n_s__ASCII;
 static PyObject *__pyx_n_s__Ellipsis;
 static PyObject *__pyx_n_s__IndexError;
@@ -1589,9 +1716,12 @@ static PyObject *__pyx_n_s__RuntimeError;
 static PyObject *__pyx_n_s__TypeError;
 static PyObject *__pyx_n_s__ValueError;
 static PyObject *__pyx_n_s____class__;
+static PyObject *__pyx_n_s____import__;
 static PyObject *__pyx_n_s____main__;
 static PyObject *__pyx_n_s____name__;
 static PyObject *__pyx_n_s____pyx_getbuffer;
+static PyObject *__pyx_n_s____pyx_releasebuffer;
+static PyObject *__pyx_n_s____pyx_vtable__;
 static PyObject *__pyx_n_s____test__;
 static PyObject *__pyx_n_s__allocate_buffer;
 static PyObject *__pyx_n_s__ascontiguousarray;
@@ -1621,7 +1751,6 @@ static PyObject *__pyx_n_b__fortran;
 static PyObject *__pyx_n_s__fortran;
 static PyObject *__pyx_n_s__i;
 static PyObject *__pyx_n_s__id;
-static PyObject *__pyx_n_s__int32;
 static PyObject *__pyx_n_s__int8;
 static PyObject *__pyx_n_s__itemsize;
 static PyObject *__pyx_n_s__l;
@@ -1652,33 +1781,32 @@ static PyObject *__pyx_int_0;
 static PyObject *__pyx_int_1;
 static PyObject *__pyx_int_neg_1;
 static PyObject *__pyx_int_15;
-static PyObject *__pyx_k_tuple_1;
-static PyObject *__pyx_k_tuple_3;
-static PyObject *__pyx_k_tuple_5;
-static PyObject *__pyx_k_tuple_7;
+static PyObject *__pyx_k_tuple_2;
+static PyObject *__pyx_k_tuple_4;
+static PyObject *__pyx_k_tuple_6;
+static PyObject *__pyx_k_tuple_9;
 static PyObject *__pyx_k_tuple_10;
-static PyObject *__pyx_k_tuple_11;
-static PyObject *__pyx_k_tuple_13;
-static PyObject *__pyx_k_tuple_15;
+static PyObject *__pyx_k_tuple_12;
+static PyObject *__pyx_k_tuple_14;
+static PyObject *__pyx_k_tuple_16;
 static PyObject *__pyx_k_tuple_17;
-static PyObject *__pyx_k_tuple_18;
-static PyObject *__pyx_k_tuple_20;
-static PyObject *__pyx_k_tuple_23;
-static PyObject *__pyx_k_tuple_25;
-static PyObject *__pyx_k_tuple_27;
-static PyObject *__pyx_k_tuple_29;
-static PyObject *__pyx_k_tuple_31;
+static PyObject *__pyx_k_tuple_19;
+static PyObject *__pyx_k_tuple_22;
+static PyObject *__pyx_k_tuple_24;
+static PyObject *__pyx_k_tuple_26;
+static PyObject *__pyx_k_tuple_28;
+static PyObject *__pyx_k_tuple_30;
+static PyObject *__pyx_k_tuple_33;
 static PyObject *__pyx_k_tuple_34;
-static PyObject *__pyx_k_tuple_35;
-static PyObject *__pyx_k_tuple_37;
-static PyObject *__pyx_k_tuple_39;
-static PyObject *__pyx_k_tuple_47;
-static PyObject *__pyx_k_tuple_52;
-static PyObject *__pyx_k_tuple_54;
-static PyObject *__pyx_k_tuple_56;
-static PyObject *__pyx_k_tuple_58;
-static PyObject *__pyx_k_tuple_60;
-static PyObject *__pyx_k_codeobj_48;
+static PyObject *__pyx_k_tuple_36;
+static PyObject *__pyx_k_tuple_38;
+static PyObject *__pyx_k_tuple_46;
+static PyObject *__pyx_k_tuple_51;
+static PyObject *__pyx_k_tuple_53;
+static PyObject *__pyx_k_tuple_55;
+static PyObject *__pyx_k_tuple_57;
+static PyObject *__pyx_k_tuple_59;
+static PyObject *__pyx_k_codeobj_47;
 
 /* "reconstruct.pyx":8
  * from cython.parallel import prange
@@ -1709,12 +1837,12 @@ static float __pyx_f_11reconstruct_invert_distance(size_t __pyx_v_i0, size_t __p
 /* "reconstruct.pyx":13
  * @cython.cdivision(True)
  * @cython.boundscheck(False)
- * cdef float processPoint(float[:,:] data,bint[:,:] mask,size_t p0,size_t p1,size_t d0,size_t d1)nogil:             # <<<<<<<<<<<<<<
- *     cdef size_t dist=0, i=0
- *     cdef float sum=0.0, count=0.0,invdst=0.0
+ * cdef inline float processPoint(float[:,:] data,             # <<<<<<<<<<<<<<
+ *                         numpy.int8_t[:,:] mask,
+ *                         size_t p0,
  */
 
-static float __pyx_f_11reconstruct_processPoint(__Pyx_memviewslice __pyx_v_data, __Pyx_memviewslice __pyx_v_mask, size_t __pyx_v_p0, size_t __pyx_v_p1, size_t __pyx_v_d0, size_t __pyx_v_d1) {
+static CYTHON_INLINE float __pyx_f_11reconstruct_processPoint(__Pyx_memviewslice __pyx_v_data, __Pyx_memviewslice __pyx_v_mask, size_t __pyx_v_p0, size_t __pyx_v_p1, size_t __pyx_v_d0, size_t __pyx_v_d1) {
   size_t __pyx_v_dist;
   size_t __pyx_v_i;
   float __pyx_v_sum;
@@ -1746,9 +1874,9 @@ static float __pyx_f_11reconstruct_processPoint(__Pyx_memviewslice __pyx_v_data,
   size_t __pyx_t_18;
   size_t __pyx_t_19;
 
-  /* "reconstruct.pyx":14
- * @cython.boundscheck(False)
- * cdef float processPoint(float[:,:] data,bint[:,:] mask,size_t p0,size_t p1,size_t d0,size_t d1)nogil:
+  /* "reconstruct.pyx":19
+ *                         size_t d0,
+ *                         size_t d1)nogil:
  *     cdef size_t dist=0, i=0             # <<<<<<<<<<<<<<
  *     cdef float sum=0.0, count=0.0,invdst=0.0
  *     cdef bint found=0
@@ -1756,8 +1884,8 @@ static float __pyx_f_11reconstruct_processPoint(__Pyx_memviewslice __pyx_v_data,
   __pyx_v_dist = 0;
   __pyx_v_i = 0;
 
-  /* "reconstruct.pyx":15
- * cdef float processPoint(float[:,:] data,bint[:,:] mask,size_t p0,size_t p1,size_t d0,size_t d1)nogil:
+  /* "reconstruct.pyx":20
+ *                         size_t d1)nogil:
  *     cdef size_t dist=0, i=0
  *     cdef float sum=0.0, count=0.0,invdst=0.0             # <<<<<<<<<<<<<<
  *     cdef bint found=0
@@ -1767,7 +1895,7 @@ static float __pyx_f_11reconstruct_processPoint(__Pyx_memviewslice __pyx_v_data,
   __pyx_v_count = 0.0;
   __pyx_v_invdst = 0.0;
 
-  /* "reconstruct.pyx":16
+  /* "reconstruct.pyx":21
  *     cdef size_t dist=0, i=0
  *     cdef float sum=0.0, count=0.0,invdst=0.0
  *     cdef bint found=0             # <<<<<<<<<<<<<<
@@ -1776,7 +1904,7 @@ static float __pyx_f_11reconstruct_processPoint(__Pyx_memviewslice __pyx_v_data,
  */
   __pyx_v_found = 0;
 
-  /* "reconstruct.pyx":17
+  /* "reconstruct.pyx":22
  *     cdef float sum=0.0, count=0.0,invdst=0.0
  *     cdef bint found=0
  *     cdef size_t start0=p0, stop0=p0, start1=p1, stop1=p1             # <<<<<<<<<<<<<<
@@ -1788,7 +1916,7 @@ static float __pyx_f_11reconstruct_processPoint(__Pyx_memviewslice __pyx_v_data,
   __pyx_v_start1 = __pyx_v_p1;
   __pyx_v_stop1 = __pyx_v_p1;
 
-  /* "reconstruct.pyx":18
+  /* "reconstruct.pyx":23
  *     cdef bint found=0
  *     cdef size_t start0=p0, stop0=p0, start1=p1, stop1=p1
  *     while not found:             # <<<<<<<<<<<<<<
@@ -1796,10 +1924,10 @@ static float __pyx_f_11reconstruct_processPoint(__Pyx_memviewslice __pyx_v_data,
  *         if start0>0:
  */
   while (1) {
-    __pyx_t_1 = (!__pyx_v_found);
+    __pyx_t_1 = ((!(__pyx_v_found != 0)) != 0);
     if (!__pyx_t_1) break;
 
-    /* "reconstruct.pyx":19
+    /* "reconstruct.pyx":24
  *     cdef size_t start0=p0, stop0=p0, start1=p1, stop1=p1
  *     while not found:
  *         dist+=1             # <<<<<<<<<<<<<<
@@ -1808,17 +1936,17 @@ static float __pyx_f_11reconstruct_processPoint(__Pyx_memviewslice __pyx_v_data,
  */
     __pyx_v_dist = (__pyx_v_dist + 1);
 
-    /* "reconstruct.pyx":20
+    /* "reconstruct.pyx":25
  *     while not found:
  *         dist+=1
  *         if start0>0:             # <<<<<<<<<<<<<<
  *             start0=p0-dist
  *         else:
  */
-    __pyx_t_1 = (__pyx_v_start0 > 0);
+    __pyx_t_1 = ((__pyx_v_start0 > 0) != 0);
     if (__pyx_t_1) {
 
-      /* "reconstruct.pyx":21
+      /* "reconstruct.pyx":26
  *         dist+=1
  *         if start0>0:
  *             start0=p0-dist             # <<<<<<<<<<<<<<
@@ -1830,7 +1958,7 @@ static float __pyx_f_11reconstruct_processPoint(__Pyx_memviewslice __pyx_v_data,
     }
     /*else*/ {
 
-      /* "reconstruct.pyx":23
+      /* "reconstruct.pyx":28
  *             start0=p0-dist
  *         else:
  *             start0=0             # <<<<<<<<<<<<<<
@@ -1841,17 +1969,17 @@ static float __pyx_f_11reconstruct_processPoint(__Pyx_memviewslice __pyx_v_data,
     }
     __pyx_L5:;
 
-    /* "reconstruct.pyx":24
+    /* "reconstruct.pyx":29
  *         else:
  *             start0=0
  *         if stop0<d0-1:             # <<<<<<<<<<<<<<
  *             stop0=p0+dist
  *         else:
  */
-    __pyx_t_1 = (__pyx_v_stop0 < (__pyx_v_d0 - 1));
+    __pyx_t_1 = ((__pyx_v_stop0 < (__pyx_v_d0 - 1)) != 0);
     if (__pyx_t_1) {
 
-      /* "reconstruct.pyx":25
+      /* "reconstruct.pyx":30
  *             start0=0
  *         if stop0<d0-1:
  *             stop0=p0+dist             # <<<<<<<<<<<<<<
@@ -1863,7 +1991,7 @@ static float __pyx_f_11reconstruct_processPoint(__Pyx_memviewslice __pyx_v_data,
     }
     /*else*/ {
 
-      /* "reconstruct.pyx":27
+      /* "reconstruct.pyx":32
  *             stop0=p0+dist
  *         else:
  *             stop0=d0-1             # <<<<<<<<<<<<<<
@@ -1874,17 +2002,17 @@ static float __pyx_f_11reconstruct_processPoint(__Pyx_memviewslice __pyx_v_data,
     }
     __pyx_L6:;
 
-    /* "reconstruct.pyx":28
+    /* "reconstruct.pyx":33
  *         else:
  *             stop0=d0-1
  *         if start1>0:             # <<<<<<<<<<<<<<
  *             start1=p1-dist
  *         else:
  */
-    __pyx_t_1 = (__pyx_v_start1 > 0);
+    __pyx_t_1 = ((__pyx_v_start1 > 0) != 0);
     if (__pyx_t_1) {
 
-      /* "reconstruct.pyx":29
+      /* "reconstruct.pyx":34
  *             stop0=d0-1
  *         if start1>0:
  *             start1=p1-dist             # <<<<<<<<<<<<<<
@@ -1896,7 +2024,7 @@ static float __pyx_f_11reconstruct_processPoint(__Pyx_memviewslice __pyx_v_data,
     }
     /*else*/ {
 
-      /* "reconstruct.pyx":31
+      /* "reconstruct.pyx":36
  *             start1=p1-dist
  *         else:
  *             start1=0             # <<<<<<<<<<<<<<
@@ -1907,17 +2035,17 @@ static float __pyx_f_11reconstruct_processPoint(__Pyx_memviewslice __pyx_v_data,
     }
     __pyx_L7:;
 
-    /* "reconstruct.pyx":32
+    /* "reconstruct.pyx":37
  *         else:
  *             start1=0
  *         if stop1<d1-1:             # <<<<<<<<<<<<<<
  *             stop1=p1+dist
  *         else:
  */
-    __pyx_t_1 = (__pyx_v_stop1 < (__pyx_v_d1 - 1));
+    __pyx_t_1 = ((__pyx_v_stop1 < (__pyx_v_d1 - 1)) != 0);
     if (__pyx_t_1) {
 
-      /* "reconstruct.pyx":33
+      /* "reconstruct.pyx":38
  *             start1=0
  *         if stop1<d1-1:
  *             stop1=p1+dist             # <<<<<<<<<<<<<<
@@ -1929,7 +2057,7 @@ static float __pyx_f_11reconstruct_processPoint(__Pyx_memviewslice __pyx_v_data,
     }
     /*else*/ {
 
-      /* "reconstruct.pyx":35
+      /* "reconstruct.pyx":40
  *             stop1=p1+dist
  *         else:
  *             stop1=d1-1             # <<<<<<<<<<<<<<
@@ -1940,7 +2068,7 @@ static float __pyx_f_11reconstruct_processPoint(__Pyx_memviewslice __pyx_v_data,
     }
     __pyx_L8:;
 
-    /* "reconstruct.pyx":36
+    /* "reconstruct.pyx":41
  *         else:
  *             stop1=d1-1
  *         for i in range(start0,stop0+1):             # <<<<<<<<<<<<<<
@@ -1951,7 +2079,7 @@ static float __pyx_f_11reconstruct_processPoint(__Pyx_memviewslice __pyx_v_data,
     for (__pyx_t_3 = __pyx_v_start0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
       __pyx_v_i = __pyx_t_3;
 
-      /* "reconstruct.pyx":37
+      /* "reconstruct.pyx":42
  *             stop1=d1-1
  *         for i in range(start0,stop0+1):
  *             if mask[i,start1]==0:             # <<<<<<<<<<<<<<
@@ -1960,10 +2088,10 @@ static float __pyx_f_11reconstruct_processPoint(__Pyx_memviewslice __pyx_v_data,
  */
       __pyx_t_4 = __pyx_v_i;
       __pyx_t_5 = __pyx_v_start1;
-      __pyx_t_1 = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mask.data + __pyx_t_4 * __pyx_v_mask.strides[0]) ) + __pyx_t_5 * __pyx_v_mask.strides[1]) ))) == 0);
+      __pyx_t_1 = (((*((__pyx_t_5numpy_int8_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mask.data + __pyx_t_4 * __pyx_v_mask.strides[0]) ) + __pyx_t_5 * __pyx_v_mask.strides[1]) ))) == 0) != 0);
       if (__pyx_t_1) {
 
-        /* "reconstruct.pyx":38
+        /* "reconstruct.pyx":43
  *         for i in range(start0,stop0+1):
  *             if mask[i,start1]==0:
  *                 invdst=invert_distance(i,start1,p0,p1)             # <<<<<<<<<<<<<<
@@ -1972,7 +2100,7 @@ static float __pyx_f_11reconstruct_processPoint(__Pyx_memviewslice __pyx_v_data,
  */
         __pyx_v_invdst = __pyx_f_11reconstruct_invert_distance(__pyx_v_i, __pyx_v_start1, __pyx_v_p0, __pyx_v_p1);
 
-        /* "reconstruct.pyx":39
+        /* "reconstruct.pyx":44
  *             if mask[i,start1]==0:
  *                 invdst=invert_distance(i,start1,p0,p1)
  *                 count+=invdst             # <<<<<<<<<<<<<<
@@ -1981,7 +2109,7 @@ static float __pyx_f_11reconstruct_processPoint(__Pyx_memviewslice __pyx_v_data,
  */
         __pyx_v_count = (__pyx_v_count + __pyx_v_invdst);
 
-        /* "reconstruct.pyx":40
+        /* "reconstruct.pyx":45
  *                 invdst=invert_distance(i,start1,p0,p1)
  *                 count+=invdst
  *                 sum+=invdst*data[i,start1]             # <<<<<<<<<<<<<<
@@ -1995,7 +2123,7 @@ static float __pyx_f_11reconstruct_processPoint(__Pyx_memviewslice __pyx_v_data,
       }
       __pyx_L11:;
 
-      /* "reconstruct.pyx":41
+      /* "reconstruct.pyx":46
  *                 count+=invdst
  *                 sum+=invdst*data[i,start1]
  *             if mask[i,stop1]==0:             # <<<<<<<<<<<<<<
@@ -2004,10 +2132,10 @@ static float __pyx_f_11reconstruct_processPoint(__Pyx_memviewslice __pyx_v_data,
  */
       __pyx_t_8 = __pyx_v_i;
       __pyx_t_9 = __pyx_v_stop1;
-      __pyx_t_1 = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mask.data + __pyx_t_8 * __pyx_v_mask.strides[0]) ) + __pyx_t_9 * __pyx_v_mask.strides[1]) ))) == 0);
+      __pyx_t_1 = (((*((__pyx_t_5numpy_int8_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mask.data + __pyx_t_8 * __pyx_v_mask.strides[0]) ) + __pyx_t_9 * __pyx_v_mask.strides[1]) ))) == 0) != 0);
       if (__pyx_t_1) {
 
-        /* "reconstruct.pyx":42
+        /* "reconstruct.pyx":47
  *                 sum+=invdst*data[i,start1]
  *             if mask[i,stop1]==0:
  *                 invdst=invert_distance(i,stop1,p0,p1)             # <<<<<<<<<<<<<<
@@ -2016,7 +2144,7 @@ static float __pyx_f_11reconstruct_processPoint(__Pyx_memviewslice __pyx_v_data,
  */
         __pyx_v_invdst = __pyx_f_11reconstruct_invert_distance(__pyx_v_i, __pyx_v_stop1, __pyx_v_p0, __pyx_v_p1);
 
-        /* "reconstruct.pyx":43
+        /* "reconstruct.pyx":48
  *             if mask[i,stop1]==0:
  *                 invdst=invert_distance(i,stop1,p0,p1)
  *                 count+=invdst             # <<<<<<<<<<<<<<
@@ -2025,7 +2153,7 @@ static float __pyx_f_11reconstruct_processPoint(__Pyx_memviewslice __pyx_v_data,
  */
         __pyx_v_count = (__pyx_v_count + __pyx_v_invdst);
 
-        /* "reconstruct.pyx":44
+        /* "reconstruct.pyx":49
  *                 invdst=invert_distance(i,stop1,p0,p1)
  *                 count+=invdst
  *                 sum+=invdst*data[i,stop1]             # <<<<<<<<<<<<<<
@@ -2040,7 +2168,7 @@ static float __pyx_f_11reconstruct_processPoint(__Pyx_memviewslice __pyx_v_data,
       __pyx_L12:;
     }
 
-    /* "reconstruct.pyx":45
+    /* "reconstruct.pyx":50
  *                 count+=invdst
  *                 sum+=invdst*data[i,stop1]
  *         for i in range(start1+1,stop1):             # <<<<<<<<<<<<<<
@@ -2051,7 +2179,7 @@ static float __pyx_f_11reconstruct_processPoint(__Pyx_memviewslice __pyx_v_data,
     for (__pyx_t_3 = (__pyx_v_start1 + 1); __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
       __pyx_v_i = __pyx_t_3;
 
-      /* "reconstruct.pyx":46
+      /* "reconstruct.pyx":51
  *                 sum+=invdst*data[i,stop1]
  *         for i in range(start1+1,stop1):
  *             if mask[start0,i]==0:             # <<<<<<<<<<<<<<
@@ -2060,10 +2188,10 @@ static float __pyx_f_11reconstruct_processPoint(__Pyx_memviewslice __pyx_v_data,
  */
       __pyx_t_12 = __pyx_v_start0;
       __pyx_t_13 = __pyx_v_i;
-      __pyx_t_1 = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mask.data + __pyx_t_12 * __pyx_v_mask.strides[0]) ) + __pyx_t_13 * __pyx_v_mask.strides[1]) ))) == 0);
+      __pyx_t_1 = (((*((__pyx_t_5numpy_int8_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mask.data + __pyx_t_12 * __pyx_v_mask.strides[0]) ) + __pyx_t_13 * __pyx_v_mask.strides[1]) ))) == 0) != 0);
       if (__pyx_t_1) {
 
-        /* "reconstruct.pyx":47
+        /* "reconstruct.pyx":52
  *         for i in range(start1+1,stop1):
  *             if mask[start0,i]==0:
  *                 invdst=invert_distance(start0,i,p0,p1)             # <<<<<<<<<<<<<<
@@ -2072,7 +2200,7 @@ static float __pyx_f_11reconstruct_processPoint(__Pyx_memviewslice __pyx_v_data,
  */
         __pyx_v_invdst = __pyx_f_11reconstruct_invert_distance(__pyx_v_start0, __pyx_v_i, __pyx_v_p0, __pyx_v_p1);
 
-        /* "reconstruct.pyx":48
+        /* "reconstruct.pyx":53
  *             if mask[start0,i]==0:
  *                 invdst=invert_distance(start0,i,p0,p1)
  *                 count+=invdst             # <<<<<<<<<<<<<<
@@ -2081,7 +2209,7 @@ static float __pyx_f_11reconstruct_processPoint(__Pyx_memviewslice __pyx_v_data,
  */
         __pyx_v_count = (__pyx_v_count + __pyx_v_invdst);
 
-        /* "reconstruct.pyx":49
+        /* "reconstruct.pyx":54
  *                 invdst=invert_distance(start0,i,p0,p1)
  *                 count+=invdst
  *                 sum+=invdst*data[start0,i]             # <<<<<<<<<<<<<<
@@ -2095,7 +2223,7 @@ static float __pyx_f_11reconstruct_processPoint(__Pyx_memviewslice __pyx_v_data,
       }
       __pyx_L15:;
 
-      /* "reconstruct.pyx":50
+      /* "reconstruct.pyx":55
  *                 count+=invdst
  *                 sum+=invdst*data[start0,i]
  *             if mask[stop0,i]==0:             # <<<<<<<<<<<<<<
@@ -2104,10 +2232,10 @@ static float __pyx_f_11reconstruct_processPoint(__Pyx_memviewslice __pyx_v_data,
  */
       __pyx_t_16 = __pyx_v_stop0;
       __pyx_t_17 = __pyx_v_i;
-      __pyx_t_1 = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mask.data + __pyx_t_16 * __pyx_v_mask.strides[0]) ) + __pyx_t_17 * __pyx_v_mask.strides[1]) ))) == 0);
+      __pyx_t_1 = (((*((__pyx_t_5numpy_int8_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mask.data + __pyx_t_16 * __pyx_v_mask.strides[0]) ) + __pyx_t_17 * __pyx_v_mask.strides[1]) ))) == 0) != 0);
       if (__pyx_t_1) {
 
-        /* "reconstruct.pyx":51
+        /* "reconstruct.pyx":56
  *                 sum+=invdst*data[start0,i]
  *             if mask[stop0,i]==0:
  *                 invdst=invert_distance(stop0,i,p0,p1)             # <<<<<<<<<<<<<<
@@ -2116,7 +2244,7 @@ static float __pyx_f_11reconstruct_processPoint(__Pyx_memviewslice __pyx_v_data,
  */
         __pyx_v_invdst = __pyx_f_11reconstruct_invert_distance(__pyx_v_stop0, __pyx_v_i, __pyx_v_p0, __pyx_v_p1);
 
-        /* "reconstruct.pyx":52
+        /* "reconstruct.pyx":57
  *             if mask[stop0,i]==0:
  *                 invdst=invert_distance(stop0,i,p0,p1)
  *                 count+=invdst             # <<<<<<<<<<<<<<
@@ -2125,7 +2253,7 @@ static float __pyx_f_11reconstruct_processPoint(__Pyx_memviewslice __pyx_v_data,
  */
         __pyx_v_count = (__pyx_v_count + __pyx_v_invdst);
 
-        /* "reconstruct.pyx":53
+        /* "reconstruct.pyx":58
  *                 invdst=invert_distance(stop0,i,p0,p1)
  *                 count+=invdst
  *                 sum+=invdst*data[stop0,i]             # <<<<<<<<<<<<<<
@@ -2140,17 +2268,17 @@ static float __pyx_f_11reconstruct_processPoint(__Pyx_memviewslice __pyx_v_data,
       __pyx_L16:;
     }
 
-    /* "reconstruct.pyx":54
+    /* "reconstruct.pyx":59
  *                 count+=invdst
  *                 sum+=invdst*data[stop0,i]
  *         if count>0:             # <<<<<<<<<<<<<<
  *             found=1
  *     return sum/count
  */
-    __pyx_t_1 = (__pyx_v_count > 0.0);
+    __pyx_t_1 = ((__pyx_v_count > 0.0) != 0);
     if (__pyx_t_1) {
 
-      /* "reconstruct.pyx":55
+      /* "reconstruct.pyx":60
  *                 sum+=invdst*data[stop0,i]
  *         if count>0:
  *             found=1             # <<<<<<<<<<<<<<
@@ -2163,7 +2291,7 @@ static float __pyx_f_11reconstruct_processPoint(__Pyx_memviewslice __pyx_v_data,
     __pyx_L17:;
   }
 
-  /* "reconstruct.pyx":56
+  /* "reconstruct.pyx":61
  *         if count>0:
  *             found=1
  *     return sum/count             # <<<<<<<<<<<<<<
@@ -2186,6 +2314,9 @@ static PyObject *__pyx_pw_11reconstruct_1reconstruct(PyObject *__pyx_self, PyObj
   PyArrayObject *__pyx_v_mask = 0;
   PyObject *__pyx_v_dummy = 0;
   PyObject *__pyx_v_delta_dummy = 0;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("reconstruct (wrapper)", 0);
@@ -2193,7 +2324,7 @@ static PyObject *__pyx_pw_11reconstruct_1reconstruct(PyObject *__pyx_self, PyObj
     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__data,&__pyx_n_s__mask,&__pyx_n_s__dummy,&__pyx_n_s__delta_dummy,0};
     PyObject* values[4] = {0,0,0,0};
 
-    /* "reconstruct.pyx":60
+    /* "reconstruct.pyx":65
  * @cython.boundscheck(False)
  * @cython.wraparound(False)
  * def reconstruct(numpy.ndarray data not None, numpy.ndarray mask=None, dummy=None,  delta_dummy=None):             # <<<<<<<<<<<<<<
@@ -2236,7 +2367,7 @@ static PyObject *__pyx_pw_11reconstruct_1reconstruct(PyObject *__pyx_self, PyObj
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "reconstruct") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "reconstruct") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     } else {
       switch (PyTuple_GET_SIZE(__pyx_args)) {
@@ -2255,14 +2386,14 @@ static PyObject *__pyx_pw_11reconstruct_1reconstruct(PyObject *__pyx_self, PyObj
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("reconstruct", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __Pyx_RaiseArgtupleInvalid("reconstruct", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_AddTraceback("reconstruct.reconstruct", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), __pyx_ptype_5numpy_ndarray, 0, "data", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mask), __pyx_ptype_5numpy_ndarray, 1, "mask", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), __pyx_ptype_5numpy_ndarray, 0, "data", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mask), __pyx_ptype_5numpy_ndarray, 1, "mask", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_r = __pyx_pf_11reconstruct_reconstruct(__pyx_self, __pyx_v_data, __pyx_v_mask, __pyx_v_dummy, __pyx_v_delta_dummy);
   goto __pyx_L0;
   __pyx_L1_error:;
@@ -2291,13 +2422,13 @@ static PyObject *__pyx_pf_11reconstruct_reconstruct(CYTHON_UNUSED PyObject *__py
   PyObject *__pyx_t_5 = NULL;
   __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
   int __pyx_t_7;
-  __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
-  PyArrayObject *__pyx_t_9 = NULL;
-  int __pyx_t_10;
-  PyObject *__pyx_t_11 = NULL;
+  int __pyx_t_8;
+  __Pyx_memviewslice __pyx_t_9 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  PyArrayObject *__pyx_t_10 = NULL;
+  int __pyx_t_11;
   PyObject *__pyx_t_12 = NULL;
   PyObject *__pyx_t_13 = NULL;
-  Py_ssize_t __pyx_t_14;
+  PyObject *__pyx_t_14 = NULL;
   Py_ssize_t __pyx_t_15;
   Py_ssize_t __pyx_t_16;
   Py_ssize_t __pyx_t_17;
@@ -2306,6 +2437,7 @@ static PyObject *__pyx_pf_11reconstruct_reconstruct(CYTHON_UNUSED PyObject *__py
   Py_ssize_t __pyx_t_20;
   Py_ssize_t __pyx_t_21;
   Py_ssize_t __pyx_t_22;
+  Py_ssize_t __pyx_t_23;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -2317,7 +2449,7 @@ static PyObject *__pyx_pf_11reconstruct_reconstruct(CYTHON_UNUSED PyObject *__py
   __pyx_pybuffernd_out.data = NULL;
   __pyx_pybuffernd_out.rcbuffer = &__pyx_pybuffer_out;
 
-  /* "reconstruct.pyx":61
+  /* "reconstruct.pyx":66
  * @cython.wraparound(False)
  * def reconstruct(numpy.ndarray data not None, numpy.ndarray mask=None, dummy=None,  delta_dummy=None):
  *     assert data.ndim==2             # <<<<<<<<<<<<<<
@@ -2325,13 +2457,13 @@ static PyObject *__pyx_pf_11reconstruct_reconstruct(CYTHON_UNUSED PyObject *__py
  *     cdef ssize_t d1=data.shape[1]
  */
   #ifndef CYTHON_WITHOUT_ASSERTIONS
-  if (unlikely(!(__pyx_v_data->nd == 2))) {
+  if (unlikely(!((__pyx_v_data->nd == 2) != 0))) {
     PyErr_SetNone(PyExc_AssertionError);
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   #endif
 
-  /* "reconstruct.pyx":62
+  /* "reconstruct.pyx":67
  * def reconstruct(numpy.ndarray data not None, numpy.ndarray mask=None, dummy=None,  delta_dummy=None):
  *     assert data.ndim==2
  *     cdef ssize_t d0=data.shape[0]             # <<<<<<<<<<<<<<
@@ -2340,7 +2472,7 @@ static PyObject *__pyx_pf_11reconstruct_reconstruct(CYTHON_UNUSED PyObject *__py
  */
   __pyx_v_d0 = (__pyx_v_data->dimensions[0]);
 
-  /* "reconstruct.pyx":63
+  /* "reconstruct.pyx":68
  *     assert data.ndim==2
  *     cdef ssize_t d0=data.shape[0]
  *     cdef ssize_t d1=data.shape[1]             # <<<<<<<<<<<<<<
@@ -2349,43 +2481,42 @@ static PyObject *__pyx_pf_11reconstruct_reconstruct(CYTHON_UNUSED PyObject *__py
  */
   __pyx_v_d1 = (__pyx_v_data->dimensions[1]);
 
-  /* "reconstruct.pyx":64
+  /* "reconstruct.pyx":69
  *     cdef ssize_t d0=data.shape[0]
  *     cdef ssize_t d1=data.shape[1]
  *     data=numpy.ascontiguousarray(data, dtype=numpy.float32)             # <<<<<<<<<<<<<<
  *     cdef float[:,:] cdata =data
  *     if mask is not None:
  */
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); 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_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __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 = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyTuple_New(1); 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_INCREF(((PyObject *)__pyx_v_data));
   PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_data));
   __Pyx_GIVEREF(((PyObject *)__pyx_v_data));
-  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__float32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__float32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(((PyObject *)__pyx_v_data));
-  __pyx_v_data = ((PyArrayObject *)__pyx_t_5);
+  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF_SET(__pyx_v_data, ((PyArrayObject *)__pyx_t_5));
   __pyx_t_5 = 0;
 
-  /* "reconstruct.pyx":65
+  /* "reconstruct.pyx":70
  *     cdef ssize_t d1=data.shape[1]
  *     data=numpy.ascontiguousarray(data, dtype=numpy.float32)
  *     cdef float[:,:] cdata =data             # <<<<<<<<<<<<<<
@@ -2393,12 +2524,12 @@ static PyObject *__pyx_pf_11reconstruct_reconstruct(CYTHON_UNUSED PyObject *__py
  *         mask = numpy.ascontiguousarray(mask, dtype=numpy.int8)
  */
   __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(((PyObject *)__pyx_v_data));
-  if (unlikely(!__pyx_t_6.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(!__pyx_t_6.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_v_cdata = __pyx_t_6;
   __pyx_t_6.memview = NULL;
   __pyx_t_6.data = NULL;
 
-  /* "reconstruct.pyx":66
+  /* "reconstruct.pyx":71
  *     data=numpy.ascontiguousarray(data, dtype=numpy.float32)
  *     cdef float[:,:] cdata =data
  *     if mask is not None:             # <<<<<<<<<<<<<<
@@ -2406,64 +2537,64 @@ static PyObject *__pyx_pf_11reconstruct_reconstruct(CYTHON_UNUSED PyObject *__py
  *     else:
  */
   __pyx_t_7 = (((PyObject *)__pyx_v_mask) != Py_None);
-  if (__pyx_t_7) {
+  __pyx_t_8 = (__pyx_t_7 != 0);
+  if (__pyx_t_8) {
 
-    /* "reconstruct.pyx":67
+    /* "reconstruct.pyx":72
  *     cdef float[:,:] cdata =data
  *     if mask is not None:
  *         mask = numpy.ascontiguousarray(mask, dtype=numpy.int8)             # <<<<<<<<<<<<<<
  *     else:
  *         mask = numpy.zeros((d0,d1),dtype=numpy.int8)
  */
-    __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__ascontiguousarray); 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_5); __pyx_t_5 = 0;
-    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __Pyx_INCREF(((PyObject *)__pyx_v_mask));
     PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_mask));
     __Pyx_GIVEREF(((PyObject *)__pyx_v_mask));
-    __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_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__int8); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__int8); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(((PyObject *)__pyx_v_mask));
-    __pyx_v_mask = ((PyArrayObject *)__pyx_t_4);
+    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF_SET(__pyx_v_mask, ((PyArrayObject *)__pyx_t_4));
     __pyx_t_4 = 0;
     goto __pyx_L3;
   }
   /*else*/ {
 
-    /* "reconstruct.pyx":69
+    /* "reconstruct.pyx":74
  *         mask = numpy.ascontiguousarray(mask, dtype=numpy.int8)
  *     else:
  *         mask = numpy.zeros((d0,d1),dtype=numpy.int8)             # <<<<<<<<<<<<<<
  *     if dummy is not None:
  *         if delta_dummy is None:
  */
-    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_d0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_d0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_d1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_d1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
     __Pyx_GIVEREF(__pyx_t_4);
@@ -2471,43 +2602,43 @@ static PyObject *__pyx_pf_11reconstruct_reconstruct(CYTHON_UNUSED PyObject *__py
     __Pyx_GIVEREF(__pyx_t_5);
     __pyx_t_4 = 0;
     __pyx_t_5 = 0;
-    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
     PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_3));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
     __pyx_t_3 = 0;
-    __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__int8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(((PyObject *)__pyx_v_mask));
-    __pyx_v_mask = ((PyArrayObject *)__pyx_t_2);
+    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF_SET(__pyx_v_mask, ((PyArrayObject *)__pyx_t_2));
     __pyx_t_2 = 0;
   }
   __pyx_L3:;
 
-  /* "reconstruct.pyx":70
+  /* "reconstruct.pyx":75
  *     else:
  *         mask = numpy.zeros((d0,d1),dtype=numpy.int8)
  *     if dummy is not None:             # <<<<<<<<<<<<<<
  *         if delta_dummy is None:
  *             mask+=(data==dummy)
  */
-  __pyx_t_7 = (__pyx_v_dummy != Py_None);
+  __pyx_t_8 = (__pyx_v_dummy != Py_None);
+  __pyx_t_7 = (__pyx_t_8 != 0);
   if (__pyx_t_7) {
 
-    /* "reconstruct.pyx":71
+    /* "reconstruct.pyx":76
  *         mask = numpy.zeros((d0,d1),dtype=numpy.int8)
  *     if dummy is not None:
  *         if delta_dummy is None:             # <<<<<<<<<<<<<<
@@ -2515,47 +2646,46 @@ static PyObject *__pyx_pf_11reconstruct_reconstruct(CYTHON_UNUSED PyObject *__py
  *         else:
  */
     __pyx_t_7 = (__pyx_v_delta_dummy == Py_None);
-    if (__pyx_t_7) {
+    __pyx_t_8 = (__pyx_t_7 != 0);
+    if (__pyx_t_8) {
 
-      /* "reconstruct.pyx":72
+      /* "reconstruct.pyx":77
  *     if dummy is not None:
  *         if delta_dummy is None:
  *             mask+=(data==dummy)             # <<<<<<<<<<<<<<
  *         else:
  *             mask+=(abs(data-dummy)<=delta_dummy)
  */
-      __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_data), __pyx_v_dummy, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_t_3 = PyNumber_InPlaceAdd(((PyObject *)__pyx_v_mask), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_data), __pyx_v_dummy, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyNumber_InPlaceAdd(((PyObject *)__pyx_v_mask), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(((PyObject *)__pyx_v_mask));
-      __pyx_v_mask = ((PyArrayObject *)__pyx_t_3);
+      if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF_SET(__pyx_v_mask, ((PyArrayObject *)__pyx_t_3));
       __pyx_t_3 = 0;
       goto __pyx_L5;
     }
     /*else*/ {
 
-      /* "reconstruct.pyx":74
+      /* "reconstruct.pyx":79
  *             mask+=(data==dummy)
  *         else:
  *             mask+=(abs(data-dummy)<=delta_dummy)             # <<<<<<<<<<<<<<
- *     cdef bint[:,:] cmask = mask.astype("int32")
+ *     cdef numpy.int8_t[:,:] cmask = mask.astype(numpy.int8)
  *     assert d0==mask.shape[0]
  */
-      __pyx_t_3 = PyNumber_Subtract(((PyObject *)__pyx_v_data), __pyx_v_dummy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyNumber_Subtract(((PyObject *)__pyx_v_data), __pyx_v_dummy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_2 = PyNumber_Absolute(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyNumber_Absolute(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_v_delta_dummy, Py_LE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_v_delta_dummy, Py_LE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __pyx_t_2 = PyNumber_InPlaceAdd(((PyObject *)__pyx_v_mask), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyNumber_InPlaceAdd(((PyObject *)__pyx_v_mask), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(((PyObject *)__pyx_v_mask));
-      __pyx_v_mask = ((PyArrayObject *)__pyx_t_2);
+      if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF_SET(__pyx_v_mask, ((PyArrayObject *)__pyx_t_2));
       __pyx_t_2 = 0;
     }
     __pyx_L5:;
@@ -2563,142 +2693,152 @@ static PyObject *__pyx_pf_11reconstruct_reconstruct(CYTHON_UNUSED PyObject *__py
   }
   __pyx_L4:;
 
-  /* "reconstruct.pyx":75
+  /* "reconstruct.pyx":80
  *         else:
  *             mask+=(abs(data-dummy)<=delta_dummy)
- *     cdef bint[:,:] cmask = mask.astype("int32")             # <<<<<<<<<<<<<<
+ *     cdef numpy.int8_t[:,:] cmask = mask.astype(numpy.int8)             # <<<<<<<<<<<<<<
  *     assert d0==mask.shape[0]
  *     assert d1==mask.shape[1]
  */
-  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_mask), __pyx_n_s__astype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_mask), __pyx_n_s__astype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(__pyx_t_3);
-  if (unlikely(!__pyx_t_8.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__int8); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_v_cmask = __pyx_t_8;
-  __pyx_t_8.memview = NULL;
-  __pyx_t_8.data = NULL;
+  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
+  __Pyx_GIVEREF(__pyx_t_5);
+  __pyx_t_5 = 0;
+  __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+  __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_int8_t(__pyx_t_5);
+  if (unlikely(!__pyx_t_9.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+  __pyx_v_cmask = __pyx_t_9;
+  __pyx_t_9.memview = NULL;
+  __pyx_t_9.data = NULL;
 
-  /* "reconstruct.pyx":76
+  /* "reconstruct.pyx":81
  *             mask+=(abs(data-dummy)<=delta_dummy)
- *     cdef bint[:,:] cmask = mask.astype("int32")
+ *     cdef numpy.int8_t[:,:] cmask = mask.astype(numpy.int8)
  *     assert d0==mask.shape[0]             # <<<<<<<<<<<<<<
  *     assert d1==mask.shape[1]
  *     cdef numpy.ndarray[numpy.float32_t, ndim = 2]out =numpy.zeros_like(data)
  */
   #ifndef CYTHON_WITHOUT_ASSERTIONS
-  if (unlikely(!(__pyx_v_d0 == (__pyx_v_mask->dimensions[0])))) {
+  if (unlikely(!((__pyx_v_d0 == (__pyx_v_mask->dimensions[0])) != 0))) {
     PyErr_SetNone(PyExc_AssertionError);
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   #endif
 
-  /* "reconstruct.pyx":77
- *     cdef bint[:,:] cmask = mask.astype("int32")
+  /* "reconstruct.pyx":82
+ *     cdef numpy.int8_t[:,:] cmask = mask.astype(numpy.int8)
  *     assert d0==mask.shape[0]
  *     assert d1==mask.shape[1]             # <<<<<<<<<<<<<<
  *     cdef numpy.ndarray[numpy.float32_t, ndim = 2]out =numpy.zeros_like(data)
  *     out+=data
  */
   #ifndef CYTHON_WITHOUT_ASSERTIONS
-  if (unlikely(!(__pyx_v_d1 == (__pyx_v_mask->dimensions[1])))) {
+  if (unlikely(!((__pyx_v_d1 == (__pyx_v_mask->dimensions[1])) != 0))) {
     PyErr_SetNone(PyExc_AssertionError);
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   #endif
 
-  /* "reconstruct.pyx":78
+  /* "reconstruct.pyx":83
  *     assert d0==mask.shape[0]
  *     assert d1==mask.shape[1]
  *     cdef numpy.ndarray[numpy.float32_t, ndim = 2]out =numpy.zeros_like(data)             # <<<<<<<<<<<<<<
  *     out+=data
  *     out[mask.astype(bool)]=0
  */
-  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__zeros_like); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
+  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__zeros_like); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
   __Pyx_INCREF(((PyObject *)__pyx_v_data));
-  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_data));
+  PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_data));
   __Pyx_GIVEREF(((PyObject *)__pyx_v_data));
-  __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_9 = ((PyArrayObject *)__pyx_t_5);
+  __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_10 = ((PyArrayObject *)__pyx_t_2);
   {
     __Pyx_BufFmt_StackElem __pyx_stack[1];
-    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
+    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
       __pyx_v_out = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_out.rcbuffer->pybuffer.buf = NULL;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     } else {__pyx_pybuffernd_out.diminfo[0].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_out.diminfo[0].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_out.diminfo[1].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_out.diminfo[1].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[1];
     }
   }
-  __pyx_t_9 = 0;
-  __pyx_v_out = ((PyArrayObject *)__pyx_t_5);
-  __pyx_t_5 = 0;
+  __pyx_t_10 = 0;
+  __pyx_v_out = ((PyArrayObject *)__pyx_t_2);
+  __pyx_t_2 = 0;
 
-  /* "reconstruct.pyx":79
+  /* "reconstruct.pyx":84
  *     assert d1==mask.shape[1]
  *     cdef numpy.ndarray[numpy.float32_t, ndim = 2]out =numpy.zeros_like(data)
  *     out+=data             # <<<<<<<<<<<<<<
  *     out[mask.astype(bool)]=0
  * 
  */
-  __pyx_t_5 = PyNumber_InPlaceAdd(((PyObject *)__pyx_v_out), ((PyObject *)__pyx_v_data)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_9 = ((PyArrayObject *)__pyx_t_5);
+  __pyx_t_2 = PyNumber_InPlaceAdd(((PyObject *)__pyx_v_out), ((PyObject *)__pyx_v_data)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_10 = ((PyArrayObject *)__pyx_t_2);
   {
     __Pyx_BufFmt_StackElem __pyx_stack[1];
     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
-    __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
-    if (unlikely(__pyx_t_10 < 0)) {
-      PyErr_Fetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
+    __pyx_t_11 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
+    if (unlikely(__pyx_t_11 < 0)) {
+      PyErr_Fetch(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
       if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)__pyx_v_out, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
-        Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13);
+        Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_14);
         __Pyx_RaiseBufferFallbackError();
       } else {
-        PyErr_Restore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
+        PyErr_Restore(__pyx_t_12, __pyx_t_13, __pyx_t_14);
       }
     }
     __pyx_pybuffernd_out.diminfo[0].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_out.diminfo[0].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_out.diminfo[1].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_out.diminfo[1].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[1];
-    if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
-  __pyx_t_9 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_v_out));
-  __pyx_v_out = ((PyArrayObject *)__pyx_t_5);
-  __pyx_t_5 = 0;
+  __pyx_t_10 = 0;
+  __Pyx_DECREF_SET(__pyx_v_out, ((PyArrayObject *)__pyx_t_2));
+  __pyx_t_2 = 0;
 
-  /* "reconstruct.pyx":80
+  /* "reconstruct.pyx":85
  *     cdef numpy.ndarray[numpy.float32_t, ndim = 2]out =numpy.zeros_like(data)
  *     out+=data
  *     out[mask.astype(bool)]=0             # <<<<<<<<<<<<<<
  * 
  *     cdef ssize_t p0,p1,i,l
  */
-  __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_mask), __pyx_n_s__astype); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_mask), __pyx_n_s__astype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
   __Pyx_INCREF(((PyObject*)&PyBool_Type));
-  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject*)&PyBool_Type));
+  PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject*)&PyBool_Type));
   __Pyx_GIVEREF(((PyObject*)&PyBool_Type));
-  __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-  if (PyObject_SetItem(((PyObject *)__pyx_v_out), __pyx_t_2, __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+  if (PyObject_SetItem(((PyObject *)__pyx_v_out), __pyx_t_3, __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
-  /* "reconstruct.pyx":83
+  /* "reconstruct.pyx":88
  * 
  *     cdef ssize_t p0,p1,i,l
  *     for p0 in prange(d0,nogil=True, schedule="guided"):             # <<<<<<<<<<<<<<
@@ -2707,11 +2847,11 @@ static PyObject *__pyx_pf_11reconstruct_reconstruct(CYTHON_UNUSED PyObject *__py
  */
   {
       #ifdef WITH_THREAD
-      PyThreadState *_save = NULL;
-      #endif
+      PyThreadState *_save;
       Py_UNBLOCK_THREADS
+      #endif
       /*try:*/ {
-        __pyx_t_14 = __pyx_v_d0;
+        __pyx_t_15 = __pyx_v_d0;
         if (1 == 0) abort();
         {
             #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
@@ -2720,55 +2860,55 @@ static PyObject *__pyx_pf_11reconstruct_reconstruct(CYTHON_UNUSED PyObject *__py
                 #define likely(x)   (x)
                 #define unlikely(x) (x)
             #endif
-            __pyx_t_16 = (__pyx_t_14 - 0) / 1;
-            if (__pyx_t_16 > 0)
+            __pyx_t_17 = (__pyx_t_15 - 0) / 1;
+            if (__pyx_t_17 > 0)
             {
                 #ifdef _OPENMP
-                #pragma omp parallel private(__pyx_t_18, __pyx_t_17, __pyx_t_20, __pyx_t_7, __pyx_t_21, __pyx_t_19, __pyx_t_22)
+                #pragma omp parallel private(__pyx_t_18, __pyx_t_23, __pyx_t_20, __pyx_t_21, __pyx_t_19, __pyx_t_22, __pyx_t_8)
                 #endif /* _OPENMP */
                 {
                     #ifdef _OPENMP
                     #pragma omp for lastprivate(__pyx_v_p1) firstprivate(__pyx_v_p0) lastprivate(__pyx_v_p0) schedule(guided)
                     #endif /* _OPENMP */
-                    for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_16; __pyx_t_15++){
+                    for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_17; __pyx_t_16++){
                         {
-                            __pyx_v_p0 = 0 + 1 * __pyx_t_15;
+                            __pyx_v_p0 = 0 + 1 * __pyx_t_16;
                             /* Initialize private variables to invalid values */
                             __pyx_v_p1 = ((Py_ssize_t)0xbad0bad0);
 
-                            /* "reconstruct.pyx":84
+                            /* "reconstruct.pyx":89
  *     cdef ssize_t p0,p1,i,l
  *     for p0 in prange(d0,nogil=True, schedule="guided"):
  *         for p1 in range(d1):             # <<<<<<<<<<<<<<
  *             if cmask[p0,p1]:
  *                 out[p0,p1] += processPoint(cdata,cmask,p0,p1,d0,d1)
  */
-                            __pyx_t_17 = __pyx_v_d1;
-                            for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
-                              __pyx_v_p1 = __pyx_t_18;
+                            __pyx_t_18 = __pyx_v_d1;
+                            for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) {
+                              __pyx_v_p1 = __pyx_t_19;
 
-                              /* "reconstruct.pyx":85
+                              /* "reconstruct.pyx":90
  *     for p0 in prange(d0,nogil=True, schedule="guided"):
  *         for p1 in range(d1):
  *             if cmask[p0,p1]:             # <<<<<<<<<<<<<<
  *                 out[p0,p1] += processPoint(cdata,cmask,p0,p1,d0,d1)
  *     return out
  */
-                              __pyx_t_19 = __pyx_v_p0;
-                              __pyx_t_20 = __pyx_v_p1;
-                              __pyx_t_7 = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_cmask.data + __pyx_t_19 * __pyx_v_cmask.strides[0]) ) + __pyx_t_20 * __pyx_v_cmask.strides[1]) )));
-                              if (__pyx_t_7) {
+                              __pyx_t_20 = __pyx_v_p0;
+                              __pyx_t_21 = __pyx_v_p1;
+                              __pyx_t_8 = ((*((__pyx_t_5numpy_int8_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_cmask.data + __pyx_t_20 * __pyx_v_cmask.strides[0]) ) + __pyx_t_21 * __pyx_v_cmask.strides[1]) ))) != 0);
+                              if (__pyx_t_8) {
 
-                                /* "reconstruct.pyx":86
+                                /* "reconstruct.pyx":91
  *         for p1 in range(d1):
  *             if cmask[p0,p1]:
  *                 out[p0,p1] += processPoint(cdata,cmask,p0,p1,d0,d1)             # <<<<<<<<<<<<<<
  *     return out
  * 
  */
-                                __pyx_t_21 = __pyx_v_p0;
-                                __pyx_t_22 = __pyx_v_p1;
-                                *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_out.diminfo[1].strides) += __pyx_f_11reconstruct_processPoint(__pyx_v_cdata, __pyx_v_cmask, __pyx_v_p0, __pyx_v_p1, __pyx_v_d0, __pyx_v_d1);
+                                __pyx_t_22 = __pyx_v_p0;
+                                __pyx_t_23 = __pyx_v_p1;
+                                *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_out.diminfo[1].strides) += __pyx_f_11reconstruct_processPoint(__pyx_v_cdata, __pyx_v_cmask, __pyx_v_p0, __pyx_v_p1, __pyx_v_d0, __pyx_v_d1);
                                 goto __pyx_L15;
                               }
                               __pyx_L15:;
@@ -2786,7 +2926,7 @@ static PyObject *__pyx_pf_11reconstruct_reconstruct(CYTHON_UNUSED PyObject *__py
         #endif
       }
 
-      /* "reconstruct.pyx":83
+      /* "reconstruct.pyx":88
  * 
  *     cdef ssize_t p0,p1,i,l
  *     for p0 in prange(d0,nogil=True, schedule="guided"):             # <<<<<<<<<<<<<<
@@ -2794,11 +2934,13 @@ static PyObject *__pyx_pf_11reconstruct_reconstruct(CYTHON_UNUSED PyObject *__py
  *             if cmask[p0,p1]:
  */
       /*finally:*/ {
+        #ifdef WITH_THREAD
         Py_BLOCK_THREADS
+        #endif
       }
   }
 
-  /* "reconstruct.pyx":87
+  /* "reconstruct.pyx":92
  *             if cmask[p0,p1]:
  *                 out[p0,p1] += processPoint(cdata,cmask,p0,p1,d0,d1)
  *     return out             # <<<<<<<<<<<<<<
@@ -2818,7 +2960,7 @@ static PyObject *__pyx_pf_11reconstruct_reconstruct(CYTHON_UNUSED PyObject *__py
   __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_5);
   __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
-  __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_out.rcbuffer->pybuffer);
@@ -2840,8 +2982,8 @@ static PyObject *__pyx_pf_11reconstruct_reconstruct(CYTHON_UNUSED PyObject *__py
 }
 
 /* Python wrapper */
-static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
-static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
+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);
@@ -2896,7 +3038,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  * 
  *             cdef int copy_shape, i, ndim
  */
-  __pyx_t_1 = (__pyx_v_info == NULL);
+  __pyx_t_1 = ((__pyx_v_info == NULL) != 0);
   if (__pyx_t_1) {
     __pyx_r = 0;
     goto __pyx_L0;
@@ -2938,7 +3080,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 copy_shape = 1
  *             else:
  */
-  __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t)));
+  __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":209
@@ -2971,7 +3113,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
  *                 raise ValueError(u"ndarray is not C contiguous")
  */
-  __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS);
+  __pyx_t_1 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":214
@@ -2981,7 +3123,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 raise ValueError(u"ndarray is not C contiguous")
  * 
  */
-    __pyx_t_2 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS));
+    __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS) != 0)) != 0);
     __pyx_t_3 = __pyx_t_2;
   } else {
     __pyx_t_3 = __pyx_t_1;
@@ -2995,7 +3137,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  * 
  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
  */
-    __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __Pyx_Raise(__pyx_t_4, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
@@ -3011,7 +3153,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
  *                 raise ValueError(u"ndarray is not Fortran contiguous")
  */
-  __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS);
+  __pyx_t_3 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0);
   if (__pyx_t_3) {
 
     /* "numpy.pxd":218
@@ -3021,7 +3163,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 raise ValueError(u"ndarray is not Fortran contiguous")
  * 
  */
-    __pyx_t_1 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS));
+    __pyx_t_1 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS) != 0)) != 0);
     __pyx_t_2 = __pyx_t_1;
   } else {
     __pyx_t_2 = __pyx_t_3;
@@ -3035,7 +3177,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  * 
  *             info.buf = PyArray_DATA(self)
  */
-    __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __Pyx_Raise(__pyx_t_4, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
@@ -3069,7 +3211,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 # Allocate new buffer for strides and shape info.
  *                 # This is allocated as one block, strides first.
  */
-  if (__pyx_v_copy_shape) {
+  __pyx_t_2 = (__pyx_v_copy_shape != 0);
+  if (__pyx_t_2) {
 
     /* "numpy.pxd":226
  *                 # Allocate new buffer for strides and shape info.
@@ -3167,7 +3310,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  * 
  *             cdef int t
  */
-  __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self));
+  __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0));
 
   /* "numpy.pxd":239
  * 
@@ -3185,8 +3328,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *             cdef list stack
  *             cdef int offset
  */
-  __Pyx_INCREF(((PyObject *)__pyx_v_self->descr));
-  __pyx_v_descr = __pyx_v_self->descr;
+  __pyx_t_4 = ((PyObject *)__pyx_v_self->descr);
+  __Pyx_INCREF(__pyx_t_4);
+  __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4);
+  __pyx_t_4 = 0;
 
   /* "numpy.pxd":244
  *             cdef int offset
@@ -3204,9 +3349,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 # do not call releasebuffer
  *                 info.obj = None
  */
-  __pyx_t_2 = (!__pyx_v_hasfields);
+  __pyx_t_2 = ((!(__pyx_v_hasfields != 0)) != 0);
   if (__pyx_t_2) {
-    __pyx_t_3 = (!__pyx_v_copy_shape);
+    __pyx_t_3 = ((!(__pyx_v_copy_shape != 0)) != 0);
     __pyx_t_1 = __pyx_t_3;
   } else {
     __pyx_t_1 = __pyx_t_2;
@@ -3251,7 +3396,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 t = descr.type_num
  *                 if ((descr.byteorder == c'>' and little_endian) or
  */
-  __pyx_t_1 = (!__pyx_v_hasfields);
+  __pyx_t_1 = ((!(__pyx_v_hasfields != 0)) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":254
@@ -3261,7 +3406,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 if ((descr.byteorder == c'>' and little_endian) or
  *                     (descr.byteorder == c'<' and not little_endian)):
  */
-    __pyx_v_t = __pyx_v_descr->type_num;
+    __pyx_t_5 = __pyx_v_descr->type_num;
+    __pyx_v_t = __pyx_t_5;
 
     /* "numpy.pxd":255
  *             if not hasfields:
@@ -3270,9 +3416,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                     (descr.byteorder == c'<' and not little_endian)):
  *                     raise ValueError(u"Non-native byte order not supported")
  */
-    __pyx_t_1 = (__pyx_v_descr->byteorder == '>');
+    __pyx_t_1 = ((__pyx_v_descr->byteorder == '>') != 0);
     if (__pyx_t_1) {
-      __pyx_t_2 = __pyx_v_little_endian;
+      __pyx_t_2 = (__pyx_v_little_endian != 0);
     } else {
       __pyx_t_2 = __pyx_t_1;
     }
@@ -3285,9 +3431,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                     raise ValueError(u"Non-native byte order not supported")
  *                 if   t == NPY_BYTE:        f = "b"
  */
-      __pyx_t_1 = (__pyx_v_descr->byteorder == '<');
+      __pyx_t_1 = ((__pyx_v_descr->byteorder == '<') != 0);
       if (__pyx_t_1) {
-        __pyx_t_3 = (!__pyx_v_little_endian);
+        __pyx_t_3 = ((!(__pyx_v_little_endian != 0)) != 0);
         __pyx_t_7 = __pyx_t_3;
       } else {
         __pyx_t_7 = __pyx_t_1;
@@ -3305,7 +3451,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 if   t == NPY_BYTE:        f = "b"
  *                 elif t == NPY_UBYTE:       f = "B"
  */
-      __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_7), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_4);
       __Pyx_Raise(__pyx_t_4, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
@@ -3314,227 +3460,202 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
     }
     __pyx_L12:;
 
-    /* "numpy.pxd":258
+    /* "numpy.pxd":274
+ *                 elif t == NPY_CDOUBLE:     f = "Zd"
+ *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
+ *                 elif t == NPY_OBJECT:      f = "O"             # <<<<<<<<<<<<<<
+ *                 else:
+ *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
+ */
+    switch (__pyx_v_t) {
+
+      /* "numpy.pxd":258
  *                     (descr.byteorder == c'<' and not little_endian)):
  *                     raise ValueError(u"Non-native byte order not supported")
  *                 if   t == NPY_BYTE:        f = "b"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_UBYTE:       f = "B"
  *                 elif t == NPY_SHORT:       f = "h"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_BYTE);
-    if (__pyx_t_1) {
+      case NPY_BYTE:
       __pyx_v_f = __pyx_k__b;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":259
+      /* "numpy.pxd":259
  *                     raise ValueError(u"Non-native byte order not supported")
  *                 if   t == NPY_BYTE:        f = "b"
  *                 elif t == NPY_UBYTE:       f = "B"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_SHORT:       f = "h"
  *                 elif t == NPY_USHORT:      f = "H"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_UBYTE);
-    if (__pyx_t_1) {
+      case NPY_UBYTE:
       __pyx_v_f = __pyx_k__B;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":260
+      /* "numpy.pxd":260
  *                 if   t == NPY_BYTE:        f = "b"
  *                 elif t == NPY_UBYTE:       f = "B"
  *                 elif t == NPY_SHORT:       f = "h"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_USHORT:      f = "H"
  *                 elif t == NPY_INT:         f = "i"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_SHORT);
-    if (__pyx_t_1) {
+      case NPY_SHORT:
       __pyx_v_f = __pyx_k__h;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":261
+      /* "numpy.pxd":261
  *                 elif t == NPY_UBYTE:       f = "B"
  *                 elif t == NPY_SHORT:       f = "h"
  *                 elif t == NPY_USHORT:      f = "H"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_INT:         f = "i"
  *                 elif t == NPY_UINT:        f = "I"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_USHORT);
-    if (__pyx_t_1) {
+      case NPY_USHORT:
       __pyx_v_f = __pyx_k__H;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":262
+      /* "numpy.pxd":262
  *                 elif t == NPY_SHORT:       f = "h"
  *                 elif t == NPY_USHORT:      f = "H"
  *                 elif t == NPY_INT:         f = "i"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_UINT:        f = "I"
  *                 elif t == NPY_LONG:        f = "l"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_INT);
-    if (__pyx_t_1) {
+      case NPY_INT:
       __pyx_v_f = __pyx_k__i;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":263
+      /* "numpy.pxd":263
  *                 elif t == NPY_USHORT:      f = "H"
  *                 elif t == NPY_INT:         f = "i"
  *                 elif t == NPY_UINT:        f = "I"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_LONG:        f = "l"
  *                 elif t == NPY_ULONG:       f = "L"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_UINT);
-    if (__pyx_t_1) {
+      case NPY_UINT:
       __pyx_v_f = __pyx_k__I;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":264
+      /* "numpy.pxd":264
  *                 elif t == NPY_INT:         f = "i"
  *                 elif t == NPY_UINT:        f = "I"
  *                 elif t == NPY_LONG:        f = "l"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_ULONG:       f = "L"
  *                 elif t == NPY_LONGLONG:    f = "q"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_LONG);
-    if (__pyx_t_1) {
+      case NPY_LONG:
       __pyx_v_f = __pyx_k__l;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":265
+      /* "numpy.pxd":265
  *                 elif t == NPY_UINT:        f = "I"
  *                 elif t == NPY_LONG:        f = "l"
  *                 elif t == NPY_ULONG:       f = "L"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_LONGLONG:    f = "q"
  *                 elif t == NPY_ULONGLONG:   f = "Q"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_ULONG);
-    if (__pyx_t_1) {
+      case NPY_ULONG:
       __pyx_v_f = __pyx_k__L;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":266
+      /* "numpy.pxd":266
  *                 elif t == NPY_LONG:        f = "l"
  *                 elif t == NPY_ULONG:       f = "L"
  *                 elif t == NPY_LONGLONG:    f = "q"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_ULONGLONG:   f = "Q"
  *                 elif t == NPY_FLOAT:       f = "f"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG);
-    if (__pyx_t_1) {
+      case NPY_LONGLONG:
       __pyx_v_f = __pyx_k__q;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":267
+      /* "numpy.pxd":267
  *                 elif t == NPY_ULONG:       f = "L"
  *                 elif t == NPY_LONGLONG:    f = "q"
  *                 elif t == NPY_ULONGLONG:   f = "Q"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_FLOAT:       f = "f"
  *                 elif t == NPY_DOUBLE:      f = "d"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG);
-    if (__pyx_t_1) {
+      case NPY_ULONGLONG:
       __pyx_v_f = __pyx_k__Q;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":268
+      /* "numpy.pxd":268
  *                 elif t == NPY_LONGLONG:    f = "q"
  *                 elif t == NPY_ULONGLONG:   f = "Q"
  *                 elif t == NPY_FLOAT:       f = "f"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_DOUBLE:      f = "d"
  *                 elif t == NPY_LONGDOUBLE:  f = "g"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_FLOAT);
-    if (__pyx_t_1) {
+      case NPY_FLOAT:
       __pyx_v_f = __pyx_k__f;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":269
+      /* "numpy.pxd":269
  *                 elif t == NPY_ULONGLONG:   f = "Q"
  *                 elif t == NPY_FLOAT:       f = "f"
  *                 elif t == NPY_DOUBLE:      f = "d"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_LONGDOUBLE:  f = "g"
  *                 elif t == NPY_CFLOAT:      f = "Zf"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE);
-    if (__pyx_t_1) {
+      case NPY_DOUBLE:
       __pyx_v_f = __pyx_k__d;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":270
+      /* "numpy.pxd":270
  *                 elif t == NPY_FLOAT:       f = "f"
  *                 elif t == NPY_DOUBLE:      f = "d"
  *                 elif t == NPY_LONGDOUBLE:  f = "g"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_CFLOAT:      f = "Zf"
  *                 elif t == NPY_CDOUBLE:     f = "Zd"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE);
-    if (__pyx_t_1) {
+      case NPY_LONGDOUBLE:
       __pyx_v_f = __pyx_k__g;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":271
+      /* "numpy.pxd":271
  *                 elif t == NPY_DOUBLE:      f = "d"
  *                 elif t == NPY_LONGDOUBLE:  f = "g"
  *                 elif t == NPY_CFLOAT:      f = "Zf"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_CDOUBLE:     f = "Zd"
  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT);
-    if (__pyx_t_1) {
+      case NPY_CFLOAT:
       __pyx_v_f = __pyx_k__Zf;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":272
+      /* "numpy.pxd":272
  *                 elif t == NPY_LONGDOUBLE:  f = "g"
  *                 elif t == NPY_CFLOAT:      f = "Zf"
  *                 elif t == NPY_CDOUBLE:     f = "Zd"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
  *                 elif t == NPY_OBJECT:      f = "O"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE);
-    if (__pyx_t_1) {
+      case NPY_CDOUBLE:
       __pyx_v_f = __pyx_k__Zd;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":273
+      /* "numpy.pxd":273
  *                 elif t == NPY_CFLOAT:      f = "Zf"
  *                 elif t == NPY_CDOUBLE:     f = "Zd"
  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_OBJECT:      f = "O"
  *                 else:
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE);
-    if (__pyx_t_1) {
+      case NPY_CLONGDOUBLE:
       __pyx_v_f = __pyx_k__Zg;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":274
+      /* "numpy.pxd":274
  *                 elif t == NPY_CDOUBLE:     f = "Zd"
  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
  *                 elif t == NPY_OBJECT:      f = "O"             # <<<<<<<<<<<<<<
  *                 else:
  *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_OBJECT);
-    if (__pyx_t_1) {
+      case NPY_OBJECT:
       __pyx_v_f = __pyx_k__O;
-      goto __pyx_L13;
-    }
-    /*else*/ {
+      break;
+      default:
 
       /* "numpy.pxd":276
  *                 elif t == NPY_OBJECT:      f = "O"
@@ -3545,7 +3666,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  */
       __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_8), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_7), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_8));
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
       __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -3559,8 +3680,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
       {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      break;
     }
-    __pyx_L13:;
 
     /* "numpy.pxd":277
  *                 else:
@@ -3656,8 +3777,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
 }
 
 /* Python wrapper */
-static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
-static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
+static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
+static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
   __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));
@@ -3684,7 +3805,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s
  *                 stdlib.free(info.format)
  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
  */
-  __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self);
+  __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":290
@@ -3706,7 +3827,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s
  *                 stdlib.free(info.strides)
  *                 # info.shape was stored after info.strides in the same block
  */
-  __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t)));
+  __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":292
@@ -4011,8 +4132,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
     #else
     __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     #endif
-    __Pyx_XDECREF(__pyx_v_childname);
-    __pyx_v_childname = __pyx_t_3;
+    __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3);
     __pyx_t_3 = 0;
 
     /* "numpy.pxd":795
@@ -4025,8 +4145,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
     __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_XDECREF(((PyObject *)__pyx_v_fields));
-    __pyx_v_fields = ((PyObject*)__pyx_t_3);
+    __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3));
     __pyx_t_3 = 0;
 
     /* "numpy.pxd":796
@@ -4055,7 +4174,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
       __Pyx_INCREF(__pyx_t_4);
       #else
       __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
       __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_4);
       #endif
     } else if (1) {
       __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -4081,11 +4202,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
       __pyx_L6_unpacking_done:;
     }
     if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_XDECREF(((PyObject *)__pyx_v_child));
-    __pyx_v_child = ((PyArray_Descr *)__pyx_t_3);
+    __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3));
     __pyx_t_3 = 0;
-    __Pyx_XDECREF(__pyx_v_new_offset);
-    __pyx_v_new_offset = __pyx_t_4;
+    __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4);
     __pyx_t_4 = 0;
 
     /* "numpy.pxd":798
@@ -4119,7 +4238,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  * 
  *         if ((child.byteorder == c'>' and little_endian) or
  */
-      __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_9), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
       __Pyx_Raise(__pyx_t_5, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
@@ -4135,9 +4254,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  *             (child.byteorder == c'<' and not little_endian)):
  *             raise ValueError(u"Non-native byte order not supported")
  */
-    __pyx_t_7 = (__pyx_v_child->byteorder == '>');
+    __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0);
     if (__pyx_t_7) {
-      __pyx_t_8 = __pyx_v_little_endian;
+      __pyx_t_8 = (__pyx_v_little_endian != 0);
     } else {
       __pyx_t_8 = __pyx_t_7;
     }
@@ -4150,9 +4269,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  *             raise ValueError(u"Non-native byte order not supported")
  *             # One could encode it in the format string and have Cython
  */
-      __pyx_t_7 = (__pyx_v_child->byteorder == '<');
+      __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0);
       if (__pyx_t_7) {
-        __pyx_t_9 = (!__pyx_v_little_endian);
+        __pyx_t_9 = ((!(__pyx_v_little_endian != 0)) != 0);
         __pyx_t_10 = __pyx_t_9;
       } else {
         __pyx_t_10 = __pyx_t_7;
@@ -4170,7 +4289,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  *             # One could encode it in the format string and have Cython
  *             # complain instead, BUT: < and > in format strings also imply
  */
-      __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_11), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
       __Pyx_Raise(__pyx_t_5, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
@@ -4241,7 +4360,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  *             t = child.type_num
  *             if end - f < 5:
  */
-    __pyx_t_7 = (!PyDataType_HASFIELDS(__pyx_v_child));
+    __pyx_t_7 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0);
     if (__pyx_t_7) {
 
       /* "numpy.pxd":821
@@ -4253,8 +4372,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  */
       __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
-      __Pyx_XDECREF(__pyx_v_t);
-      __pyx_v_t = __pyx_t_3;
+      __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_3);
       __pyx_t_3 = 0;
 
       /* "numpy.pxd":822
@@ -4264,7 +4382,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  *                 raise RuntimeError(u"Format string allocated too short.")
  * 
  */
-      __pyx_t_7 = ((__pyx_v_end - __pyx_v_f) < 5);
+      __pyx_t_7 = (((__pyx_v_end - __pyx_v_f) < 5) != 0);
       if (__pyx_t_7) {
 
         /* "numpy.pxd":823
@@ -4274,7 +4392,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  * 
  *             # Until ticket #99 is fixed, use integers to avoid warnings
  */
-        __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_13), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_3);
         __Pyx_Raise(__pyx_t_3, 0, 0, 0);
         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
@@ -4603,7 +4721,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  *             f += 1
  *         else:
  */
-        __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_8), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_7), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(((PyObject *)__pyx_t_5));
         __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_3);
@@ -4686,6 +4804,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a
   PyObject *__pyx_v_baseptr;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
+  int __pyx_t_2;
   __Pyx_RefNannySetupContext("set_array_base", 0);
 
   /* "numpy.pxd":967
@@ -4696,7 +4815,8 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a
  *      else:
  */
   __pyx_t_1 = (__pyx_v_base == Py_None);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
     /* "numpy.pxd":968
  *      cdef PyObject* baseptr
@@ -4772,7 +4892,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py
  *         return None
  *     else:
  */
-  __pyx_t_1 = (__pyx_v_arr->base == NULL);
+  __pyx_t_1 = ((__pyx_v_arr->base == NULL) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":977
@@ -4817,6 +4937,9 @@ static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, P
   PyObject *__pyx_v_format = 0;
   PyObject *__pyx_v_mode = 0;
   int __pyx_v_allocate_buffer;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
@@ -4936,12 +5059,12 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
   Py_ssize_t __pyx_t_1;
   int __pyx_t_2;
   PyObject *__pyx_t_3 = NULL;
-  PyObject *__pyx_t_4 = NULL;
-  PyObject *__pyx_t_5 = NULL;
-  char *__pyx_t_6;
+  char *__pyx_t_4;
+  int __pyx_t_5;
+  int __pyx_t_6;
   int __pyx_t_7;
-  int __pyx_t_8;
-  int __pyx_t_9;
+  PyObject *__pyx_t_8 = NULL;
+  PyObject *__pyx_t_9 = NULL;
   Py_ssize_t __pyx_t_10;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
@@ -4953,7 +5076,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
   /* "View.MemoryView":120
  *         cdef PyObject **p
  * 
- *         self.ndim = len(shape)             # <<<<<<<<<<<<<<
+ *         self.ndim = <int> len(shape)             # <<<<<<<<<<<<<<
  *         self.itemsize = itemsize
  * 
  */
@@ -4962,11 +5085,11 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   __pyx_t_1 = PyTuple_GET_SIZE(((PyObject *)__pyx_v_shape)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_self->ndim = __pyx_t_1;
+  __pyx_v_self->ndim = ((int)__pyx_t_1);
 
   /* "View.MemoryView":121
  * 
- *         self.ndim = len(shape)
+ *         self.ndim = <int> len(shape)
  *         self.itemsize = itemsize             # <<<<<<<<<<<<<<
  * 
  *         if not self.ndim:
@@ -4980,7 +5103,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             raise ValueError("Empty shape tuple for cython.array")
  * 
  */
-  __pyx_t_2 = (!__pyx_v_self->ndim);
+  __pyx_t_2 = ((!(__pyx_v_self->ndim != 0)) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":124
@@ -4990,7 +5113,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  *         if self.itemsize <= 0:
  */
-    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_15), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
@@ -5006,7 +5129,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             raise ValueError("itemsize <= 0 for cython.array")
  * 
  */
-  __pyx_t_2 = (__pyx_v_self->itemsize <= 0);
+  __pyx_t_2 = ((__pyx_v_self->itemsize <= 0) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":127
@@ -5016,7 +5139,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  *         encode = getattr(format, 'encode', None)
  */
-    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_17), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_16), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
@@ -5032,16 +5155,10 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *         if encode:
  *             format = encode('ASCII')
  */
-  __pyx_t_3 = ((PyObject *)__pyx_n_s__encode);
-  __Pyx_INCREF(__pyx_t_3);
-  __pyx_t_4 = Py_None;
-  __Pyx_INCREF(__pyx_t_4);
-  __pyx_t_5 = __Pyx_GetAttr3(__pyx_v_format, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_v_encode = __pyx_t_5;
-  __pyx_t_5 = 0;
+  __pyx_t_3 = __Pyx_GetAttr3(__pyx_v_format, ((PyObject *)__pyx_n_s__encode), Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_v_encode = __pyx_t_3;
+  __pyx_t_3 = 0;
 
   /* "View.MemoryView":130
  * 
@@ -5060,11 +5177,10 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *         self._format = format
  *         self.format = self._format
  */
-    __pyx_t_5 = PyObject_Call(__pyx_v_encode, ((PyObject *)__pyx_k_tuple_18), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_v_format);
-    __pyx_v_format = __pyx_t_5;
-    __pyx_t_5 = 0;
+    __pyx_t_3 = PyObject_Call(__pyx_v_encode, ((PyObject *)__pyx_k_tuple_17), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_3);
+    __pyx_t_3 = 0;
     goto __pyx_L5;
   }
   __pyx_L5:;
@@ -5090,8 +5206,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  *         self._shape = <Py_ssize_t *> malloc(sizeof(Py_ssize_t)*self.ndim)
  */
-  __pyx_t_6 = PyBytes_AsString(((PyObject *)__pyx_v_self->_format)); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_self->format = __pyx_t_6;
+  __pyx_t_4 = __Pyx_PyObject_AsString(((PyObject *)__pyx_v_self->_format)); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_v_self->format = __pyx_t_4;
 
   /* "View.MemoryView":135
  *         self.format = self._format
@@ -5118,14 +5234,14 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             free(self._shape)
  *             free(self._strides)
  */
-  __pyx_t_2 = (!(__pyx_v_self->_shape != 0));
+  __pyx_t_2 = ((!(__pyx_v_self->_shape != 0)) != 0);
   if (!__pyx_t_2) {
-    __pyx_t_7 = (!(__pyx_v_self->_strides != 0));
-    __pyx_t_8 = __pyx_t_7;
+    __pyx_t_5 = ((!(__pyx_v_self->_strides != 0)) != 0);
+    __pyx_t_6 = __pyx_t_5;
   } else {
-    __pyx_t_8 = __pyx_t_2;
+    __pyx_t_6 = __pyx_t_2;
   }
-  if (__pyx_t_8) {
+  if (__pyx_t_6) {
 
     /* "View.MemoryView":139
  * 
@@ -5152,10 +5268,10 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  * 
  */
-    __pyx_t_5 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_20), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_19), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L6;
   }
@@ -5177,20 +5293,19 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             if dim <= 0:
  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
  */
-  __pyx_t_9 = 0;
-  __pyx_t_5 = ((PyObject *)__pyx_v_shape); __Pyx_INCREF(__pyx_t_5); __pyx_t_1 = 0;
+  __pyx_t_7 = 0;
+  __pyx_t_3 = ((PyObject *)__pyx_v_shape); __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
   for (;;) {
-    if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
+    if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
     #if CYTHON_COMPILING_IN_CPYTHON
-    __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_1); __Pyx_INCREF(__pyx_t_4); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_8); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     #else
-    __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_8 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     #endif
-    __Pyx_XDECREF(__pyx_v_dim);
-    __pyx_v_dim = __pyx_t_4;
-    __pyx_t_4 = 0;
-    __pyx_v_idx = __pyx_t_9;
-    __pyx_t_9 = (__pyx_t_9 + 1);
+    __Pyx_XDECREF_SET(__pyx_v_dim, __pyx_t_8);
+    __pyx_t_8 = 0;
+    __pyx_v_idx = __pyx_t_7;
+    __pyx_t_7 = (__pyx_t_7 + 1);
 
     /* "View.MemoryView":146
  *         idx = 0
@@ -5199,10 +5314,10 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
  * 
  */
-    __pyx_t_4 = PyObject_RichCompare(__pyx_v_dim, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    if (__pyx_t_8) {
+    __pyx_t_8 = PyObject_RichCompare(__pyx_v_dim, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    if (__pyx_t_6) {
 
       /* "View.MemoryView":147
  *         for idx, dim in enumerate(shape):
@@ -5211,29 +5326,29 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  *             self._shape[idx] = dim
  */
-      __pyx_t_4 = PyInt_FromLong(__pyx_v_idx); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
-      __Pyx_GIVEREF(__pyx_t_4);
+      __pyx_t_8 = PyInt_FromLong(__pyx_v_idx); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_8);
+      __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
+      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8);
+      __Pyx_GIVEREF(__pyx_t_8);
       __Pyx_INCREF(__pyx_v_dim);
-      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_dim);
+      PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_dim);
       __Pyx_GIVEREF(__pyx_v_dim);
-      __pyx_t_4 = 0;
-      __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_21), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
-      __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
-      __pyx_t_4 = 0;
-      __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+      __pyx_t_8 = 0;
+      __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_20), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_8));
+      __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
+      __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
+      PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_t_8));
+      __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
+      __pyx_t_8 = 0;
+      __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_8);
+      __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
+      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
+      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
       {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L9;
     }
@@ -5258,7 +5373,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  */
     __pyx_v_idx = (__pyx_v_idx + 1);
   }
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
   /* "View.MemoryView":152
  *             idx += 1
@@ -5268,21 +5383,21 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  */
   __Pyx_INCREF(__pyx_v_mode);
-  __pyx_t_5 = __pyx_v_mode;
-  __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, ((PyObject *)__pyx_n_s__fortran), Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (((int)__pyx_t_8)) {
-    __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, ((PyObject *)__pyx_n_s__c), Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_7 = ((int)__pyx_t_2);
+  __pyx_t_3 = __pyx_v_mode;
+  __pyx_t_8 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__fortran), Py_NE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+  if (((int)__pyx_t_6)) {
+    __pyx_t_8 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__c), Py_NE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    __pyx_t_5 = ((int)__pyx_t_2);
   } else {
-    __pyx_t_7 = ((int)__pyx_t_8);
+    __pyx_t_5 = ((int)__pyx_t_6);
   }
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __pyx_t_8 = __pyx_t_7;
-  if (__pyx_t_8) {
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_6 = (__pyx_t_5 != 0);
+  if (__pyx_t_6) {
 
     /* "View.MemoryView":153
  * 
@@ -5291,18 +5406,18 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  *         cdef char order
  */
-    __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_22), __pyx_v_mode); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
-    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_5));
-    __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
-    __pyx_t_5 = 0;
-    __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_21), __pyx_v_mode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+    __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_8);
+    PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_3));
+    __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
+    __pyx_t_3 = 0;
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
+    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L10;
   }
@@ -5315,10 +5430,10 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             order = 'F'
  *         else:
  */
-  __pyx_t_5 = PyObject_RichCompare(__pyx_v_mode, ((PyObject *)__pyx_n_s__fortran), Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  if (__pyx_t_8) {
+  __pyx_t_3 = PyObject_RichCompare(__pyx_v_mode, ((PyObject *)__pyx_n_s__fortran), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  if (__pyx_t_6) {
 
     /* "View.MemoryView":157
  *         cdef char order
@@ -5359,14 +5474,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *         if decode:
  *             mode = decode('ASCII')
  */
-  __pyx_t_5 = ((PyObject *)__pyx_n_s__decode);
-  __Pyx_INCREF(__pyx_t_5);
-  __pyx_t_4 = Py_None;
-  __Pyx_INCREF(__pyx_t_4);
-  __pyx_t_3 = __Pyx_GetAttr3(__pyx_v_mode, __pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_GetAttr3(__pyx_v_mode, ((PyObject *)__pyx_n_s__decode), Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   __pyx_v_decode = __pyx_t_3;
   __pyx_t_3 = 0;
 
@@ -5377,8 +5486,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             mode = decode('ASCII')
  *         self.mode = mode
  */
-  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_decode); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__pyx_t_8) {
+  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_decode); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__pyx_t_6) {
 
     /* "View.MemoryView":166
  *         decode = getattr(mode, 'decode', None)
@@ -5387,10 +5496,9 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *         self.mode = mode
  * 
  */
-    __pyx_t_3 = PyObject_Call(__pyx_v_decode, ((PyObject *)__pyx_k_tuple_23), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Call(__pyx_v_decode, ((PyObject *)__pyx_k_tuple_22), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_v_mode);
-    __pyx_v_mode = __pyx_t_3;
+    __Pyx_DECREF_SET(__pyx_v_mode, __pyx_t_3);
     __pyx_t_3 = 0;
     goto __pyx_L12;
   }
@@ -5427,9 +5535,9 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             self.data = <char *>malloc(self.len)
  */
   __pyx_t_3 = PyObject_RichCompare(__pyx_v_format, ((PyObject *)__pyx_n_b__O), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_v_self->dtype_is_object = __pyx_t_8;
+  __pyx_v_self->dtype_is_object = __pyx_t_6;
 
   /* "View.MemoryView":171
  *         self.free_data = allocate_buffer
@@ -5438,7 +5546,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             self.data = <char *>malloc(self.len)
  *             if not self.data:
  */
-  if (__pyx_v_allocate_buffer) {
+  __pyx_t_6 = (__pyx_v_allocate_buffer != 0);
+  if (__pyx_t_6) {
 
     /* "View.MemoryView":172
  *         self.dtype_is_object = format == b'O'
@@ -5456,8 +5565,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *                 raise MemoryError("unable to allocate array data.")
  * 
  */
-    __pyx_t_8 = (!(__pyx_v_self->data != 0));
-    if (__pyx_t_8) {
+    __pyx_t_6 = ((!(__pyx_v_self->data != 0)) != 0);
+    if (__pyx_t_6) {
 
       /* "View.MemoryView":174
  *             self.data = <char *>malloc(self.len)
@@ -5466,7 +5575,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  *             if self.dtype_is_object:
  */
-      __pyx_t_3 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_25), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_24), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
@@ -5482,7 +5591,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *                 p = <PyObject **> self.data
  *                 for i in range(self.len / itemsize):
  */
-    if (__pyx_v_self->dtype_is_object) {
+    __pyx_t_6 = (__pyx_v_self->dtype_is_object != 0);
+    if (__pyx_t_6) {
 
       /* "View.MemoryView":177
  * 
@@ -5501,11 +5611,23 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *                     Py_INCREF(Py_None)
  */
       if (unlikely(__pyx_v_itemsize == 0)) {
+        #ifdef WITH_THREAD
+        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+        #endif
         PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero");
+        #ifdef WITH_THREAD
+        PyGILState_Release(__pyx_gilstate_save);
+        #endif
         {__pyx_filename = __pyx_f[2]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       }
       else if (sizeof(Py_ssize_t) == sizeof(long) && unlikely(__pyx_v_itemsize == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) {
+        #ifdef WITH_THREAD
+        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+        #endif
         PyErr_Format(PyExc_OverflowError, "value too large to perform division");
+        #ifdef WITH_THREAD
+        PyGILState_Release(__pyx_gilstate_save);
+        #endif
         {__pyx_filename = __pyx_f[2]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       }
       __pyx_t_1 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_itemsize);
@@ -5541,8 +5663,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_XDECREF(__pyx_t_4);
-  __Pyx_XDECREF(__pyx_t_5);
+  __Pyx_XDECREF(__pyx_t_8);
+  __Pyx_XDECREF(__pyx_t_9);
   __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
@@ -5556,8 +5678,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
 }
 
 /* Python wrapper */
-static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
-static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
+static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
+static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
@@ -5579,8 +5701,12 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
-  PyObject *__pyx_t_2 = NULL;
-  int __pyx_t_3;
+  int __pyx_t_2;
+  PyObject *__pyx_t_3 = NULL;
+  char *__pyx_t_4;
+  Py_ssize_t __pyx_t_5;
+  int __pyx_t_6;
+  Py_ssize_t *__pyx_t_7;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -5607,7 +5733,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         elif self.mode == b"fortran":
  */
   __pyx_t_1 = (__Pyx_PyUnicode_Equals(((PyObject *)__pyx_v_self->mode), ((PyObject *)__pyx_n_b__c), Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":186
  *         cdef int bufmode = -1
@@ -5627,7 +5754,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
  *         if not (flags & bufmode):
  */
-  __pyx_t_1 = (__Pyx_PyUnicode_Equals(((PyObject *)__pyx_v_self->mode), ((PyObject *)__pyx_n_b__fortran), Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = (__Pyx_PyUnicode_Equals(((PyObject *)__pyx_v_self->mode), ((PyObject *)__pyx_n_b__fortran), Py_EQ)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = (__pyx_t_2 != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":188
@@ -5649,7 +5777,7 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
  *         info.buf = self.data
  */
-  __pyx_t_1 = (!(__pyx_v_flags & __pyx_v_bufmode));
+  __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":190
@@ -5659,10 +5787,10 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.buf = self.data
  *         info.len = self.len
  */
-    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_27), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_26), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L4;
   }
@@ -5675,7 +5803,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.len = self.len
  *         info.ndim = self.ndim
  */
-  __pyx_v_info->buf = __pyx_v_self->data;
+  __pyx_t_4 = __pyx_v_self->data;
+  __pyx_v_info->buf = __pyx_t_4;
 
   /* "View.MemoryView":192
  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
@@ -5684,7 +5813,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.ndim = self.ndim
  *         info.shape = self._shape
  */
-  __pyx_v_info->len = __pyx_v_self->len;
+  __pyx_t_5 = __pyx_v_self->len;
+  __pyx_v_info->len = __pyx_t_5;
 
   /* "View.MemoryView":193
  *         info.buf = self.data
@@ -5693,7 +5823,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.shape = self._shape
  *         info.strides = self._strides
  */
-  __pyx_v_info->ndim = __pyx_v_self->ndim;
+  __pyx_t_6 = __pyx_v_self->ndim;
+  __pyx_v_info->ndim = __pyx_t_6;
 
   /* "View.MemoryView":194
  *         info.len = self.len
@@ -5702,7 +5833,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.strides = self._strides
  *         info.suboffsets = NULL
  */
-  __pyx_v_info->shape = __pyx_v_self->_shape;
+  __pyx_t_7 = __pyx_v_self->_shape;
+  __pyx_v_info->shape = __pyx_t_7;
 
   /* "View.MemoryView":195
  *         info.ndim = self.ndim
@@ -5711,7 +5843,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.suboffsets = NULL
  *         info.itemsize = self.itemsize
  */
-  __pyx_v_info->strides = __pyx_v_self->_strides;
+  __pyx_t_7 = __pyx_v_self->_strides;
+  __pyx_v_info->strides = __pyx_t_7;
 
   /* "View.MemoryView":196
  *         info.shape = self._shape
@@ -5729,7 +5862,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.readonly = 0
  * 
  */
-  __pyx_v_info->itemsize = __pyx_v_self->itemsize;
+  __pyx_t_5 = __pyx_v_self->itemsize;
+  __pyx_v_info->itemsize = __pyx_t_5;
 
   /* "View.MemoryView":198
  *         info.suboffsets = NULL
@@ -5747,8 +5881,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *             info.format = self.format
  *         else:
  */
-  __pyx_t_3 = (__pyx_v_flags & PyBUF_FORMAT);
-  if (__pyx_t_3) {
+  __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
+  if (__pyx_t_1) {
 
     /* "View.MemoryView":201
  * 
@@ -5757,7 +5891,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         else:
  *             info.format = NULL
  */
-    __pyx_v_info->format = __pyx_v_self->format;
+    __pyx_t_4 = __pyx_v_self->format;
+    __pyx_v_info->format = __pyx_t_4;
     goto __pyx_L5;
   }
   /*else*/ {
@@ -5789,7 +5924,7 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
   __pyx_r = 0;
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_2);
+  __Pyx_XDECREF(__pyx_t_3);
   __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) {
@@ -5836,7 +5971,7 @@ static void __pyx_array_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *_
  *             self.callback_free_data(self.data)
  *         elif self.free_data:
  */
-  __pyx_t_1 = (__pyx_v_self->callback_free_data != NULL);
+  __pyx_t_1 = ((__pyx_v_self->callback_free_data != NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":211
@@ -5857,7 +5992,8 @@ static void __pyx_array_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *_
  *             if self.dtype_is_object:
  *                 refcount_objects_in_slice(self.data, self._shape,
  */
-  if (__pyx_v_self->free_data) {
+  __pyx_t_1 = (__pyx_v_self->free_data != 0);
+  if (__pyx_t_1) {
 
     /* "View.MemoryView":213
  *             self.callback_free_data(self.data)
@@ -5866,7 +6002,8 @@ static void __pyx_array_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *_
  *                 refcount_objects_in_slice(self.data, self._shape,
  *                                           self._strides, self.ndim, False)
  */
-    if (__pyx_v_self->dtype_is_object) {
+    __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
+    if (__pyx_t_1) {
 
       /* "View.MemoryView":215
  *             if self.dtype_is_object:
@@ -6034,9 +6171,9 @@ static PyObject *__pyx_array_MemoryView_5array_6__getattr__(struct __pyx_array_o
  *     def __getitem__(self, item):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __pyx_r = __pyx_t_2;
@@ -6093,7 +6230,7 @@ static PyObject *__pyx_array_MemoryView_5array_8__getitem__(struct __pyx_array_o
  *     def __setitem__(self, item, value):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (!__pyx_t_2) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
@@ -6150,7 +6287,7 @@ static int __pyx_array_MemoryView_5array_10__setitem__(struct __pyx_array_obj *_
  * 
  * 
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   if (PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -6195,7 +6332,7 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize
  *         result = array(shape, itemsize, format, mode.decode('ASCII'))
  *     else:
  */
-  __pyx_t_1 = (__pyx_v_buf == NULL);
+  __pyx_t_1 = ((__pyx_v_buf == NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":245
@@ -6207,7 +6344,7 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize
  */
     __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_3 = PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_3));
     __pyx_t_4 = ((PyObject *)__Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_4));
@@ -6243,7 +6380,7 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize
  */
     __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_5 = PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_5));
     __pyx_t_3 = ((PyObject *)__Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_3));
@@ -6325,6 +6462,9 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize
 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_name = 0;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
@@ -6481,7 +6621,7 @@ static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment)
  *         aligned_p += alignment - offset
  * 
  */
-  __pyx_t_1 = (__pyx_v_offset > 0);
+  __pyx_t_1 = ((__pyx_v_offset > 0) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":303
@@ -6517,6 +6657,9 @@ static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_ar
   PyObject *__pyx_v_obj = 0;
   int __pyx_v_flags;
   int __pyx_v_dtype_is_object;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
@@ -6634,11 +6777,11 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor
  *             if <PyObject *> self.view.obj == NULL:
  */
   __pyx_t_1 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)((PyObject *)__pyx_memoryview_type)));
-  if (!__pyx_t_1) {
+  if (!(__pyx_t_1 != 0)) {
     __pyx_t_2 = (__pyx_v_obj != Py_None);
-    __pyx_t_3 = __pyx_t_2;
+    __pyx_t_3 = (__pyx_t_2 != 0);
   } else {
-    __pyx_t_3 = __pyx_t_1;
+    __pyx_t_3 = (__pyx_t_1 != 0);
   }
   if (__pyx_t_3) {
 
@@ -6658,7 +6801,7 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor
  *                 (<__pyx_buffer *> &self.view).obj = Py_None
  *                 Py_INCREF(Py_None)
  */
-    __pyx_t_3 = (((PyObject *)__pyx_v_self->view.obj) == NULL);
+    __pyx_t_3 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0);
     if (__pyx_t_3) {
 
       /* "View.MemoryView":329
@@ -6701,7 +6844,7 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor
  *             raise MemoryError
  * 
  */
-  __pyx_t_3 = (__pyx_v_self->lock == NULL);
+  __pyx_t_3 = ((__pyx_v_self->lock == NULL) != 0);
   if (__pyx_t_3) {
 
     /* "View.MemoryView":334
@@ -6723,8 +6866,8 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor
  *             self.dtype_is_object = self.view.format == b'O'
  *         else:
  */
-  __pyx_t_4 = (__pyx_v_flags & PyBUF_FORMAT);
-  if (__pyx_t_4) {
+  __pyx_t_3 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
+  if (__pyx_t_3) {
 
     /* "View.MemoryView":337
  * 
@@ -6733,7 +6876,7 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor
  *         else:
  *             self.dtype_is_object = dtype_is_object
  */
-    __pyx_t_5 = PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_5));
     __pyx_t_6 = PyObject_RichCompare(((PyObject *)__pyx_t_5), ((PyObject *)__pyx_n_b__O), Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
@@ -6805,6 +6948,7 @@ static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) {
 static void __pyx_memoryview_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) {
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
+  int __pyx_t_2;
   __Pyx_RefNannySetupContext("__dealloc__", 0);
 
   /* "View.MemoryView":346
@@ -6815,7 +6959,8 @@ static void __pyx_memoryview_MemoryView_10memoryview_2__dealloc__(struct __pyx_m
  * 
  */
   __pyx_t_1 = (__pyx_v_self->obj != Py_None);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":347
  *     def __dealloc__(memoryview self):
@@ -6836,8 +6981,8 @@ static void __pyx_memoryview_MemoryView_10memoryview_2__dealloc__(struct __pyx_m
  *             PyThread_free_lock(self.lock)
  * 
  */
-  __pyx_t_1 = (__pyx_v_self->lock != NULL);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((__pyx_v_self->lock != NULL) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":350
  * 
@@ -6931,8 +7076,7 @@ static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__py
       }
       __Pyx_GOTREF(__pyx_t_5);
     }
-    __Pyx_XDECREF(__pyx_v_idx);
-    __pyx_v_idx = __pyx_t_5;
+    __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5);
     __pyx_t_5 = 0;
     __pyx_v_dim = __pyx_t_1;
     __pyx_t_1 = (__pyx_t_1 + 1);
@@ -6999,12 +7143,13 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
-  PyObject *__pyx_t_2 = NULL;
+  int __pyx_t_2;
   PyObject *__pyx_t_3 = NULL;
   PyObject *__pyx_t_4 = NULL;
   PyObject *__pyx_t_5 = NULL;
-  PyObject *(*__pyx_t_6)(PyObject *);
-  char *__pyx_t_7;
+  PyObject *__pyx_t_6 = NULL;
+  PyObject *(*__pyx_t_7)(PyObject *);
+  char *__pyx_t_8;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -7018,7 +7163,8 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  * 
  */
   __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":364
  *     def __getitem__(memoryview self, object index):
@@ -7042,10 +7188,10 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  * 
  *         cdef char *itemp
  */
-  __pyx_t_2 = ((PyObject *)_unellipsify(__pyx_v_index, __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  if (likely(PyTuple_CheckExact(__pyx_t_2))) {
-    PyObject* sequence = __pyx_t_2;
+  __pyx_t_3 = ((PyObject *)_unellipsify(__pyx_v_index, __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  if (likely(PyTuple_CheckExact(__pyx_t_3))) {
+    PyObject* sequence = __pyx_t_3;
     #if CYTHON_COMPILING_IN_CPYTHON
     Py_ssize_t size = Py_SIZE(sequence);
     #else
@@ -7057,43 +7203,45 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
       {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     #if CYTHON_COMPILING_IN_CPYTHON
-    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
-    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
-    __Pyx_INCREF(__pyx_t_3);
+    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
+    __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
     __Pyx_INCREF(__pyx_t_4);
+    __Pyx_INCREF(__pyx_t_5);
     #else
-    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
     #endif
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   } else if (1) {
     __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   } else
   {
     Py_ssize_t index = -1;
-    __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
-    index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L4_unpacking_failed;
-    __Pyx_GOTREF(__pyx_t_3);
-    index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed;
+    __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
+    index = 0; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed;
     __Pyx_GOTREF(__pyx_t_4);
-    if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_6 = NULL;
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L4_unpacking_failed;
+    __Pyx_GOTREF(__pyx_t_5);
+    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = NULL;
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
     goto __pyx_L5_unpacking_done;
     __pyx_L4_unpacking_failed:;
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_6 = NULL;
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __pyx_t_7 = NULL;
     if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_L5_unpacking_done:;
   }
-  __pyx_v_have_slices = __pyx_t_3;
-  __pyx_t_3 = 0;
-  __pyx_v_indices = __pyx_t_4;
+  __pyx_v_have_slices = __pyx_t_4;
   __pyx_t_4 = 0;
+  __pyx_v_indices = __pyx_t_5;
+  __pyx_t_5 = 0;
 
   /* "View.MemoryView":369
  * 
@@ -7102,8 +7250,8 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  *             return memview_slice(self, indices)
  *         else:
  */
-  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__pyx_t_1) {
+  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":370
  *         cdef char *itemp
@@ -7113,10 +7261,10 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  *             itemp = self.get_item_pointer(indices)
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_2 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_r = __pyx_t_2;
-    __pyx_t_2 = 0;
+    __pyx_t_3 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_r = __pyx_t_3;
+    __pyx_t_3 = 0;
     goto __pyx_L0;
     goto __pyx_L6;
   }
@@ -7129,8 +7277,8 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  *             return self.convert_item_to_object(itemp)
  * 
  */
-    __pyx_t_7 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_v_itemp = __pyx_t_7;
+    __pyx_t_8 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_8 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_v_itemp = __pyx_t_8;
 
     /* "View.MemoryView":373
  *         else:
@@ -7140,10 +7288,10 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  *     def __setitem__(memoryview self, object index, object value):
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_r = __pyx_t_2;
-    __pyx_t_2 = 0;
+    __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_r = __pyx_t_3;
+    __pyx_t_3 = 0;
     goto __pyx_L0;
   }
   __pyx_L6:;
@@ -7151,10 +7299,10 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_5);
+  __Pyx_XDECREF(__pyx_t_6);
   __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
@@ -7229,7 +7377,9 @@ static int __pyx_memoryview_MemoryView_10memoryview_6__setitem__(struct __pyx_me
     __Pyx_INCREF(__pyx_t_3);
     #else
     __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
     __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
     #endif
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   } else if (1) {
@@ -7258,8 +7408,7 @@ static int __pyx_memoryview_MemoryView_10memoryview_6__setitem__(struct __pyx_me
   }
   __pyx_v_have_slices = __pyx_t_2;
   __pyx_t_2 = 0;
-  __Pyx_DECREF(__pyx_v_index);
-  __pyx_v_index = __pyx_t_3;
+  __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_3);
   __pyx_t_3 = 0;
 
   /* "View.MemoryView":378
@@ -7372,9 +7521,9 @@ static int __pyx_memoryview_MemoryView_10memoryview_6__setitem__(struct __pyx_me
 static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
+  int __pyx_t_1;
   int __pyx_t_2;
-  int __pyx_t_3;
+  PyObject *__pyx_t_3 = NULL;
   PyObject *__pyx_t_4 = NULL;
   PyObject *__pyx_t_5 = NULL;
   PyObject *__pyx_t_6 = NULL;
@@ -7394,12 +7543,9 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
  *             try:
  *                 obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS,
  */
-  __pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryview_type));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = (!__pyx_t_2);
-  if (__pyx_t_3) {
+  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, ((PyObject *)__pyx_memoryview_type)); 
+  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":389
  *     cdef is_slice(self, obj):
@@ -7409,10 +7555,10 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
  *                                  self.dtype_is_object)
  */
     {
-      __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
+      __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
+      __Pyx_XGOTREF(__pyx_t_3);
       __Pyx_XGOTREF(__pyx_t_4);
       __Pyx_XGOTREF(__pyx_t_5);
-      __Pyx_XGOTREF(__pyx_t_6);
       /*try:*/ {
 
         /* "View.MemoryView":390
@@ -7422,8 +7568,8 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
  *                                  self.dtype_is_object)
  *             except TypeError:
  */
-        __pyx_t_1 = PyInt_FromLong((__pyx_v_self->flags | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
-        __Pyx_GOTREF(__pyx_t_1);
+        __pyx_t_6 = PyInt_FromLong((__pyx_v_self->flags | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+        __Pyx_GOTREF(__pyx_t_6);
 
         /* "View.MemoryView":391
  *             try:
@@ -7439,25 +7585,24 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
         __Pyx_INCREF(__pyx_v_obj);
         PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj);
         __Pyx_GIVEREF(__pyx_v_obj);
-        PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_1);
-        __Pyx_GIVEREF(__pyx_t_1);
+        PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
+        __Pyx_GIVEREF(__pyx_t_6);
         PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
         __Pyx_GIVEREF(__pyx_t_7);
-        __pyx_t_1 = 0;
+        __pyx_t_6 = 0;
         __pyx_t_7 = 0;
         __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject *)__pyx_memoryview_type)), ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
         __Pyx_GOTREF(__pyx_t_7);
         __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
-        __Pyx_DECREF(__pyx_v_obj);
-        __pyx_v_obj = __pyx_t_7;
+        __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7);
         __pyx_t_7 = 0;
       }
+      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
       goto __pyx_L11_try_end;
       __pyx_L4_error:;
-      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
       __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
 
@@ -7471,10 +7616,10 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
       __pyx_t_9 = PyErr_ExceptionMatches(__pyx_builtin_TypeError);
       if (__pyx_t_9) {
         __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
-        if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
+        if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
         __Pyx_GOTREF(__pyx_t_7);
         __Pyx_GOTREF(__pyx_t_8);
-        __Pyx_GOTREF(__pyx_t_1);
+        __Pyx_GOTREF(__pyx_t_6);
 
         /* "View.MemoryView":393
  *                                  self.dtype_is_object)
@@ -7486,32 +7631,32 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
         __Pyx_XDECREF(__pyx_r);
         __Pyx_INCREF(Py_None);
         __pyx_r = Py_None;
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
         goto __pyx_L7_except_return;
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
         goto __pyx_L5_exception_handled;
       }
       __pyx_L6_except_error:;
+      __Pyx_XGIVEREF(__pyx_t_3);
       __Pyx_XGIVEREF(__pyx_t_4);
       __Pyx_XGIVEREF(__pyx_t_5);
-      __Pyx_XGIVEREF(__pyx_t_6);
-      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
+      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
       goto __pyx_L1_error;
       __pyx_L7_except_return:;
+      __Pyx_XGIVEREF(__pyx_t_3);
       __Pyx_XGIVEREF(__pyx_t_4);
       __Pyx_XGIVEREF(__pyx_t_5);
-      __Pyx_XGIVEREF(__pyx_t_6);
-      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
+      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
       goto __pyx_L0;
       __pyx_L5_exception_handled:;
+      __Pyx_XGIVEREF(__pyx_t_3);
       __Pyx_XGIVEREF(__pyx_t_4);
       __Pyx_XGIVEREF(__pyx_t_5);
-      __Pyx_XGIVEREF(__pyx_t_6);
-      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
+      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
       __pyx_L11_try_end:;
     }
     goto __pyx_L3;
@@ -7533,7 +7678,7 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_XDECREF(__pyx_t_6);
   __Pyx_XDECREF(__pyx_t_7);
   __Pyx_XDECREF(__pyx_t_8);
   __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -7559,11 +7704,9 @@ static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryvi
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
-  PyObject *__pyx_t_2 = NULL;
-  PyObject *__pyx_t_3 = NULL;
+  int __pyx_t_2;
+  int __pyx_t_3;
   int __pyx_t_4;
-  int __pyx_t_5;
-  int __pyx_t_6;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -7577,8 +7720,6 @@ static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryvi
  *                                  src.ndim, dst.ndim, self.dtype_is_object)
  */
   if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_1 = __pyx_v_src;
-  __Pyx_INCREF(__pyx_t_1);
 
   /* "View.MemoryView":402
  * 
@@ -7588,8 +7729,6 @@ static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryvi
  * 
  */
   if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_2 = __pyx_v_dst;
-  __Pyx_INCREF(__pyx_t_2);
 
   /* "View.MemoryView":403
  *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
@@ -7598,24 +7737,20 @@ static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryvi
  * 
  *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):
  */
-  __pyx_t_3 = PyObject_GetAttr(__pyx_v_src, __pyx_n_s__ndim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = PyObject_GetAttr(__pyx_v_dst, __pyx_n_s__ndim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_6 = __pyx_memoryview_copy_contents((__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_t_1), (&__pyx_v_src_slice))[0]), (__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_t_2), (&__pyx_v_dst_slice))[0]), __pyx_t_4, __pyx_t_5, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s__ndim); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __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_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s__ndim); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_4 = __pyx_memoryview_copy_contents((__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice))[0]), (__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice))[0]), __pyx_t_2, __pyx_t_3, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_XDECREF(__pyx_t_3);
   __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
@@ -7677,7 +7812,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor
  *             tmp = malloc(self.view.itemsize)
  *             if tmp == NULL:
  */
-  __pyx_t_1 = (((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array)));
+  __pyx_t_1 = ((((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":414
@@ -7696,7 +7831,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor
  *                 raise MemoryError
  *             item = tmp
  */
-    __pyx_t_1 = (__pyx_v_tmp == NULL);
+    __pyx_t_1 = ((__pyx_v_tmp == NULL) != 0);
     if (__pyx_t_1) {
 
       /* "View.MemoryView":416
@@ -7741,7 +7876,8 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor
  *             (<PyObject **> item)[0] = <PyObject *> value
  *         else:
  */
-  if (__pyx_v_self->dtype_is_object) {
+  __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
+  if (__pyx_t_1) {
 
     /* "View.MemoryView":422
  * 
@@ -7851,7 +7987,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor
  *             assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
  *         slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
  */
-  __pyx_t_1 = (__pyx_v_self->view.suboffsets != NULL);
+  __pyx_t_1 = ((__pyx_v_self->view.suboffsets != NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":433
@@ -8000,9 +8136,9 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview
  *         try:
  *             result = struct.unpack(self.view.format, bytesitem)
  */
-  __pyx_t_1 = PyBytes_FromStringAndSize(((const char*)__pyx_v_itemp) + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  __pyx_v_bytesitem = __pyx_t_1;
+  __pyx_v_bytesitem = ((PyObject*)__pyx_t_1);
   __pyx_t_1 = 0;
 
   /* "View.MemoryView":449
@@ -8026,9 +8162,9 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview
  *         except struct.error:
  *             raise ValueError("Unable to convert item to object")
  */
-      __pyx_t_1 = PyObject_GetAttr(__pyx_v_struct, __pyx_n_s__unpack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s__unpack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_5 = PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_5));
       __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       __Pyx_GOTREF(__pyx_t_6);
@@ -8055,7 +8191,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview
  *             return result
  */
       __pyx_t_7 = strlen(__pyx_v_self->view.format); 
-      __pyx_t_8 = (__pyx_t_7 == 1);
+      __pyx_t_8 = ((__pyx_t_7 == 1) != 0);
       if (__pyx_t_8) {
 
         /* "View.MemoryView":455
@@ -8066,7 +8202,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview
  * 
  */
         __Pyx_XDECREF(__pyx_r);
-        __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_result, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
+        __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_result, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_5) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
         __Pyx_GOTREF(__pyx_t_5);
         __pyx_r = __pyx_t_5;
         __pyx_t_5 = 0;
@@ -8103,7 +8239,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview
  *             raise ValueError("Unable to convert item to object")
  *         else:
  */
-    __pyx_t_5 = PyObject_GetAttr(__pyx_v_struct, __pyx_n_s__error); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
+    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s__error); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __pyx_t_9 = PyErr_ExceptionMatches(__pyx_t_5);
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
@@ -8121,7 +8257,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview
  *         else:
  *             if len(self.view.format) == 1:
  */
-      __pyx_t_10 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_29), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
+      __pyx_t_10 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_28), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
       __Pyx_GOTREF(__pyx_t_10);
       __Pyx_Raise(__pyx_t_10, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
@@ -8186,15 +8322,16 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
   int __pyx_t_2;
-  PyObject *__pyx_t_3 = NULL;
+  int __pyx_t_3;
   PyObject *__pyx_t_4 = NULL;
   PyObject *__pyx_t_5 = NULL;
-  Py_ssize_t __pyx_t_6;
-  PyObject *__pyx_t_7 = NULL;
-  char *__pyx_t_8;
+  PyObject *__pyx_t_6 = NULL;
+  Py_ssize_t __pyx_t_7;
+  PyObject *__pyx_t_8 = NULL;
   char *__pyx_t_9;
   char *__pyx_t_10;
   char *__pyx_t_11;
+  char *__pyx_t_12;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -8219,11 +8356,9 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  *             bytesvalue = struct.pack(self.view.format, *value)
  *         else:
  */
-  __pyx_t_1 = ((PyObject *)((PyObject*)(&PyTuple_Type)));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_value, __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (__pyx_t_2) {
+  __pyx_t_2 = PyTuple_Check(__pyx_v_value); 
+  __pyx_t_3 = (__pyx_t_2 != 0);
+  if (__pyx_t_3) {
 
     /* "View.MemoryView":467
  * 
@@ -8232,28 +8367,28 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  *         else:
  *             bytesvalue = struct.pack(self.view.format, value)
  */
-    __pyx_t_1 = PyObject_GetAttr(__pyx_v_struct, __pyx_n_s__pack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s__pack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_3 = PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
-    __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
-    __pyx_t_3 = 0;
-    __pyx_t_3 = PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-    __pyx_t_5 = PyNumber_Add(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+    __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4));
+    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
+    __pyx_t_4 = 0;
+    __pyx_t_4 = PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+    __pyx_t_6 = PyNumber_Add(((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
+    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-    __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
-    if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_v_bytesvalue = ((PyObject*)__pyx_t_3);
-    __pyx_t_3 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+    if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_4)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
+    __pyx_t_4 = 0;
     goto __pyx_L3;
   }
   /*else*/ {
@@ -8265,25 +8400,25 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  * 
  *         for i, c in enumerate(bytesvalue):
  */
-    __pyx_t_3 = PyObject_GetAttr(__pyx_v_struct, __pyx_n_s__pack); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_5 = PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s__pack); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
     __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_5));
-    __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
+    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_6));
+    __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
     __Pyx_INCREF(__pyx_v_value);
     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_value);
     __Pyx_GIVEREF(__pyx_v_value);
-    __pyx_t_5 = 0;
-    __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __pyx_t_6 = 0;
+    __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-    if (!(likely(PyBytes_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_5)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_v_bytesvalue = ((PyObject*)__pyx_t_5);
-    __pyx_t_5 = 0;
+    if (!(likely(PyBytes_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_6)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_v_bytesvalue = ((PyObject*)__pyx_t_6);
+    __pyx_t_6 = 0;
   }
   __pyx_L3:;
 
@@ -8294,18 +8429,18 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  *             itemp[i] = c
  * 
  */
-  __pyx_t_6 = 0;
+  __pyx_t_7 = 0;
   if (unlikely(((PyObject *)__pyx_v_bytesvalue) == Py_None)) {
     PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   __Pyx_INCREF(((PyObject *)__pyx_v_bytesvalue));
-  __pyx_t_7 = __pyx_v_bytesvalue;
-  __pyx_t_9 = PyBytes_AS_STRING(__pyx_t_7);
-  __pyx_t_10 = (__pyx_t_9 + PyBytes_GET_SIZE(__pyx_t_7));
-  for (__pyx_t_11 = __pyx_t_9; __pyx_t_11 < __pyx_t_10; __pyx_t_11++) {
-    __pyx_t_8 = __pyx_t_11;
-    __pyx_v_c = (__pyx_t_8[0]);
+  __pyx_t_8 = __pyx_v_bytesvalue;
+  __pyx_t_10 = PyBytes_AS_STRING(__pyx_t_8);
+  __pyx_t_11 = (__pyx_t_10 + PyBytes_GET_SIZE(__pyx_t_8));
+  for (__pyx_t_12 = __pyx_t_10; __pyx_t_12 < __pyx_t_11; __pyx_t_12++) {
+    __pyx_t_9 = __pyx_t_12;
+    __pyx_v_c = (__pyx_t_9[0]);
 
     /* "View.MemoryView":472
  * 
@@ -8314,7 +8449,7 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  * 
  *     @cname('getbuffer')
  */
-    __pyx_v_i = __pyx_t_6;
+    __pyx_v_i = __pyx_t_7;
 
     /* "View.MemoryView":471
  *             bytesvalue = struct.pack(self.view.format, value)
@@ -8323,7 +8458,7 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  *             itemp[i] = c
  * 
  */
-    __pyx_t_6 = (__pyx_t_6 + 1);
+    __pyx_t_7 = (__pyx_t_7 + 1);
 
     /* "View.MemoryView":472
  * 
@@ -8334,16 +8469,16 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  */
     (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c;
   }
-  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_5);
-  __Pyx_XDECREF(((PyObject *)__pyx_t_7));
+  __Pyx_XDECREF(__pyx_t_6);
+  __Pyx_XDECREF(((PyObject *)__pyx_t_8));
   __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
@@ -8355,8 +8490,8 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
 }
 
 /* Python wrapper */
-static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
-static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
+static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
+static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
@@ -8377,6 +8512,11 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
+  Py_ssize_t *__pyx_t_2;
+  char *__pyx_t_3;
+  void *__pyx_t_4;
+  int __pyx_t_5;
+  Py_ssize_t __pyx_t_6;
   __Pyx_RefNannySetupContext("__getbuffer__", 0);
   if (__pyx_v_info != NULL) {
     __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
@@ -8390,7 +8530,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *             info.shape = self.view.shape
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_flags & PyBUF_STRIDES);
+  __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":477
@@ -8400,7 +8540,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         else:
  *             info.shape = NULL
  */
-    __pyx_v_info->shape = __pyx_v_self->view.shape;
+    __pyx_t_2 = __pyx_v_self->view.shape;
+    __pyx_v_info->shape = __pyx_t_2;
     goto __pyx_L3;
   }
   /*else*/ {
@@ -8423,7 +8564,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *             info.strides = self.view.strides
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_flags & PyBUF_STRIDES);
+  __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":482
@@ -8433,7 +8574,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         else:
  *             info.strides = NULL
  */
-    __pyx_v_info->strides = __pyx_v_self->view.strides;
+    __pyx_t_2 = __pyx_v_self->view.strides;
+    __pyx_v_info->strides = __pyx_t_2;
     goto __pyx_L4;
   }
   /*else*/ {
@@ -8456,7 +8598,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *             info.suboffsets = self.view.suboffsets
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_flags & PyBUF_INDIRECT);
+  __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":487
@@ -8466,7 +8608,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         else:
  *             info.suboffsets = NULL
  */
-    __pyx_v_info->suboffsets = __pyx_v_self->view.suboffsets;
+    __pyx_t_2 = __pyx_v_self->view.suboffsets;
+    __pyx_v_info->suboffsets = __pyx_t_2;
     goto __pyx_L5;
   }
   /*else*/ {
@@ -8489,7 +8632,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *             info.format = self.view.format
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_flags & PyBUF_FORMAT);
+  __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":492
@@ -8499,7 +8642,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         else:
  *             info.format = NULL
  */
-    __pyx_v_info->format = __pyx_v_self->view.format;
+    __pyx_t_3 = __pyx_v_self->view.format;
+    __pyx_v_info->format = __pyx_t_3;
     goto __pyx_L6;
   }
   /*else*/ {
@@ -8522,7 +8666,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         info.ndim = self.view.ndim
  *         info.itemsize = self.view.itemsize
  */
-  __pyx_v_info->buf = __pyx_v_self->view.buf;
+  __pyx_t_4 = __pyx_v_self->view.buf;
+  __pyx_v_info->buf = __pyx_t_4;
 
   /* "View.MemoryView":497
  * 
@@ -8531,7 +8676,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         info.itemsize = self.view.itemsize
  *         info.len = self.view.len
  */
-  __pyx_v_info->ndim = __pyx_v_self->view.ndim;
+  __pyx_t_5 = __pyx_v_self->view.ndim;
+  __pyx_v_info->ndim = __pyx_t_5;
 
   /* "View.MemoryView":498
  *         info.buf = self.view.buf
@@ -8540,7 +8686,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         info.len = self.view.len
  *         info.readonly = 0
  */
-  __pyx_v_info->itemsize = __pyx_v_self->view.itemsize;
+  __pyx_t_6 = __pyx_v_self->view.itemsize;
+  __pyx_v_info->itemsize = __pyx_t_6;
 
   /* "View.MemoryView":499
  *         info.ndim = self.view.ndim
@@ -8549,7 +8696,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         info.readonly = 0
  *         info.obj = self
  */
-  __pyx_v_info->len = __pyx_v_self->view.len;
+  __pyx_t_6 = __pyx_v_self->view.len;
+  __pyx_v_info->len = __pyx_t_6;
 
   /* "View.MemoryView":500
  *         info.itemsize = self.view.itemsize
@@ -8749,10 +8897,10 @@ static PyObject *__pyx_memoryview_get_shape_MemoryView_10memoryview_5shape___get
     __pyx_v_i = __pyx_t_3;
     __pyx_t_4 = PyInt_FromSsize_t((__pyx_v_self->view.shape[__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    if (unlikely(__Pyx_PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   }
-  __pyx_t_4 = ((PyObject *)PyList_AsTuple(__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = ((PyObject *)PyList_AsTuple(((PyObject*)__pyx_t_1))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_4));
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   __pyx_r = ((PyObject *)__pyx_t_4);
@@ -8812,7 +8960,7 @@ static PyObject *__pyx_memoryview_get_strides_MemoryView_10memoryview_7strides__
  * 
  *                 raise ValueError("Buffer view does not expose strides")
  */
-  __pyx_t_1 = (__pyx_v_self->view.strides == NULL);
+  __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":528
@@ -8822,7 +8970,7 @@ static PyObject *__pyx_memoryview_get_strides_MemoryView_10memoryview_7strides__
  * 
  *             return tuple([self.view.strides[i] for i in xrange(self.view.ndim)])
  */
-    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_31), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_30), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
@@ -8846,10 +8994,10 @@ static PyObject *__pyx_memoryview_get_strides_MemoryView_10memoryview_7strides__
     __pyx_v_i = __pyx_t_4;
     __pyx_t_5 = PyInt_FromSsize_t((__pyx_v_self->view.strides[__pyx_v_i])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    if (unlikely(__Pyx_PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
   }
-  __pyx_t_5 = ((PyObject *)PyList_AsTuple(__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = ((PyObject *)PyList_AsTuple(((PyObject*)__pyx_t_2))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_5));
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __pyx_r = ((PyObject *)__pyx_t_5);
@@ -8909,7 +9057,7 @@ static PyObject *__pyx_memoryview_get_suboffsets_MemoryView_10memoryview_10subof
  *                 return [-1] * self.view.ndim
  * 
  */
-  __pyx_t_1 = (__pyx_v_self->view.suboffsets == NULL);
+  __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":536
@@ -8951,10 +9099,10 @@ static PyObject *__pyx_memoryview_get_suboffsets_MemoryView_10memoryview_10subof
     __pyx_v_i = __pyx_t_4;
     __pyx_t_5 = PyInt_FromSsize_t((__pyx_v_self->view.suboffsets[__pyx_v_i])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    if (unlikely(__Pyx_PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
   }
-  __pyx_t_5 = ((PyObject *)PyList_AsTuple(__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = ((PyObject *)PyList_AsTuple(((PyObject*)__pyx_t_2))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_5));
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __pyx_r = ((PyObject *)__pyx_t_5);
@@ -9120,7 +9268,7 @@ static PyObject *__pyx_memoryview_get_nbytes_MemoryView_10memoryview_6nbytes___g
  *     property size:
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
@@ -9171,10 +9319,11 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
-  PyObject *__pyx_t_2 = NULL;
+  int __pyx_t_2;
   PyObject *__pyx_t_3 = NULL;
-  Py_ssize_t __pyx_t_4;
-  PyObject *(*__pyx_t_5)(PyObject *);
+  PyObject *__pyx_t_4 = NULL;
+  Py_ssize_t __pyx_t_5;
+  PyObject *(*__pyx_t_6)(PyObject *);
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -9188,7 +9337,8 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__
  * 
  */
   __pyx_t_1 = (__pyx_v_self->_size == Py_None);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":559
  *         def __get__(self):
@@ -9207,46 +9357,45 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__
  *                     result *= length
  * 
  */
-    __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
-      __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
-      __pyx_t_5 = NULL;
+    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) {
+      __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
+      __pyx_t_6 = NULL;
     } else {
-      __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext;
+      __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_4);
+      __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext;
     }
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     for (;;) {
-      if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_3)) {
-        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
+      if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_4)) {
+        if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
         #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         #else
-        __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         #endif
-      } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_3)) {
-        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
+      } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_4)) {
+        if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
         #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         #else
-        __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         #endif
       } else {
-        __pyx_t_2 = __pyx_t_5(__pyx_t_3);
-        if (unlikely(!__pyx_t_2)) {
+        __pyx_t_3 = __pyx_t_6(__pyx_t_4);
+        if (unlikely(!__pyx_t_3)) {
           if (PyErr_Occurred()) {
             if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
             else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           }
           break;
         }
-        __Pyx_GOTREF(__pyx_t_2);
+        __Pyx_GOTREF(__pyx_t_3);
       }
-      __Pyx_XDECREF(__pyx_v_length);
-      __pyx_v_length = __pyx_t_2;
-      __pyx_t_2 = 0;
+      __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_3);
+      __pyx_t_3 = 0;
 
       /* "View.MemoryView":562
  * 
@@ -9255,13 +9404,12 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__
  * 
  *                 self._size = result
  */
-      __pyx_t_2 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(__pyx_v_result);
-      __pyx_v_result = __pyx_t_2;
-      __pyx_t_2 = 0;
+      __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_3);
+      __pyx_t_3 = 0;
     }
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
     /* "View.MemoryView":564
  *                     result *= length
@@ -9294,8 +9442,8 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
+  __Pyx_XDECREF(__pyx_t_4);
   __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
@@ -9338,7 +9486,7 @@ static Py_ssize_t __pyx_memoryview_MemoryView_10memoryview_10__len__(struct __py
  *             return self.view.shape[0]
  * 
  */
-  __pyx_t_1 = (__pyx_v_self->view.ndim >= 1);
+  __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":570
@@ -9408,12 +9556,12 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_12__repr__(struct __py
  * 
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__base); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__base); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____name__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s____name__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
@@ -9440,7 +9588,7 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_12__repr__(struct __py
   __Pyx_GIVEREF(__pyx_t_3);
   __pyx_t_1 = 0;
   __pyx_t_3 = 0;
-  __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_32), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_31), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_3));
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __pyx_r = ((PyObject *)__pyx_t_3);
@@ -9498,12 +9646,12 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_14__str__(struct __pyx
  * 
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__base); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__base); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____name__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s____name__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -9511,7 +9659,7 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_14__str__(struct __pyx
   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
   __pyx_t_1 = 0;
-  __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_33), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_32), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __pyx_r = ((PyObject *)__pyx_t_1);
@@ -9919,30 +10067,26 @@ static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, in
 /* "View.MemoryView":624
  * 
  * @cname('__pyx_memoryview_check')
- * cdef bint memoryview_check(object o):             # <<<<<<<<<<<<<<
+ * cdef inline bint memoryview_check(object o):             # <<<<<<<<<<<<<<
  *     return isinstance(o, memoryview)
  * 
  */
 
-static int __pyx_memoryview_check(PyObject *__pyx_v_o) {
+static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
-  int __pyx_t_2;
+  int __pyx_t_1;
   __Pyx_RefNannySetupContext("memoryview_check", 0);
 
   /* "View.MemoryView":625
  * @cname('__pyx_memoryview_check')
- * cdef bint memoryview_check(object o):
+ * cdef inline bint memoryview_check(object o):
  *     return isinstance(o, memoryview)             # <<<<<<<<<<<<<<
  * 
  * cdef tuple _unellipsify(object index, int ndim):
  */
-  __pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryview_type));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_o, __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_r = __pyx_t_2;
+  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, ((PyObject *)__pyx_memoryview_type)); 
+  __pyx_r = __pyx_t_1;
   goto __pyx_L0;
 
   __pyx_r = 0;
@@ -9969,9 +10113,9 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
   PyObject *__pyx_v_nslices = NULL;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
+  int __pyx_t_1;
   int __pyx_t_2;
-  int __pyx_t_3;
+  PyObject *__pyx_t_3 = NULL;
   PyObject *__pyx_t_4 = NULL;
   Py_ssize_t __pyx_t_5;
   PyObject *(*__pyx_t_6)(PyObject *);
@@ -9993,12 +10137,9 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *         tup = (index,)
  *     else:
  */
-  __pyx_t_1 = ((PyObject *)((PyObject*)(&PyTuple_Type)));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_index, __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = (!__pyx_t_2);
-  if (__pyx_t_3) {
+  __pyx_t_1 = PyTuple_Check(__pyx_v_index); 
+  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":633
  *     """
@@ -10007,13 +10148,13 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *     else:
  *         tup = index
  */
-    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
     __Pyx_INCREF(__pyx_v_index);
-    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_index);
+    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index);
     __Pyx_GIVEREF(__pyx_v_index);
-    __pyx_v_tup = ((PyObject *)__pyx_t_1);
-    __pyx_t_1 = 0;
+    __pyx_v_tup = ((PyObject *)__pyx_t_3);
+    __pyx_t_3 = 0;
     goto __pyx_L3;
   }
   /*else*/ {
@@ -10037,10 +10178,10 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *     have_slices = False
  *     seen_ellipsis = False
  */
-  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_v_result = __pyx_t_1;
-  __pyx_t_1 = 0;
+  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_v_result = ((PyObject*)__pyx_t_3);
+  __pyx_t_3 = 0;
 
   /* "View.MemoryView":638
  * 
@@ -10049,10 +10190,10 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *     seen_ellipsis = False
  *     for idx, item in enumerate(tup):
  */
-  __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_v_have_slices = __pyx_t_1;
-  __pyx_t_1 = 0;
+  __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_v_have_slices = __pyx_t_3;
+  __pyx_t_3 = 0;
 
   /* "View.MemoryView":639
  *     result = []
@@ -10071,7 +10212,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *             if not seen_ellipsis:
  */
   __Pyx_INCREF(__pyx_int_0);
-  __pyx_t_1 = __pyx_int_0;
+  __pyx_t_3 = __pyx_int_0;
   if (PyList_CheckExact(__pyx_v_tup) || PyTuple_CheckExact(__pyx_v_tup)) {
     __pyx_t_4 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
     __pyx_t_6 = NULL;
@@ -10106,16 +10247,14 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
       }
       __Pyx_GOTREF(__pyx_t_7);
     }
-    __Pyx_XDECREF(__pyx_v_item);
-    __pyx_v_item = __pyx_t_7;
+    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7);
     __pyx_t_7 = 0;
-    __Pyx_INCREF(__pyx_t_1);
-    __Pyx_XDECREF(__pyx_v_idx);
-    __pyx_v_idx = __pyx_t_1;
-    __pyx_t_7 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_INCREF(__pyx_t_3);
+    __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3);
+    __pyx_t_7 = PyNumber_Add(__pyx_t_3, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
-    __Pyx_DECREF(__pyx_t_1);
-    __pyx_t_1 = __pyx_t_7;
+    __Pyx_DECREF(__pyx_t_3);
+    __pyx_t_3 = __pyx_t_7;
     __pyx_t_7 = 0;
 
     /* "View.MemoryView":641
@@ -10125,8 +10264,9 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *             if not seen_ellipsis:
  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
  */
-    __pyx_t_3 = (__pyx_v_item == __pyx_builtin_Ellipsis);
-    if (__pyx_t_3) {
+    __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis);
+    __pyx_t_1 = (__pyx_t_2 != 0);
+    if (__pyx_t_1) {
 
       /* "View.MemoryView":642
  *     for idx, item in enumerate(tup):
@@ -10135,8 +10275,8 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
  *                 seen_ellipsis = True
  */
-      __pyx_t_3 = (!__pyx_v_seen_ellipsis);
-      if (__pyx_t_3) {
+      __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0);
+      if (__pyx_t_1) {
 
         /* "View.MemoryView":643
  *         if item is Ellipsis:
@@ -10145,9 +10285,9 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *                 seen_ellipsis = True
  *             else:
  */
-        __pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_v_result), __pyx_n_s__extend); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_result), __pyx_n_s__extend); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_7);
-        __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_34), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_33), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_8);
         __pyx_t_9 = PyObject_Length(__pyx_v_tup); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __pyx_t_10 = PyList_New(1 * ((((__pyx_v_ndim - __pyx_t_9) + 1)<0) ? 0:((__pyx_v_ndim - __pyx_t_9) + 1))); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -10190,9 +10330,9 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *             have_slices = True
  *         else:
  */
-        __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_35), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_34), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_10);
-        __pyx_t_11 = PyList_Append(__pyx_v_result, __pyx_t_10); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_10); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
       }
       __pyx_L7:;
@@ -10206,8 +10346,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  */
       __pyx_t_10 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_10);
-      __Pyx_DECREF(__pyx_v_have_slices);
-      __pyx_v_have_slices = __pyx_t_10;
+      __Pyx_DECREF_SET(__pyx_v_have_slices, __pyx_t_10);
       __pyx_t_10 = 0;
       goto __pyx_L6;
     }
@@ -10220,14 +10359,11 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *                 raise TypeError("Cannot index with type '%s'" % type(item))
  * 
  */
-      __pyx_t_10 = ((PyObject *)((PyObject*)(&PySlice_Type)));
-      __Pyx_INCREF(__pyx_t_10);
-      __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_item, __pyx_t_10); 
-      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-      __pyx_t_2 = (!__pyx_t_3);
+      __pyx_t_1 = PySlice_Check(__pyx_v_item); 
+      __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
       if (__pyx_t_2) {
-        __pyx_t_3 = (!PyIndex_Check(__pyx_v_item));
-        __pyx_t_12 = __pyx_t_3;
+        __pyx_t_1 = ((!(__Pyx_PyIndex_Check(__pyx_v_item) != 0)) != 0);
+        __pyx_t_12 = __pyx_t_1;
       } else {
         __pyx_t_12 = __pyx_t_2;
       }
@@ -10240,7 +10376,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  * 
  *             have_slices = have_slices or isinstance(item, slice)
  */
-        __pyx_t_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_36), ((PyObject *)Py_TYPE(__pyx_v_item))); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_35), ((PyObject *)Py_TYPE(__pyx_v_item))); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(((PyObject *)__pyx_t_10));
         __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_8);
@@ -10266,10 +10402,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  */
       __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       if (!__pyx_t_12) {
-        __pyx_t_10 = ((PyObject *)((PyObject*)(&PySlice_Type)));
-        __Pyx_INCREF(__pyx_t_10);
-        __pyx_t_12 = __Pyx_TypeCheck(__pyx_v_item, __pyx_t_10); 
-        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+        __pyx_t_12 = PySlice_Check(__pyx_v_item); 
         __pyx_t_10 = __Pyx_PyBool_FromLong(__pyx_t_12); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_10);
         __pyx_t_8 = __pyx_t_10;
@@ -10278,8 +10411,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
         __Pyx_INCREF(__pyx_v_have_slices);
         __pyx_t_8 = __pyx_v_have_slices;
       }
-      __Pyx_DECREF(__pyx_v_have_slices);
-      __pyx_v_have_slices = __pyx_t_8;
+      __Pyx_DECREF_SET(__pyx_v_have_slices, __pyx_t_8);
       __pyx_t_8 = 0;
 
       /* "View.MemoryView":653
@@ -10289,12 +10421,12 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  * 
  *     nslices = ndim - len(result)
  */
-      __pyx_t_11 = PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     __pyx_L6:;
   }
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
   /* "View.MemoryView":655
  *             result.append(item)
@@ -10304,10 +10436,10 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *         result.extend([slice(None)] * nslices)
  */
   __pyx_t_5 = PyList_GET_SIZE(((PyObject *)__pyx_v_result)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_1 = PyInt_FromSsize_t((__pyx_v_ndim - __pyx_t_5)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_v_nslices = __pyx_t_1;
-  __pyx_t_1 = 0;
+  __pyx_t_3 = PyInt_FromSsize_t((__pyx_v_ndim - __pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_v_nslices = __pyx_t_3;
+  __pyx_t_3 = 0;
 
   /* "View.MemoryView":656
  * 
@@ -10326,9 +10458,9 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  * 
  *     return have_slices or nslices, tuple(result)
  */
-    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_result), __pyx_n_s__extend); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_37), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_result), __pyx_n_s__extend); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_36), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_8);
@@ -10345,9 +10477,9 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
     PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
     __pyx_t_8 = 0;
-    __pyx_t_8 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_8 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_8);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
     goto __pyx_L9;
@@ -10372,22 +10504,22 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
   }
   __pyx_t_4 = ((PyObject *)PyList_AsTuple(__pyx_v_result)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8);
+  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_8);
   __Pyx_GIVEREF(__pyx_t_8);
-  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_t_4));
+  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_t_4));
   __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
   __pyx_t_8 = 0;
   __pyx_t_4 = 0;
-  __pyx_r = __pyx_t_1;
-  __pyx_t_1 = 0;
+  __pyx_r = ((PyObject*)__pyx_t_3);
+  __pyx_t_3 = 0;
   goto __pyx_L0;
 
   __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_7);
   __Pyx_XDECREF(__pyx_t_8);
@@ -10445,7 +10577,7 @@ static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __
  *             raise ValueError("Indirect dimensions not supported")
  * 
  */
-    __pyx_t_3 = ((__pyx_v_suboffsets[__pyx_v_i]) >= 0);
+    __pyx_t_3 = (((__pyx_v_suboffsets[__pyx_v_i]) >= 0) != 0);
     if (__pyx_t_3) {
 
       /* "View.MemoryView":665
@@ -10455,7 +10587,7 @@ static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __
  * 
  * 
  */
-      __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_39), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_38), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_4);
       __Pyx_Raise(__pyx_t_4, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
@@ -10504,15 +10636,18 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
   PyObject *__pyx_v_index = NULL;
   struct __pyx_memoryview_obj *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
+  int __pyx_t_1;
   int __pyx_t_2;
-  int __pyx_t_3;
-  Py_ssize_t __pyx_t_4;
-  PyObject *(*__pyx_t_5)(PyObject *);
+  struct __pyx_memoryview_obj *__pyx_t_3;
+  char *__pyx_t_4;
+  int __pyx_t_5;
   PyObject *__pyx_t_6 = NULL;
-  int __pyx_t_7;
-  Py_ssize_t __pyx_t_8;
+  Py_ssize_t __pyx_t_7;
+  PyObject *(*__pyx_t_8)(PyObject *);
   PyObject *__pyx_t_9 = NULL;
+  Py_ssize_t __pyx_t_10;
+  int __pyx_t_11;
+  PyObject *__pyx_t_12 = NULL;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -10545,7 +10680,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *     if isinstance(memview, _memoryviewslice):
  */
   #ifndef CYTHON_WITHOUT_ASSERTIONS
-  if (unlikely(!(__pyx_v_memview->view.ndim > 0))) {
+  if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) {
     PyErr_SetNone(PyExc_AssertionError);
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
@@ -10558,10 +10693,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *         memviewsliceobj = memview
  *         p_src = &memviewsliceobj.from_slice
  */
-  __pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryviewslice_type));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), ((PyObject *)__pyx_memoryviewslice_type)); 
+  __pyx_t_2 = (__pyx_t_1 != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":687
@@ -10614,7 +10747,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *     dst.data = p_src.data
  * 
  */
-  __pyx_v_dst.memview = __pyx_v_p_src->memview;
+  __pyx_t_3 = __pyx_v_p_src->memview;
+  __pyx_v_dst.memview = __pyx_t_3;
 
   /* "View.MemoryView":698
  * 
@@ -10623,7 +10757,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  * 
  * 
  */
-  __pyx_v_dst.data = __pyx_v_p_src->data;
+  __pyx_t_4 = __pyx_v_p_src->data;
+  __pyx_v_dst.data = __pyx_t_4;
 
   /* "View.MemoryView":703
  * 
@@ -10650,46 +10785,45 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *         if PyIndex_Check(index):
  *             slice_memviewslice(
  */
-  __pyx_t_3 = 0;
+  __pyx_t_5 = 0;
   if (PyList_CheckExact(__pyx_v_indices) || PyTuple_CheckExact(__pyx_v_indices)) {
-    __pyx_t_1 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0;
-    __pyx_t_5 = NULL;
+    __pyx_t_6 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_6); __pyx_t_7 = 0;
+    __pyx_t_8 = NULL;
   } else {
-    __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext;
+    __pyx_t_7 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __pyx_t_8 = Py_TYPE(__pyx_t_6)->tp_iternext;
   }
   for (;;) {
-    if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_1)) {
-      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
+    if (!__pyx_t_8 && PyList_CheckExact(__pyx_t_6)) {
+      if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_6)) break;
       #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       #else
-      __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       #endif
-    } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_1)) {
-      if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+    } else if (!__pyx_t_8 && PyTuple_CheckExact(__pyx_t_6)) {
+      if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
       #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       #else
-      __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       #endif
     } else {
-      __pyx_t_6 = __pyx_t_5(__pyx_t_1);
-      if (unlikely(!__pyx_t_6)) {
+      __pyx_t_9 = __pyx_t_8(__pyx_t_6);
+      if (unlikely(!__pyx_t_9)) {
         if (PyErr_Occurred()) {
           if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
           else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         }
         break;
       }
-      __Pyx_GOTREF(__pyx_t_6);
+      __Pyx_GOTREF(__pyx_t_9);
     }
-    __Pyx_XDECREF(__pyx_v_index);
-    __pyx_v_index = __pyx_t_6;
-    __pyx_t_6 = 0;
-    __pyx_v_dim = __pyx_t_3;
-    __pyx_t_3 = (__pyx_t_3 + 1);
+    __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9);
+    __pyx_t_9 = 0;
+    __pyx_v_dim = __pyx_t_5;
+    __pyx_t_5 = (__pyx_t_5 + 1);
 
     /* "View.MemoryView":709
  * 
@@ -10698,8 +10832,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             slice_memviewslice(
  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
  */
-    __pyx_t_7 = PyIndex_Check(__pyx_v_index);
-    if (__pyx_t_7) {
+    __pyx_t_2 = (__Pyx_PyIndex_Check(__pyx_v_index) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":713
  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
@@ -10708,7 +10842,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *                 0, 0, 0, # have_{start,stop,step}
  *                 False)
  */
-      __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
       /* "View.MemoryView":715
  *                 index, 0, 0, # start, stop, step
@@ -10717,7 +10851,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *         elif index is None:
  *             p_dst.shape[new_ndim] = 1
  */
-      __pyx_t_7 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_8, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_10, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L6;
     }
 
@@ -10729,7 +10863,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             p_dst.strides[new_ndim] = 0
  */
     __pyx_t_2 = (__pyx_v_index == Py_None);
-    if (__pyx_t_2) {
+    __pyx_t_1 = (__pyx_t_2 != 0);
+    if (__pyx_t_1) {
 
       /* "View.MemoryView":717
  *                 False)
@@ -10777,20 +10912,20 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             stop = index.stop or 0
  *             step = index.step or 0
  */
-      __pyx_t_6 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_6);
-      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      if (!__pyx_t_2) {
-        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
+      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      if (!__pyx_t_1) {
+        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
         __Pyx_INCREF(__pyx_int_0);
-        __pyx_t_9 = __pyx_int_0;
+        __pyx_t_12 = __pyx_int_0;
       } else {
-        __pyx_t_9 = __pyx_t_6;
-        __pyx_t_6 = 0;
+        __pyx_t_12 = __pyx_t_9;
+        __pyx_t_9 = 0;
       }
-      __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_v_start = __pyx_t_8;
+      __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_12); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+      __pyx_v_start = __pyx_t_10;
 
       /* "View.MemoryView":723
  *         else:
@@ -10799,20 +10934,20 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             step = index.step or 0
  * 
  */
-      __pyx_t_9 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__stop); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      if (!__pyx_t_2) {
-        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__stop); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_12);
+      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      if (!__pyx_t_1) {
+        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
         __Pyx_INCREF(__pyx_int_0);
-        __pyx_t_6 = __pyx_int_0;
+        __pyx_t_9 = __pyx_int_0;
       } else {
-        __pyx_t_6 = __pyx_t_9;
-        __pyx_t_9 = 0;
+        __pyx_t_9 = __pyx_t_12;
+        __pyx_t_12 = 0;
       }
-      __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-      __pyx_v_stop = __pyx_t_8;
+      __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_v_stop = __pyx_t_10;
 
       /* "View.MemoryView":724
  *             start = index.start or 0
@@ -10821,20 +10956,20 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  * 
  *             have_start = index.start is not None
  */
-      __pyx_t_6 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_6);
-      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      if (!__pyx_t_2) {
-        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
+      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      if (!__pyx_t_1) {
+        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
         __Pyx_INCREF(__pyx_int_0);
-        __pyx_t_9 = __pyx_int_0;
+        __pyx_t_12 = __pyx_int_0;
       } else {
-        __pyx_t_9 = __pyx_t_6;
-        __pyx_t_6 = 0;
+        __pyx_t_12 = __pyx_t_9;
+        __pyx_t_9 = 0;
       }
-      __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_v_step = __pyx_t_8;
+      __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_12); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+      __pyx_v_step = __pyx_t_10;
 
       /* "View.MemoryView":726
  *             step = index.step or 0
@@ -10843,11 +10978,11 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             have_stop = index.stop is not None
  *             have_step = index.step is not None
  */
-      __pyx_t_9 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_2 = (__pyx_t_9 != Py_None);
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_v_have_start = __pyx_t_2;
+      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_12);
+      __pyx_t_1 = (__pyx_t_12 != Py_None);
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+      __pyx_v_have_start = __pyx_t_1;
 
       /* "View.MemoryView":727
  * 
@@ -10856,11 +10991,11 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             have_step = index.step is not None
  * 
  */
-      __pyx_t_9 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__stop); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_2 = (__pyx_t_9 != Py_None);
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_v_have_stop = __pyx_t_2;
+      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__stop); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_12);
+      __pyx_t_1 = (__pyx_t_12 != Py_None);
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+      __pyx_v_have_stop = __pyx_t_1;
 
       /* "View.MemoryView":728
  *             have_start = index.start is not None
@@ -10869,11 +11004,11 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  * 
  *             slice_memviewslice(
  */
-      __pyx_t_9 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_2 = (__pyx_t_9 != Py_None);
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_v_have_step = __pyx_t_2;
+      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_12);
+      __pyx_t_1 = (__pyx_t_12 != Py_None);
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+      __pyx_v_have_step = __pyx_t_1;
 
       /* "View.MemoryView":735
  *                 start, stop, step,
@@ -10882,7 +11017,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             new_ndim += 1
  * 
  */
-      __pyx_t_7 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
       /* "View.MemoryView":736
  *                 have_start, have_stop, have_step,
@@ -10895,7 +11030,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
     }
     __pyx_L6:;
   }
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
 
   /* "View.MemoryView":738
  *             new_ndim += 1
@@ -10904,10 +11039,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *         return memoryview_fromslice(dst, new_ndim,
  *                                     memviewsliceobj.to_object_func,
  */
-  __pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryviewslice_type));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), ((PyObject *)__pyx_memoryviewslice_type)); 
+  __pyx_t_2 = (__pyx_t_1 != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":739
@@ -10935,11 +11068,11 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *     else:
  *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,
  */
-    __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_1);
-    __pyx_t_1 = 0;
+    __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_6);
+    __pyx_t_6 = 0;
     goto __pyx_L0;
     goto __pyx_L7;
   }
@@ -10961,11 +11094,11 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  * 
  * 
  */
-    __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_1);
-    __pyx_t_1 = 0;
+    __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_6);
+    __pyx_t_6 = 0;
     goto __pyx_L0;
   }
   __pyx_L7:;
@@ -10973,9 +11106,9 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
   __pyx_r = ((struct __pyx_memoryview_obj *)Py_None); __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_6);
   __Pyx_XDECREF(__pyx_t_9);
+  __Pyx_XDECREF(__pyx_t_12);
   __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
@@ -11002,7 +11135,6 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
   int __pyx_t_2;
   int __pyx_t_3;
   int __pyx_t_4;
-  Py_ssize_t __pyx_t_5;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -11014,7 +11146,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  * 
  *         if start < 0:
  */
-  __pyx_t_1 = (!__pyx_v_is_slice);
+  __pyx_t_1 = ((!(__pyx_v_is_slice != 0)) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":791
@@ -11024,7 +11156,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             start += shape
  *         if not 0 <= start < shape:
  */
-    __pyx_t_1 = (__pyx_v_start < 0);
+    __pyx_t_1 = ((__pyx_v_start < 0) != 0);
     if (__pyx_t_1) {
 
       /* "View.MemoryView":792
@@ -11050,7 +11182,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
     if (__pyx_t_1) {
       __pyx_t_1 = (__pyx_v_start < __pyx_v_shape);
     }
-    __pyx_t_2 = (!__pyx_t_1);
+    __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":794
@@ -11060,7 +11192,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *     else:
  * 
  */
-      __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, __pyx_k_40, __pyx_v_dim); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, __pyx_k_39, __pyx_v_dim); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L5;
     }
     __pyx_L5:;
@@ -11091,11 +11223,11 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
  * 
  */
-    if (__pyx_v_have_step) {
+    if ((__pyx_v_have_step != 0)) {
       __pyx_t_4 = (__pyx_v_step == 0);
       __pyx_t_2 = __pyx_t_4;
     } else {
-      __pyx_t_2 = __pyx_v_have_step;
+      __pyx_t_2 = (__pyx_v_have_step != 0);
     }
     if (__pyx_t_2) {
 
@@ -11106,7 +11238,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  * 
  * 
  */
-      __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, __pyx_k_41, __pyx_v_dim); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, __pyx_k_40, __pyx_v_dim); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L6;
     }
     __pyx_L6:;
@@ -11118,7 +11250,8 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             if start < 0:
  *                 start += shape
  */
-    if (__pyx_v_have_start) {
+    __pyx_t_2 = (__pyx_v_have_start != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":804
  * 
@@ -11127,7 +11260,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 start += shape
  *                 if start < 0:
  */
-      __pyx_t_2 = (__pyx_v_start < 0);
+      __pyx_t_2 = ((__pyx_v_start < 0) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":805
@@ -11146,7 +11279,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                     start = 0
  *             elif start >= shape:
  */
-        __pyx_t_2 = (__pyx_v_start < 0);
+        __pyx_t_2 = ((__pyx_v_start < 0) != 0);
         if (__pyx_t_2) {
 
           /* "View.MemoryView":807
@@ -11170,7 +11303,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 if negative_step:
  *                     start = shape - 1
  */
-      __pyx_t_2 = (__pyx_v_start >= __pyx_v_shape);
+      __pyx_t_2 = ((__pyx_v_start >= __pyx_v_shape) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":809
@@ -11180,7 +11313,8 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                     start = shape - 1
  *                 else:
  */
-        if (__pyx_v_negative_step) {
+        __pyx_t_2 = (__pyx_v_negative_step != 0);
+        if (__pyx_t_2) {
 
           /* "View.MemoryView":810
  *             elif start >= shape:
@@ -11218,7 +11352,8 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 start = shape - 1
  *             else:
  */
-      if (__pyx_v_negative_step) {
+      __pyx_t_2 = (__pyx_v_negative_step != 0);
+      if (__pyx_t_2) {
 
         /* "View.MemoryView":815
  *         else:
@@ -11252,7 +11387,8 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             if stop < 0:
  *                 stop += shape
  */
-    if (__pyx_v_have_stop) {
+    __pyx_t_2 = (__pyx_v_have_stop != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":820
  * 
@@ -11261,7 +11397,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 stop += shape
  *                 if stop < 0:
  */
-      __pyx_t_2 = (__pyx_v_stop < 0);
+      __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":821
@@ -11280,7 +11416,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                     stop = 0
  *             elif stop > shape:
  */
-        __pyx_t_2 = (__pyx_v_stop < 0);
+        __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
         if (__pyx_t_2) {
 
           /* "View.MemoryView":823
@@ -11304,7 +11440,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 stop = shape
  *         else:
  */
-      __pyx_t_2 = (__pyx_v_stop > __pyx_v_shape);
+      __pyx_t_2 = ((__pyx_v_stop > __pyx_v_shape) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":825
@@ -11329,7 +11465,8 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 stop = -1
  *             else:
  */
-      if (__pyx_v_negative_step) {
+      __pyx_t_2 = (__pyx_v_negative_step != 0);
+      if (__pyx_t_2) {
 
         /* "View.MemoryView":828
  *         else:
@@ -11363,7 +11500,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             step = 1
  * 
  */
-    __pyx_t_2 = (!__pyx_v_have_step);
+    __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":833
@@ -11383,23 +11520,23 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *         with cython.cdivision(True):
  *             new_shape = (stop - start) // step             # <<<<<<<<<<<<<<
  * 
- *             if (stop - start) % step:
+ *             if (stop - start) - step * new_shape:
  */
     __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step);
 
     /* "View.MemoryView":839
  *             new_shape = (stop - start) // step
  * 
- *             if (stop - start) % step:             # <<<<<<<<<<<<<<
+ *             if (stop - start) - step * new_shape:             # <<<<<<<<<<<<<<
  *                 new_shape += 1
  * 
  */
-    __pyx_t_5 = ((__pyx_v_stop - __pyx_v_start) % __pyx_v_step);
-    if (__pyx_t_5) {
+    __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":840
  * 
- *             if (stop - start) % step:
+ *             if (stop - start) - step * new_shape:
  *                 new_shape += 1             # <<<<<<<<<<<<<<
  * 
  *         if new_shape < 0:
@@ -11416,7 +11553,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             new_shape = 0
  * 
  */
-    __pyx_t_2 = (__pyx_v_new_shape < 0);
+    __pyx_t_2 = ((__pyx_v_new_shape < 0) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":843
@@ -11467,7 +11604,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *         dst.data += start * stride
  *     else:
  */
-  __pyx_t_2 = ((__pyx_v_suboffset_dim[0]) < 0);
+  __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":852
@@ -11501,7 +11638,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *         if not is_slice:
  *             if new_ndim == 0:
  */
-  __pyx_t_2 = (__pyx_v_suboffset >= 0);
+  __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":857
@@ -11511,7 +11648,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             if new_ndim == 0:
  *                 dst.data = (<char **> dst.data)[0] + suboffset
  */
-    __pyx_t_2 = (!__pyx_v_is_slice);
+    __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":858
@@ -11521,7 +11658,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 dst.data = (<char **> dst.data)[0] + suboffset
  *             else:
  */
-      __pyx_t_2 = (__pyx_v_new_ndim == 0);
+      __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":859
@@ -11543,7 +11680,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *         else:
  *             suboffset_dim[0] = new_ndim
  */
-        __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, __pyx_k_42, __pyx_v_dim); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, __pyx_k_41, __pyx_v_dim); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       }
       __pyx_L22:;
       goto __pyx_L21;
@@ -11595,11 +11732,11 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  * 
  * @cname('__pyx_pybuffer_index')
  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,             # <<<<<<<<<<<<<<
- *                           int dim) except NULL:
+ *                           Py_ssize_t dim) except NULL:
  *     cdef Py_ssize_t shape, stride, suboffset = -1
  */
 
-static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, int __pyx_v_dim) {
+static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) {
   Py_ssize_t __pyx_v_shape;
   Py_ssize_t __pyx_v_stride;
   Py_ssize_t __pyx_v_suboffset;
@@ -11607,9 +11744,10 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
   char *__pyx_v_resultp;
   char *__pyx_r;
   __Pyx_RefNannyDeclarations
-  int __pyx_t_1;
-  PyObject *__pyx_t_2 = NULL;
+  Py_ssize_t __pyx_t_1;
+  int __pyx_t_2;
   PyObject *__pyx_t_3 = NULL;
+  PyObject *__pyx_t_4 = NULL;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -11617,7 +11755,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
 
   /* "View.MemoryView":874
  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,
- *                           int dim) except NULL:
+ *                           Py_ssize_t dim) except NULL:
  *     cdef Py_ssize_t shape, stride, suboffset = -1             # <<<<<<<<<<<<<<
  *     cdef Py_ssize_t itemsize = view.itemsize
  *     cdef char *resultp
@@ -11625,13 +11763,14 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
   __pyx_v_suboffset = -1;
 
   /* "View.MemoryView":875
- *                           int dim) except NULL:
+ *                           Py_ssize_t dim) except NULL:
  *     cdef Py_ssize_t shape, stride, suboffset = -1
  *     cdef Py_ssize_t itemsize = view.itemsize             # <<<<<<<<<<<<<<
  *     cdef char *resultp
  * 
  */
-  __pyx_v_itemsize = __pyx_v_view->itemsize;
+  __pyx_t_1 = __pyx_v_view->itemsize;
+  __pyx_v_itemsize = __pyx_t_1;
 
   /* "View.MemoryView":878
  *     cdef char *resultp
@@ -11640,8 +11779,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *         shape = view.len / itemsize
  *         stride = itemsize
  */
-  __pyx_t_1 = (__pyx_v_view->ndim == 0);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":879
  * 
@@ -11651,11 +11790,23 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *     else:
  */
     if (unlikely(__pyx_v_itemsize == 0)) {
+      #ifdef WITH_THREAD
+      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+      #endif
       PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero");
+      #ifdef WITH_THREAD
+      PyGILState_Release(__pyx_gilstate_save);
+      #endif
       {__pyx_filename = __pyx_f[2]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     else if (sizeof(Py_ssize_t) == sizeof(long) && unlikely(__pyx_v_itemsize == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) {
+      #ifdef WITH_THREAD
+      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+      #endif
       PyErr_Format(PyExc_OverflowError, "value too large to perform division");
+      #ifdef WITH_THREAD
+      PyGILState_Release(__pyx_gilstate_save);
+      #endif
       {__pyx_filename = __pyx_f[2]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize);
@@ -11697,8 +11848,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *             suboffset = view.suboffsets[dim]
  * 
  */
-    __pyx_t_1 = (__pyx_v_view->suboffsets != NULL);
-    if (__pyx_t_1) {
+    __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":885
  *         stride = view.strides[dim]
@@ -11721,8 +11872,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *         index += view.shape[dim]
  *         if index < 0:
  */
-  __pyx_t_1 = (__pyx_v_index < 0);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((__pyx_v_index < 0) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":888
  * 
@@ -11740,8 +11891,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
  * 
  */
-    __pyx_t_1 = (__pyx_v_index < 0);
-    if (__pyx_t_1) {
+    __pyx_t_2 = ((__pyx_v_index < 0) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":890
  *         index += view.shape[dim]
@@ -11750,21 +11901,21 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  * 
  *     if index >= shape:
  */
-      __pyx_t_2 = PyInt_FromLong(__pyx_v_dim); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_43), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3));
-      __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
-      __pyx_t_3 = 0;
-      __pyx_t_3 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
-      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+      __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_42), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
+      __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
+      __pyx_t_4 = 0;
+      __pyx_t_4 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_4);
+      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
+      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
       {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L6;
     }
@@ -11780,8 +11931,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
  * 
  */
-  __pyx_t_1 = (__pyx_v_index >= __pyx_v_shape);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":893
  * 
@@ -11790,21 +11941,21 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  * 
  *     resultp = bufp + index * stride
  */
-    __pyx_t_3 = PyInt_FromLong(__pyx_v_dim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_42), __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
+    __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
+    __pyx_t_3 = 0;
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_43), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
-    __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
-    __pyx_t_2 = 0;
-    __pyx_t_2 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L7;
   }
@@ -11826,8 +11977,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *         resultp = (<char **> resultp)[0] + suboffset
  * 
  */
-  __pyx_t_1 = (__pyx_v_suboffset >= 0);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":897
  *     resultp = bufp + index * stride
@@ -11854,8 +12005,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
   __pyx_r = 0;
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
+  __Pyx_XDECREF(__pyx_t_4);
   __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
@@ -11878,14 +12029,15 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
   int __pyx_v_i;
   int __pyx_v_j;
   int __pyx_r;
-  long __pyx_t_1;
-  int __pyx_t_2;
-  Py_ssize_t __pyx_t_3;
+  int __pyx_t_1;
+  Py_ssize_t *__pyx_t_2;
+  long __pyx_t_3;
   Py_ssize_t __pyx_t_4;
-  int __pyx_t_5;
+  Py_ssize_t __pyx_t_5;
   int __pyx_t_6;
   int __pyx_t_7;
   int __pyx_t_8;
+  int __pyx_t_9;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -11897,7 +12049,8 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  * 
  *     cdef Py_ssize_t *shape = memslice.shape
  */
-  __pyx_v_ndim = __pyx_v_memslice->memview->view.ndim;
+  __pyx_t_1 = __pyx_v_memslice->memview->view.ndim;
+  __pyx_v_ndim = __pyx_t_1;
 
   /* "View.MemoryView":908
  *     cdef int ndim = memslice.memview.view.ndim
@@ -11906,7 +12059,8 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  *     cdef Py_ssize_t *strides = memslice.strides
  * 
  */
-  __pyx_v_shape = __pyx_v_memslice->shape;
+  __pyx_t_2 = __pyx_v_memslice->shape;
+  __pyx_v_shape = __pyx_t_2;
 
   /* "View.MemoryView":909
  * 
@@ -11915,7 +12069,8 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  * 
  * 
  */
-  __pyx_v_strides = __pyx_v_memslice->strides;
+  __pyx_t_2 = __pyx_v_memslice->strides;
+  __pyx_v_strides = __pyx_t_2;
 
   /* "View.MemoryView":913
  * 
@@ -11924,9 +12079,9 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  *         j = ndim - 1 - i
  *         strides[i], strides[j] = strides[j], strides[i]
  */
-  __pyx_t_1 = __Pyx_div_long(__pyx_v_ndim, 2);
-  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
-    __pyx_v_i = __pyx_t_2;
+  __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2);
+  for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_3; __pyx_t_1+=1) {
+    __pyx_v_i = __pyx_t_1;
 
     /* "View.MemoryView":914
  *     cdef int i, j
@@ -11944,10 +12099,10 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  *         shape[i], shape[j] = shape[j], shape[i]
  * 
  */
-    __pyx_t_3 = (__pyx_v_strides[__pyx_v_j]);
-    __pyx_t_4 = (__pyx_v_strides[__pyx_v_i]);
-    (__pyx_v_strides[__pyx_v_i]) = __pyx_t_3;
-    (__pyx_v_strides[__pyx_v_j]) = __pyx_t_4;
+    __pyx_t_4 = (__pyx_v_strides[__pyx_v_j]);
+    __pyx_t_5 = (__pyx_v_strides[__pyx_v_i]);
+    (__pyx_v_strides[__pyx_v_i]) = __pyx_t_4;
+    (__pyx_v_strides[__pyx_v_j]) = __pyx_t_5;
 
     /* "View.MemoryView":916
  *         j = ndim - 1 - i
@@ -11956,10 +12111,10 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  * 
  *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
  */
-    __pyx_t_4 = (__pyx_v_shape[__pyx_v_j]);
-    __pyx_t_3 = (__pyx_v_shape[__pyx_v_i]);
-    (__pyx_v_shape[__pyx_v_i]) = __pyx_t_4;
-    (__pyx_v_shape[__pyx_v_j]) = __pyx_t_3;
+    __pyx_t_5 = (__pyx_v_shape[__pyx_v_j]);
+    __pyx_t_4 = (__pyx_v_shape[__pyx_v_i]);
+    (__pyx_v_shape[__pyx_v_i]) = __pyx_t_5;
+    (__pyx_v_shape[__pyx_v_j]) = __pyx_t_4;
 
     /* "View.MemoryView":918
  *         shape[i], shape[j] = shape[j], shape[i]
@@ -11968,14 +12123,14 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
  * 
  */
-    __pyx_t_5 = ((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0);
-    if (!__pyx_t_5) {
-      __pyx_t_6 = ((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0);
-      __pyx_t_7 = __pyx_t_6;
+    __pyx_t_6 = (((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0) != 0);
+    if (!__pyx_t_6) {
+      __pyx_t_7 = (((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0) != 0);
+      __pyx_t_8 = __pyx_t_7;
     } else {
-      __pyx_t_7 = __pyx_t_5;
+      __pyx_t_8 = __pyx_t_6;
     }
-    if (__pyx_t_7) {
+    if (__pyx_t_8) {
 
       /* "View.MemoryView":919
  * 
@@ -11984,7 +12139,7 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  * 
  *     return 1
  */
-      __pyx_t_8 = __pyx_memoryview_err(__pyx_builtin_ValueError, __pyx_k_44); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = __pyx_memoryview_err(__pyx_builtin_ValueError, __pyx_k_43); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L5;
     }
     __pyx_L5:;
@@ -12075,7 +12230,7 @@ static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memor
  *             return self.to_object_func(itemp)
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_self->to_object_func != NULL);
+  __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":943
@@ -12149,7 +12304,7 @@ static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memo
  *             self.to_dtype_func(itemp, value)
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_self->to_dtype_func != NULL);
+  __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":949
@@ -12248,8 +12403,11 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
   int __pyx_t_1;
   PyObject *__pyx_t_2 = NULL;
   PyObject *__pyx_t_3 = NULL;
-  int __pyx_t_4;
-  int __pyx_t_5;
+  __Pyx_TypeInfo *__pyx_t_4;
+  Py_buffer __pyx_t_5;
+  Py_ssize_t __pyx_t_6;
+  int __pyx_t_7;
+  int __pyx_t_8;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -12262,7 +12420,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
  *         return None
  * 
  */
-  __pyx_t_1 = (((PyObject *)__pyx_v_memviewslice.memview) == Py_None);
+  __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":972
@@ -12331,7 +12489,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
  *     result.typeinfo = memviewslice.memview.typeinfo
  * 
  */
-  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s__base); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s__base); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_GIVEREF(__pyx_t_2);
   __Pyx_GOTREF(__pyx_v_result->from_object);
@@ -12346,7 +12504,8 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
  * 
  *     result.view = memviewslice.memview.view
  */
-  __pyx_v_result->__pyx_base.typeinfo = __pyx_v_memviewslice.memview->typeinfo;
+  __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo;
+  __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4;
 
   /* "View.MemoryView":985
  *     result.typeinfo = memviewslice.memview.typeinfo
@@ -12355,7 +12514,8 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
  *     result.view.buf = <void *> memviewslice.data
  *     result.view.ndim = ndim
  */
-  __pyx_v_result->__pyx_base.view = __pyx_v_memviewslice.memview->view;
+  __pyx_t_5 = __pyx_v_memviewslice.memview->view;
+  __pyx_v_result->__pyx_base.view = __pyx_t_5;
 
   /* "View.MemoryView":986
  * 
@@ -12436,7 +12596,8 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
  *     for i in range(ndim):
  *         result.view.len *= result.view.shape[i]
  */
-  __pyx_v_result->__pyx_base.view.len = __pyx_v_result->__pyx_base.view.itemsize;
+  __pyx_t_6 = __pyx_v_result->__pyx_base.view.itemsize;
+  __pyx_v_result->__pyx_base.view.len = __pyx_t_6;
 
   /* "View.MemoryView":998
  * 
@@ -12445,9 +12606,9 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
  *         result.view.len *= result.view.shape[i]
  * 
  */
-  __pyx_t_4 = __pyx_v_ndim;
-  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
-    __pyx_v_i = __pyx_t_5;
+  __pyx_t_7 = __pyx_v_ndim;
+  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
+    __pyx_v_i = __pyx_t_8;
 
     /* "View.MemoryView":999
  *     result.view.len = result.view.itemsize
@@ -12515,7 +12676,7 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p
   struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0;
   __Pyx_memviewslice *__pyx_r;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
+  int __pyx_t_1;
   int __pyx_t_2;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
@@ -12529,10 +12690,8 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p
  *         obj = memview
  *         return &obj.from_slice
  */
-  __pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryviewslice_type));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), ((PyObject *)__pyx_memoryviewslice_type)); 
+  __pyx_t_2 = (__pyx_t_1 != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":1011
@@ -12583,7 +12742,6 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p
   __pyx_r = 0;
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
   __Pyx_WriteUnraisable("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
@@ -12606,9 +12764,10 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem
   Py_ssize_t *__pyx_v_strides;
   Py_ssize_t *__pyx_v_suboffsets;
   __Pyx_RefNannyDeclarations
-  int __pyx_t_1;
+  Py_ssize_t *__pyx_t_1;
   int __pyx_t_2;
   int __pyx_t_3;
+  int __pyx_t_4;
   __Pyx_RefNannySetupContext("slice_copy", 0);
 
   /* "View.MemoryView":1022
@@ -12618,7 +12777,8 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem
  *     strides = memview.view.strides
  *     suboffsets = memview.view.suboffsets
  */
-  __pyx_v_shape = __pyx_v_memview->view.shape;
+  __pyx_t_1 = __pyx_v_memview->view.shape;
+  __pyx_v_shape = __pyx_t_1;
 
   /* "View.MemoryView":1023
  * 
@@ -12627,7 +12787,8 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem
  *     suboffsets = memview.view.suboffsets
  * 
  */
-  __pyx_v_strides = __pyx_v_memview->view.strides;
+  __pyx_t_1 = __pyx_v_memview->view.strides;
+  __pyx_v_strides = __pyx_t_1;
 
   /* "View.MemoryView":1024
  *     shape = memview.view.shape
@@ -12636,7 +12797,8 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem
  * 
  *     dst.memview = <__pyx_memoryview *> memview
  */
-  __pyx_v_suboffsets = __pyx_v_memview->view.suboffsets;
+  __pyx_t_1 = __pyx_v_memview->view.suboffsets;
+  __pyx_v_suboffsets = __pyx_t_1;
 
   /* "View.MemoryView":1026
  *     suboffsets = memview.view.suboffsets
@@ -12663,9 +12825,9 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem
  *         dst.shape[dim] = shape[dim]
  *         dst.strides[dim] = strides[dim]
  */
-  __pyx_t_1 = __pyx_v_memview->view.ndim;
-  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
-    __pyx_v_dim = __pyx_t_2;
+  __pyx_t_2 = __pyx_v_memview->view.ndim;
+  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
+    __pyx_v_dim = __pyx_t_3;
 
     /* "View.MemoryView":1030
  * 
@@ -12692,8 +12854,8 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem
  *             dst.suboffsets[dim] = -1
  *         else:
  */
-    __pyx_t_3 = (__pyx_v_suboffsets == NULL);
-    if (__pyx_t_3) {
+    __pyx_t_4 = ((__pyx_v_suboffsets == NULL) != 0);
+    if (__pyx_t_4) {
 
       /* "View.MemoryView":1033
  *         dst.strides[dim] = strides[dim]
@@ -12788,8 +12950,11 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview
   int (*__pyx_v_to_dtype_func)(char *, PyObject *);
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
+  int __pyx_t_1;
   int __pyx_t_2;
+  PyObject *(*__pyx_t_3)(char *);
+  int (*__pyx_t_4)(char *, PyObject *);
+  PyObject *__pyx_t_5 = NULL;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -12802,10 +12967,8 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview
  *         to_object_func = (<_memoryviewslice> memview).to_object_func
  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
  */
-  __pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryviewslice_type));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), ((PyObject *)__pyx_memoryviewslice_type)); 
+  __pyx_t_2 = (__pyx_t_1 != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":1053
@@ -12815,7 +12978,8 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview
  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
  *     else:
  */
-    __pyx_v_to_object_func = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
+    __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
+    __pyx_v_to_object_func = __pyx_t_3;
 
     /* "View.MemoryView":1054
  *     if isinstance(memview, _memoryviewslice):
@@ -12824,7 +12988,8 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview
  *     else:
  *         to_object_func = NULL
  */
-    __pyx_v_to_dtype_func = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
+    __pyx_t_4 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
+    __pyx_v_to_dtype_func = __pyx_t_4;
     goto __pyx_L3;
   }
   /*else*/ {
@@ -12865,16 +13030,16 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview
  * 
  * 
  */
-  __pyx_t_1 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_r = __pyx_t_1;
-  __pyx_t_1 = 0;
+  __pyx_t_5 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
+  __pyx_r = __pyx_t_5;
+  __pyx_t_5 = 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_5);
   __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
@@ -12902,7 +13067,7 @@ static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) {
  *         return -arg
  *     else:
  */
-  __pyx_t_1 = (__pyx_v_arg < 0);
+  __pyx_t_1 = ((__pyx_v_arg < 0) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":1069
@@ -12987,7 +13152,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _
  *             c_stride = mslice.strides[i]
  *             break
  */
-    __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1);
+    __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":1084
@@ -13031,7 +13196,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _
  *             f_stride = mslice.strides[i]
  *             break
  */
-    __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1);
+    __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":1089
@@ -13064,7 +13229,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _
  *         return 'C'
  *     else:
  */
-  __pyx_t_2 = (abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride));
+  __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":1093
@@ -13161,7 +13326,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v
  *        if (src_stride > 0 and dst_stride > 0 and
  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
  */
-  __pyx_t_1 = (__pyx_v_ndim == 1);
+  __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":1111
@@ -13171,9 +13336,9 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v
  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
  *            memcpy(dst_data, src_data, itemsize * dst_extent)
  */
-    __pyx_t_1 = (__pyx_v_src_stride > 0);
+    __pyx_t_1 = ((__pyx_v_src_stride > 0) != 0);
     if (__pyx_t_1) {
-      __pyx_t_2 = (__pyx_v_dst_stride > 0);
+      __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":1112
@@ -13187,7 +13352,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v
         if (__pyx_t_3) {
           __pyx_t_3 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride));
         }
-        __pyx_t_4 = __pyx_t_3;
+        __pyx_t_4 = (__pyx_t_3 != 0);
       } else {
         __pyx_t_4 = __pyx_t_2;
       }
@@ -13329,8 +13494,9 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_sr
   int __pyx_v_i;
   Py_ssize_t __pyx_v_size;
   Py_ssize_t __pyx_r;
-  int __pyx_t_1;
+  Py_ssize_t __pyx_t_1;
   int __pyx_t_2;
+  int __pyx_t_3;
 
   /* "View.MemoryView":1138
  *     "Return the size of the memory occupied by the slice in number of bytes"
@@ -13339,7 +13505,8 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_sr
  * 
  *     for i in range(ndim):
  */
-  __pyx_v_size = __pyx_v_src->memview->view.itemsize;
+  __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
+  __pyx_v_size = __pyx_t_1;
 
   /* "View.MemoryView":1140
  *     cdef Py_ssize_t size = src.memview.view.itemsize
@@ -13348,9 +13515,9 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_sr
  *         size *= src.shape[i]
  * 
  */
-  __pyx_t_1 = __pyx_v_ndim;
-  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
-    __pyx_v_i = __pyx_t_2;
+  __pyx_t_2 = __pyx_v_ndim;
+  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
+    __pyx_v_i = __pyx_t_3;
 
     /* "View.MemoryView":1141
  * 
@@ -13399,7 +13566,7 @@ static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_
  *         for idx in range(ndim):
  *             strides[idx] = stride
  */
-  __pyx_t_1 = (__pyx_v_order == 'F');
+  __pyx_t_1 = ((__pyx_v_order == 'F') != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":1156
@@ -13495,9 +13662,11 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
   size_t __pyx_v_itemsize;
   size_t __pyx_v_size;
   void *__pyx_r;
-  int __pyx_t_1;
+  Py_ssize_t __pyx_t_1;
   int __pyx_t_2;
   int __pyx_t_3;
+  struct __pyx_memoryview_obj *__pyx_t_4;
+  int __pyx_t_5;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -13509,7 +13678,8 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *     cdef size_t size = slice_get_size(src, ndim)
  * 
  */
-  __pyx_v_itemsize = __pyx_v_src->memview->view.itemsize;
+  __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
+  __pyx_v_itemsize = __pyx_t_1;
 
   /* "View.MemoryView":1179
  * 
@@ -13536,8 +13706,8 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *         _err(MemoryError, NULL)
  * 
  */
-  __pyx_t_1 = (!(__pyx_v_result != 0));
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":1183
  *     result = malloc(size)
@@ -13546,7 +13716,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  * 
  * 
  */
-    __pyx_t_2 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L3;
   }
   __pyx_L3:;
@@ -13567,7 +13737,8 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *     for i in range(ndim):
  *         tmpslice.shape[i] = src.shape[i]
  */
-  __pyx_v_tmpslice->memview = __pyx_v_src->memview;
+  __pyx_t_4 = __pyx_v_src->memview;
+  __pyx_v_tmpslice->memview = __pyx_t_4;
 
   /* "View.MemoryView":1188
  *     tmpslice.data = <char *> result
@@ -13576,9 +13747,9 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *         tmpslice.shape[i] = src.shape[i]
  *         tmpslice.suboffsets[i] = -1
  */
-  __pyx_t_2 = __pyx_v_ndim;
-  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
-    __pyx_v_i = __pyx_t_3;
+  __pyx_t_3 = __pyx_v_ndim;
+  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_3; __pyx_t_5+=1) {
+    __pyx_v_i = __pyx_t_5;
 
     /* "View.MemoryView":1189
  *     tmpslice.memview = src.memview
@@ -13615,9 +13786,9 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *         if tmpslice.shape[i] == 1:
  *             tmpslice.strides[i] = 0
  */
-  __pyx_t_2 = __pyx_v_ndim;
-  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
-    __pyx_v_i = __pyx_t_3;
+  __pyx_t_3 = __pyx_v_ndim;
+  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_3; __pyx_t_5+=1) {
+    __pyx_v_i = __pyx_t_5;
 
     /* "View.MemoryView":1197
  * 
@@ -13626,8 +13797,8 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *             tmpslice.strides[i] = 0
  * 
  */
-    __pyx_t_1 = ((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1);
-    if (__pyx_t_1) {
+    __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1198
  *     for i in range(ndim):
@@ -13649,8 +13820,8 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *         memcpy(result, src.data, size)
  *     else:
  */
-  __pyx_t_1 = __pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":1201
  * 
@@ -13749,7 +13920,7 @@ static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent
   __pyx_t_1 = 0;
   __pyx_t_2 = 0;
   __pyx_t_3 = 0;
-  __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_45), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_44), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_3));
   __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
   __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -13878,7 +14049,7 @@ static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) {
  *         raise error(msg.decode('ascii'))
  *     else:
  */
-  __pyx_t_1 = (__pyx_v_msg != NULL);
+  __pyx_t_1 = ((__pyx_v_msg != NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":1222
@@ -13951,11 +14122,13 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
   __Pyx_memviewslice __pyx_v_tmp;
   int __pyx_v_ndim;
   int __pyx_r;
-  int __pyx_t_1;
+  Py_ssize_t __pyx_t_1;
   int __pyx_t_2;
   int __pyx_t_3;
   int __pyx_t_4;
-  void *__pyx_t_5;
+  int __pyx_t_5;
+  void *__pyx_t_6;
+  int __pyx_t_7;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -13976,7 +14149,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *     cdef int i
  *     cdef char order = get_best_order(&src, src_ndim)
  */
-  __pyx_v_itemsize = __pyx_v_src.memview->view.itemsize;
+  __pyx_t_1 = __pyx_v_src.memview->view.itemsize;
+  __pyx_v_itemsize = __pyx_t_1;
 
   /* "View.MemoryView":1238
  *     cdef size_t itemsize = src.memview.view.itemsize
@@ -14012,8 +14186,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *         broadcast_leading(&src, src_ndim, dst_ndim)
  *     elif dst_ndim < src_ndim:
  */
-  __pyx_t_1 = (__pyx_v_src_ndim < __pyx_v_dst_ndim);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":1244
  * 
@@ -14033,8 +14207,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *         broadcast_leading(&dst, dst_ndim, src_ndim)
  * 
  */
-  __pyx_t_1 = (__pyx_v_dst_ndim < __pyx_v_src_ndim);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":1246
  *         broadcast_leading(&src, src_ndim, dst_ndim)
@@ -14055,14 +14229,14 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  *     for i in range(ndim):
  */
-  __pyx_t_2 = __pyx_v_dst_ndim;
-  __pyx_t_3 = __pyx_v_src_ndim;
-  if ((__pyx_t_2 > __pyx_t_3)) {
-    __pyx_t_4 = __pyx_t_2;
+  __pyx_t_3 = __pyx_v_dst_ndim;
+  __pyx_t_4 = __pyx_v_src_ndim;
+  if (((__pyx_t_3 > __pyx_t_4) != 0)) {
+    __pyx_t_5 = __pyx_t_3;
   } else {
-    __pyx_t_4 = __pyx_t_3;
+    __pyx_t_5 = __pyx_t_4;
   }
-  __pyx_v_ndim = __pyx_t_4;
+  __pyx_v_ndim = __pyx_t_5;
 
   /* "View.MemoryView":1250
  *     cdef int ndim = max(src_ndim, dst_ndim)
@@ -14071,9 +14245,9 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *         if src.shape[i] != dst.shape[i]:
  *             if src.shape[i] == 1:
  */
-  __pyx_t_4 = __pyx_v_ndim;
-  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_4; __pyx_t_2+=1) {
-    __pyx_v_i = __pyx_t_2;
+  __pyx_t_5 = __pyx_v_ndim;
+  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_5; __pyx_t_3+=1) {
+    __pyx_v_i = __pyx_t_3;
 
     /* "View.MemoryView":1251
  * 
@@ -14082,8 +14256,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *             if src.shape[i] == 1:
  *                 broadcasting = True
  */
-    __pyx_t_1 = ((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i]));
-    if (__pyx_t_1) {
+    __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1252
  *     for i in range(ndim):
@@ -14092,8 +14266,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *                 broadcasting = True
  *                 src.strides[i] = 0
  */
-      __pyx_t_1 = ((__pyx_v_src.shape[__pyx_v_i]) == 1);
-      if (__pyx_t_1) {
+      __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0);
+      if (__pyx_t_2) {
 
         /* "View.MemoryView":1253
  *         if src.shape[i] != dst.shape[i]:
@@ -14123,7 +14297,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  *         if src.suboffsets[i] >= 0:
  */
-        __pyx_t_3 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_4 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       }
       __pyx_L7:;
       goto __pyx_L6;
@@ -14137,8 +14311,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *             _err_dim(ValueError, "Dimension %d is not direct", i)
  * 
  */
-    __pyx_t_1 = ((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0);
-    if (__pyx_t_1) {
+    __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1259
  * 
@@ -14147,7 +14321,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  *     if slices_overlap(&src, &dst, ndim, itemsize):
  */
-      __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, __pyx_k_46, __pyx_v_i); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, __pyx_k_45, __pyx_v_i); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L8;
     }
     __pyx_L8:;
@@ -14160,8 +14334,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  *         if not slice_is_contig(&src, order, ndim):
  */
-  __pyx_t_1 = __pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":1263
  *     if slices_overlap(&src, &dst, ndim, itemsize):
@@ -14170,8 +14344,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *             order = get_best_order(&dst, ndim)
  * 
  */
-    __pyx_t_1 = (!__pyx_memviewslice_is_contig((&__pyx_v_src), __pyx_v_order, __pyx_v_ndim));
-    if (__pyx_t_1) {
+    __pyx_t_2 = ((!(__pyx_memviewslice_is_contig((&__pyx_v_src), __pyx_v_order, __pyx_v_ndim) != 0)) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1264
  * 
@@ -14192,8 +14366,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *         src = tmp
  * 
  */
-    __pyx_t_5 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_v_tmpdata = __pyx_t_5;
+    __pyx_t_6 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_v_tmpdata = __pyx_t_6;
 
     /* "View.MemoryView":1267
  * 
@@ -14214,8 +14388,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  * 
  */
-  __pyx_t_1 = (!__pyx_v_broadcasting);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":1272
  * 
@@ -14224,8 +14398,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *             direct_copy = slice_is_contig(&dst, 'C', ndim)
  *         elif slice_is_contig(&src, 'F', ndim):
  */
-    __pyx_t_1 = __pyx_memviewslice_is_contig((&__pyx_v_src), 'C', __pyx_v_ndim);
-    if (__pyx_t_1) {
+    __pyx_t_2 = (__pyx_memviewslice_is_contig((&__pyx_v_src), 'C', __pyx_v_ndim) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1273
  * 
@@ -14245,8 +14419,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *             direct_copy = slice_is_contig(&dst, 'F', ndim)
  * 
  */
-    __pyx_t_1 = __pyx_memviewslice_is_contig((&__pyx_v_src), 'F', __pyx_v_ndim);
-    if (__pyx_t_1) {
+    __pyx_t_2 = (__pyx_memviewslice_is_contig((&__pyx_v_src), 'F', __pyx_v_ndim) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1275
  *             direct_copy = slice_is_contig(&dst, 'C', ndim)
@@ -14267,7 +14441,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  *             refcount_copying(&dst, dtype_is_object, ndim, False)
  */
-    if (__pyx_v_direct_copy) {
+    __pyx_t_2 = (__pyx_v_direct_copy != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1279
  *         if direct_copy:
@@ -14319,11 +14494,12 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  * 
  */
-  __pyx_t_1 = (__pyx_v_order == 'F');
-  if (__pyx_t_1) {
-    __pyx_t_1 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
+  __pyx_t_2 = (__pyx_v_order == 'F');
+  if (__pyx_t_2) {
+    __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
   }
-  if (__pyx_t_1) {
+  __pyx_t_7 = (__pyx_t_2 != 0);
+  if (__pyx_t_7) {
 
     /* "View.MemoryView":1287
  * 
@@ -14332,7 +14508,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *         transpose_memslice(&dst)
  * 
  */
-    __pyx_t_4 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_4 == 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
     /* "View.MemoryView":1288
  * 
@@ -14341,7 +14517,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  *     refcount_copying(&dst, dtype_is_object, ndim, False)
  */
-    __pyx_t_4 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_4 == 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L14;
   }
   __pyx_L14:;
@@ -14520,6 +14696,7 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_slice
  */
 
 static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) {
+  int __pyx_t_1;
 
   /* "View.MemoryView":1324
  * 
@@ -14528,7 +14705,8 @@ static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, i
  *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,
  *                                            dst.strides, ndim, inc)
  */
-  if (__pyx_v_dtype_is_object) {
+  __pyx_t_1 = (__pyx_v_dtype_is_object != 0);
+  if (__pyx_t_1) {
 
     /* "View.MemoryView":1326
  *     if dtype_is_object:
@@ -14608,7 +14786,7 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss
  *             if inc:
  *                 Py_INCREF((<PyObject **> data)[0])
  */
-    __pyx_t_3 = (__pyx_v_ndim == 1);
+    __pyx_t_3 = ((__pyx_v_ndim == 1) != 0);
     if (__pyx_t_3) {
 
       /* "View.MemoryView":1341
@@ -14618,7 +14796,8 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss
  *                 Py_INCREF((<PyObject **> data)[0])
  *             else:
  */
-      if (__pyx_v_inc) {
+      __pyx_t_3 = (__pyx_v_inc != 0);
+      if (__pyx_t_3) {
 
         /* "View.MemoryView":1342
  *         if ndim == 1:
@@ -14750,7 +14929,7 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t
  *         for i in range(extent):
  *             memcpy(data, item, itemsize)
  */
-  __pyx_t_1 = (__pyx_v_ndim == 1);
+  __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":1373
@@ -14819,60 +14998,77 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t
   __pyx_L3:;
 
 }
+static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;
 
-static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
-  struct __pyx_array_obj *p;
-  PyObject *o = (*t->tp_alloc)(t, 0);
-  if (!o) return 0;
-  p = ((struct __pyx_array_obj *)o);
-  p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
-  p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
-  if (__pyx_array___cinit__(o, a, k) < 0) {
+static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
+  struct __pyx_memoryview_obj *p;
+  PyObject *o;
+  o = (*t->tp_alloc)(t, 0);
+  if (unlikely(!o)) return 0;
+  p = ((struct __pyx_memoryview_obj *)o);
+  p->__pyx_vtab = __pyx_vtabptr_memoryview;
+  p->obj = Py_None; Py_INCREF(Py_None);
+  p->_size = Py_None; Py_INCREF(Py_None);
+  p->_array_interface = Py_None; Py_INCREF(Py_None);
+  p->view.obj = NULL;
+  if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) {
     Py_DECREF(o); o = 0;
   }
   return o;
 }
 
-static void __pyx_tp_dealloc_array(PyObject *o) {
-  struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
+static void __pyx_tp_dealloc_memoryview(PyObject *o) {
+  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
+  PyObject_GC_UnTrack(o);
   {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
     ++Py_REFCNT(o);
-    __pyx_array___dealloc__(o);
+    __pyx_memoryview___dealloc__(o);
     if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
     --Py_REFCNT(o);
     PyErr_Restore(etype, eval, etb);
   }
-  Py_CLEAR(p->mode);
-  Py_CLEAR(p->_format);
+  Py_CLEAR(p->obj);
+  Py_CLEAR(p->_size);
+  Py_CLEAR(p->_array_interface);
   (*Py_TYPE(o)->tp_free)(o);
 }
 
-static int __pyx_tp_traverse_array(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) {
   int e;
-  struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
-  if (p->mode) {
-    e = (*v)(p->mode, a); if (e) return e;
+  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
+  if (p->obj) {
+    e = (*v)(p->obj, a); if (e) return e;
   }
-  if (p->_format) {
-    e = (*v)(p->_format, a); if (e) return e;
+  if (p->_size) {
+    e = (*v)(p->_size, a); if (e) return e;
+  }
+  if (p->_array_interface) {
+    e = (*v)(p->_array_interface, a); if (e) return e;
+  }
+  if (p->view.obj) {
+    e = (*v)(p->view.obj, a); if (e) return e;
   }
   return 0;
 }
 
-static int __pyx_tp_clear_array(PyObject *o) {
-  struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
+static int __pyx_tp_clear_memoryview(PyObject *o) {
+  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
   PyObject* tmp;
-  tmp = ((PyObject*)p->mode);
-  p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
+  tmp = ((PyObject*)p->obj);
+  p->obj = Py_None; Py_INCREF(Py_None);
   Py_XDECREF(tmp);
-  tmp = ((PyObject*)p->_format);
-  p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
+  tmp = ((PyObject*)p->_size);
+  p->_size = Py_None; Py_INCREF(Py_None);
   Py_XDECREF(tmp);
+  tmp = ((PyObject*)p->_array_interface);
+  p->_array_interface = Py_None; Py_INCREF(Py_None);
+  Py_XDECREF(tmp);
+  Py_CLEAR(p->view.obj);
   return 0;
 }
-static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
+static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
   PyObject *r;
   PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
   r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
@@ -14880,9 +15076,9 @@ static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
   return r;
 }
 
-static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) {
+static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) {
   if (v) {
-    return __pyx_array___setitem__(o, i, v);
+    return __pyx_memoryview___setitem__(o, i, v);
   }
   else {
     PyErr_Format(PyExc_NotImplementedError,
@@ -14891,92 +15087,68 @@ static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) {
   }
 }
 
-static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) {
-  PyObject *v = PyObject_GenericGetAttr(o, n);
-  if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
-    PyErr_Clear();
-    v = __pyx_array___getattr__(o, n);
-  }
-  return v;
+static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_transpose(o);
 }
 
-static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) {
-  return get_memview(o);
+static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview__get__base(o);
 }
 
-static PyMethodDef __pyx_methods_array[] = {
-  {__Pyx_NAMESTR("__getattr__"), (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, __Pyx_DOCSTR(0)},
-  {0, 0, 0, 0}
-};
-
-static struct PyGetSetDef __pyx_getsets_array[] = {
-  {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, 0, 0},
-  {0, 0, 0, 0, 0}
-};
+static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_shape(o);
+}
 
-static PyNumberMethods __pyx_tp_as_number_array = {
-  0, /*nb_add*/
-  0, /*nb_subtract*/
-  0, /*nb_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_divide*/
-  #endif
-  0, /*nb_remainder*/
-  0, /*nb_divmod*/
-  0, /*nb_power*/
-  0, /*nb_negative*/
-  0, /*nb_positive*/
-  0, /*nb_absolute*/
-  0, /*nb_nonzero*/
-  0, /*nb_invert*/
-  0, /*nb_lshift*/
-  0, /*nb_rshift*/
-  0, /*nb_and*/
-  0, /*nb_xor*/
-  0, /*nb_or*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_coerce*/
-  #endif
-  0, /*nb_int*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_long*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*nb_float*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_oct*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_hex*/
-  #endif
-  0, /*nb_inplace_add*/
-  0, /*nb_inplace_subtract*/
-  0, /*nb_inplace_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_inplace_divide*/
-  #endif
-  0, /*nb_inplace_remainder*/
-  0, /*nb_inplace_power*/
-  0, /*nb_inplace_lshift*/
-  0, /*nb_inplace_rshift*/
-  0, /*nb_inplace_and*/
-  0, /*nb_inplace_xor*/
-  0, /*nb_inplace_or*/
-  0, /*nb_floor_divide*/
-  0, /*nb_true_divide*/
-  0, /*nb_inplace_floor_divide*/
-  0, /*nb_inplace_true_divide*/
-  #if PY_VERSION_HEX >= 0x02050000
-  0, /*nb_index*/
-  #endif
+static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_strides(o);
+}
+
+static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_suboffsets(o);
+}
+
+static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_ndim(o);
+}
+
+static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_itemsize(o);
+}
+
+static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_nbytes(o);
+}
+
+static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_size(o);
+}
+
+static PyMethodDef __pyx_methods_memoryview[] = {
+  {__Pyx_NAMESTR("is_c_contig"), (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, __Pyx_DOCSTR(0)},
+  {__Pyx_NAMESTR("is_f_contig"), (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, __Pyx_DOCSTR(0)},
+  {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, __Pyx_DOCSTR(0)},
+  {__Pyx_NAMESTR("copy_fortran"), (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, __Pyx_DOCSTR(0)},
+  {0, 0, 0, 0}
 };
 
-static PySequenceMethods __pyx_tp_as_sequence_array = {
-  0, /*sq_length*/
+static struct PyGetSetDef __pyx_getsets_memoryview[] = {
+  {(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, 0, 0},
+  {(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, 0, 0},
+  {(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, 0, 0},
+  {(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, 0, 0},
+  {(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, 0, 0},
+  {(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, 0, 0},
+  {(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, 0, 0},
+  {(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, 0, 0},
+  {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, 0, 0},
+  {0, 0, 0, 0, 0}
+};
+
+static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
+  __pyx_memoryview___len__, /*sq_length*/
   0, /*sq_concat*/
   0, /*sq_repeat*/
-  __pyx_sq_item_array, /*sq_item*/
+  __pyx_sq_item_memoryview, /*sq_item*/
   0, /*sq_slice*/
   0, /*sq_ass_item*/
   0, /*sq_ass_slice*/
@@ -14985,13 +15157,13 @@ static PySequenceMethods __pyx_tp_as_sequence_array = {
   0, /*sq_inplace_repeat*/
 };
 
-static PyMappingMethods __pyx_tp_as_mapping_array = {
-  0, /*mp_length*/
-  __pyx_array___getitem__, /*mp_subscript*/
-  __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/
+static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
+  __pyx_memoryview___len__, /*mp_length*/
+  __pyx_memoryview___getitem__, /*mp_subscript*/
+  __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/
 };
 
-static PyBufferProcs __pyx_tp_as_buffer_array = {
+static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
   #if PY_MAJOR_VERSION < 3
   0, /*bf_getreadbuffer*/
   #endif
@@ -15005,19 +15177,19 @@ static PyBufferProcs __pyx_tp_as_buffer_array = {
   0, /*bf_getcharbuffer*/
   #endif
   #if PY_VERSION_HEX >= 0x02060000
-  __pyx_array_getbuffer, /*bf_getbuffer*/
+  __pyx_memoryview_getbuffer, /*bf_getbuffer*/
   #endif
   #if PY_VERSION_HEX >= 0x02060000
   0, /*bf_releasebuffer*/
   #endif
 };
 
-static PyTypeObject __pyx_type___pyx_array = {
+static PyTypeObject __pyx_type___pyx_memoryview = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("reconstruct.array"), /*tp_name*/
-  sizeof(struct __pyx_array_obj), /*tp_basicsize*/
+  __Pyx_NAMESTR("reconstruct.memoryview"), /*tp_name*/
+  sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_array, /*tp_dealloc*/
+  __pyx_tp_dealloc_memoryview, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -15026,27 +15198,27 @@ static PyTypeObject __pyx_type___pyx_array = {
   #else
   0, /*reserved*/
   #endif
-  0, /*tp_repr*/
-  &__pyx_tp_as_number_array, /*tp_as_number*/
-  &__pyx_tp_as_sequence_array, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping_array, /*tp_as_mapping*/
+  __pyx_memoryview___repr__, /*tp_repr*/
+  0, /*tp_as_number*/
+  &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/
+  &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/
   0, /*tp_hash*/
   0, /*tp_call*/
-  0, /*tp_str*/
-  __pyx_tp_getattro_array, /*tp_getattro*/
+  __pyx_memoryview___str__, /*tp_str*/
+  0, /*tp_getattro*/
   0, /*tp_setattro*/
-  &__pyx_tp_as_buffer_array, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+  &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
   0, /*tp_doc*/
-  __pyx_tp_traverse_array, /*tp_traverse*/
-  __pyx_tp_clear_array, /*tp_clear*/
+  __pyx_tp_traverse_memoryview, /*tp_traverse*/
+  __pyx_tp_clear_memoryview, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
   0, /*tp_iter*/
   0, /*tp_iternext*/
-  __pyx_methods_array, /*tp_methods*/
+  __pyx_methods_memoryview, /*tp_methods*/
   0, /*tp_members*/
-  __pyx_getsets_array, /*tp_getset*/
+  __pyx_getsets_memoryview, /*tp_getset*/
   0, /*tp_base*/
   0, /*tp_dict*/
   0, /*tp_descr_get*/
@@ -15054,7 +15226,7 @@ static PyTypeObject __pyx_type___pyx_array = {
   0, /*tp_dictoffset*/
   0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_array, /*tp_new*/
+  __pyx_tp_new_memoryview, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -15066,108 +15238,112 @@ static PyTypeObject __pyx_type___pyx_array = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
-static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
-  struct __pyx_MemviewEnum_obj *p;
-  PyObject *o = (*t->tp_alloc)(t, 0);
-  if (!o) return 0;
-  p = ((struct __pyx_MemviewEnum_obj *)o);
-  p->name = Py_None; Py_INCREF(Py_None);
+static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
+  struct __pyx_array_obj *p;
+  PyObject *o;
+  o = (*t->tp_alloc)(t, 0);
+  if (unlikely(!o)) return 0;
+  p = ((struct __pyx_array_obj *)o);
+  p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
+  p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
+  if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) {
+    Py_DECREF(o); o = 0;
+  }
   return o;
 }
 
-static void __pyx_tp_dealloc_Enum(PyObject *o) {
-  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
-  Py_CLEAR(p->name);
+static void __pyx_tp_dealloc_array(PyObject *o) {
+  struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
+  PyObject_GC_UnTrack(o);
+  {
+    PyObject *etype, *eval, *etb;
+    PyErr_Fetch(&etype, &eval, &etb);
+    ++Py_REFCNT(o);
+    __pyx_array___dealloc__(o);
+    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
+    --Py_REFCNT(o);
+    PyErr_Restore(etype, eval, etb);
+  }
+  Py_CLEAR(p->mode);
+  Py_CLEAR(p->_format);
   (*Py_TYPE(o)->tp_free)(o);
 }
 
-static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_array(PyObject *o, visitproc v, void *a) {
   int e;
-  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
-  if (p->name) {
-    e = (*v)(p->name, a); if (e) return e;
+  struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
+  if (p->mode) {
+    e = (*v)(p->mode, a); if (e) return e;
+  }
+  if (p->_format) {
+    e = (*v)(p->_format, a); if (e) return e;
   }
   return 0;
 }
 
-static int __pyx_tp_clear_Enum(PyObject *o) {
-  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
+static int __pyx_tp_clear_array(PyObject *o) {
+  struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
   PyObject* tmp;
-  tmp = ((PyObject*)p->name);
-  p->name = Py_None; Py_INCREF(Py_None);
+  tmp = ((PyObject*)p->mode);
+  p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
+  Py_XDECREF(tmp);
+  tmp = ((PyObject*)p->_format);
+  p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
   Py_XDECREF(tmp);
   return 0;
 }
+static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
+  PyObject *r;
+  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
+  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
+  Py_DECREF(x);
+  return r;
+}
 
-static PyMethodDef __pyx_methods_Enum[] = {
+static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) {
+  if (v) {
+    return __pyx_array___setitem__(o, i, v);
+  }
+  else {
+    PyErr_Format(PyExc_NotImplementedError,
+      "Subscript deletion not supported by %s", Py_TYPE(o)->tp_name);
+    return -1;
+  }
+}
+
+static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) {
+  PyObject *v = PyObject_GenericGetAttr(o, n);
+  if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
+    PyErr_Clear();
+    v = __pyx_array___getattr__(o, n);
+  }
+  return v;
+}
+
+static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) {
+  return get_memview(o);
+}
+
+static PyMethodDef __pyx_methods_array[] = {
+  {__Pyx_NAMESTR("__getattr__"), (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, __Pyx_DOCSTR(0)},
   {0, 0, 0, 0}
 };
 
-static PyNumberMethods __pyx_tp_as_number_Enum = {
-  0, /*nb_add*/
-  0, /*nb_subtract*/
-  0, /*nb_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_divide*/
-  #endif
-  0, /*nb_remainder*/
-  0, /*nb_divmod*/
-  0, /*nb_power*/
-  0, /*nb_negative*/
-  0, /*nb_positive*/
-  0, /*nb_absolute*/
-  0, /*nb_nonzero*/
-  0, /*nb_invert*/
-  0, /*nb_lshift*/
-  0, /*nb_rshift*/
-  0, /*nb_and*/
-  0, /*nb_xor*/
-  0, /*nb_or*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_coerce*/
-  #endif
-  0, /*nb_int*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_long*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*nb_float*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_oct*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_hex*/
-  #endif
-  0, /*nb_inplace_add*/
-  0, /*nb_inplace_subtract*/
-  0, /*nb_inplace_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_inplace_divide*/
-  #endif
-  0, /*nb_inplace_remainder*/
-  0, /*nb_inplace_power*/
-  0, /*nb_inplace_lshift*/
-  0, /*nb_inplace_rshift*/
-  0, /*nb_inplace_and*/
-  0, /*nb_inplace_xor*/
-  0, /*nb_inplace_or*/
-  0, /*nb_floor_divide*/
-  0, /*nb_true_divide*/
-  0, /*nb_inplace_floor_divide*/
-  0, /*nb_inplace_true_divide*/
-  #if PY_VERSION_HEX >= 0x02050000
-  0, /*nb_index*/
-  #endif
+static struct PyGetSetDef __pyx_getsets_array[] = {
+  {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, 0, 0},
+  {0, 0, 0, 0, 0}
 };
 
-static PySequenceMethods __pyx_tp_as_sequence_Enum = {
+static PySequenceMethods __pyx_tp_as_sequence_array = {
   0, /*sq_length*/
   0, /*sq_concat*/
   0, /*sq_repeat*/
-  0, /*sq_item*/
+  __pyx_sq_item_array, /*sq_item*/
   0, /*sq_slice*/
   0, /*sq_ass_item*/
   0, /*sq_ass_slice*/
@@ -15176,13 +15352,13 @@ static PySequenceMethods __pyx_tp_as_sequence_Enum = {
   0, /*sq_inplace_repeat*/
 };
 
-static PyMappingMethods __pyx_tp_as_mapping_Enum = {
+static PyMappingMethods __pyx_tp_as_mapping_array = {
   0, /*mp_length*/
-  0, /*mp_subscript*/
-  0, /*mp_ass_subscript*/
+  __pyx_array___getitem__, /*mp_subscript*/
+  __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/
 };
 
-static PyBufferProcs __pyx_tp_as_buffer_Enum = {
+static PyBufferProcs __pyx_tp_as_buffer_array = {
   #if PY_MAJOR_VERSION < 3
   0, /*bf_getreadbuffer*/
   #endif
@@ -15196,19 +15372,19 @@ static PyBufferProcs __pyx_tp_as_buffer_Enum = {
   0, /*bf_getcharbuffer*/
   #endif
   #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_getbuffer*/
+  __pyx_array_getbuffer, /*bf_getbuffer*/
   #endif
   #if PY_VERSION_HEX >= 0x02060000
   0, /*bf_releasebuffer*/
   #endif
 };
 
-static PyTypeObject __pyx_type___pyx_MemviewEnum = {
+static PyTypeObject __pyx_type___pyx_array = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("reconstruct.Enum"), /*tp_name*/
-  sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/
+  __Pyx_NAMESTR("reconstruct.array"), /*tp_name*/
+  sizeof(struct __pyx_array_obj), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_Enum, /*tp_dealloc*/
+  __pyx_tp_dealloc_array, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -15217,35 +15393,35 @@ static PyTypeObject __pyx_type___pyx_MemviewEnum = {
   #else
   0, /*reserved*/
   #endif
-  __pyx_MemviewEnum___repr__, /*tp_repr*/
-  &__pyx_tp_as_number_Enum, /*tp_as_number*/
-  &__pyx_tp_as_sequence_Enum, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping_Enum, /*tp_as_mapping*/
+  0, /*tp_repr*/
+  0, /*tp_as_number*/
+  &__pyx_tp_as_sequence_array, /*tp_as_sequence*/
+  &__pyx_tp_as_mapping_array, /*tp_as_mapping*/
   0, /*tp_hash*/
   0, /*tp_call*/
   0, /*tp_str*/
-  0, /*tp_getattro*/
+  __pyx_tp_getattro_array, /*tp_getattro*/
   0, /*tp_setattro*/
-  &__pyx_tp_as_buffer_Enum, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+  &__pyx_tp_as_buffer_array, /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
   0, /*tp_doc*/
-  __pyx_tp_traverse_Enum, /*tp_traverse*/
-  __pyx_tp_clear_Enum, /*tp_clear*/
+  __pyx_tp_traverse_array, /*tp_traverse*/
+  __pyx_tp_clear_array, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
   0, /*tp_iter*/
   0, /*tp_iternext*/
-  __pyx_methods_Enum, /*tp_methods*/
+  __pyx_methods_array, /*tp_methods*/
   0, /*tp_members*/
-  0, /*tp_getset*/
+  __pyx_getsets_array, /*tp_getset*/
   0, /*tp_base*/
   0, /*tp_dict*/
   0, /*tp_descr_get*/
   0, /*tp_descr_set*/
   0, /*tp_dictoffset*/
-  __pyx_MemviewEnum___init__, /*tp_init*/
+  0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_Enum, /*tp_new*/
+  __pyx_tp_new_array, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -15257,255 +15433,56 @@ static PyTypeObject __pyx_type___pyx_MemviewEnum = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
-static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;
-
-static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
-  struct __pyx_memoryview_obj *p;
-  PyObject *o = (*t->tp_alloc)(t, 0);
-  if (!o) return 0;
-  p = ((struct __pyx_memoryview_obj *)o);
-  p->__pyx_vtab = __pyx_vtabptr_memoryview;
-  p->obj = Py_None; Py_INCREF(Py_None);
-  p->_size = Py_None; Py_INCREF(Py_None);
-  p->_array_interface = Py_None; Py_INCREF(Py_None);
-  p->view.obj = NULL;
-  if (__pyx_memoryview___cinit__(o, a, k) < 0) {
-    Py_DECREF(o); o = 0;
-  }
-  return o;
-}
 
-static void __pyx_tp_dealloc_memoryview(PyObject *o) {
-  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
-  {
-    PyObject *etype, *eval, *etb;
-    PyErr_Fetch(&etype, &eval, &etb);
-    ++Py_REFCNT(o);
-    __pyx_memoryview___dealloc__(o);
-    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
-    --Py_REFCNT(o);
-    PyErr_Restore(etype, eval, etb);
-  }
-  Py_CLEAR(p->obj);
-  Py_CLEAR(p->_size);
-  Py_CLEAR(p->_array_interface);
+static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+  struct __pyx_MemviewEnum_obj *p;
+  PyObject *o;
+  o = (*t->tp_alloc)(t, 0);
+  if (unlikely(!o)) return 0;
+  p = ((struct __pyx_MemviewEnum_obj *)o);
+  p->name = Py_None; Py_INCREF(Py_None);
+  return o;
+}
+
+static void __pyx_tp_dealloc_Enum(PyObject *o) {
+  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
+  PyObject_GC_UnTrack(o);
+  Py_CLEAR(p->name);
   (*Py_TYPE(o)->tp_free)(o);
 }
 
-static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) {
   int e;
-  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
-  if (p->obj) {
-    e = (*v)(p->obj, a); if (e) return e;
-  }
-  if (p->_size) {
-    e = (*v)(p->_size, a); if (e) return e;
-  }
-  if (p->_array_interface) {
-    e = (*v)(p->_array_interface, a); if (e) return e;
-  }
-  if (p->view.obj) {
-    e = (*v)(p->view.obj, a); if (e) return e;
+  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
+  if (p->name) {
+    e = (*v)(p->name, a); if (e) return e;
   }
   return 0;
 }
 
-static int __pyx_tp_clear_memoryview(PyObject *o) {
-  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
+static int __pyx_tp_clear_Enum(PyObject *o) {
+  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
   PyObject* tmp;
-  tmp = ((PyObject*)p->obj);
-  p->obj = Py_None; Py_INCREF(Py_None);
-  Py_XDECREF(tmp);
-  tmp = ((PyObject*)p->_size);
-  p->_size = Py_None; Py_INCREF(Py_None);
-  Py_XDECREF(tmp);
-  tmp = ((PyObject*)p->_array_interface);
-  p->_array_interface = Py_None; Py_INCREF(Py_None);
+  tmp = ((PyObject*)p->name);
+  p->name = Py_None; Py_INCREF(Py_None);
   Py_XDECREF(tmp);
-  Py_CLEAR(p->view.obj);
   return 0;
 }
-static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
-  PyObject *r;
-  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
-  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
-  Py_DECREF(x);
-  return r;
-}
-
-static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) {
-  if (v) {
-    return __pyx_memoryview___setitem__(o, i, v);
-  }
-  else {
-    PyErr_Format(PyExc_NotImplementedError,
-      "Subscript deletion not supported by %s", Py_TYPE(o)->tp_name);
-    return -1;
-  }
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_transpose(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview__get__base(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_shape(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_strides(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_suboffsets(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_ndim(o);
-}
 
-static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_itemsize(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_nbytes(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_size(o);
-}
-
-static PyMethodDef __pyx_methods_memoryview[] = {
-  {__Pyx_NAMESTR("is_c_contig"), (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, __Pyx_DOCSTR(0)},
-  {__Pyx_NAMESTR("is_f_contig"), (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, __Pyx_DOCSTR(0)},
-  {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, __Pyx_DOCSTR(0)},
-  {__Pyx_NAMESTR("copy_fortran"), (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, __Pyx_DOCSTR(0)},
+static PyMethodDef __pyx_methods_Enum[] = {
   {0, 0, 0, 0}
 };
 
-static struct PyGetSetDef __pyx_getsets_memoryview[] = {
-  {(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, 0, 0},
-  {(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, 0, 0},
-  {(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, 0, 0},
-  {(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, 0, 0},
-  {(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, 0, 0},
-  {(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, 0, 0},
-  {(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, 0, 0},
-  {(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, 0, 0},
-  {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, 0, 0},
-  {0, 0, 0, 0, 0}
-};
-
-static PyNumberMethods __pyx_tp_as_number_memoryview = {
-  0, /*nb_add*/
-  0, /*nb_subtract*/
-  0, /*nb_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_divide*/
-  #endif
-  0, /*nb_remainder*/
-  0, /*nb_divmod*/
-  0, /*nb_power*/
-  0, /*nb_negative*/
-  0, /*nb_positive*/
-  0, /*nb_absolute*/
-  0, /*nb_nonzero*/
-  0, /*nb_invert*/
-  0, /*nb_lshift*/
-  0, /*nb_rshift*/
-  0, /*nb_and*/
-  0, /*nb_xor*/
-  0, /*nb_or*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_coerce*/
-  #endif
-  0, /*nb_int*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_long*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*nb_float*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_oct*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_hex*/
-  #endif
-  0, /*nb_inplace_add*/
-  0, /*nb_inplace_subtract*/
-  0, /*nb_inplace_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_inplace_divide*/
-  #endif
-  0, /*nb_inplace_remainder*/
-  0, /*nb_inplace_power*/
-  0, /*nb_inplace_lshift*/
-  0, /*nb_inplace_rshift*/
-  0, /*nb_inplace_and*/
-  0, /*nb_inplace_xor*/
-  0, /*nb_inplace_or*/
-  0, /*nb_floor_divide*/
-  0, /*nb_true_divide*/
-  0, /*nb_inplace_floor_divide*/
-  0, /*nb_inplace_true_divide*/
-  #if PY_VERSION_HEX >= 0x02050000
-  0, /*nb_index*/
-  #endif
-};
-
-static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
-  __pyx_memoryview___len__, /*sq_length*/
-  0, /*sq_concat*/
-  0, /*sq_repeat*/
-  __pyx_sq_item_memoryview, /*sq_item*/
-  0, /*sq_slice*/
-  0, /*sq_ass_item*/
-  0, /*sq_ass_slice*/
-  0, /*sq_contains*/
-  0, /*sq_inplace_concat*/
-  0, /*sq_inplace_repeat*/
-};
-
-static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
-  __pyx_memoryview___len__, /*mp_length*/
-  __pyx_memoryview___getitem__, /*mp_subscript*/
-  __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/
-};
-
-static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getreadbuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getwritebuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getsegcount*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getcharbuffer*/
-  #endif
-  #if PY_VERSION_HEX >= 0x02060000
-  __pyx_memoryview_getbuffer, /*bf_getbuffer*/
-  #endif
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_releasebuffer*/
-  #endif
-};
-
-static PyTypeObject __pyx_type___pyx_memoryview = {
+static PyTypeObject __pyx_type___pyx_MemviewEnum = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("reconstruct.memoryview"), /*tp_name*/
-  sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/
+  __Pyx_NAMESTR("reconstruct.Enum"), /*tp_name*/
+  sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_memoryview, /*tp_dealloc*/
+  __pyx_tp_dealloc_Enum, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -15514,35 +15491,35 @@ static PyTypeObject __pyx_type___pyx_memoryview = {
   #else
   0, /*reserved*/
   #endif
-  __pyx_memoryview___repr__, /*tp_repr*/
-  &__pyx_tp_as_number_memoryview, /*tp_as_number*/
-  &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/
+  __pyx_MemviewEnum___repr__, /*tp_repr*/
+  0, /*tp_as_number*/
+  0, /*tp_as_sequence*/
+  0, /*tp_as_mapping*/
   0, /*tp_hash*/
   0, /*tp_call*/
-  __pyx_memoryview___str__, /*tp_str*/
+  0, /*tp_str*/
   0, /*tp_getattro*/
   0, /*tp_setattro*/
-  &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+  0, /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
   0, /*tp_doc*/
-  __pyx_tp_traverse_memoryview, /*tp_traverse*/
-  __pyx_tp_clear_memoryview, /*tp_clear*/
+  __pyx_tp_traverse_Enum, /*tp_traverse*/
+  __pyx_tp_clear_Enum, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
   0, /*tp_iter*/
   0, /*tp_iternext*/
-  __pyx_methods_memoryview, /*tp_methods*/
+  __pyx_methods_Enum, /*tp_methods*/
   0, /*tp_members*/
-  __pyx_getsets_memoryview, /*tp_getset*/
+  0, /*tp_getset*/
   0, /*tp_base*/
   0, /*tp_dict*/
   0, /*tp_descr_get*/
   0, /*tp_descr_set*/
   0, /*tp_dictoffset*/
-  0, /*tp_init*/
+  __pyx_MemviewEnum___init__, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_memoryview, /*tp_new*/
+  __pyx_tp_new_Enum, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -15554,13 +15531,16 @@ static PyTypeObject __pyx_type___pyx_memoryview = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice;
 
 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) {
   struct __pyx_memoryviewslice_obj *p;
   PyObject *o = __pyx_tp_new_memoryview(t, a, k);
-  if (!o) return 0;
+  if (unlikely(!o)) return 0;
   p = ((struct __pyx_memoryviewslice_obj *)o);
   p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice;
   p->from_object = Py_None; Py_INCREF(Py_None);
@@ -15570,6 +15550,7 @@ static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyO
 
 static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) {
   struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
+  PyObject_GC_UnTrack(o);
   {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
@@ -15580,6 +15561,7 @@ static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) {
     PyErr_Restore(etype, eval, etb);
   }
   Py_CLEAR(p->from_object);
+  PyObject_GC_Track(o);
   __pyx_tp_dealloc_memoryview(o);
 }
 
@@ -15611,124 +15593,10 @@ static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UN
 static PyMethodDef __pyx_methods__memoryviewslice[] = {
   {0, 0, 0, 0}
 };
-
-static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = {
-  {(char *)"base", __pyx_getprop___pyx_memoryviewslice_base, 0, 0, 0},
-  {0, 0, 0, 0, 0}
-};
-
-static PyNumberMethods __pyx_tp_as_number__memoryviewslice = {
-  0, /*nb_add*/
-  0, /*nb_subtract*/
-  0, /*nb_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_divide*/
-  #endif
-  0, /*nb_remainder*/
-  0, /*nb_divmod*/
-  0, /*nb_power*/
-  0, /*nb_negative*/
-  0, /*nb_positive*/
-  0, /*nb_absolute*/
-  0, /*nb_nonzero*/
-  0, /*nb_invert*/
-  0, /*nb_lshift*/
-  0, /*nb_rshift*/
-  0, /*nb_and*/
-  0, /*nb_xor*/
-  0, /*nb_or*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_coerce*/
-  #endif
-  0, /*nb_int*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_long*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*nb_float*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_oct*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_hex*/
-  #endif
-  0, /*nb_inplace_add*/
-  0, /*nb_inplace_subtract*/
-  0, /*nb_inplace_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_inplace_divide*/
-  #endif
-  0, /*nb_inplace_remainder*/
-  0, /*nb_inplace_power*/
-  0, /*nb_inplace_lshift*/
-  0, /*nb_inplace_rshift*/
-  0, /*nb_inplace_and*/
-  0, /*nb_inplace_xor*/
-  0, /*nb_inplace_or*/
-  0, /*nb_floor_divide*/
-  0, /*nb_true_divide*/
-  0, /*nb_inplace_floor_divide*/
-  0, /*nb_inplace_true_divide*/
-  #if PY_VERSION_HEX >= 0x02050000
-  0, /*nb_index*/
-  #endif
-};
-
-static PySequenceMethods __pyx_tp_as_sequence__memoryviewslice = {
-  #if CYTHON_COMPILING_IN_PYPY
-  __pyx_memoryview___len__, /*sq_length*/
-  #else
-  0, /*sq_length*/
-  #endif
-  0, /*sq_concat*/
-  0, /*sq_repeat*/
-  0, /*sq_item*/
-  0, /*sq_slice*/
-  0, /*sq_ass_item*/
-  0, /*sq_ass_slice*/
-  0, /*sq_contains*/
-  0, /*sq_inplace_concat*/
-  0, /*sq_inplace_repeat*/
-};
-
-static PyMappingMethods __pyx_tp_as_mapping__memoryviewslice = {
-  #if CYTHON_COMPILING_IN_PYPY
-  __pyx_memoryview___len__, /*mp_length*/
-  #else
-  0, /*mp_length*/
-  #endif
-  #if CYTHON_COMPILING_IN_PYPY
-  __pyx_memoryview___getitem__, /*mp_subscript*/
-  #else
-  0, /*mp_subscript*/
-  #endif
-  0, /*mp_ass_subscript*/
-};
-
-static PyBufferProcs __pyx_tp_as_buffer__memoryviewslice = {
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getreadbuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getwritebuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getsegcount*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getcharbuffer*/
-  #endif
-  #if CYTHON_COMPILING_IN_PYPY
-  __pyx_memoryview_getbuffer, /*bf_getbuffer*/
-  #else
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_getbuffer*/
-  #endif
-  #endif
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_releasebuffer*/
-  #endif
+
+static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = {
+  {(char *)"base", __pyx_getprop___pyx_memoryviewslice_base, 0, 0, 0},
+  {0, 0, 0, 0, 0}
 };
 
 static PyTypeObject __pyx_type___pyx_memoryviewslice = {
@@ -15750,9 +15618,9 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = {
   #else
   0, /*tp_repr*/
   #endif
-  &__pyx_tp_as_number__memoryviewslice, /*tp_as_number*/
-  &__pyx_tp_as_sequence__memoryviewslice, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping__memoryviewslice, /*tp_as_mapping*/
+  0, /*tp_as_number*/
+  0, /*tp_as_sequence*/
+  0, /*tp_as_mapping*/
   0, /*tp_hash*/
   0, /*tp_call*/
   #if CYTHON_COMPILING_IN_PYPY
@@ -15762,8 +15630,8 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = {
   #endif
   0, /*tp_getattro*/
   0, /*tp_setattro*/
-  &__pyx_tp_as_buffer__memoryviewslice, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+  0, /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
   __Pyx_DOCSTR("Internal class for passing memoryview slices to Python"), /*tp_doc*/
   __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/
   __pyx_tp_clear__memoryviewslice, /*tp_clear*/
@@ -15793,6 +15661,9 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
 static PyMethodDef __pyx_methods[] = {
@@ -15801,7 +15672,11 @@ static PyMethodDef __pyx_methods[] = {
 
 #if PY_MAJOR_VERSION >= 3
 static struct PyModuleDef __pyx_moduledef = {
+  #if PY_VERSION_HEX < 0x03020000
+    { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
+  #else
     PyModuleDef_HEAD_INIT,
+  #endif
     __Pyx_NAMESTR("reconstruct"),
     0, /* m_doc */
     -1, /* m_size */
@@ -15814,33 +15689,33 @@ static struct PyModuleDef __pyx_moduledef = {
 #endif
 
 static __Pyx_StringTabEntry __pyx_string_tab[] = {
-  {&__pyx_kp_u_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 1, 0, 0},
-  {&__pyx_kp_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 0},
-  {&__pyx_kp_s_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 0, 1, 0},
-  {&__pyx_kp_s_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 0, 1, 0},
-  {&__pyx_kp_u_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 1, 0, 0},
+  {&__pyx_kp_u_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 1, 0, 0},
+  {&__pyx_kp_u_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 1, 0, 0},
+  {&__pyx_kp_s_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 0, 1, 0},
+  {&__pyx_kp_s_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 1, 0},
+  {&__pyx_kp_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 0},
+  {&__pyx_kp_s_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 1, 0},
   {&__pyx_kp_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 0},
-  {&__pyx_kp_s_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 0, 1, 0},
-  {&__pyx_kp_s_24, __pyx_k_24, sizeof(__pyx_k_24), 0, 0, 1, 0},
-  {&__pyx_kp_s_26, __pyx_k_26, sizeof(__pyx_k_26), 0, 0, 1, 0},
-  {&__pyx_kp_s_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 0, 1, 0},
-  {&__pyx_kp_s_30, __pyx_k_30, sizeof(__pyx_k_30), 0, 0, 1, 0},
+  {&__pyx_kp_s_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 1, 0},
+  {&__pyx_kp_s_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 1, 0},
+  {&__pyx_kp_s_27, __pyx_k_27, sizeof(__pyx_k_27), 0, 0, 1, 0},
+  {&__pyx_kp_s_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 0, 1, 0},
+  {&__pyx_kp_u_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 1, 0, 0},
+  {&__pyx_kp_s_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 0, 1, 0},
   {&__pyx_kp_s_32, __pyx_k_32, sizeof(__pyx_k_32), 0, 0, 1, 0},
-  {&__pyx_kp_s_33, __pyx_k_33, sizeof(__pyx_k_33), 0, 0, 1, 0},
-  {&__pyx_kp_s_36, __pyx_k_36, sizeof(__pyx_k_36), 0, 0, 1, 0},
-  {&__pyx_kp_s_38, __pyx_k_38, sizeof(__pyx_k_38), 0, 0, 1, 0},
-  {&__pyx_kp_u_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 1, 0, 0},
-  {&__pyx_kp_s_43, __pyx_k_43, sizeof(__pyx_k_43), 0, 0, 1, 0},
-  {&__pyx_kp_s_45, __pyx_k_45, sizeof(__pyx_k_45), 0, 0, 1, 0},
-  {&__pyx_kp_s_49, __pyx_k_49, sizeof(__pyx_k_49), 0, 0, 1, 0},
-  {&__pyx_kp_s_51, __pyx_k_51, sizeof(__pyx_k_51), 0, 0, 1, 0},
-  {&__pyx_kp_s_53, __pyx_k_53, sizeof(__pyx_k_53), 0, 0, 1, 0},
-  {&__pyx_kp_s_55, __pyx_k_55, sizeof(__pyx_k_55), 0, 0, 1, 0},
-  {&__pyx_kp_s_57, __pyx_k_57, sizeof(__pyx_k_57), 0, 0, 1, 0},
-  {&__pyx_kp_s_59, __pyx_k_59, sizeof(__pyx_k_59), 0, 0, 1, 0},
-  {&__pyx_kp_u_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 1, 0, 0},
+  {&__pyx_kp_s_35, __pyx_k_35, sizeof(__pyx_k_35), 0, 0, 1, 0},
+  {&__pyx_kp_s_37, __pyx_k_37, sizeof(__pyx_k_37), 0, 0, 1, 0},
+  {&__pyx_kp_s_42, __pyx_k_42, sizeof(__pyx_k_42), 0, 0, 1, 0},
+  {&__pyx_kp_s_44, __pyx_k_44, sizeof(__pyx_k_44), 0, 0, 1, 0},
+  {&__pyx_kp_s_48, __pyx_k_48, sizeof(__pyx_k_48), 0, 0, 1, 0},
+  {&__pyx_kp_u_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 1, 0, 0},
+  {&__pyx_kp_s_50, __pyx_k_50, sizeof(__pyx_k_50), 0, 0, 1, 0},
+  {&__pyx_kp_s_52, __pyx_k_52, sizeof(__pyx_k_52), 0, 0, 1, 0},
+  {&__pyx_kp_s_54, __pyx_k_54, sizeof(__pyx_k_54), 0, 0, 1, 0},
+  {&__pyx_kp_s_56, __pyx_k_56, sizeof(__pyx_k_56), 0, 0, 1, 0},
+  {&__pyx_kp_s_58, __pyx_k_58, sizeof(__pyx_k_58), 0, 0, 1, 0},
+  {&__pyx_kp_u_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 1, 0, 0},
   {&__pyx_kp_u_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 1, 0, 0},
-  {&__pyx_kp_u_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 1, 0, 0},
   {&__pyx_n_s__ASCII, __pyx_k__ASCII, sizeof(__pyx_k__ASCII), 0, 0, 1, 1},
   {&__pyx_n_s__Ellipsis, __pyx_k__Ellipsis, sizeof(__pyx_k__Ellipsis), 0, 0, 1, 1},
   {&__pyx_n_s__IndexError, __pyx_k__IndexError, sizeof(__pyx_k__IndexError), 0, 0, 1, 1},
@@ -15850,9 +15725,12 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s__TypeError, __pyx_k__TypeError, sizeof(__pyx_k__TypeError), 0, 0, 1, 1},
   {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1},
   {&__pyx_n_s____class__, __pyx_k____class__, sizeof(__pyx_k____class__), 0, 0, 1, 1},
+  {&__pyx_n_s____import__, __pyx_k____import__, sizeof(__pyx_k____import__), 0, 0, 1, 1},
   {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
   {&__pyx_n_s____name__, __pyx_k____name__, sizeof(__pyx_k____name__), 0, 0, 1, 1},
   {&__pyx_n_s____pyx_getbuffer, __pyx_k____pyx_getbuffer, sizeof(__pyx_k____pyx_getbuffer), 0, 0, 1, 1},
+  {&__pyx_n_s____pyx_releasebuffer, __pyx_k____pyx_releasebuffer, sizeof(__pyx_k____pyx_releasebuffer), 0, 0, 1, 1},
+  {&__pyx_n_s____pyx_vtable__, __pyx_k____pyx_vtable__, sizeof(__pyx_k____pyx_vtable__), 0, 0, 1, 1},
   {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
   {&__pyx_n_s__allocate_buffer, __pyx_k__allocate_buffer, sizeof(__pyx_k__allocate_buffer), 0, 0, 1, 1},
   {&__pyx_n_s__ascontiguousarray, __pyx_k__ascontiguousarray, sizeof(__pyx_k__ascontiguousarray), 0, 0, 1, 1},
@@ -15882,7 +15760,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s__fortran, __pyx_k__fortran, sizeof(__pyx_k__fortran), 0, 0, 1, 1},
   {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1},
   {&__pyx_n_s__id, __pyx_k__id, sizeof(__pyx_k__id), 0, 0, 1, 1},
-  {&__pyx_n_s__int32, __pyx_k__int32, sizeof(__pyx_k__int32), 0, 0, 1, 1},
   {&__pyx_n_s__int8, __pyx_k__int8, sizeof(__pyx_k__int8), 0, 0, 1, 1},
   {&__pyx_n_s__itemsize, __pyx_k__itemsize, sizeof(__pyx_k__itemsize), 0, 0, 1, 1},
   {&__pyx_n_s__l, __pyx_k__l, sizeof(__pyx_k__l), 0, 0, 1, 1},
@@ -15912,20 +15789,20 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {0, 0, 0, 0, 0, 0, 0}
 };
 static int __Pyx_InitCachedBuiltins(void) {
-  __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_MemoryError = __Pyx_GetName(__pyx_b, __pyx_n_s__MemoryError); if (!__pyx_builtin_MemoryError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_enumerate = __Pyx_GetName(__pyx_b, __pyx_n_s__enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_Ellipsis = __Pyx_GetName(__pyx_b, __pyx_n_s__Ellipsis); if (!__pyx_builtin_Ellipsis) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s__MemoryError); if (!__pyx_builtin_MemoryError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s__enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s__Ellipsis); if (!__pyx_builtin_Ellipsis) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   #if PY_MAJOR_VERSION >= 3
-  __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   #else
-  __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__xrange); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s__xrange); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   #endif
-  __pyx_builtin_id = __Pyx_GetName(__pyx_b, __pyx_n_s__id); if (!__pyx_builtin_id) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_IndexError = __Pyx_GetName(__pyx_b, __pyx_n_s__IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s__id); if (!__pyx_builtin_id) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s__IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   return 0;
   __pyx_L1_error:;
   return -1;
@@ -15935,20 +15812,6 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
 
-  /* "reconstruct.pyx":75
- *         else:
- *             mask+=(abs(data-dummy)<=delta_dummy)
- *     cdef bint[:,:] cmask = mask.astype("int32")             # <<<<<<<<<<<<<<
- *     assert d0==mask.shape[0]
- *     assert d1==mask.shape[1]
- */
-  __pyx_k_tuple_1 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_1);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__int32));
-  PyTuple_SET_ITEM(__pyx_k_tuple_1, 0, ((PyObject *)__pyx_n_s__int32));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__int32));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_1));
-
   /* "numpy.pxd":215
  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
  *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
@@ -15956,12 +15819,9 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
  */
-  __pyx_k_tuple_3 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_3);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_2));
-  PyTuple_SET_ITEM(__pyx_k_tuple_3, 0, ((PyObject *)__pyx_kp_u_2));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_2));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_3));
+  __pyx_k_tuple_2 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_1)); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_2);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2));
 
   /* "numpy.pxd":219
  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
@@ -15970,12 +15830,9 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *             info.buf = PyArray_DATA(self)
  */
-  __pyx_k_tuple_5 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_5);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_4));
-  PyTuple_SET_ITEM(__pyx_k_tuple_5, 0, ((PyObject *)__pyx_kp_u_4));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_4));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5));
+  __pyx_k_tuple_4 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_3)); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_4);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4));
 
   /* "numpy.pxd":257
  *                 if ((descr.byteorder == c'>' and little_endian) or
@@ -15984,12 +15841,9 @@ static int __Pyx_InitCachedConstants(void) {
  *                 if   t == NPY_BYTE:        f = "b"
  *                 elif t == NPY_UBYTE:       f = "B"
  */
-  __pyx_k_tuple_7 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_7);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_6));
-  PyTuple_SET_ITEM(__pyx_k_tuple_7, 0, ((PyObject *)__pyx_kp_u_6));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_6));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_7));
+  __pyx_k_tuple_6 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_5)); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_6);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6));
 
   /* "numpy.pxd":799
  * 
@@ -15998,12 +15852,9 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *         if ((child.byteorder == c'>' and little_endian) or
  */
-  __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_10);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_9));
-  PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_kp_u_9));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_9));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10));
+  __pyx_k_tuple_9 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_8)); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_9);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9));
 
   /* "numpy.pxd":803
  *         if ((child.byteorder == c'>' and little_endian) or
@@ -16012,12 +15863,9 @@ static int __Pyx_InitCachedConstants(void) {
  *             # One could encode it in the format string and have Cython
  *             # complain instead, BUT: < and > in format strings also imply
  */
-  __pyx_k_tuple_11 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_11);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_6));
-  PyTuple_SET_ITEM(__pyx_k_tuple_11, 0, ((PyObject *)__pyx_kp_u_6));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_6));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11));
+  __pyx_k_tuple_10 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_5)); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_10);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10));
 
   /* "numpy.pxd":823
  *             t = child.type_num
@@ -16026,12 +15874,9 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *             # Until ticket #99 is fixed, use integers to avoid warnings
  */
-  __pyx_k_tuple_13 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_13);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_12));
-  PyTuple_SET_ITEM(__pyx_k_tuple_13, 0, ((PyObject *)__pyx_kp_u_12));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_12));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_13));
+  __pyx_k_tuple_12 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_11)); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_12);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12));
 
   /* "View.MemoryView":124
  * 
@@ -16040,12 +15885,9 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *         if self.itemsize <= 0:
  */
-  __pyx_k_tuple_15 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_15);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_14));
-  PyTuple_SET_ITEM(__pyx_k_tuple_15, 0, ((PyObject *)__pyx_kp_s_14));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15));
+  __pyx_k_tuple_14 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_13)); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_14);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14));
 
   /* "View.MemoryView":127
  * 
@@ -16054,12 +15896,9 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *         encode = getattr(format, 'encode', None)
  */
-  __pyx_k_tuple_17 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_17);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_16));
-  PyTuple_SET_ITEM(__pyx_k_tuple_17, 0, ((PyObject *)__pyx_kp_s_16));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_16));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17));
+  __pyx_k_tuple_16 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_15)); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_16);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16));
 
   /* "View.MemoryView":131
  *         encode = getattr(format, 'encode', None)
@@ -16068,12 +15907,9 @@ static int __Pyx_InitCachedConstants(void) {
  *         self._format = format
  *         self.format = self._format
  */
-  __pyx_k_tuple_18 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_18);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__ASCII));
-  PyTuple_SET_ITEM(__pyx_k_tuple_18, 0, ((PyObject *)__pyx_n_s__ASCII));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ASCII));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18));
+  __pyx_k_tuple_17 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__ASCII)); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_17);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17));
 
   /* "View.MemoryView":141
  *             free(self._shape)
@@ -16082,12 +15918,9 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  * 
  */
-  __pyx_k_tuple_20 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_20)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_20);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_19));
-  PyTuple_SET_ITEM(__pyx_k_tuple_20, 0, ((PyObject *)__pyx_kp_s_19));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_19));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_20));
+  __pyx_k_tuple_19 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_18)); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_19);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_19));
 
   /* "View.MemoryView":166
  *         decode = getattr(mode, 'decode', None)
@@ -16096,12 +15929,9 @@ static int __Pyx_InitCachedConstants(void) {
  *         self.mode = mode
  * 
  */
-  __pyx_k_tuple_23 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_23)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_23);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__ASCII));
-  PyTuple_SET_ITEM(__pyx_k_tuple_23, 0, ((PyObject *)__pyx_n_s__ASCII));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ASCII));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_23));
+  __pyx_k_tuple_22 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__ASCII)); if (unlikely(!__pyx_k_tuple_22)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_22);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_22));
 
   /* "View.MemoryView":174
  *             self.data = <char *>malloc(self.len)
@@ -16110,12 +15940,9 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *             if self.dtype_is_object:
  */
-  __pyx_k_tuple_25 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_25)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_25);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_24));
-  PyTuple_SET_ITEM(__pyx_k_tuple_25, 0, ((PyObject *)__pyx_kp_s_24));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_24));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_25));
+  __pyx_k_tuple_24 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_23)); if (unlikely(!__pyx_k_tuple_24)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_24);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_24));
 
   /* "View.MemoryView":190
  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
@@ -16124,12 +15951,9 @@ static int __Pyx_InitCachedConstants(void) {
  *         info.buf = self.data
  *         info.len = self.len
  */
-  __pyx_k_tuple_27 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_27)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_27);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_26));
-  PyTuple_SET_ITEM(__pyx_k_tuple_27, 0, ((PyObject *)__pyx_kp_s_26));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_26));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_27));
+  __pyx_k_tuple_26 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_25)); if (unlikely(!__pyx_k_tuple_26)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_26);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_26));
 
   /* "View.MemoryView":452
  *             result = struct.unpack(self.view.format, bytesitem)
@@ -16138,12 +15962,9 @@ static int __Pyx_InitCachedConstants(void) {
  *         else:
  *             if len(self.view.format) == 1:
  */
-  __pyx_k_tuple_29 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_29)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_29);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_28));
-  PyTuple_SET_ITEM(__pyx_k_tuple_29, 0, ((PyObject *)__pyx_kp_s_28));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_28));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_29));
+  __pyx_k_tuple_28 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_27)); if (unlikely(!__pyx_k_tuple_28)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_28);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_28));
 
   /* "View.MemoryView":528
  *             if self.view.strides == NULL:
@@ -16152,12 +15973,9 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *             return tuple([self.view.strides[i] for i in xrange(self.view.ndim)])
  */
-  __pyx_k_tuple_31 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_31)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_31);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_30));
-  PyTuple_SET_ITEM(__pyx_k_tuple_31, 0, ((PyObject *)__pyx_kp_s_30));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_30));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_31));
+  __pyx_k_tuple_30 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_29)); if (unlikely(!__pyx_k_tuple_30)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_30);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_30));
 
   /* "View.MemoryView":643
  *         if item is Ellipsis:
@@ -16166,12 +15984,9 @@ static int __Pyx_InitCachedConstants(void) {
  *                 seen_ellipsis = True
  *             else:
  */
-  __pyx_k_tuple_34 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_34)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_34);
-  __Pyx_INCREF(Py_None);
-  PyTuple_SET_ITEM(__pyx_k_tuple_34, 0, Py_None);
-  __Pyx_GIVEREF(Py_None);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_34));
+  __pyx_k_tuple_33 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_k_tuple_33)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_33);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_33));
 
   /* "View.MemoryView":646
  *                 seen_ellipsis = True
@@ -16180,12 +15995,9 @@ static int __Pyx_InitCachedConstants(void) {
  *             have_slices = True
  *         else:
  */
-  __pyx_k_tuple_35 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_35)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_35);
-  __Pyx_INCREF(Py_None);
-  PyTuple_SET_ITEM(__pyx_k_tuple_35, 0, Py_None);
-  __Pyx_GIVEREF(Py_None);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_35));
+  __pyx_k_tuple_34 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_k_tuple_34)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_34);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_34));
 
   /* "View.MemoryView":657
  *     nslices = ndim - len(result)
@@ -16194,12 +16006,9 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *     return have_slices or nslices, tuple(result)
  */
-  __pyx_k_tuple_37 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_37)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_37);
-  __Pyx_INCREF(Py_None);
-  PyTuple_SET_ITEM(__pyx_k_tuple_37, 0, Py_None);
-  __Pyx_GIVEREF(Py_None);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_37));
+  __pyx_k_tuple_36 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_k_tuple_36)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_36);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_36));
 
   /* "View.MemoryView":665
  *     for i in range(ndim):
@@ -16208,63 +16017,21 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  * 
  */
-  __pyx_k_tuple_39 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_39)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_39);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_38));
-  PyTuple_SET_ITEM(__pyx_k_tuple_39, 0, ((PyObject *)__pyx_kp_s_38));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_38));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_39));
+  __pyx_k_tuple_38 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_37)); if (unlikely(!__pyx_k_tuple_38)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_38);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_38));
 
-  /* "reconstruct.pyx":60
+  /* "reconstruct.pyx":65
  * @cython.boundscheck(False)
  * @cython.wraparound(False)
  * def reconstruct(numpy.ndarray data not None, numpy.ndarray mask=None, dummy=None,  delta_dummy=None):             # <<<<<<<<<<<<<<
  *     assert data.ndim==2
  *     cdef ssize_t d0=data.shape[0]
  */
-  __pyx_k_tuple_47 = PyTuple_New(13); if (unlikely(!__pyx_k_tuple_47)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_47);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__data));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 0, ((PyObject *)__pyx_n_s__data));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__data));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__mask));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 1, ((PyObject *)__pyx_n_s__mask));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mask));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__dummy));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 2, ((PyObject *)__pyx_n_s__dummy));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dummy));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__delta_dummy));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 3, ((PyObject *)__pyx_n_s__delta_dummy));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__delta_dummy));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__d0));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 4, ((PyObject *)__pyx_n_s__d0));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__d0));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__d1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 5, ((PyObject *)__pyx_n_s__d1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__d1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cdata));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 6, ((PyObject *)__pyx_n_s__cdata));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cdata));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cmask));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 7, ((PyObject *)__pyx_n_s__cmask));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cmask));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 8, ((PyObject *)__pyx_n_s__out));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__p0));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 9, ((PyObject *)__pyx_n_s__p0));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__p0));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__p1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 10, ((PyObject *)__pyx_n_s__p1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__p1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 11, ((PyObject *)__pyx_n_s__i));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__l));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 12, ((PyObject *)__pyx_n_s__l));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__l));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_47));
-  __pyx_k_codeobj_48 = (PyObject*)__Pyx_PyCode_New(4, 0, 13, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_47, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_49, __pyx_n_s__reconstruct, 60, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_48)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_46 = PyTuple_Pack(13, ((PyObject *)__pyx_n_s__data), ((PyObject *)__pyx_n_s__mask), ((PyObject *)__pyx_n_s__dummy), ((PyObject *)__pyx_n_s__delta_dummy), ((PyObject *)__pyx_n_s__d0), ((PyObject *)__pyx_n_s__d1), ((PyObject *)__pyx_n_s__cdata), ((PyObject *)__pyx_n_s__cmask), ((PyObject *)__pyx_n_s__out), ((PyObject *)__pyx_n_s__p0), ((PyObject *)__pyx_n_s__p1), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__l)); if (unlikely(!__pyx_k_tuple_46)) {__pyx_filename = __py [...]
+  __Pyx_GOTREF(__pyx_k_tuple_46);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_46));
+  __pyx_k_codeobj_47 = (PyObject*)__Pyx_PyCode_New(4, 0, 13, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_48, __pyx_n_s__reconstruct, 65, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_47)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   /* "View.MemoryView":282
  *         return self.name
@@ -16273,12 +16040,9 @@ static int __Pyx_InitCachedConstants(void) {
  * cdef strided = Enum("<strided and direct>") # default
  * cdef indirect = Enum("<strided and indirect>")
  */
-  __pyx_k_tuple_52 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_52)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_52);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_51));
-  PyTuple_SET_ITEM(__pyx_k_tuple_52, 0, ((PyObject *)__pyx_kp_s_51));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_51));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_52));
+  __pyx_k_tuple_51 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_50)); if (unlikely(!__pyx_k_tuple_51)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_51);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_51));
 
   /* "View.MemoryView":283
  * 
@@ -16287,12 +16051,9 @@ static int __Pyx_InitCachedConstants(void) {
  * cdef indirect = Enum("<strided and indirect>")
  * 
  */
-  __pyx_k_tuple_54 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_54)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_54);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_53));
-  PyTuple_SET_ITEM(__pyx_k_tuple_54, 0, ((PyObject *)__pyx_kp_s_53));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_53));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_54));
+  __pyx_k_tuple_53 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_52)); if (unlikely(!__pyx_k_tuple_53)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_53);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_53));
 
   /* "View.MemoryView":284
  * cdef generic = Enum("<strided and direct or indirect>")
@@ -16301,12 +16062,9 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  * 
  */
-  __pyx_k_tuple_56 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_56)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_56);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_55));
-  PyTuple_SET_ITEM(__pyx_k_tuple_56, 0, ((PyObject *)__pyx_kp_s_55));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_55));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_56));
+  __pyx_k_tuple_55 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_54)); if (unlikely(!__pyx_k_tuple_55)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_55);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_55));
 
   /* "View.MemoryView":287
  * 
@@ -16315,12 +16073,9 @@ static int __Pyx_InitCachedConstants(void) {
  * cdef indirect_contiguous = Enum("<contiguous and indirect>")
  * 
  */
-  __pyx_k_tuple_58 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_58)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_58);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_57));
-  PyTuple_SET_ITEM(__pyx_k_tuple_58, 0, ((PyObject *)__pyx_kp_s_57));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_57));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_58));
+  __pyx_k_tuple_57 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_56)); if (unlikely(!__pyx_k_tuple_57)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_57);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_57));
 
   /* "View.MemoryView":288
  * 
@@ -16329,12 +16084,9 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  * 
  */
-  __pyx_k_tuple_60 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_60)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_60);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_59));
-  PyTuple_SET_ITEM(__pyx_k_tuple_60, 0, ((PyObject *)__pyx_kp_s_59));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_59));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_60));
+  __pyx_k_tuple_59 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_58)); if (unlikely(!__pyx_k_tuple_59)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_59);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_59));
   __Pyx_RefNannyFinishContext();
   return 0;
   __pyx_L1_error:;
@@ -16343,16 +16095,14 @@ static int __Pyx_InitCachedConstants(void) {
 }
 
 static int __Pyx_InitGlobals(void) {
-  /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and
-   a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is
-   a quiet NaN. */
-    memset(&__PYX_NAN, 0xFF, sizeof(__PYX_NAN));
-
-#ifdef WITH_THREAD
+  /* InitThreads.init */
+  #ifdef WITH_THREAD
 PyEval_InitThreads();
 #endif
 
-if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
   __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
   __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
   __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
@@ -16371,6 +16121,9 @@ PyMODINIT_FUNC PyInit_reconstruct(void)
 #endif
 {
   PyObject *__pyx_t_1 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannyDeclarations
   #if CYTHON_REFNANNY
   __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
@@ -16408,6 +16161,16 @@ PyMODINIT_FUNC PyInit_reconstruct(void)
   __pyx_m = PyModule_Create(&__pyx_moduledef);
   #endif
   if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  Py_INCREF(__pyx_d);
+  #if PY_MAJOR_VERSION >= 3
+  {
+    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (!PyDict_GetItemString(modules, "reconstruct")) {
+      if (unlikely(PyDict_SetItemString(modules, "reconstruct", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    }
+  }
+  #endif
   __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   #if CYTHON_COMPILING_IN_PYPY
   Py_INCREF(__pyx_b);
@@ -16415,6 +16178,9 @@ PyMODINIT_FUNC PyInit_reconstruct(void)
   if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
   /*--- Initialize various global constants etc. ---*/
   if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
+  if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  #endif
   if (__pyx_module_is_main_reconstruct) {
     if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
   }
@@ -16431,12 +16197,6 @@ PyMODINIT_FUNC PyInit_reconstruct(void)
   /*--- Variable export code ---*/
   /*--- Function export code ---*/
   /*--- Type init code ---*/
-  if (PyType_Ready(&__pyx_type___pyx_array) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "array", (PyObject *)&__pyx_type___pyx_array) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_array_type = &__pyx_type___pyx_array;
-  if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "Enum", (PyObject *)&__pyx_type___pyx_MemviewEnum) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
   __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview;
   __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer;
   __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice;
@@ -16447,8 +16207,11 @@ PyMODINIT_FUNC PyInit_reconstruct(void)
   __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object;
   if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "memoryview", (PyObject *)&__pyx_type___pyx_memoryview) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_memoryview_type = &__pyx_type___pyx_memoryview;
+  if (PyType_Ready(&__pyx_type___pyx_array) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_array_type = &__pyx_type___pyx_array;
+  if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
   __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice;
   __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview;
   __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object;
@@ -16456,7 +16219,6 @@ PyMODINIT_FUNC PyInit_reconstruct(void)
   __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type;
   if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "_memoryviewslice", (PyObject *)&__pyx_type___pyx_memoryviewslice) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice;
   /*--- Type import code ---*/
   __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", 
@@ -16484,19 +16246,19 @@ PyMODINIT_FUNC PyInit_reconstruct(void)
  */
   __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__numpy, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s__numpy, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "reconstruct.pyx":60
+  /* "reconstruct.pyx":65
  * @cython.boundscheck(False)
  * @cython.wraparound(False)
  * def reconstruct(numpy.ndarray data not None, numpy.ndarray mask=None, dummy=None,  delta_dummy=None):             # <<<<<<<<<<<<<<
  *     assert data.ndim==2
  *     cdef ssize_t d0=data.shape[0]
  */
-  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11reconstruct_1reconstruct, NULL, __pyx_n_s__reconstruct); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11reconstruct_1reconstruct, NULL, __pyx_n_s__reconstruct); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__reconstruct, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s__reconstruct, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
   /* "reconstruct.pyx":1
@@ -16506,7 +16268,7 @@ PyMODINIT_FUNC PyInit_reconstruct(void)
  */
   __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
   /* "View.MemoryView":207
@@ -16516,7 +16278,7 @@ PyMODINIT_FUNC PyInit_reconstruct(void)
  * 
  *     def __dealloc__(array self):
  */
-  __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), __pyx_k_50); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), __pyx_k_49); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   if (PyDict_SetItem(__pyx_array_type->tp_dict, __pyx_n_s____pyx_getbuffer, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -16529,12 +16291,11 @@ PyMODINIT_FUNC PyInit_reconstruct(void)
  * cdef strided = Enum("<strided and direct>") # default
  * cdef indirect = Enum("<strided and indirect>")
  */
-  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_52), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_51), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_XGOTREF(generic);
-  __Pyx_DECREF(generic);
+  __Pyx_DECREF_SET(generic, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
-  generic = __pyx_t_1;
   __pyx_t_1 = 0;
 
   /* "View.MemoryView":283
@@ -16544,12 +16305,11 @@ PyMODINIT_FUNC PyInit_reconstruct(void)
  * cdef indirect = Enum("<strided and indirect>")
  * 
  */
-  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_54), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_53), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_XGOTREF(strided);
-  __Pyx_DECREF(strided);
+  __Pyx_DECREF_SET(strided, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
-  strided = __pyx_t_1;
   __pyx_t_1 = 0;
 
   /* "View.MemoryView":284
@@ -16559,12 +16319,11 @@ PyMODINIT_FUNC PyInit_reconstruct(void)
  * 
  * 
  */
-  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_56), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_55), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_XGOTREF(indirect);
-  __Pyx_DECREF(indirect);
+  __Pyx_DECREF_SET(indirect, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
-  indirect = __pyx_t_1;
   __pyx_t_1 = 0;
 
   /* "View.MemoryView":287
@@ -16574,12 +16333,11 @@ PyMODINIT_FUNC PyInit_reconstruct(void)
  * cdef indirect_contiguous = Enum("<contiguous and indirect>")
  * 
  */
-  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_58), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_57), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_XGOTREF(contiguous);
-  __Pyx_DECREF(contiguous);
+  __Pyx_DECREF_SET(contiguous, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
-  contiguous = __pyx_t_1;
   __pyx_t_1 = 0;
 
   /* "View.MemoryView":288
@@ -16589,12 +16347,11 @@ PyMODINIT_FUNC PyInit_reconstruct(void)
  * 
  * 
  */
-  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_60), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_59), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_XGOTREF(indirect_contiguous);
-  __Pyx_DECREF(indirect_contiguous);
+  __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
-  indirect_contiguous = __pyx_t_1;
   __pyx_t_1 = 0;
 
   /* "View.MemoryView":503
@@ -16604,7 +16361,7 @@ PyMODINIT_FUNC PyInit_reconstruct(void)
  * 
  * 
  */
-  __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), __pyx_k_50); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), __pyx_k_49); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   if (PyDict_SetItem(__pyx_memoryview_type->tp_dict, __pyx_n_s____pyx_getbuffer, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -16617,7 +16374,7 @@ PyMODINIT_FUNC PyInit_reconstruct(void)
  * 
  * 
  */
-  __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), __pyx_k_50); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), __pyx_k_49); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   if (PyDict_SetItem(__pyx_memoryviewslice_type->tp_dict, __pyx_n_s____pyx_getbuffer, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -16665,17 +16422,15 @@ end:
 }
 #endif /* CYTHON_REFNANNY */
 
-static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
-    PyObject *result;
-    result = PyObject_GetAttr(dict, name);
-    if (!result) {
-        if (dict != __pyx_b) {
-            PyErr_Clear();
-            result = PyObject_GetAttr(__pyx_b, name);
-        }
-        if (!result) {
-            PyErr_SetObject(PyExc_NameError, name);
-        }
+static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
+    PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
+    if (unlikely(!result)) {
+        PyErr_Format(PyExc_NameError,
+#if PY_MAJOR_VERSION >= 3
+            "name '%U' is not defined", name);
+#else
+            "name '%s' is not defined", PyString_AS_STRING(name));
+#endif
     }
     return result;
 }
@@ -16839,6 +16594,23 @@ static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed
     return 0;
 }
 
+static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
+    PyObject *result;
+#if CYTHON_COMPILING_IN_CPYTHON
+    result = PyDict_GetItem(__pyx_d, name);
+    if (result) {
+        Py_INCREF(result);
+    } else {
+#else
+    result = PyObject_GetItem(__pyx_d, name);
+    if (!result) {
+        PyErr_Clear();
+#endif
+        result = __Pyx_GetBuiltinName(name);
+    }
+    return result;
+}
+
 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
     if (unlikely(!type)) {
         PyErr_Format(PyExc_SystemError, "Missing type object");
@@ -17345,246 +17117,60 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha
           ctx->new_count = (size_t)number;
         }
     }
-  }
-}
-static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) {
-  buf->buf = NULL;
-  buf->obj = NULL;
-  buf->strides = __Pyx_zeros;
-  buf->shape = __Pyx_zeros;
-  buf->suboffsets = __Pyx_minusones;
-}
-static CYTHON_INLINE int __Pyx_GetBufferAndValidate(
-        Py_buffer* buf, PyObject* obj,  __Pyx_TypeInfo* dtype, int flags,
-        int nd, int cast, __Pyx_BufFmt_StackElem* stack)
-{
-  if (obj == Py_None || obj == NULL) {
-    __Pyx_ZeroBuffer(buf);
-    return 0;
-  }
-  buf->buf = NULL;
-  if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail;
-  if (buf->ndim != nd) {
-    PyErr_Format(PyExc_ValueError,
-                 "Buffer has wrong number of dimensions (expected %d, got %d)",
-                 nd, buf->ndim);
-    goto fail;
-  }
-  if (!cast) {
-    __Pyx_BufFmt_Context ctx;
-    __Pyx_BufFmt_Init(&ctx, stack, dtype);
-    if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
-  }
-  if ((unsigned)buf->itemsize != dtype->size) {
-    PyErr_Format(PyExc_ValueError,
-      "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)",
-      buf->itemsize, (buf->itemsize > 1) ? "s" : "",
-      dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : "");
-    goto fail;
-  }
-  if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
-  return 0;
-fail:;
-  __Pyx_ZeroBuffer(buf);
-  return -1;
-}
-static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
-  if (info->buf == NULL) return;
-  if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
-  __Pyx_ReleaseBuffer(info);
-}
-
-static void __Pyx_RaiseBufferFallbackError(void) {
-  PyErr_Format(PyExc_ValueError,
-     "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!");
-}
-
-static int
-__pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b)
-{
-    int i;
-    if (!a || !b)
-        return 0;
-    if (a == b)
-        return 1;
-    if (a->size != b->size || a->typegroup != b->typegroup ||
-            a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) {
-        if (a->typegroup == 'H' || b->typegroup == 'H') {
-            return a->size == b->size;
-        } else {
-            return 0;
-        }
-    }
-    if (a->ndim) {
-        for (i = 0; i < a->ndim; i++)
-            if (a->arraysize[i] != b->arraysize[i])
-                return 0;
-    }
-    if (a->typegroup == 'S') {
-        if (a->flags != b->flags)
-            return 0;
-        if (a->fields || b->fields) {
-            if (!(a->fields && b->fields))
-                return 0;
-            for (i = 0; a->fields[i].type && b->fields[i].type; i++) {
-                __Pyx_StructField *field_a = a->fields + i;
-                __Pyx_StructField *field_b = b->fields + i;
-                if (field_a->offset != field_b->offset ||
-                    !__pyx_typeinfo_cmp(field_a->type, field_b->type))
-                    return 0;
-            }
-            return !a->fields[i].type && !b->fields[i].type;
-        }
-    }
-    return 1;
-}
-
-static int __Pyx_ValidateAndInit_memviewslice(
-                int *axes_specs,
-                int c_or_f_flag,
-                int buf_flags,
-                int ndim,
-                __Pyx_TypeInfo *dtype,
-                __Pyx_BufFmt_StackElem stack[],
-                __Pyx_memviewslice *memviewslice,
-                PyObject *original_obj)
-{
-    struct __pyx_memoryview_obj *memview, *new_memview;
-    __Pyx_RefNannyDeclarations
-    Py_buffer *buf;
-    int i, spec = 0, retval = -1;
-    __Pyx_BufFmt_Context ctx;
-    int from_memoryview = __pyx_memoryview_check(original_obj);
-    __Pyx_RefNannySetupContext("ValidateAndInit_memviewslice", 0);
-    if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((struct __pyx_memoryview_obj *)
-                                                            original_obj)->typeinfo)) {
-        memview = (struct __pyx_memoryview_obj *) original_obj;
-        new_memview = NULL;
-    } else {
-        memview = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
-                                            original_obj, buf_flags, 0, dtype);
-        new_memview = memview;
-        if (unlikely(!memview))
-            goto fail;
-    }
-    buf = &memview->view;
-    if (buf->ndim != ndim) {
-        PyErr_Format(PyExc_ValueError,
-                "Buffer has wrong number of dimensions (expected %d, got %d)",
-                ndim, buf->ndim);
-        goto fail;
-    }
-    if (new_memview) {
-        __Pyx_BufFmt_Init(&ctx, stack, dtype);
-        if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
-    }
-    if ((unsigned)buf->itemsize != dtype->size) {
-        PyErr_Format(PyExc_ValueError,
-                     "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "u byte%s) "
-                     "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "u byte%s)",
-                     buf->itemsize,
-                     (buf->itemsize > 1) ? "s" : "",
-                     dtype->name,
-                     dtype->size,
-                     (dtype->size > 1) ? "s" : "");
-        goto fail;
-    }
-    for (i = 0; i < ndim; i++) {
-        spec = axes_specs[i];
-        if (buf->strides) {
-            if (spec & __Pyx_MEMVIEW_CONTIG) {
-                if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) {
-                    if (buf->strides[i] != sizeof(void *)) {
-                        PyErr_Format(PyExc_ValueError,
-                            "Buffer is not indirectly contiguous in dimension %d.", i);
-                        goto fail;
-                    }
-                } else if (buf->strides[i] != buf->itemsize) {
-                    PyErr_SetString(PyExc_ValueError,
-                        "Buffer and memoryview are not contiguous in the same dimension.");
-                    goto fail;
-                }
-            }
-            if (spec & __Pyx_MEMVIEW_FOLLOW) {
-                Py_ssize_t stride = buf->strides[i];
-                if (stride < 0)
-                    stride = -stride;
-                if (stride < buf->itemsize) {
-                    PyErr_SetString(PyExc_ValueError,
-                        "Buffer and memoryview are not contiguous in the same dimension.");
-                    goto fail;
-                }
-            }
-        } else {
-            if (spec & __Pyx_MEMVIEW_CONTIG && i != ndim - 1) {
-                PyErr_Format(PyExc_ValueError,
-                             "C-contiguous buffer is not contiguous in "
-                             "dimension %d", i);
-                goto fail;
-            } else if (spec & (__Pyx_MEMVIEW_PTR)) {
-                PyErr_Format(PyExc_ValueError,
-                             "C-contiguous buffer is not indirect in "
-                             "dimension %d", i);
-                goto fail;
-            } else if (buf->suboffsets) {
-                PyErr_SetString(PyExc_ValueError,
-                                "Buffer exposes suboffsets but no strides");
-                goto fail;
-            }
-        }
-        /* Todo: without PyBUF_INDIRECT we may not have suboffset information, i.e., the
-           ptr may not be set to NULL but may be uninitialized? */
-        if (spec & __Pyx_MEMVIEW_DIRECT) {
-            if (buf->suboffsets && buf->suboffsets[i] >= 0) {
-                PyErr_Format(PyExc_ValueError,
-                    "Buffer not compatible with direct access in dimension %d.", i);
-                goto fail;
-            }
-        }
-        if (spec & __Pyx_MEMVIEW_PTR) {
-            if (!buf->suboffsets || (buf->suboffsets && buf->suboffsets[i] < 0)) {
-                PyErr_Format(PyExc_ValueError,
-                    "Buffer is not indirectly accessisble in dimension %d.", i);
-                goto fail;
-            }
-        }
-    }
-    if (buf->strides) {
-        if (c_or_f_flag & __Pyx_IS_F_CONTIG) {
-            Py_ssize_t stride = 1;
-            for (i=0; i<ndim; i++) {
-                if (stride * buf->itemsize != buf->strides[i]) {
-                    PyErr_SetString(PyExc_ValueError,
-                        "Buffer not fortran contiguous.");
-                    goto fail;
-                }
-                stride = stride * buf->shape[i];
-            }
-        } else if (c_or_f_flag & __Pyx_IS_C_CONTIG) {
-            Py_ssize_t stride = 1;
-            for (i = ndim-1; i>-1; i--) {
-                if(stride * buf->itemsize != buf->strides[i]) {
-                    PyErr_SetString(PyExc_ValueError,
-                        "Buffer not C contiguous.");
-                    goto fail;
-                }
-                stride = stride * buf->shape[i];
-            }
-        }
-    }
-    if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice,
-                                         new_memview != NULL) == -1)) {
-        goto fail;
-    }
-    retval = 0;
-    goto no_fail;
-fail:
-    Py_XDECREF(new_memview);
-    retval = -1;
-no_fail:
-    __Pyx_RefNannyFinishContext();
-    return retval;
+  }
+}
+static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) {
+  buf->buf = NULL;
+  buf->obj = NULL;
+  buf->strides = __Pyx_zeros;
+  buf->shape = __Pyx_zeros;
+  buf->suboffsets = __Pyx_minusones;
+}
+static CYTHON_INLINE int __Pyx_GetBufferAndValidate(
+        Py_buffer* buf, PyObject* obj,  __Pyx_TypeInfo* dtype, int flags,
+        int nd, int cast, __Pyx_BufFmt_StackElem* stack)
+{
+  if (obj == Py_None || obj == NULL) {
+    __Pyx_ZeroBuffer(buf);
+    return 0;
+  }
+  buf->buf = NULL;
+  if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail;
+  if (buf->ndim != nd) {
+    PyErr_Format(PyExc_ValueError,
+                 "Buffer has wrong number of dimensions (expected %d, got %d)",
+                 nd, buf->ndim);
+    goto fail;
+  }
+  if (!cast) {
+    __Pyx_BufFmt_Context ctx;
+    __Pyx_BufFmt_Init(&ctx, stack, dtype);
+    if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
+  }
+  if ((unsigned)buf->itemsize != dtype->size) {
+    PyErr_Format(PyExc_ValueError,
+      "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)",
+      buf->itemsize, (buf->itemsize > 1) ? "s" : "",
+      dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : "");
+    goto fail;
+  }
+  if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
+  return 0;
+fail:;
+  __Pyx_ZeroBuffer(buf);
+  return -1;
+}
+static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
+  if (info->buf == NULL) return;
+  if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
+  __Pyx_ReleaseBuffer(info);
+}
+
+static void __Pyx_RaiseBufferFallbackError(void) {
+  PyErr_Format(PyExc_ValueError,
+     "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!");
 }
+
 static int
 __Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview,
                         int ndim,
@@ -17789,24 +17375,23 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
         }
         value = type;
         #if PY_VERSION_HEX < 0x02050000
-            if (PyInstance_Check(type)) {
-                type = (PyObject*) ((PyInstanceObject*)type)->in_class;
-                Py_INCREF(type);
-            }
-            else {
-                type = 0;
-                PyErr_SetString(PyExc_TypeError,
-                    "raise: exception must be an old-style class or instance");
-                goto raise_error;
-            }
-        #else
-            type = (PyObject*) Py_TYPE(type);
+        if (PyInstance_Check(type)) {
+            type = (PyObject*) ((PyInstanceObject*)type)->in_class;
             Py_INCREF(type);
-            if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
-                PyErr_SetString(PyExc_TypeError,
-                    "raise: exception class must be a subclass of BaseException");
-                goto raise_error;
-            }
+        } else {
+            type = 0;
+            PyErr_SetString(PyExc_TypeError,
+                "raise: exception must be an old-style class or instance");
+            goto raise_error;
+        }
+        #else
+        type = (PyObject*) Py_TYPE(type);
+        Py_INCREF(type);
+        if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
+            PyErr_SetString(PyExc_TypeError,
+                "raise: exception class must be a subclass of BaseException");
+            goto raise_error;
+        }
         #endif
     }
     __Pyx_ErrRestore(type, value, tb);
@@ -17838,46 +17423,62 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject
         value = type;
         type = (PyObject*) Py_TYPE(value);
     } else if (PyExceptionClass_Check(type)) {
-        PyObject *args;
-        if (!value)
-            args = PyTuple_New(0);
-        else if (PyTuple_Check(value)) {
-            Py_INCREF(value);
-            args = value;
+        PyObject *instance_class = NULL;
+        if (value && PyExceptionInstance_Check(value)) {
+            instance_class = (PyObject*) Py_TYPE(value);
+            if (instance_class != type) {
+                if (PyObject_IsSubclass(instance_class, type)) {
+                    type = instance_class;
+                } else {
+                    instance_class = NULL;
+                }
+            }
         }
-        else
-            args = PyTuple_Pack(1, value);
-        if (!args)
-            goto bad;
-        owned_instance = PyEval_CallObject(type, args);
-        Py_DECREF(args);
-        if (!owned_instance)
-            goto bad;
-        value = owned_instance;
-        if (!PyExceptionInstance_Check(value)) {
-            PyErr_Format(PyExc_TypeError,
-                         "calling %R should have returned an instance of "
-                         "BaseException, not %R",
-                         type, Py_TYPE(value));
-            goto bad;
+        if (!instance_class) {
+            PyObject *args;
+            if (!value)
+                args = PyTuple_New(0);
+            else if (PyTuple_Check(value)) {
+                Py_INCREF(value);
+                args = value;
+            } else
+                args = PyTuple_Pack(1, value);
+            if (!args)
+                goto bad;
+            owned_instance = PyObject_Call(type, args, NULL);
+            Py_DECREF(args);
+            if (!owned_instance)
+                goto bad;
+            value = owned_instance;
+            if (!PyExceptionInstance_Check(value)) {
+                PyErr_Format(PyExc_TypeError,
+                             "calling %R should have returned an instance of "
+                             "BaseException, not %R",
+                             type, Py_TYPE(value));
+                goto bad;
+            }
         }
     } else {
         PyErr_SetString(PyExc_TypeError,
             "raise: exception class must be a subclass of BaseException");
         goto bad;
     }
+#if PY_VERSION_HEX >= 0x03030000
+    if (cause) {
+#else
     if (cause && cause != Py_None) {
+#endif
         PyObject *fixed_cause;
-        if (PyExceptionClass_Check(cause)) {
+        if (cause == Py_None) {
+            fixed_cause = NULL;
+        } else if (PyExceptionClass_Check(cause)) {
             fixed_cause = PyObject_CallObject(cause, NULL);
             if (fixed_cause == NULL)
                 goto bad;
-        }
-        else if (PyExceptionInstance_Check(cause)) {
+        } else if (PyExceptionInstance_Check(cause)) {
             fixed_cause = cause;
             Py_INCREF(fixed_cause);
-        }
-        else {
+        } else {
             PyErr_SetString(PyExc_TypeError,
                             "exception causes must derive from "
                             "BaseException");
@@ -17961,8 +17562,20 @@ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
     return 0;
 }
 
+static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
+#if CYTHON_COMPILING_IN_CPYTHON
+#if PY_MAJOR_VERSION >= 3
+    if (likely(PyUnicode_Check(n)))
+#else
+    if (likely(PyString_Check(n)))
+#endif
+        return __Pyx_PyObject_GetAttrStr(o, n);
+#endif
+    return PyObject_GetAttr(o, n);
+}
+
 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
-    PyObject *r = PyObject_GetAttr(o, n);
+    PyObject *r = __Pyx_GetAttr(o, n);
     if (!r) {
         if (!PyErr_ExceptionMatches(PyExc_AttributeError))
             goto bad;
@@ -18111,6 +17724,84 @@ bad:
     return -1;
 }
 
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
+    PyObject *r;
+    if (!j) return NULL;
+    r = PyObject_GetItem(o, j);
+    Py_DECREF(j);
+    return r;
+}
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
+                                                              int wraparound, int boundscheck) {
+#if CYTHON_COMPILING_IN_CPYTHON
+    if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o);
+    if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
+        PyObject *r = PyList_GET_ITEM(o, i);
+        Py_INCREF(r);
+        return r;
+    }
+    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+#else
+    return PySequence_GetItem(o, i);
+#endif
+}
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
+                                                              int wraparound, int boundscheck) {
+#if CYTHON_COMPILING_IN_CPYTHON
+    if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o);
+    if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
+        PyObject *r = PyTuple_GET_ITEM(o, i);
+        Py_INCREF(r);
+        return r;
+    }
+    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+#else
+    return PySequence_GetItem(o, i);
+#endif
+}
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
+                                                     int is_list, int wraparound, int boundscheck) {
+#if CYTHON_COMPILING_IN_CPYTHON
+    if (is_list || PyList_CheckExact(o)) {
+        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
+        if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) {
+            PyObject *r = PyList_GET_ITEM(o, n);
+            Py_INCREF(r);
+            return r;
+        }
+    }
+    else if (PyTuple_CheckExact(o)) {
+        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
+        if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
+            PyObject *r = PyTuple_GET_ITEM(o, n);
+            Py_INCREF(r);
+            return r;
+        }
+    } else {
+        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
+        if (likely(m && m->sq_item)) {
+            if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
+                Py_ssize_t l = m->sq_length(o);
+                if (likely(l >= 0)) {
+                    i += l;
+                } else {
+                    if (PyErr_ExceptionMatches(PyExc_OverflowError))
+                        PyErr_Clear();
+                    else
+                        return NULL;
+                }
+            }
+            return m->sq_item(o, i);
+        }
+    }
+#else
+    if (is_list || PySequence_Check(o)) {
+        return PySequence_GetItem(o, i);
+    }
+#endif
+    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+}
+
 static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
     PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
 }
@@ -18122,9 +17813,44 @@ static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
     return q;
 }
 
+static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
+                                  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename) {
+    PyObject *old_exc, *old_val, *old_tb;
+    PyObject *ctx;
+    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
+    #if PY_MAJOR_VERSION < 3
+    ctx = PyString_FromString(name);
+    #else
+    ctx = PyUnicode_FromString(name);
+    #endif
+    __Pyx_ErrRestore(old_exc, old_val, old_tb);
+    if (!ctx) {
+        PyErr_WriteUnraisable(Py_None);
+    } else {
+        PyErr_WriteUnraisable(ctx);
+        Py_DECREF(ctx);
+    }
+}
+
+static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
+#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
+    PyObject *ob = PyCapsule_New(vtable, 0, 0);
+#else
+    PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
+#endif
+    if (!ob)
+        goto bad;
+    if (PyDict_SetItem(dict, __pyx_n_s____pyx_vtable__, ob) < 0)
+        goto bad;
+    Py_DECREF(ob);
+    return 0;
+bad:
+    Py_XDECREF(ob);
+    return -1;
+}
+
 #if PY_MAJOR_VERSION < 3
 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
-    CYTHON_UNUSED PyObject *getbuffer_cobj;
   #if PY_VERSION_HEX >= 0x02060000
     if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
   #endif
@@ -18132,21 +17858,18 @@ static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
         if (PyObject_TypeCheck(obj, __pyx_array_type)) return __pyx_array_getbuffer(obj, view, flags);
         if (PyObject_TypeCheck(obj, __pyx_memoryview_type)) return __pyx_memoryview_getbuffer(obj, view, flags);
   #if PY_VERSION_HEX < 0x02060000
-    if (obj->ob_type->tp_dict &&
-        (getbuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict,
-                                             "__pyx_getbuffer"))) {
-        getbufferproc func;
-      #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0)
-        func = (getbufferproc) PyCapsule_GetPointer(getbuffer_cobj, "getbuffer(obj, view, flags)");
-      #else
-        func = (getbufferproc) PyCObject_AsVoidPtr(getbuffer_cobj);
-      #endif
-        Py_DECREF(getbuffer_cobj);
-        if (!func)
-            goto fail;
-        return func(obj, view, flags);
-    } else {
-        PyErr_Clear();
+    if (obj->ob_type->tp_dict) {
+        PyObject *getbuffer_cobj = PyObject_GetItem(
+            obj->ob_type->tp_dict, __pyx_n_s____pyx_getbuffer);
+        if (getbuffer_cobj) {
+            getbufferproc func = (getbufferproc) PyCObject_AsVoidPtr(getbuffer_cobj);
+            Py_DECREF(getbuffer_cobj);
+            if (!func)
+                goto fail;
+            return func(obj, view, flags);
+        } else {
+            PyErr_Clear();
+        }
     }
   #endif
     PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
@@ -18157,7 +17880,6 @@ fail:
 }
 static void __Pyx_ReleaseBuffer(Py_buffer *view) {
     PyObject *obj = view->obj;
-    CYTHON_UNUSED PyObject *releasebuffer_cobj;
     if (!obj) return;
   #if PY_VERSION_HEX >= 0x02060000
     if (PyObject_CheckBuffer(obj)) {
@@ -18167,22 +17889,19 @@ static void __Pyx_ReleaseBuffer(Py_buffer *view) {
   #endif
         if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) { __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view); return; }
   #if PY_VERSION_HEX < 0x02060000
-    if (obj->ob_type->tp_dict &&
-        (releasebuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict,
-                                                      "__pyx_releasebuffer"))) {
-        releasebufferproc func;
-      #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0)
-        func = (releasebufferproc) PyCapsule_GetPointer(releasebuffer_cobj, "releasebuffer(obj, view)");
-      #else
-        func = (releasebufferproc) PyCObject_AsVoidPtr(releasebuffer_cobj);
-      #endif
-        Py_DECREF(releasebuffer_cobj);
-        if (!func)
-            goto fail;
-        func(obj, view);
-        return;
-    } else {
-        PyErr_Clear();
+    if (obj->ob_type->tp_dict) {
+        PyObject *releasebuffer_cobj = PyObject_GetItem(
+            obj->ob_type->tp_dict, __pyx_n_s____pyx_releasebuffer);
+        if (releasebuffer_cobj) {
+            releasebufferproc func = (releasebufferproc) PyCObject_AsVoidPtr(releasebuffer_cobj);
+            Py_DECREF(releasebuffer_cobj);
+            if (!func)
+                goto fail;
+            func(obj, view);
+            return;
+        } else {
+            PyErr_Clear();
+        }
     }
   #endif
     goto nofail;
@@ -18197,16 +17916,18 @@ nofail:
 #endif /*  PY_MAJOR_VERSION < 3 */
 
 
-      static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) {
-    PyObject *py_import = 0;
+          static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
     PyObject *empty_list = 0;
     PyObject *module = 0;
     PyObject *global_dict = 0;
     PyObject *empty_dict = 0;
     PyObject *list;
-    py_import = __Pyx_GetAttrString(__pyx_b, "__import__");
+    #if PY_VERSION_HEX < 0x03030000
+    PyObject *py_import;
+    py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s____import__);
     if (!py_import)
         goto bad;
+    #endif
     if (from_list)
         list = from_list;
     else {
@@ -18226,13 +17947,17 @@ nofail:
         #if PY_MAJOR_VERSION >= 3
         if (level == -1) {
             if (strchr(__Pyx_MODULE_NAME, '.')) {
-                /* try package relative import first */
+                #if PY_VERSION_HEX < 0x03030000
                 PyObject *py_level = PyInt_FromLong(1);
                 if (!py_level)
                     goto bad;
                 module = PyObject_CallFunctionObjArgs(py_import,
                     name, global_dict, empty_dict, list, py_level, NULL);
                 Py_DECREF(py_level);
+                #else
+                module = PyImport_ImportModuleLevelObject(
+                    name, global_dict, empty_dict, list, 1);
+                #endif
                 if (!module) {
                     if (!PyErr_ExceptionMatches(PyExc_ImportError))
                         goto bad;
@@ -18243,12 +17968,17 @@ nofail:
         }
         #endif
         if (!module) {
+            #if PY_VERSION_HEX < 0x03030000
             PyObject *py_level = PyInt_FromLong(level);
             if (!py_level)
                 goto bad;
             module = PyObject_CallFunctionObjArgs(py_import,
                 name, global_dict, empty_dict, list, py_level, NULL);
             Py_DECREF(py_level);
+            #else
+            module = PyImport_ImportModuleLevelObject(
+                name, global_dict, empty_dict, list, level);
+            #endif
         }
     }
     #else
@@ -18260,8 +17990,10 @@ nofail:
         name, global_dict, empty_dict, list, NULL);
     #endif
 bad:
-    Py_XDECREF(empty_list);
+    #if PY_VERSION_HEX < 0x03030000
     Py_XDECREF(py_import);
+    #endif
+    Py_XDECREF(empty_list);
     Py_XDECREF(empty_dict);
     return module;
 }
@@ -18278,7 +18010,9 @@ static CYTHON_INLINE size_t __Pyx_pow_size_t(size_t b, size_t e) {
         case 0:
             return 1;
     }
+    #if 0
     if (unlikely(e<0)) return 0;
+    #endif
     t = 1;
     while (likely(e)) {
         t *= (b * (e&1)) | ((~e)&1);    /* 1 or b */
@@ -18614,7 +18348,7 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
     }
     __Pyx_GOTREF(shape_tuple);
     for(i = 0; i < ndim; i++) {
-        temp_int = PyInt_FromLong(from_mvs->shape[i]);
+        temp_int = PyInt_FromSsize_t(from_mvs->shape[i]);
         if(unlikely(!temp_int)) {
             goto fail;
         } else {
@@ -18652,7 +18386,7 @@ no_fail:
 }
 
 static CYTHON_INLINE PyObject *
-__pyx_capsule_create(void *p, const char *sig)
+__pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig)
 {
     PyObject *cobj;
 #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0)
@@ -18884,10 +18618,15 @@ static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) {
     return (int)__Pyx_PyInt_AsLong(x);
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
     const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -18900,6 +18639,16 @@ static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(unsigned long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (unsigned long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to unsigned long");
@@ -18907,6 +18656,17 @@ static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
             }
             return (unsigned long)PyLong_AsUnsignedLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(unsigned long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(unsigned long) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(unsigned long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (unsigned long)PyLong_AsLong(x);
         }
     } else {
@@ -18919,10 +18679,15 @@ static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
     }
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
     const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -18935,6 +18700,16 @@ static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObje
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to unsigned PY_LONG_LONG");
@@ -18942,6 +18717,17 @@ static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObje
             }
             return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x);
         }
     } else {
@@ -18954,10 +18740,15 @@ static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObje
     }
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
     const long neg_one = (long)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -18970,6 +18761,16 @@ static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to long");
@@ -18977,6 +18778,17 @@ static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
             }
             return (long)PyLong_AsUnsignedLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(long) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (long)PyLong_AsLong(x);
         }
     } else {
@@ -18989,10 +18801,15 @@ static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
     }
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
     const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -19005,6 +18822,16 @@ static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to PY_LONG_LONG");
@@ -19012,6 +18839,17 @@ static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
             }
             return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (PY_LONG_LONG)PyLong_AsLongLong(x);
         }
     } else {
@@ -19024,10 +18862,15 @@ static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
     }
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
     const signed long neg_one = (signed long)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -19040,6 +18883,16 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(signed long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (signed long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to signed long");
@@ -19047,6 +18900,17 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
             }
             return (signed long)PyLong_AsUnsignedLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(signed long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(signed long) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(signed long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (signed long)PyLong_AsLong(x);
         }
     } else {
@@ -19059,10 +18923,15 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
     }
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
     const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -19075,6 +18944,16 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject*
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to signed PY_LONG_LONG");
@@ -19082,6 +18961,17 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject*
             }
             return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (signed PY_LONG_LONG)PyLong_AsLongLong(x);
         }
     } else {
@@ -19094,6 +18984,227 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject*
     }
 }
 
+static int
+__pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b)
+{
+    int i;
+    if (!a || !b)
+        return 0;
+    if (a == b)
+        return 1;
+    if (a->size != b->size || a->typegroup != b->typegroup ||
+            a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) {
+        if (a->typegroup == 'H' || b->typegroup == 'H') {
+            return a->size == b->size;
+        } else {
+            return 0;
+        }
+    }
+    if (a->ndim) {
+        for (i = 0; i < a->ndim; i++)
+            if (a->arraysize[i] != b->arraysize[i])
+                return 0;
+    }
+    if (a->typegroup == 'S') {
+        if (a->flags != b->flags)
+            return 0;
+        if (a->fields || b->fields) {
+            if (!(a->fields && b->fields))
+                return 0;
+            for (i = 0; a->fields[i].type && b->fields[i].type; i++) {
+                __Pyx_StructField *field_a = a->fields + i;
+                __Pyx_StructField *field_b = b->fields + i;
+                if (field_a->offset != field_b->offset ||
+                    !__pyx_typeinfo_cmp(field_a->type, field_b->type))
+                    return 0;
+            }
+            return !a->fields[i].type && !b->fields[i].type;
+        }
+    }
+    return 1;
+}
+
+static int
+__pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec)
+{
+    if (buf->shape[dim] <= 1)
+        return 1;
+    if (buf->strides) {
+        if (spec & __Pyx_MEMVIEW_CONTIG) {
+            if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) {
+                if (buf->strides[dim] != sizeof(void *)) {
+                    PyErr_Format(PyExc_ValueError,
+                                 "Buffer is not indirectly contiguous "
+                                 "in dimension %d.", dim);
+                    goto fail;
+                }
+            } else if (buf->strides[dim] != buf->itemsize) {
+                PyErr_SetString(PyExc_ValueError,
+                                "Buffer and memoryview are not contiguous "
+                                "in the same dimension.");
+                goto fail;
+            }
+        }
+        if (spec & __Pyx_MEMVIEW_FOLLOW) {
+            Py_ssize_t stride = buf->strides[dim];
+            if (stride < 0)
+                stride = -stride;
+            if (stride < buf->itemsize) {
+                PyErr_SetString(PyExc_ValueError,
+                                "Buffer and memoryview are not contiguous "
+                                "in the same dimension.");
+                goto fail;
+            }
+        }
+    } else {
+        if (spec & __Pyx_MEMVIEW_CONTIG && dim != ndim - 1) {
+            PyErr_Format(PyExc_ValueError,
+                         "C-contiguous buffer is not contiguous in "
+                         "dimension %d", dim);
+            goto fail;
+        } else if (spec & (__Pyx_MEMVIEW_PTR)) {
+            PyErr_Format(PyExc_ValueError,
+                         "C-contiguous buffer is not indirect in "
+                         "dimension %d", dim);
+            goto fail;
+        } else if (buf->suboffsets) {
+            PyErr_SetString(PyExc_ValueError,
+                            "Buffer exposes suboffsets but no strides");
+            goto fail;
+        }
+    }
+    return 1;
+fail:
+    return 0;
+}
+static int
+__pyx_check_suboffsets(Py_buffer *buf, int dim, CYTHON_UNUSED int ndim, int spec)
+{
+    if (spec & __Pyx_MEMVIEW_DIRECT) {
+        if (buf->suboffsets && buf->suboffsets[dim] >= 0) {
+            PyErr_Format(PyExc_ValueError,
+                         "Buffer not compatible with direct access "
+                         "in dimension %d.", dim);
+            goto fail;
+        }
+    }
+    if (spec & __Pyx_MEMVIEW_PTR) {
+        if (!buf->suboffsets || (buf->suboffsets && buf->suboffsets[dim] < 0)) {
+            PyErr_Format(PyExc_ValueError,
+                         "Buffer is not indirectly accessisble "
+                         "in dimension %d.", dim);
+            goto fail;
+        }
+    }
+    return 1;
+fail:
+    return 0;
+}
+static int
+__pyx_verify_contig(Py_buffer *buf, int ndim, int c_or_f_flag)
+{
+    int i;
+    if (c_or_f_flag & __Pyx_IS_F_CONTIG) {
+        Py_ssize_t stride = 1;
+        for (i = 0; i < ndim; i++) {
+            if (stride * buf->itemsize != buf->strides[i] &&
+                    buf->shape[i] > 1)
+            {
+                PyErr_SetString(PyExc_ValueError,
+                    "Buffer not fortran contiguous.");
+                goto fail;
+            }
+            stride = stride * buf->shape[i];
+        }
+    } else if (c_or_f_flag & __Pyx_IS_C_CONTIG) {
+        Py_ssize_t stride = 1;
+        for (i = ndim - 1; i >- 1; i--) {
+            if (stride * buf->itemsize != buf->strides[i] &&
+                    buf->shape[i] > 1) {
+                PyErr_SetString(PyExc_ValueError,
+                    "Buffer not C contiguous.");
+                goto fail;
+            }
+            stride = stride * buf->shape[i];
+        }
+    }
+    return 1;
+fail:
+    return 0;
+}
+static int __Pyx_ValidateAndInit_memviewslice(
+                int *axes_specs,
+                int c_or_f_flag,
+                int buf_flags,
+                int ndim,
+                __Pyx_TypeInfo *dtype,
+                __Pyx_BufFmt_StackElem stack[],
+                __Pyx_memviewslice *memviewslice,
+                PyObject *original_obj)
+{
+    struct __pyx_memoryview_obj *memview, *new_memview;
+    __Pyx_RefNannyDeclarations
+    Py_buffer *buf;
+    int i, spec = 0, retval = -1;
+    __Pyx_BufFmt_Context ctx;
+    int from_memoryview = __pyx_memoryview_check(original_obj);
+    __Pyx_RefNannySetupContext("ValidateAndInit_memviewslice", 0);
+    if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((struct __pyx_memoryview_obj *)
+                                                            original_obj)->typeinfo)) {
+        memview = (struct __pyx_memoryview_obj *) original_obj;
+        new_memview = NULL;
+    } else {
+        memview = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
+                                            original_obj, buf_flags, 0, dtype);
+        new_memview = memview;
+        if (unlikely(!memview))
+            goto fail;
+    }
+    buf = &memview->view;
+    if (buf->ndim != ndim) {
+        PyErr_Format(PyExc_ValueError,
+                "Buffer has wrong number of dimensions (expected %d, got %d)",
+                ndim, buf->ndim);
+        goto fail;
+    }
+    if (new_memview) {
+        __Pyx_BufFmt_Init(&ctx, stack, dtype);
+        if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
+    }
+    if ((unsigned) buf->itemsize != dtype->size) {
+        PyErr_Format(PyExc_ValueError,
+                     "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "u byte%s) "
+                     "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "u byte%s)",
+                     buf->itemsize,
+                     (buf->itemsize > 1) ? "s" : "",
+                     dtype->name,
+                     dtype->size,
+                     (dtype->size > 1) ? "s" : "");
+        goto fail;
+    }
+    for (i = 0; i < ndim; i++) {
+        spec = axes_specs[i];
+        if (!__pyx_check_strides(buf, i, ndim, spec))
+            goto fail;
+        if (!__pyx_check_suboffsets(buf, i, ndim, spec))
+            goto fail;
+    }
+    if (buf->strides && !__pyx_verify_contig(buf, ndim, c_or_f_flag))
+        goto fail;
+    if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice,
+                                         new_memview != NULL) == -1)) {
+        goto fail;
+    }
+    retval = 0;
+    goto no_fail;
+fail:
+    Py_XDECREF(new_memview);
+    retval = -1;
+no_fail:
+    __Pyx_RefNannyFinishContext();
+    return retval;
+}
+
 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_float(PyObject *obj) {
     __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
     __Pyx_BufFmt_StackElem stack[1];
@@ -19116,7 +19227,7 @@ __pyx_fail:
     return result;
 }
 
-static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_int(PyObject *obj) {
+static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_int8_t(PyObject *obj) {
     __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
     __Pyx_BufFmt_StackElem stack[1];
     int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
@@ -19127,7 +19238,7 @@ static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_i
     }
     retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
                                                  PyBUF_RECORDS, 2,
-                                                 &__Pyx_TypeInfo_int, stack,
+                                                 &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, stack,
                                                  &result, obj);
     if (unlikely(retcode == -1))
         goto __pyx_fail;
@@ -19138,25 +19249,6 @@ __pyx_fail:
     return result;
 }
 
-static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
-                                  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename) {
-    PyObject *old_exc, *old_val, *old_tb;
-    PyObject *ctx;
-    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
-    #if PY_MAJOR_VERSION < 3
-    ctx = PyString_FromString(name);
-    #else
-    ctx = PyUnicode_FromString(name);
-    #endif
-    __Pyx_ErrRestore(old_exc, old_val, old_tb);
-    if (!ctx) {
-        PyErr_WriteUnraisable(Py_None);
-    } else {
-        PyErr_WriteUnraisable(ctx);
-        Py_DECREF(ctx);
-    }
-}
-
 static int __Pyx_check_binary_version(void) {
     char ctversion[4], rtversion[4];
     PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
@@ -19176,23 +19268,6 @@ static int __Pyx_check_binary_version(void) {
     return 0;
 }
 
-static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
-#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
-    PyObject *ob = PyCapsule_New(vtable, 0, 0);
-#else
-    PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
-#endif
-    if (!ob)
-        goto bad;
-    if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0)
-        goto bad;
-    Py_DECREF(ob);
-    return 0;
-bad:
-    Py_XDECREF(ob);
-    return -1;
-}
-
 #ifndef __PYX_HAVE_RT_ImportModule
 #define __PYX_HAVE_RT_ImportModule
 static PyObject *__Pyx_ImportModule(const char *name) {
@@ -19219,6 +19294,10 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class
     PyObject *result = 0;
     PyObject *py_name = 0;
     char warning[200];
+    Py_ssize_t basicsize;
+#ifdef Py_LIMITED_API
+    PyObject *py_basicsize;
+#endif
     py_module = __Pyx_ImportModule(module_name);
     if (!py_module)
         goto bad;
@@ -19238,7 +19317,19 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class
             module_name, class_name);
         goto bad;
     }
-    if (!strict && (size_t)((PyTypeObject *)result)->tp_basicsize > size) {
+#ifndef Py_LIMITED_API
+    basicsize = ((PyTypeObject *)result)->tp_basicsize;
+#else
+    py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
+    if (!py_basicsize)
+        goto bad;
+    basicsize = PyLong_AsSsize_t(py_basicsize);
+    Py_DECREF(py_basicsize);
+    py_basicsize = 0;
+    if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
+        goto bad;
+#endif
+    if (!strict && (size_t)basicsize > size) {
         PyOS_snprintf(warning, sizeof(warning),
             "%s.%s size changed, may indicate binary incompatibility",
             module_name, class_name);
@@ -19248,7 +19339,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class
         if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
         #endif
     }
-    else if ((size_t)((PyTypeObject *)result)->tp_basicsize != size) {
+    else if ((size_t)basicsize != size) {
         PyErr_Format(PyExc_ValueError,
             "%s.%s has the wrong size, try recompiling",
             module_name, class_name);
@@ -19454,27 +19545,82 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
     return 0;
 }
 
-
-/* Type Conversion Functions */
-
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char* c_str) {
+    return __Pyx_PyUnicode_FromStringAndSize(c_str, strlen(c_str));
+}
+static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
+    Py_ssize_t ignore;
+    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
+}
+static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
+    if (
+#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+            __Pyx_sys_getdefaultencoding_not_ascii &&
+#endif
+            PyUnicode_Check(o)) {
+#if PY_VERSION_HEX < 0x03030000
+        char* defenc_c;
+        PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
+        if (!defenc) return NULL;
+        defenc_c = PyBytes_AS_STRING(defenc);
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+        {
+            char* end = defenc_c + PyBytes_GET_SIZE(defenc);
+            char* c;
+            for (c = defenc_c; c < end; c++) {
+                if ((unsigned char) (*c) >= 128) {
+                    PyUnicode_AsASCIIString(o);
+                    return NULL;
+                }
+            }
+        }
+#endif /*__PYX_DEFAULT_STRING_ENCODING_IS_ASCII*/
+        *length = PyBytes_GET_SIZE(defenc);
+        return defenc_c;
+#else /* PY_VERSION_HEX < 0x03030000 */
+        if (PyUnicode_READY(o) == -1) return NULL;
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+        if (PyUnicode_IS_ASCII(o)) {
+            *length = PyUnicode_GET_DATA_SIZE(o);
+            return PyUnicode_AsUTF8(o);
+        } else {
+            PyUnicode_AsASCIIString(o);
+            return NULL;
+        }
+#else /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
+        return PyUnicode_AsUTF8AndSize(o, length);
+#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
+#endif /* PY_VERSION_HEX < 0x03030000 */
+    } else
+#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII  || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT */
+    {
+        char* result;
+        int r = PyBytes_AsStringAndSize(o, &result, length);
+        if (r < 0) {
+            return NULL;
+        } else {
+            return result;
+        }
+    }
+}
 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
    int is_true = x == Py_True;
    if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
    else return PyObject_IsTrue(x);
 }
-
 static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
   PyNumberMethods *m;
   const char *name = NULL;
   PyObject *res = NULL;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
   if (PyInt_Check(x) || PyLong_Check(x))
 #else
   if (PyLong_Check(x))
 #endif
     return Py_INCREF(x), x;
   m = Py_TYPE(x)->tp_as_number;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
   if (m && m->nb_int) {
     name = "int";
     res = PyNumber_Int(x);
@@ -19490,7 +19636,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
   }
 #endif
   if (res) {
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (!PyInt_Check(res) && !PyLong_Check(res)) {
 #else
     if (!PyLong_Check(res)) {
@@ -19508,7 +19654,6 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
   }
   return res;
 }
-
 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
   Py_ssize_t ival;
   PyObject* x = PyNumber_Index(b);
@@ -19517,7 +19662,6 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
   Py_DECREF(x);
   return ival;
 }
-
 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
 #if PY_VERSION_HEX < 0x02050000
    if (ival <= LONG_MAX)
@@ -19531,14 +19675,12 @@ static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
    return PyInt_FromSize_t(ival);
 #endif
 }
-
 static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
    unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
-   if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) {
-       return (size_t)-1;
-   } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
-       PyErr_SetString(PyExc_OverflowError,
-                       "value too large to convert to size_t");
+   if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
+       if ((val != (unsigned PY_LONG_LONG)-1) || !PyErr_Occurred())
+           PyErr_SetString(PyExc_OverflowError,
+                           "value too large to convert to size_t");
        return (size_t)-1;
    }
    return (size_t)val;
diff --git a/src/reconstruct.pyx b/src/reconstruct.pyx
index 97fc2aa..7ad1622 100644
--- a/src/reconstruct.pyx
+++ b/src/reconstruct.pyx
@@ -10,7 +10,12 @@ cdef float invert_distance(size_t i0,size_t i1, size_t p0,size_t p1)nogil:
 
 @cython.cdivision(True)
 @cython.boundscheck(False)
-cdef float processPoint(float[:,:] data,bint[:,:] mask,size_t p0,size_t p1,size_t d0,size_t d1)nogil:
+cdef inline float processPoint(float[:,:] data, 
+                        numpy.int8_t[:,:] mask, 
+                        size_t p0,
+                        size_t p1, 
+                        size_t d0, 
+                        size_t d1)nogil:
     cdef size_t dist=0, i=0
     cdef float sum=0.0, count=0.0,invdst=0.0
     cdef bint found=0
@@ -58,6 +63,16 @@ cdef float processPoint(float[:,:] data,bint[:,:] mask,size_t p0,size_t p1,size_
 @cython.boundscheck(False)
 @cython.wraparound(False)
 def reconstruct(numpy.ndarray data not None, numpy.ndarray mask=None, dummy=None,  delta_dummy=None):
+    """
+    reconstruct missing part of an image (tries to be continuous)
+    
+    @param data: the input image 
+    @parma mask: where data should be reconstructed.
+    @param dummy: value of the dummy (masked out) data
+    @param delta_dummy: precision for dummy values
+    
+    @return: reconstructed image.
+    """
     assert data.ndim==2
     cdef ssize_t d0=data.shape[0]
     cdef ssize_t d1=data.shape[1]
@@ -72,7 +87,7 @@ def reconstruct(numpy.ndarray data not None, numpy.ndarray mask=None, dummy=None
             mask+=(data==dummy)
         else:
             mask+=(abs(data-dummy)<=delta_dummy)
-    cdef bint[:,:] cmask = mask.astype("int32")
+    cdef numpy.int8_t[:,:] cmask = mask.astype(numpy.int8)
     assert d0==mask.shape[0]
     assert d1==mask.shape[1]
     cdef numpy.ndarray[numpy.float32_t, ndim = 2]out =numpy.zeros_like(data)
diff --git a/src/relabel.c b/src/relabel.c
index 66396a2..56b5170 100644
--- a/src/relabel.c
+++ b/src/relabel.c
@@ -1,6 +1,18 @@
-/* Generated by Cython 0.17.1 on Thu Nov 15 14:44:22 2012 */
+/* Generated by Cython 0.19.2 on Mon Jan  6 15:01:35 2014 */
 
 #define PY_SSIZE_T_CLEAN
+#ifndef CYTHON_USE_PYLONG_INTERNALS
+#ifdef PYLONG_BITS_IN_DIGIT
+#define CYTHON_USE_PYLONG_INTERNALS 0
+#else
+#include "pyconfig.h"
+#ifdef PYLONG_BITS_IN_DIGIT
+#define CYTHON_USE_PYLONG_INTERNALS 1
+#else
+#define CYTHON_USE_PYLONG_INTERNALS 0
+#endif
+#endif
+#endif
 #include "Python.h"
 #ifndef Py_PYTHON_H
     #error Python headers needed to compile C extensions, please install development version of Python.
@@ -53,12 +65,15 @@
                                 (PyErr_Format(PyExc_TypeError, \
                                               "expected index value, got %.200s", Py_TYPE(o)->tp_name), \
                                  (PyObject*)0))
-  #define PyIndex_Check(o)     (PyNumber_Check(o) && !PyFloat_Check(o) && !PyComplex_Check(o))
+  #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \
+                                  !PyComplex_Check(o))
+  #define PyIndex_Check __Pyx_PyIndex_Check
   #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
   #define __PYX_BUILD_PY_SSIZE_T "i"
 #else
   #define __PYX_BUILD_PY_SSIZE_T "n"
   #define CYTHON_FORMAT_SSIZE_T "z"
+  #define __Pyx_PyIndex_Check PyIndex_Check
 #endif
 #if PY_VERSION_HEX < 0x02060000
   #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
@@ -113,6 +128,9 @@
 #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
   #define Py_TPFLAGS_HAVE_NEWBUFFER 0
 #endif
+#if PY_VERSION_HEX < 0x02060000
+  #define Py_TPFLAGS_HAVE_VERSION_TAG 0
+#endif
 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
   #define CYTHON_PEP393_ENABLED 1
   #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ? \
@@ -152,6 +170,14 @@
   #define PyBytes_Concat               PyString_Concat
   #define PyBytes_ConcatAndDel         PyString_ConcatAndDel
 #endif
+#if PY_MAJOR_VERSION >= 3
+  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
+  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
+#else
+  #define __Pyx_PyBaseString_Check(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj) || \
+                                         PyString_Check(obj) || PyUnicode_Check(obj))
+  #define __Pyx_PyBaseString_CheckExact(obj) (Py_TYPE(obj) == &PyBaseString_Type)
+#endif
 #if PY_VERSION_HEX < 0x02060000
   #define PySet_Check(obj)             PyObject_TypeCheck(obj, &PySet_Type)
   #define PyFrozenSet_Check(obj)       PyObject_TypeCheck(obj, &PyFrozenSet_Type)
@@ -224,6 +250,40 @@
   #define __Pyx_NAMESTR(n) (n)
   #define __Pyx_DOCSTR(n)  (n)
 #endif
+#ifndef CYTHON_INLINE
+  #if defined(__GNUC__)
+    #define CYTHON_INLINE __inline__
+  #elif defined(_MSC_VER)
+    #define CYTHON_INLINE __inline
+  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+    #define CYTHON_INLINE inline
+  #else
+    #define CYTHON_INLINE
+  #endif
+#endif
+#ifndef CYTHON_RESTRICT
+  #if defined(__GNUC__)
+    #define CYTHON_RESTRICT __restrict__
+  #elif defined(_MSC_VER) && _MSC_VER >= 1400
+    #define CYTHON_RESTRICT __restrict
+  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+    #define CYTHON_RESTRICT restrict
+  #else
+    #define CYTHON_RESTRICT
+  #endif
+#endif
+#ifdef NAN
+#define __PYX_NAN() ((float) NAN)
+#else
+static CYTHON_INLINE float __PYX_NAN() {
+  /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and
+   a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is
+   a quiet NaN. */
+  float value;
+  memset(&value, 0xFF, sizeof(value));
+  return value;
+}
+#endif
 
 
 #if PY_MAJOR_VERSION >= 3
@@ -248,12 +308,12 @@
 #include <math.h>
 #define __PYX_HAVE__relabel
 #define __PYX_HAVE_API__relabel
+#include "string.h"
 #include "stdio.h"
 #include "stdlib.h"
 #include "numpy/arrayobject.h"
 #include "numpy/ufuncobject.h"
 #include "pythread.h"
-#include "string.h"
 #include "pystate.h"
 #ifdef _OPENMP
 #include <omp.h>
@@ -263,21 +323,6 @@
 #define CYTHON_WITHOUT_ASSERTIONS
 #endif
 
-
-/* inline attribute */
-#ifndef CYTHON_INLINE
-  #if defined(__GNUC__)
-    #define CYTHON_INLINE __inline__
-  #elif defined(_MSC_VER)
-    #define CYTHON_INLINE __inline
-  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
-    #define CYTHON_INLINE inline
-  #else
-    #define CYTHON_INLINE
-  #endif
-#endif
-
-/* unused attribute */
 #ifndef CYTHON_UNUSED
 # if defined(__GNUC__)
 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
@@ -291,30 +336,130 @@
 #   define CYTHON_UNUSED
 # endif
 #endif
-
-typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/
-
-
-/* Type Conversion Predeclarations */
-
-#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
-#define __Pyx_PyBytes_AsUString(s)   ((unsigned char*) PyBytes_AsString(s))
-
+typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding;
+                const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/
+
+#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
+#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
+#define __PYX_DEFAULT_STRING_ENCODING ""
+#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
+#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
+static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
+static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
+#define __Pyx_PyBytes_FromString        PyBytes_FromString
+#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char*);
+#if PY_MAJOR_VERSION < 3
+    #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
+    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
+#else
+    #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
+    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
+#endif
+#define __Pyx_PyObject_AsUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
+#define __Pyx_PyObject_FromUString(s)  __Pyx_PyObject_FromString((char*)s)
+#define __Pyx_PyBytes_FromUString(s)   __Pyx_PyBytes_FromString((char*)s)
+#define __Pyx_PyStr_FromUString(s)     __Pyx_PyStr_FromString((char*)s)
+#define __Pyx_PyUnicode_FromUString(s) __Pyx_PyUnicode_FromString((char*)s)
+#if PY_MAJOR_VERSION < 3
+static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
+{
+    const Py_UNICODE *u_end = u;
+    while (*u_end++) ;
+    return u_end - u - 1;
+}
+#else
+#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
+#endif
+#define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
+#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
+#define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
 #define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
 #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
 static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
-
 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
 static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
-
 #if CYTHON_COMPILING_IN_CPYTHON
 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
 #else
 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
 #endif
 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
+#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+static int __Pyx_sys_getdefaultencoding_not_ascii;
+static int __Pyx_init_sys_getdefaultencoding_params() {
+    PyObject* sys = NULL;
+    PyObject* default_encoding = NULL;
+    PyObject* ascii_chars_u = NULL;
+    PyObject* ascii_chars_b = NULL;
+    sys = PyImport_ImportModule("sys");
+    if (sys == NULL) goto bad;
+    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
+    if (default_encoding == NULL) goto bad;
+    if (strcmp(PyBytes_AsString(default_encoding), "ascii") == 0) {
+        __Pyx_sys_getdefaultencoding_not_ascii = 0;
+    } else {
+        const char* default_encoding_c = PyBytes_AS_STRING(default_encoding);
+        char ascii_chars[128];
+        int c;
+        for (c = 0; c < 128; c++) {
+            ascii_chars[c] = c;
+        }
+        __Pyx_sys_getdefaultencoding_not_ascii = 1;
+        ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
+        if (ascii_chars_u == NULL) goto bad;
+        ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
+        if (ascii_chars_b == NULL || strncmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
+            PyErr_Format(
+                PyExc_ValueError,
+                "This module compiled with c_string_encoding=ascii, but default encoding '%s' is not a superset of ascii.",
+                default_encoding_c);
+            goto bad;
+        }
+    }
+    Py_XDECREF(sys);
+    Py_XDECREF(default_encoding);
+    Py_XDECREF(ascii_chars_u);
+    Py_XDECREF(ascii_chars_b);
+    return 0;
+bad:
+    Py_XDECREF(sys);
+    Py_XDECREF(default_encoding);
+    Py_XDECREF(ascii_chars_u);
+    Py_XDECREF(ascii_chars_b);
+    return -1;
+}
+#endif
+#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
+#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
+#else
+#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
+#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
+static char* __PYX_DEFAULT_STRING_ENCODING;
+static int __Pyx_init_sys_getdefaultencoding_params() {
+    PyObject* sys = NULL;
+    PyObject* default_encoding = NULL;
+    char* default_encoding_c;
+    sys = PyImport_ImportModule("sys");
+    if (sys == NULL) goto bad;
+    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
+    if (default_encoding == NULL) goto bad;
+    default_encoding_c = PyBytes_AS_STRING(default_encoding);
+    __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
+    strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
+    Py_DECREF(sys);
+    Py_DECREF(default_encoding);
+    return 0;
+bad:
+    Py_XDECREF(sys);
+    Py_XDECREF(default_encoding);
+    return -1;
+}
+#endif
+#endif
+
 
 #ifdef __GNUC__
   /* Test for GCC > 2.95 */
@@ -329,8 +474,9 @@ static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
   #define likely(x)   (x)
   #define unlikely(x) (x)
 #endif /* __GNUC__ */
-    
+
 static PyObject *__pyx_m;
+static PyObject *__pyx_d;
 static PyObject *__pyx_b;
 static PyObject *__pyx_empty_tuple;
 static PyObject *__pyx_empty_bytes;
@@ -416,10 +562,9 @@ typedef struct {
     #define CYTHON_ATOMICS 1
 #endif
 #define __pyx_atomic_int_type int
-/* todo: Portland pgcc, maybe OS X's OSAtomicIncrement32,
-   libatomic + autotools-like distutils support? Such a pain... */
-#if CYTHON_ATOMICS && __GNUC__ >= 4 && (__GNUC_MINOR__ > 1 || \
-                    (__GNUC_MINOR__ == 1 && __GNUC_PATHLEVEL >= 2))
+#if CYTHON_ATOMICS && __GNUC__ >= 4 && (__GNUC_MINOR__ > 1 ||           \
+                    (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL >= 2)) && \
+                    !defined(__i386__)
     #define __pyx_atomic_incr_aligned(value, lock) __sync_fetch_and_add(value, 1)
     #define __pyx_atomic_decr_aligned(value, lock) __sync_fetch_and_sub(value, 1)
     #ifdef __PYX_DEBUG_ATOMICS
@@ -872,10 +1017,33 @@ static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice;
   #define __Pyx_XGOTREF(r)
   #define __Pyx_XGIVEREF(r)
 #endif /* CYTHON_REFNANNY */
+#define __Pyx_XDECREF_SET(r, v) do {                            \
+        PyObject *tmp = (PyObject *) r;                         \
+        r = v; __Pyx_XDECREF(tmp);                              \
+    } while (0)
+#define __Pyx_DECREF_SET(r, v) do {                             \
+        PyObject *tmp = (PyObject *) r;                         \
+        r = v; __Pyx_DECREF(tmp);                               \
+    } while (0)
 #define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
 #define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
 
-static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
+    PyTypeObject* tp = Py_TYPE(obj);
+    if (likely(tp->tp_getattro))
+        return tp->tp_getattro(obj, attr_name);
+#if PY_MAJOR_VERSION < 3
+    if (likely(tp->tp_getattr))
+        return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
+#endif
+    return PyObject_GetAttr(obj, attr_name);
+}
+#else
+#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
+#endif
+
+static PyObject *__Pyx_GetBuiltinName(PyObject *name); /*proto*/
 
 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
     Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/
@@ -889,6 +1057,8 @@ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \
 static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
     const char *name, int exact); /*proto*/
 
+static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); /*proto*/
+
 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/
 
 static CYTHON_INLINE int  __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj,
@@ -896,8 +1066,6 @@ static CYTHON_INLINE int  __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* o
 static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);
 
 #define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0)
-static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
-
 #define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d
 #define __Pyx_MEMVIEW_DIRECT   1
 #define __Pyx_MEMVIEW_PTR      2
@@ -907,24 +1075,15 @@ static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
 #define __Pyx_MEMVIEW_FOLLOW   32
 #define __Pyx_IS_C_CONTIG 1
 #define __Pyx_IS_F_CONTIG 2
-static int __Pyx_ValidateAndInit_memviewslice(
-                int *axes_specs,
-                int c_or_f_flag,
-                int buf_flags,
-                int ndim,
-                __Pyx_TypeInfo *dtype,
-                __Pyx_BufFmt_StackElem stack[],
-                __Pyx_memviewslice *memviewslice,
-                PyObject *original_obj);
 static int __Pyx_init_memviewslice(
                 struct __pyx_memoryview_obj *memview,
                 int ndim,
                 __Pyx_memviewslice *memviewslice,
                 int memview_is_new_reference);
-static CYTHON_INLINE int __pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
-                                                            PyThread_type_lock lock);
-static CYTHON_INLINE int __pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
-                                                            PyThread_type_lock lock);
+static CYTHON_INLINE int __pyx_add_acquisition_count_locked(
+    __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
+static CYTHON_INLINE int __pyx_sub_acquisition_count_locked(
+    __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
 #define __pyx_get_slice_count_pointer(memview) (memview->acquisition_count_aligned_p)
 #define __pyx_get_slice_count(memview) (*__pyx_get_slice_count_pointer(memview))
 #define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__)
@@ -947,13 +1106,19 @@ static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/
 
 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/
 
+static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); /*proto*/
+
 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); /*proto*/
 
 static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t); /* proto */
 
+#ifndef __PYX_FORCE_INIT_THREADS
+  #define __PYX_FORCE_INIT_THREADS 0
+#endif
+
 #define UNARY_NEG_WOULD_OVERFLOW(x)            (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))
 
-static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
+static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/
 
 static PyObject *get_memview(PyObject *__pyx_v_self); /*proto*/
@@ -966,98 +1131,32 @@ static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
 
 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
 
-static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
-    PyObject *r;
-    if (!j) return NULL;
-    r = PyObject_GetItem(o, j);
-    Py_DECREF(j);
-    return r;
-}
-#define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
-                                                    __Pyx_GetItemInt_List_Fast(o, i) : \
-                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
-static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) {
-#if CYTHON_COMPILING_IN_CPYTHON
-    if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
-        PyObject *r = PyList_GET_ITEM(o, i);
-        Py_INCREF(r);
-        return r;
-    }
-    else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
-        PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
-        Py_INCREF(r);
-        return r;
-    }
-    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
-#else
-    return PySequence_GetItem(o, i);
-#endif
-}
-#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
-                                                    __Pyx_GetItemInt_Tuple_Fast(o, i) : \
-                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
-static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) {
-#if CYTHON_COMPILING_IN_CPYTHON
-    if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
-        PyObject *r = PyTuple_GET_ITEM(o, i);
-        Py_INCREF(r);
-        return r;
-    }
-    else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
-        PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
-        Py_INCREF(r);
-        return r;
-    }
-    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
-#else
-    return PySequence_GetItem(o, i);
-#endif
-}
-#define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
-                                                    __Pyx_GetItemInt_Fast(o, i) : \
-                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
-static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) {
-#if CYTHON_COMPILING_IN_CPYTHON
-    if (PyList_CheckExact(o)) {
-        Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
-        if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) {
-            PyObject *r = PyList_GET_ITEM(o, n);
-            Py_INCREF(r);
-            return r;
-        }
-    }
-    else if (PyTuple_CheckExact(o)) {
-        Py_ssize_t n = (likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
-        if (likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
-            PyObject *r = PyTuple_GET_ITEM(o, n);
-            Py_INCREF(r);
-            return r;
-        }
-    } else {  /* inlined PySequence_GetItem() */
-        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
-        if (likely(m && m->sq_item)) {
-            if (unlikely(i < 0) && likely(m->sq_length)) {
-                Py_ssize_t l = m->sq_length(o);
-                if (unlikely(l < 0)) return NULL;
-                i += l;
-            }
-            return m->sq_item(o, i);
-        }
-    }
-#else
-    if (PySequence_Check(o)) {
-        return PySequence_GetItem(o, i);
-    }
-#endif
-    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
-}
-
-static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
+#define __Pyx_GetItemInt(o, i, size, to_py_func, is_list, wraparound, boundscheck) \
+    (((size) <= sizeof(Py_ssize_t)) ? \
+    __Pyx_GetItemInt_Fast(o, i, is_list, wraparound, boundscheck) : \
+    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
+#define __Pyx_GetItemInt_List(o, i, size, to_py_func, is_list, wraparound, boundscheck) \
+    (((size) <= sizeof(Py_ssize_t)) ? \
+    __Pyx_GetItemInt_List_Fast(o, i, wraparound, boundscheck) : \
+    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
+                                                              int wraparound, int boundscheck);
+#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func, is_list, wraparound, boundscheck) \
+    (((size) <= sizeof(Py_ssize_t)) ? \
+    __Pyx_GetItemInt_Tuple_Fast(o, i, wraparound, boundscheck) : \
+    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
+                                                              int wraparound, int boundscheck);
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
+                                                     int is_list, int wraparound, int boundscheck);
+
+static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
 static PyObject *__pyx_memoryview_transpose(PyObject *__pyx_v_self); /*proto*/
 static PyObject *__pyx_memoryview__get__base(PyObject *__pyx_v_self); /*proto*/
 static PyObject *__pyx_memoryview_get_shape(PyObject *__pyx_v_self); /*proto*/
 #if CYTHON_COMPILING_IN_CPYTHON
-static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
+static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
     PyListObject* L = (PyListObject*) list;
     Py_ssize_t len = Py_SIZE(list);
     if (likely(L->allocated > len)) {
@@ -1069,7 +1168,7 @@ static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
     return PyList_Append(list, x);
 }
 #else
-#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
+#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
 #endif
 
 static PyObject *__pyx_memoryview_get_strides(PyObject *__pyx_v_self); /*proto*/
@@ -1078,15 +1177,32 @@ static PyObject *__pyx_memoryview_get_ndim(PyObject *__pyx_v_self); /*proto*/
 static PyObject *__pyx_memoryview_get_itemsize(PyObject *__pyx_v_self); /*proto*/
 static PyObject *__pyx_memoryview_get_nbytes(PyObject *__pyx_v_self); /*proto*/
 static PyObject *__pyx_memoryview_get_size(PyObject *__pyx_v_self); /*proto*/
-static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
-
-#ifndef __PYX_FORCE_INIT_THREADS
-  #define __PYX_FORCE_INIT_THREADS 0
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
+    PyListObject* L = (PyListObject*) list;
+    Py_ssize_t len = Py_SIZE(list);
+    if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
+        Py_INCREF(x);
+        PyList_SET_ITEM(list, len, x);
+        Py_SIZE(list) = len+1;
+        return 0;
+    }
+    return PyList_Append(list, x);
+}
+#else
+#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
 #endif
 
+static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
+
 static CYTHON_INLINE long __Pyx_div_long(long, long); /* proto */
 
 static PyObject *__pyx_memoryviewslice__get__base(PyObject *__pyx_v_self); /*proto*/
+static void __Pyx_WriteUnraisable(const char *name, int clineno,
+                                  int lineno, const char *filename); /*proto*/
+
+static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
+
 typedef struct {
   Py_ssize_t shape, strides, suboffsets;
 } __Pyx_Buf_DimInfo;
@@ -1112,10 +1228,10 @@ typedef struct {
 static Py_ssize_t __Pyx_zeros[] = {0, 0, 0, 0, 0, 0, 0, 0};
 static Py_ssize_t __Pyx_minusones[] = {-1, -1, -1, -1, -1, -1, -1, -1};
 
-static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/
+static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /*proto*/
 
-PyObject *__pyx_memview_get_float(const char *itemp); /* proto */
-int __pyx_memview_set_float(const char *itemp, PyObject *obj); /* proto */
+static PyObject *__pyx_memview_get_float(const char *itemp); /* proto */
+static int __pyx_memview_set_float(const char *itemp, PyObject *obj); /* proto */
 
 #if CYTHON_CCOMPLEX
   #ifdef __cplusplus
@@ -1265,17 +1381,24 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);
 
 static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);
 
+static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
+
+static int __Pyx_ValidateAndInit_memviewslice(
+                int *axes_specs,
+                int c_or_f_flag,
+                int buf_flags,
+                int ndim,
+                __Pyx_TypeInfo *dtype,
+                __Pyx_BufFmt_StackElem stack[],
+                __Pyx_memviewslice *memviewslice,
+                PyObject *original_obj);
+
 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_uint32_t(PyObject *);
 
 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_float(PyObject *);
 
-static void __Pyx_WriteUnraisable(const char *name, int clineno,
-                                  int lineno, const char *filename); /*proto*/
-
 static int __Pyx_check_binary_version(void);
 
-static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
-
 #if !defined(__Pyx_PyIdentifier_FromString)
 #if PY_MAJOR_VERSION < 3
   #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
@@ -1316,6 +1439,8 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
 
 /* Module declarations from 'cpython.ref' */
 
+/* Module declarations from 'libc.string' */
+
 /* Module declarations from 'libc.stdio' */
 
 /* Module declarations from 'cpython.object' */
@@ -1338,9 +1463,9 @@ static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
 static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/
 
 /* Module declarations from 'relabel' */
+static PyTypeObject *__pyx_memoryview_type = 0;
 static PyTypeObject *__pyx_array_type = 0;
 static PyTypeObject *__pyx_MemviewEnum_type = 0;
-static PyTypeObject *__pyx_memoryview_type = 0;
 static PyTypeObject *__pyx_memoryviewslice_type = 0;
 static PyObject *generic = 0;
 static PyObject *strided = 0;
@@ -1350,12 +1475,12 @@ static PyObject *indirect_contiguous = 0;
 static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/
 static void *__pyx_align_pointer(void *, size_t); /*proto*/
 static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo *); /*proto*/
-static int __pyx_memoryview_check(PyObject *); /*proto*/
+static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/
 static PyObject *_unellipsify(PyObject *, int); /*proto*/
 static PyObject *assert_direct_dimensions(Py_ssize_t *, int); /*proto*/
 static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/
 static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int, int); /*proto*/
-static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, int); /*proto*/
+static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/
 static int __pyx_memslice_transpose(__Pyx_memviewslice *); /*proto*/
 static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice, int, PyObject *(*)(char *), int (*)(char *, PyObject *), int); /*proto*/
 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
@@ -1432,6 +1557,10 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_20copy(struct __pyx_me
 static PyObject *__pyx_memoryview_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
 static void __pyx_memoryviewslice_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
 static PyObject *__pyx_memoryviewslice__get__base_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
+static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
 static char __pyx_k_1[] = "ndarray is not C contiguous";
 static char __pyx_k_3[] = "ndarray is not Fortran contiguous";
 static char __pyx_k_5[] = "Non-native byte order not supported";
@@ -1548,15 +1677,18 @@ static char __pyx_k__maxBlured[] = "maxBlured";
 static char __pyx_k__IndexError[] = "IndexError";
 static char __pyx_k__ValueError[] = "ValueError";
 static char __pyx_k____author__[] = "__author__";
+static char __pyx_k____import__[] = "__import__";
 static char __pyx_k____status__[] = "__status__";
 static char __pyx_k__MemoryError[] = "MemoryError";
 static char __pyx_k____contact__[] = "__contact__";
 static char __pyx_k____license__[] = "__license__";
 static char __pyx_k__RuntimeError[] = "RuntimeError";
+static char __pyx_k____pyx_vtable__[] = "__pyx_vtable__";
 static char __pyx_k____pyx_getbuffer[] = "__pyx_getbuffer";
 static char __pyx_k__allocate_buffer[] = "allocate_buffer";
 static char __pyx_k__dtype_is_object[] = "dtype_is_object";
 static char __pyx_k__ascontiguousarray[] = "ascontiguousarray";
+static char __pyx_k____pyx_releasebuffer[] = "__pyx_releasebuffer";
 static PyObject *__pyx_kp_u_1;
 static PyObject *__pyx_kp_u_11;
 static PyObject *__pyx_kp_s_13;
@@ -1600,10 +1732,13 @@ static PyObject *__pyx_n_s____author__;
 static PyObject *__pyx_n_s____class__;
 static PyObject *__pyx_n_s____contact__;
 static PyObject *__pyx_n_s____date__;
+static PyObject *__pyx_n_s____import__;
 static PyObject *__pyx_n_s____license__;
 static PyObject *__pyx_n_s____main__;
 static PyObject *__pyx_n_s____name__;
 static PyObject *__pyx_n_s____pyx_getbuffer;
+static PyObject *__pyx_n_s____pyx_releasebuffer;
+static PyObject *__pyx_n_s____pyx_vtable__;
 static PyObject *__pyx_n_s____status__;
 static PyObject *__pyx_n_s____test__;
 static PyObject *__pyx_n_s__allocate_buffer;
@@ -1705,6 +1840,9 @@ static PyObject *__pyx_pw_7relabel_1countThem(PyObject *__pyx_self, PyObject *__
   PyArrayObject *__pyx_v_label = 0;
   PyArrayObject *__pyx_v_data = 0;
   PyArrayObject *__pyx_v_blured = 0;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("countThem (wrapper)", 0);
@@ -1856,12 +1994,12 @@ static PyObject *__pyx_pf_7relabel_countThem(CYTHON_UNUSED PyObject *__pyx_self,
  *     cdef float[:] cdata = numpy.ascontiguousarray(data.ravel(), dtype=numpy.float32)
  *     cdef float[:] cblured = numpy.ascontiguousarray(blured.ravel(), dtype=numpy.float32)
  */
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_label), __pyx_n_s__ravel); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_label), __pyx_n_s__ravel); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __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 = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
@@ -1873,9 +2011,9 @@ static PyObject *__pyx_pf_7relabel_countThem(CYTHON_UNUSED PyObject *__pyx_self,
   __pyx_t_3 = 0;
   __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__uint32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__uint32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -1899,12 +2037,12 @@ static PyObject *__pyx_pf_7relabel_countThem(CYTHON_UNUSED PyObject *__pyx_self,
  *     cdef float[:] cblured = numpy.ascontiguousarray(blured.ravel(), dtype=numpy.float32)
  *     cdef size_t maxLabel = label.max()
  */
-  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_data), __pyx_n_s__ravel); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_data), __pyx_n_s__ravel); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
   __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
@@ -1916,9 +2054,9 @@ static PyObject *__pyx_pf_7relabel_countThem(CYTHON_UNUSED PyObject *__pyx_self,
   __pyx_t_1 = 0;
   __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__float32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __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 = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -1942,12 +2080,12 @@ static PyObject *__pyx_pf_7relabel_countThem(CYTHON_UNUSED PyObject *__pyx_self,
  *     cdef size_t maxLabel = label.max()
  *     cdef numpy.ndarray[numpy.uint_t, ndim = 1] count = numpy.zeros(maxLabel + 1, dtype=numpy.uint)
  */
-  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_blured), __pyx_n_s__ravel); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_blured), __pyx_n_s__ravel); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
@@ -1959,9 +2097,9 @@ static PyObject *__pyx_pf_7relabel_countThem(CYTHON_UNUSED PyObject *__pyx_self,
   __pyx_t_5 = 0;
   __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_5));
-  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__float32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__float32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -1985,7 +2123,7 @@ static PyObject *__pyx_pf_7relabel_countThem(CYTHON_UNUSED PyObject *__pyx_self,
  *     cdef numpy.ndarray[numpy.uint_t, ndim = 1] count = numpy.zeros(maxLabel + 1, dtype=numpy.uint)
  *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] maxData = numpy.zeros(maxLabel + 1, dtype=numpy.float32)
  */
-  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_label), __pyx_n_s__max); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_label), __pyx_n_s__max); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
@@ -2001,9 +2139,9 @@ static PyObject *__pyx_pf_7relabel_countThem(CYTHON_UNUSED PyObject *__pyx_self,
  *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] maxData = numpy.zeros(maxLabel + 1, dtype=numpy.float32)
  *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] maxBlured = numpy.zeros(maxLabel + 1, dtype=numpy.float32)
  */
-  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
   __pyx_t_5 = __Pyx_PyInt_FromSize_t((__pyx_v_maxLabel + 1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -2015,9 +2153,9 @@ static PyObject *__pyx_pf_7relabel_countThem(CYTHON_UNUSED PyObject *__pyx_self,
   __pyx_t_5 = 0;
   __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_5));
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__uint); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__uint); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -2048,9 +2186,9 @@ static PyObject *__pyx_pf_7relabel_countThem(CYTHON_UNUSED PyObject *__pyx_self,
  *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] maxBlured = numpy.zeros(maxLabel + 1, dtype=numpy.float32)
  *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] maxDelta = numpy.zeros(maxLabel + 1, dtype=numpy.float32)
  */
-  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__zeros); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__zeros); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   __pyx_t_3 = __Pyx_PyInt_FromSize_t((__pyx_v_maxLabel + 1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -2062,9 +2200,9 @@ static PyObject *__pyx_pf_7relabel_countThem(CYTHON_UNUSED PyObject *__pyx_self,
   __pyx_t_3 = 0;
   __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__float32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__float32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -2095,9 +2233,9 @@ static PyObject *__pyx_pf_7relabel_countThem(CYTHON_UNUSED PyObject *__pyx_self,
  *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] maxDelta = numpy.zeros(maxLabel + 1, dtype=numpy.float32)
  *     cdef int s , i, idx
  */
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __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_PyInt_FromSize_t((__pyx_v_maxLabel + 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -2109,9 +2247,9 @@ static PyObject *__pyx_pf_7relabel_countThem(CYTHON_UNUSED PyObject *__pyx_self,
   __pyx_t_1 = 0;
   __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__float32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__float32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
   if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -2142,9 +2280,9 @@ static PyObject *__pyx_pf_7relabel_countThem(CYTHON_UNUSED PyObject *__pyx_self,
  *     cdef int s , i, idx
  *     cdef float d, b
  */
-  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_t_2 = __Pyx_PyInt_FromSize_t((__pyx_v_maxLabel + 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -2156,9 +2294,9 @@ static PyObject *__pyx_pf_7relabel_countThem(CYTHON_UNUSED PyObject *__pyx_self,
   __pyx_t_2 = 0;
   __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__float32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__float32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -2189,7 +2327,7 @@ static PyObject *__pyx_pf_7relabel_countThem(CYTHON_UNUSED PyObject *__pyx_self,
  *     assert s == cdata.size
  *     assert s == cblured.size
  */
-  __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_label), __pyx_n_s__size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_label), __pyx_n_s__size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
   __pyx_t_14 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
@@ -2207,7 +2345,7 @@ static PyObject *__pyx_pf_7relabel_countThem(CYTHON_UNUSED PyObject *__pyx_self,
   __Pyx_GOTREF(__pyx_t_5);
   __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_cdata, 1, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_t_2 = PyObject_RichCompare(__pyx_t_5, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -2233,7 +2371,7 @@ static PyObject *__pyx_pf_7relabel_countThem(CYTHON_UNUSED PyObject *__pyx_self,
   __Pyx_GOTREF(__pyx_t_2);
   __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_cblured, 1, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -2256,9 +2394,9 @@ static PyObject *__pyx_pf_7relabel_countThem(CYTHON_UNUSED PyObject *__pyx_self,
  */
   {
       #ifdef WITH_THREAD
-      PyThreadState *_save = NULL;
-      #endif
+      PyThreadState *_save;
       Py_UNBLOCK_THREADS
+      #endif
       /*try:*/ {
 
         /* "relabel.pyx":40
@@ -2320,7 +2458,7 @@ static PyObject *__pyx_pf_7relabel_countThem(CYTHON_UNUSED PyObject *__pyx_self,
  *                 maxDelta[idx] = d - b
  */
           __pyx_t_21 = __pyx_v_idx;
-          __pyx_t_15 = (__pyx_v_d > (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_maxData.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_maxData.diminfo[0].strides)));
+          __pyx_t_15 = ((__pyx_v_d > (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_maxData.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_maxData.diminfo[0].strides))) != 0);
           if (__pyx_t_15) {
 
             /* "relabel.pyx":46
@@ -2354,7 +2492,7 @@ static PyObject *__pyx_pf_7relabel_countThem(CYTHON_UNUSED PyObject *__pyx_self,
  *     return count, maxData, maxBlured, maxDelta
  */
           __pyx_t_24 = __pyx_v_idx;
-          __pyx_t_15 = (__pyx_v_b > (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_maxBlured.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_maxBlured.diminfo[0].strides)));
+          __pyx_t_15 = ((__pyx_v_b > (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_maxBlured.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_maxBlured.diminfo[0].strides))) != 0);
           if (__pyx_t_15) {
 
             /* "relabel.pyx":49
@@ -2380,7 +2518,9 @@ static PyObject *__pyx_pf_7relabel_countThem(CYTHON_UNUSED PyObject *__pyx_self,
  *             idx =  clabel[i]
  */
       /*finally:*/ {
+        #ifdef WITH_THREAD
         Py_BLOCK_THREADS
+        #endif
       }
   }
 
@@ -2450,8 +2590,8 @@ static PyObject *__pyx_pf_7relabel_countThem(CYTHON_UNUSED PyObject *__pyx_self,
 }
 
 /* Python wrapper */
-static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
-static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
+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);
@@ -2506,7 +2646,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  * 
  *             cdef int copy_shape, i, ndim
  */
-  __pyx_t_1 = (__pyx_v_info == NULL);
+  __pyx_t_1 = ((__pyx_v_info == NULL) != 0);
   if (__pyx_t_1) {
     __pyx_r = 0;
     goto __pyx_L0;
@@ -2548,7 +2688,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 copy_shape = 1
  *             else:
  */
-  __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t)));
+  __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":209
@@ -2581,7 +2721,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
  *                 raise ValueError(u"ndarray is not C contiguous")
  */
-  __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS);
+  __pyx_t_1 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":214
@@ -2591,7 +2731,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 raise ValueError(u"ndarray is not C contiguous")
  * 
  */
-    __pyx_t_2 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS));
+    __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS) != 0)) != 0);
     __pyx_t_3 = __pyx_t_2;
   } else {
     __pyx_t_3 = __pyx_t_1;
@@ -2621,7 +2761,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
  *                 raise ValueError(u"ndarray is not Fortran contiguous")
  */
-  __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS);
+  __pyx_t_3 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0);
   if (__pyx_t_3) {
 
     /* "numpy.pxd":218
@@ -2631,7 +2771,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 raise ValueError(u"ndarray is not Fortran contiguous")
  * 
  */
-    __pyx_t_1 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS));
+    __pyx_t_1 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS) != 0)) != 0);
     __pyx_t_2 = __pyx_t_1;
   } else {
     __pyx_t_2 = __pyx_t_3;
@@ -2679,7 +2819,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 # Allocate new buffer for strides and shape info.
  *                 # This is allocated as one block, strides first.
  */
-  if (__pyx_v_copy_shape) {
+  __pyx_t_2 = (__pyx_v_copy_shape != 0);
+  if (__pyx_t_2) {
 
     /* "numpy.pxd":226
  *                 # Allocate new buffer for strides and shape info.
@@ -2777,7 +2918,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  * 
  *             cdef int t
  */
-  __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self));
+  __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0));
 
   /* "numpy.pxd":239
  * 
@@ -2795,8 +2936,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *             cdef list stack
  *             cdef int offset
  */
-  __Pyx_INCREF(((PyObject *)__pyx_v_self->descr));
-  __pyx_v_descr = __pyx_v_self->descr;
+  __pyx_t_4 = ((PyObject *)__pyx_v_self->descr);
+  __Pyx_INCREF(__pyx_t_4);
+  __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4);
+  __pyx_t_4 = 0;
 
   /* "numpy.pxd":244
  *             cdef int offset
@@ -2814,9 +2957,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 # do not call releasebuffer
  *                 info.obj = None
  */
-  __pyx_t_2 = (!__pyx_v_hasfields);
+  __pyx_t_2 = ((!(__pyx_v_hasfields != 0)) != 0);
   if (__pyx_t_2) {
-    __pyx_t_3 = (!__pyx_v_copy_shape);
+    __pyx_t_3 = ((!(__pyx_v_copy_shape != 0)) != 0);
     __pyx_t_1 = __pyx_t_3;
   } else {
     __pyx_t_1 = __pyx_t_2;
@@ -2861,7 +3004,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 t = descr.type_num
  *                 if ((descr.byteorder == c'>' and little_endian) or
  */
-  __pyx_t_1 = (!__pyx_v_hasfields);
+  __pyx_t_1 = ((!(__pyx_v_hasfields != 0)) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":254
@@ -2871,7 +3014,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 if ((descr.byteorder == c'>' and little_endian) or
  *                     (descr.byteorder == c'<' and not little_endian)):
  */
-    __pyx_v_t = __pyx_v_descr->type_num;
+    __pyx_t_5 = __pyx_v_descr->type_num;
+    __pyx_v_t = __pyx_t_5;
 
     /* "numpy.pxd":255
  *             if not hasfields:
@@ -2880,9 +3024,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                     (descr.byteorder == c'<' and not little_endian)):
  *                     raise ValueError(u"Non-native byte order not supported")
  */
-    __pyx_t_1 = (__pyx_v_descr->byteorder == '>');
+    __pyx_t_1 = ((__pyx_v_descr->byteorder == '>') != 0);
     if (__pyx_t_1) {
-      __pyx_t_2 = __pyx_v_little_endian;
+      __pyx_t_2 = (__pyx_v_little_endian != 0);
     } else {
       __pyx_t_2 = __pyx_t_1;
     }
@@ -2895,9 +3039,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                     raise ValueError(u"Non-native byte order not supported")
  *                 if   t == NPY_BYTE:        f = "b"
  */
-      __pyx_t_1 = (__pyx_v_descr->byteorder == '<');
+      __pyx_t_1 = ((__pyx_v_descr->byteorder == '<') != 0);
       if (__pyx_t_1) {
-        __pyx_t_3 = (!__pyx_v_little_endian);
+        __pyx_t_3 = ((!(__pyx_v_little_endian != 0)) != 0);
         __pyx_t_7 = __pyx_t_3;
       } else {
         __pyx_t_7 = __pyx_t_1;
@@ -2924,227 +3068,202 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
     }
     __pyx_L12:;
 
-    /* "numpy.pxd":258
+    /* "numpy.pxd":274
+ *                 elif t == NPY_CDOUBLE:     f = "Zd"
+ *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
+ *                 elif t == NPY_OBJECT:      f = "O"             # <<<<<<<<<<<<<<
+ *                 else:
+ *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
+ */
+    switch (__pyx_v_t) {
+
+      /* "numpy.pxd":258
  *                     (descr.byteorder == c'<' and not little_endian)):
  *                     raise ValueError(u"Non-native byte order not supported")
  *                 if   t == NPY_BYTE:        f = "b"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_UBYTE:       f = "B"
  *                 elif t == NPY_SHORT:       f = "h"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_BYTE);
-    if (__pyx_t_1) {
+      case NPY_BYTE:
       __pyx_v_f = __pyx_k__b;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":259
+      /* "numpy.pxd":259
  *                     raise ValueError(u"Non-native byte order not supported")
  *                 if   t == NPY_BYTE:        f = "b"
  *                 elif t == NPY_UBYTE:       f = "B"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_SHORT:       f = "h"
  *                 elif t == NPY_USHORT:      f = "H"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_UBYTE);
-    if (__pyx_t_1) {
+      case NPY_UBYTE:
       __pyx_v_f = __pyx_k__B;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":260
+      /* "numpy.pxd":260
  *                 if   t == NPY_BYTE:        f = "b"
  *                 elif t == NPY_UBYTE:       f = "B"
  *                 elif t == NPY_SHORT:       f = "h"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_USHORT:      f = "H"
  *                 elif t == NPY_INT:         f = "i"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_SHORT);
-    if (__pyx_t_1) {
+      case NPY_SHORT:
       __pyx_v_f = __pyx_k__h;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":261
+      /* "numpy.pxd":261
  *                 elif t == NPY_UBYTE:       f = "B"
  *                 elif t == NPY_SHORT:       f = "h"
  *                 elif t == NPY_USHORT:      f = "H"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_INT:         f = "i"
  *                 elif t == NPY_UINT:        f = "I"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_USHORT);
-    if (__pyx_t_1) {
+      case NPY_USHORT:
       __pyx_v_f = __pyx_k__H;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":262
+      /* "numpy.pxd":262
  *                 elif t == NPY_SHORT:       f = "h"
  *                 elif t == NPY_USHORT:      f = "H"
  *                 elif t == NPY_INT:         f = "i"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_UINT:        f = "I"
  *                 elif t == NPY_LONG:        f = "l"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_INT);
-    if (__pyx_t_1) {
+      case NPY_INT:
       __pyx_v_f = __pyx_k__i;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":263
+      /* "numpy.pxd":263
  *                 elif t == NPY_USHORT:      f = "H"
  *                 elif t == NPY_INT:         f = "i"
  *                 elif t == NPY_UINT:        f = "I"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_LONG:        f = "l"
  *                 elif t == NPY_ULONG:       f = "L"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_UINT);
-    if (__pyx_t_1) {
+      case NPY_UINT:
       __pyx_v_f = __pyx_k__I;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":264
+      /* "numpy.pxd":264
  *                 elif t == NPY_INT:         f = "i"
  *                 elif t == NPY_UINT:        f = "I"
  *                 elif t == NPY_LONG:        f = "l"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_ULONG:       f = "L"
  *                 elif t == NPY_LONGLONG:    f = "q"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_LONG);
-    if (__pyx_t_1) {
+      case NPY_LONG:
       __pyx_v_f = __pyx_k__l;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":265
+      /* "numpy.pxd":265
  *                 elif t == NPY_UINT:        f = "I"
  *                 elif t == NPY_LONG:        f = "l"
  *                 elif t == NPY_ULONG:       f = "L"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_LONGLONG:    f = "q"
  *                 elif t == NPY_ULONGLONG:   f = "Q"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_ULONG);
-    if (__pyx_t_1) {
+      case NPY_ULONG:
       __pyx_v_f = __pyx_k__L;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":266
+      /* "numpy.pxd":266
  *                 elif t == NPY_LONG:        f = "l"
  *                 elif t == NPY_ULONG:       f = "L"
  *                 elif t == NPY_LONGLONG:    f = "q"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_ULONGLONG:   f = "Q"
  *                 elif t == NPY_FLOAT:       f = "f"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG);
-    if (__pyx_t_1) {
+      case NPY_LONGLONG:
       __pyx_v_f = __pyx_k__q;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":267
+      /* "numpy.pxd":267
  *                 elif t == NPY_ULONG:       f = "L"
  *                 elif t == NPY_LONGLONG:    f = "q"
  *                 elif t == NPY_ULONGLONG:   f = "Q"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_FLOAT:       f = "f"
  *                 elif t == NPY_DOUBLE:      f = "d"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG);
-    if (__pyx_t_1) {
+      case NPY_ULONGLONG:
       __pyx_v_f = __pyx_k__Q;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":268
+      /* "numpy.pxd":268
  *                 elif t == NPY_LONGLONG:    f = "q"
  *                 elif t == NPY_ULONGLONG:   f = "Q"
  *                 elif t == NPY_FLOAT:       f = "f"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_DOUBLE:      f = "d"
  *                 elif t == NPY_LONGDOUBLE:  f = "g"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_FLOAT);
-    if (__pyx_t_1) {
+      case NPY_FLOAT:
       __pyx_v_f = __pyx_k__f;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":269
+      /* "numpy.pxd":269
  *                 elif t == NPY_ULONGLONG:   f = "Q"
  *                 elif t == NPY_FLOAT:       f = "f"
  *                 elif t == NPY_DOUBLE:      f = "d"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_LONGDOUBLE:  f = "g"
  *                 elif t == NPY_CFLOAT:      f = "Zf"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE);
-    if (__pyx_t_1) {
+      case NPY_DOUBLE:
       __pyx_v_f = __pyx_k__d;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":270
+      /* "numpy.pxd":270
  *                 elif t == NPY_FLOAT:       f = "f"
  *                 elif t == NPY_DOUBLE:      f = "d"
  *                 elif t == NPY_LONGDOUBLE:  f = "g"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_CFLOAT:      f = "Zf"
  *                 elif t == NPY_CDOUBLE:     f = "Zd"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE);
-    if (__pyx_t_1) {
+      case NPY_LONGDOUBLE:
       __pyx_v_f = __pyx_k__g;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":271
+      /* "numpy.pxd":271
  *                 elif t == NPY_DOUBLE:      f = "d"
  *                 elif t == NPY_LONGDOUBLE:  f = "g"
  *                 elif t == NPY_CFLOAT:      f = "Zf"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_CDOUBLE:     f = "Zd"
  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT);
-    if (__pyx_t_1) {
+      case NPY_CFLOAT:
       __pyx_v_f = __pyx_k__Zf;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":272
+      /* "numpy.pxd":272
  *                 elif t == NPY_LONGDOUBLE:  f = "g"
  *                 elif t == NPY_CFLOAT:      f = "Zf"
  *                 elif t == NPY_CDOUBLE:     f = "Zd"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
  *                 elif t == NPY_OBJECT:      f = "O"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE);
-    if (__pyx_t_1) {
+      case NPY_CDOUBLE:
       __pyx_v_f = __pyx_k__Zd;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":273
+      /* "numpy.pxd":273
  *                 elif t == NPY_CFLOAT:      f = "Zf"
  *                 elif t == NPY_CDOUBLE:     f = "Zd"
  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_OBJECT:      f = "O"
  *                 else:
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE);
-    if (__pyx_t_1) {
+      case NPY_CLONGDOUBLE:
       __pyx_v_f = __pyx_k__Zg;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":274
+      /* "numpy.pxd":274
  *                 elif t == NPY_CDOUBLE:     f = "Zd"
  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
  *                 elif t == NPY_OBJECT:      f = "O"             # <<<<<<<<<<<<<<
  *                 else:
  *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_OBJECT);
-    if (__pyx_t_1) {
+      case NPY_OBJECT:
       __pyx_v_f = __pyx_k__O;
-      goto __pyx_L13;
-    }
-    /*else*/ {
+      break;
+      default:
 
       /* "numpy.pxd":276
  *                 elif t == NPY_OBJECT:      f = "O"
@@ -3169,8 +3288,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
       {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      break;
     }
-    __pyx_L13:;
 
     /* "numpy.pxd":277
  *                 else:
@@ -3266,8 +3385,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
 }
 
 /* Python wrapper */
-static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
-static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
+static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
+static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
   __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));
@@ -3294,7 +3413,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s
  *                 stdlib.free(info.format)
  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
  */
-  __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self);
+  __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":290
@@ -3316,7 +3435,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s
  *                 stdlib.free(info.strides)
  *                 # info.shape was stored after info.strides in the same block
  */
-  __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t)));
+  __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":292
@@ -3621,8 +3740,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
     #else
     __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     #endif
-    __Pyx_XDECREF(__pyx_v_childname);
-    __pyx_v_childname = __pyx_t_3;
+    __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3);
     __pyx_t_3 = 0;
 
     /* "numpy.pxd":795
@@ -3635,8 +3753,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
     __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_XDECREF(((PyObject *)__pyx_v_fields));
-    __pyx_v_fields = ((PyObject*)__pyx_t_3);
+    __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3));
     __pyx_t_3 = 0;
 
     /* "numpy.pxd":796
@@ -3665,7 +3782,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
       __Pyx_INCREF(__pyx_t_4);
       #else
       __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
       __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_4);
       #endif
     } else if (1) {
       __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -3691,11 +3810,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
       __pyx_L6_unpacking_done:;
     }
     if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_XDECREF(((PyObject *)__pyx_v_child));
-    __pyx_v_child = ((PyArray_Descr *)__pyx_t_3);
+    __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3));
     __pyx_t_3 = 0;
-    __Pyx_XDECREF(__pyx_v_new_offset);
-    __pyx_v_new_offset = __pyx_t_4;
+    __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4);
     __pyx_t_4 = 0;
 
     /* "numpy.pxd":798
@@ -3745,9 +3862,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  *             (child.byteorder == c'<' and not little_endian)):
  *             raise ValueError(u"Non-native byte order not supported")
  */
-    __pyx_t_7 = (__pyx_v_child->byteorder == '>');
+    __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0);
     if (__pyx_t_7) {
-      __pyx_t_8 = __pyx_v_little_endian;
+      __pyx_t_8 = (__pyx_v_little_endian != 0);
     } else {
       __pyx_t_8 = __pyx_t_7;
     }
@@ -3760,9 +3877,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  *             raise ValueError(u"Non-native byte order not supported")
  *             # One could encode it in the format string and have Cython
  */
-      __pyx_t_7 = (__pyx_v_child->byteorder == '<');
+      __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0);
       if (__pyx_t_7) {
-        __pyx_t_9 = (!__pyx_v_little_endian);
+        __pyx_t_9 = ((!(__pyx_v_little_endian != 0)) != 0);
         __pyx_t_10 = __pyx_t_9;
       } else {
         __pyx_t_10 = __pyx_t_7;
@@ -3851,7 +3968,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  *             t = child.type_num
  *             if end - f < 5:
  */
-    __pyx_t_7 = (!PyDataType_HASFIELDS(__pyx_v_child));
+    __pyx_t_7 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0);
     if (__pyx_t_7) {
 
       /* "numpy.pxd":821
@@ -3863,8 +3980,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  */
       __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
-      __Pyx_XDECREF(__pyx_v_t);
-      __pyx_v_t = __pyx_t_3;
+      __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_3);
       __pyx_t_3 = 0;
 
       /* "numpy.pxd":822
@@ -3874,7 +3990,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  *                 raise RuntimeError(u"Format string allocated too short.")
  * 
  */
-      __pyx_t_7 = ((__pyx_v_end - __pyx_v_f) < 5);
+      __pyx_t_7 = (((__pyx_v_end - __pyx_v_f) < 5) != 0);
       if (__pyx_t_7) {
 
         /* "numpy.pxd":823
@@ -4296,6 +4412,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a
   PyObject *__pyx_v_baseptr;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
+  int __pyx_t_2;
   __Pyx_RefNannySetupContext("set_array_base", 0);
 
   /* "numpy.pxd":967
@@ -4306,7 +4423,8 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a
  *      else:
  */
   __pyx_t_1 = (__pyx_v_base == Py_None);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
     /* "numpy.pxd":968
  *      cdef PyObject* baseptr
@@ -4382,7 +4500,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py
  *         return None
  *     else:
  */
-  __pyx_t_1 = (__pyx_v_arr->base == NULL);
+  __pyx_t_1 = ((__pyx_v_arr->base == NULL) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":977
@@ -4427,6 +4545,9 @@ static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, P
   PyObject *__pyx_v_format = 0;
   PyObject *__pyx_v_mode = 0;
   int __pyx_v_allocate_buffer;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
@@ -4546,12 +4667,12 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
   Py_ssize_t __pyx_t_1;
   int __pyx_t_2;
   PyObject *__pyx_t_3 = NULL;
-  PyObject *__pyx_t_4 = NULL;
-  PyObject *__pyx_t_5 = NULL;
-  char *__pyx_t_6;
+  char *__pyx_t_4;
+  int __pyx_t_5;
+  int __pyx_t_6;
   int __pyx_t_7;
-  int __pyx_t_8;
-  int __pyx_t_9;
+  PyObject *__pyx_t_8 = NULL;
+  PyObject *__pyx_t_9 = NULL;
   Py_ssize_t __pyx_t_10;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
@@ -4563,7 +4684,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
   /* "View.MemoryView":120
  *         cdef PyObject **p
  * 
- *         self.ndim = len(shape)             # <<<<<<<<<<<<<<
+ *         self.ndim = <int> len(shape)             # <<<<<<<<<<<<<<
  *         self.itemsize = itemsize
  * 
  */
@@ -4572,11 +4693,11 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   __pyx_t_1 = PyTuple_GET_SIZE(((PyObject *)__pyx_v_shape)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_self->ndim = __pyx_t_1;
+  __pyx_v_self->ndim = ((int)__pyx_t_1);
 
   /* "View.MemoryView":121
  * 
- *         self.ndim = len(shape)
+ *         self.ndim = <int> len(shape)
  *         self.itemsize = itemsize             # <<<<<<<<<<<<<<
  * 
  *         if not self.ndim:
@@ -4590,7 +4711,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             raise ValueError("Empty shape tuple for cython.array")
  * 
  */
-  __pyx_t_2 = (!__pyx_v_self->ndim);
+  __pyx_t_2 = ((!(__pyx_v_self->ndim != 0)) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":124
@@ -4616,7 +4737,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             raise ValueError("itemsize <= 0 for cython.array")
  * 
  */
-  __pyx_t_2 = (__pyx_v_self->itemsize <= 0);
+  __pyx_t_2 = ((__pyx_v_self->itemsize <= 0) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":127
@@ -4642,16 +4763,10 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *         if encode:
  *             format = encode('ASCII')
  */
-  __pyx_t_3 = ((PyObject *)__pyx_n_s__encode);
-  __Pyx_INCREF(__pyx_t_3);
-  __pyx_t_4 = Py_None;
-  __Pyx_INCREF(__pyx_t_4);
-  __pyx_t_5 = __Pyx_GetAttr3(__pyx_v_format, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_v_encode = __pyx_t_5;
-  __pyx_t_5 = 0;
+  __pyx_t_3 = __Pyx_GetAttr3(__pyx_v_format, ((PyObject *)__pyx_n_s__encode), Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_v_encode = __pyx_t_3;
+  __pyx_t_3 = 0;
 
   /* "View.MemoryView":130
  * 
@@ -4670,11 +4785,10 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *         self._format = format
  *         self.format = self._format
  */
-    __pyx_t_5 = PyObject_Call(__pyx_v_encode, ((PyObject *)__pyx_k_tuple_17), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_v_format);
-    __pyx_v_format = __pyx_t_5;
-    __pyx_t_5 = 0;
+    __pyx_t_3 = PyObject_Call(__pyx_v_encode, ((PyObject *)__pyx_k_tuple_17), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_3);
+    __pyx_t_3 = 0;
     goto __pyx_L5;
   }
   __pyx_L5:;
@@ -4700,8 +4814,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  *         self._shape = <Py_ssize_t *> malloc(sizeof(Py_ssize_t)*self.ndim)
  */
-  __pyx_t_6 = PyBytes_AsString(((PyObject *)__pyx_v_self->_format)); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_self->format = __pyx_t_6;
+  __pyx_t_4 = __Pyx_PyObject_AsString(((PyObject *)__pyx_v_self->_format)); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_v_self->format = __pyx_t_4;
 
   /* "View.MemoryView":135
  *         self.format = self._format
@@ -4728,14 +4842,14 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             free(self._shape)
  *             free(self._strides)
  */
-  __pyx_t_2 = (!(__pyx_v_self->_shape != 0));
+  __pyx_t_2 = ((!(__pyx_v_self->_shape != 0)) != 0);
   if (!__pyx_t_2) {
-    __pyx_t_7 = (!(__pyx_v_self->_strides != 0));
-    __pyx_t_8 = __pyx_t_7;
+    __pyx_t_5 = ((!(__pyx_v_self->_strides != 0)) != 0);
+    __pyx_t_6 = __pyx_t_5;
   } else {
-    __pyx_t_8 = __pyx_t_2;
+    __pyx_t_6 = __pyx_t_2;
   }
-  if (__pyx_t_8) {
+  if (__pyx_t_6) {
 
     /* "View.MemoryView":139
  * 
@@ -4762,10 +4876,10 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  * 
  */
-    __pyx_t_5 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_19), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_19), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L6;
   }
@@ -4787,20 +4901,19 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             if dim <= 0:
  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
  */
-  __pyx_t_9 = 0;
-  __pyx_t_5 = ((PyObject *)__pyx_v_shape); __Pyx_INCREF(__pyx_t_5); __pyx_t_1 = 0;
+  __pyx_t_7 = 0;
+  __pyx_t_3 = ((PyObject *)__pyx_v_shape); __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
   for (;;) {
-    if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
+    if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
     #if CYTHON_COMPILING_IN_CPYTHON
-    __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_1); __Pyx_INCREF(__pyx_t_4); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_8); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     #else
-    __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_8 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     #endif
-    __Pyx_XDECREF(__pyx_v_dim);
-    __pyx_v_dim = __pyx_t_4;
-    __pyx_t_4 = 0;
-    __pyx_v_idx = __pyx_t_9;
-    __pyx_t_9 = (__pyx_t_9 + 1);
+    __Pyx_XDECREF_SET(__pyx_v_dim, __pyx_t_8);
+    __pyx_t_8 = 0;
+    __pyx_v_idx = __pyx_t_7;
+    __pyx_t_7 = (__pyx_t_7 + 1);
 
     /* "View.MemoryView":146
  *         idx = 0
@@ -4809,10 +4922,10 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
  * 
  */
-    __pyx_t_4 = PyObject_RichCompare(__pyx_v_dim, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    if (__pyx_t_8) {
+    __pyx_t_8 = PyObject_RichCompare(__pyx_v_dim, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    if (__pyx_t_6) {
 
       /* "View.MemoryView":147
  *         for idx, dim in enumerate(shape):
@@ -4821,29 +4934,29 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  *             self._shape[idx] = dim
  */
-      __pyx_t_4 = PyInt_FromLong(__pyx_v_idx); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
-      __Pyx_GIVEREF(__pyx_t_4);
+      __pyx_t_8 = PyInt_FromLong(__pyx_v_idx); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_8);
+      __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
+      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8);
+      __Pyx_GIVEREF(__pyx_t_8);
       __Pyx_INCREF(__pyx_v_dim);
-      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_dim);
+      PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_dim);
       __Pyx_GIVEREF(__pyx_v_dim);
-      __pyx_t_4 = 0;
-      __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_20), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
-      __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
-      __pyx_t_4 = 0;
-      __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+      __pyx_t_8 = 0;
+      __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_20), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_8));
+      __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
+      __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
+      PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_t_8));
+      __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
+      __pyx_t_8 = 0;
+      __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_8);
+      __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
+      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
+      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
       {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L9;
     }
@@ -4868,7 +4981,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  */
     __pyx_v_idx = (__pyx_v_idx + 1);
   }
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
   /* "View.MemoryView":152
  *             idx += 1
@@ -4878,21 +4991,21 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  */
   __Pyx_INCREF(__pyx_v_mode);
-  __pyx_t_5 = __pyx_v_mode;
-  __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, ((PyObject *)__pyx_n_s__fortran), Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (((int)__pyx_t_8)) {
-    __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, ((PyObject *)__pyx_n_s__c), Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_7 = ((int)__pyx_t_2);
+  __pyx_t_3 = __pyx_v_mode;
+  __pyx_t_8 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__fortran), Py_NE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+  if (((int)__pyx_t_6)) {
+    __pyx_t_8 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__c), Py_NE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    __pyx_t_5 = ((int)__pyx_t_2);
   } else {
-    __pyx_t_7 = ((int)__pyx_t_8);
+    __pyx_t_5 = ((int)__pyx_t_6);
   }
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __pyx_t_8 = __pyx_t_7;
-  if (__pyx_t_8) {
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_6 = (__pyx_t_5 != 0);
+  if (__pyx_t_6) {
 
     /* "View.MemoryView":153
  * 
@@ -4901,18 +5014,18 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  *         cdef char order
  */
-    __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_21), __pyx_v_mode); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
-    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_5));
-    __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
-    __pyx_t_5 = 0;
-    __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_21), __pyx_v_mode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+    __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_8);
+    PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_3));
+    __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
+    __pyx_t_3 = 0;
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
+    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L10;
   }
@@ -4925,10 +5038,10 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             order = 'F'
  *         else:
  */
-  __pyx_t_5 = PyObject_RichCompare(__pyx_v_mode, ((PyObject *)__pyx_n_s__fortran), Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  if (__pyx_t_8) {
+  __pyx_t_3 = PyObject_RichCompare(__pyx_v_mode, ((PyObject *)__pyx_n_s__fortran), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  if (__pyx_t_6) {
 
     /* "View.MemoryView":157
  *         cdef char order
@@ -4969,14 +5082,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *         if decode:
  *             mode = decode('ASCII')
  */
-  __pyx_t_5 = ((PyObject *)__pyx_n_s__decode);
-  __Pyx_INCREF(__pyx_t_5);
-  __pyx_t_4 = Py_None;
-  __Pyx_INCREF(__pyx_t_4);
-  __pyx_t_3 = __Pyx_GetAttr3(__pyx_v_mode, __pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_GetAttr3(__pyx_v_mode, ((PyObject *)__pyx_n_s__decode), Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   __pyx_v_decode = __pyx_t_3;
   __pyx_t_3 = 0;
 
@@ -4987,8 +5094,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             mode = decode('ASCII')
  *         self.mode = mode
  */
-  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_decode); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__pyx_t_8) {
+  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_decode); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__pyx_t_6) {
 
     /* "View.MemoryView":166
  *         decode = getattr(mode, 'decode', None)
@@ -4999,8 +5106,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  */
     __pyx_t_3 = PyObject_Call(__pyx_v_decode, ((PyObject *)__pyx_k_tuple_22), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_v_mode);
-    __pyx_v_mode = __pyx_t_3;
+    __Pyx_DECREF_SET(__pyx_v_mode, __pyx_t_3);
     __pyx_t_3 = 0;
     goto __pyx_L12;
   }
@@ -5037,9 +5143,9 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             self.data = <char *>malloc(self.len)
  */
   __pyx_t_3 = PyObject_RichCompare(__pyx_v_format, ((PyObject *)__pyx_n_b__O), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_v_self->dtype_is_object = __pyx_t_8;
+  __pyx_v_self->dtype_is_object = __pyx_t_6;
 
   /* "View.MemoryView":171
  *         self.free_data = allocate_buffer
@@ -5048,7 +5154,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             self.data = <char *>malloc(self.len)
  *             if not self.data:
  */
-  if (__pyx_v_allocate_buffer) {
+  __pyx_t_6 = (__pyx_v_allocate_buffer != 0);
+  if (__pyx_t_6) {
 
     /* "View.MemoryView":172
  *         self.dtype_is_object = format == b'O'
@@ -5066,8 +5173,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *                 raise MemoryError("unable to allocate array data.")
  * 
  */
-    __pyx_t_8 = (!(__pyx_v_self->data != 0));
-    if (__pyx_t_8) {
+    __pyx_t_6 = ((!(__pyx_v_self->data != 0)) != 0);
+    if (__pyx_t_6) {
 
       /* "View.MemoryView":174
  *             self.data = <char *>malloc(self.len)
@@ -5092,7 +5199,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *                 p = <PyObject **> self.data
  *                 for i in range(self.len / itemsize):
  */
-    if (__pyx_v_self->dtype_is_object) {
+    __pyx_t_6 = (__pyx_v_self->dtype_is_object != 0);
+    if (__pyx_t_6) {
 
       /* "View.MemoryView":177
  * 
@@ -5111,11 +5219,23 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *                     Py_INCREF(Py_None)
  */
       if (unlikely(__pyx_v_itemsize == 0)) {
+        #ifdef WITH_THREAD
+        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+        #endif
         PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero");
+        #ifdef WITH_THREAD
+        PyGILState_Release(__pyx_gilstate_save);
+        #endif
         {__pyx_filename = __pyx_f[2]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       }
       else if (sizeof(Py_ssize_t) == sizeof(long) && unlikely(__pyx_v_itemsize == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) {
+        #ifdef WITH_THREAD
+        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+        #endif
         PyErr_Format(PyExc_OverflowError, "value too large to perform division");
+        #ifdef WITH_THREAD
+        PyGILState_Release(__pyx_gilstate_save);
+        #endif
         {__pyx_filename = __pyx_f[2]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       }
       __pyx_t_1 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_itemsize);
@@ -5151,8 +5271,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_XDECREF(__pyx_t_4);
-  __Pyx_XDECREF(__pyx_t_5);
+  __Pyx_XDECREF(__pyx_t_8);
+  __Pyx_XDECREF(__pyx_t_9);
   __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
@@ -5166,8 +5286,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
 }
 
 /* Python wrapper */
-static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
-static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
+static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
+static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
@@ -5189,8 +5309,12 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
-  PyObject *__pyx_t_2 = NULL;
-  int __pyx_t_3;
+  int __pyx_t_2;
+  PyObject *__pyx_t_3 = NULL;
+  char *__pyx_t_4;
+  Py_ssize_t __pyx_t_5;
+  int __pyx_t_6;
+  Py_ssize_t *__pyx_t_7;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -5217,7 +5341,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         elif self.mode == b"fortran":
  */
   __pyx_t_1 = (__Pyx_PyUnicode_Equals(((PyObject *)__pyx_v_self->mode), ((PyObject *)__pyx_n_b__c), Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":186
  *         cdef int bufmode = -1
@@ -5237,7 +5362,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
  *         if not (flags & bufmode):
  */
-  __pyx_t_1 = (__Pyx_PyUnicode_Equals(((PyObject *)__pyx_v_self->mode), ((PyObject *)__pyx_n_b__fortran), Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = (__Pyx_PyUnicode_Equals(((PyObject *)__pyx_v_self->mode), ((PyObject *)__pyx_n_b__fortran), Py_EQ)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = (__pyx_t_2 != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":188
@@ -5259,7 +5385,7 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
  *         info.buf = self.data
  */
-  __pyx_t_1 = (!(__pyx_v_flags & __pyx_v_bufmode));
+  __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":190
@@ -5269,10 +5395,10 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.buf = self.data
  *         info.len = self.len
  */
-    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_26), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_26), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L4;
   }
@@ -5285,7 +5411,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.len = self.len
  *         info.ndim = self.ndim
  */
-  __pyx_v_info->buf = __pyx_v_self->data;
+  __pyx_t_4 = __pyx_v_self->data;
+  __pyx_v_info->buf = __pyx_t_4;
 
   /* "View.MemoryView":192
  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
@@ -5294,7 +5421,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.ndim = self.ndim
  *         info.shape = self._shape
  */
-  __pyx_v_info->len = __pyx_v_self->len;
+  __pyx_t_5 = __pyx_v_self->len;
+  __pyx_v_info->len = __pyx_t_5;
 
   /* "View.MemoryView":193
  *         info.buf = self.data
@@ -5303,7 +5431,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.shape = self._shape
  *         info.strides = self._strides
  */
-  __pyx_v_info->ndim = __pyx_v_self->ndim;
+  __pyx_t_6 = __pyx_v_self->ndim;
+  __pyx_v_info->ndim = __pyx_t_6;
 
   /* "View.MemoryView":194
  *         info.len = self.len
@@ -5312,7 +5441,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.strides = self._strides
  *         info.suboffsets = NULL
  */
-  __pyx_v_info->shape = __pyx_v_self->_shape;
+  __pyx_t_7 = __pyx_v_self->_shape;
+  __pyx_v_info->shape = __pyx_t_7;
 
   /* "View.MemoryView":195
  *         info.ndim = self.ndim
@@ -5321,7 +5451,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.suboffsets = NULL
  *         info.itemsize = self.itemsize
  */
-  __pyx_v_info->strides = __pyx_v_self->_strides;
+  __pyx_t_7 = __pyx_v_self->_strides;
+  __pyx_v_info->strides = __pyx_t_7;
 
   /* "View.MemoryView":196
  *         info.shape = self._shape
@@ -5339,7 +5470,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.readonly = 0
  * 
  */
-  __pyx_v_info->itemsize = __pyx_v_self->itemsize;
+  __pyx_t_5 = __pyx_v_self->itemsize;
+  __pyx_v_info->itemsize = __pyx_t_5;
 
   /* "View.MemoryView":198
  *         info.suboffsets = NULL
@@ -5357,8 +5489,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *             info.format = self.format
  *         else:
  */
-  __pyx_t_3 = (__pyx_v_flags & PyBUF_FORMAT);
-  if (__pyx_t_3) {
+  __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
+  if (__pyx_t_1) {
 
     /* "View.MemoryView":201
  * 
@@ -5367,7 +5499,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         else:
  *             info.format = NULL
  */
-    __pyx_v_info->format = __pyx_v_self->format;
+    __pyx_t_4 = __pyx_v_self->format;
+    __pyx_v_info->format = __pyx_t_4;
     goto __pyx_L5;
   }
   /*else*/ {
@@ -5399,7 +5532,7 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
   __pyx_r = 0;
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_2);
+  __Pyx_XDECREF(__pyx_t_3);
   __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) {
@@ -5446,7 +5579,7 @@ static void __pyx_array_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *_
  *             self.callback_free_data(self.data)
  *         elif self.free_data:
  */
-  __pyx_t_1 = (__pyx_v_self->callback_free_data != NULL);
+  __pyx_t_1 = ((__pyx_v_self->callback_free_data != NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":211
@@ -5467,7 +5600,8 @@ static void __pyx_array_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *_
  *             if self.dtype_is_object:
  *                 refcount_objects_in_slice(self.data, self._shape,
  */
-  if (__pyx_v_self->free_data) {
+  __pyx_t_1 = (__pyx_v_self->free_data != 0);
+  if (__pyx_t_1) {
 
     /* "View.MemoryView":213
  *             self.callback_free_data(self.data)
@@ -5476,7 +5610,8 @@ static void __pyx_array_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *_
  *                 refcount_objects_in_slice(self.data, self._shape,
  *                                           self._strides, self.ndim, False)
  */
-    if (__pyx_v_self->dtype_is_object) {
+    __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
+    if (__pyx_t_1) {
 
       /* "View.MemoryView":215
  *             if self.dtype_is_object:
@@ -5644,9 +5779,9 @@ static PyObject *__pyx_array_MemoryView_5array_6__getattr__(struct __pyx_array_o
  *     def __getitem__(self, item):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __pyx_r = __pyx_t_2;
@@ -5703,7 +5838,7 @@ static PyObject *__pyx_array_MemoryView_5array_8__getitem__(struct __pyx_array_o
  *     def __setitem__(self, item, value):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (!__pyx_t_2) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
@@ -5760,7 +5895,7 @@ static int __pyx_array_MemoryView_5array_10__setitem__(struct __pyx_array_obj *_
  * 
  * 
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   if (PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -5805,7 +5940,7 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize
  *         result = array(shape, itemsize, format, mode.decode('ASCII'))
  *     else:
  */
-  __pyx_t_1 = (__pyx_v_buf == NULL);
+  __pyx_t_1 = ((__pyx_v_buf == NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":245
@@ -5817,7 +5952,7 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize
  */
     __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_3 = PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_3));
     __pyx_t_4 = ((PyObject *)__Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_4));
@@ -5853,7 +5988,7 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize
  */
     __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_5 = PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_5));
     __pyx_t_3 = ((PyObject *)__Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_3));
@@ -5935,6 +6070,9 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize
 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_name = 0;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
@@ -6091,7 +6229,7 @@ static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment)
  *         aligned_p += alignment - offset
  * 
  */
-  __pyx_t_1 = (__pyx_v_offset > 0);
+  __pyx_t_1 = ((__pyx_v_offset > 0) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":303
@@ -6127,6 +6265,9 @@ static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_ar
   PyObject *__pyx_v_obj = 0;
   int __pyx_v_flags;
   int __pyx_v_dtype_is_object;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
@@ -6244,11 +6385,11 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor
  *             if <PyObject *> self.view.obj == NULL:
  */
   __pyx_t_1 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)((PyObject *)__pyx_memoryview_type)));
-  if (!__pyx_t_1) {
+  if (!(__pyx_t_1 != 0)) {
     __pyx_t_2 = (__pyx_v_obj != Py_None);
-    __pyx_t_3 = __pyx_t_2;
+    __pyx_t_3 = (__pyx_t_2 != 0);
   } else {
-    __pyx_t_3 = __pyx_t_1;
+    __pyx_t_3 = (__pyx_t_1 != 0);
   }
   if (__pyx_t_3) {
 
@@ -6268,7 +6409,7 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor
  *                 (<__pyx_buffer *> &self.view).obj = Py_None
  *                 Py_INCREF(Py_None)
  */
-    __pyx_t_3 = (((PyObject *)__pyx_v_self->view.obj) == NULL);
+    __pyx_t_3 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0);
     if (__pyx_t_3) {
 
       /* "View.MemoryView":329
@@ -6311,7 +6452,7 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor
  *             raise MemoryError
  * 
  */
-  __pyx_t_3 = (__pyx_v_self->lock == NULL);
+  __pyx_t_3 = ((__pyx_v_self->lock == NULL) != 0);
   if (__pyx_t_3) {
 
     /* "View.MemoryView":334
@@ -6333,8 +6474,8 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor
  *             self.dtype_is_object = self.view.format == b'O'
  *         else:
  */
-  __pyx_t_4 = (__pyx_v_flags & PyBUF_FORMAT);
-  if (__pyx_t_4) {
+  __pyx_t_3 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
+  if (__pyx_t_3) {
 
     /* "View.MemoryView":337
  * 
@@ -6343,7 +6484,7 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor
  *         else:
  *             self.dtype_is_object = dtype_is_object
  */
-    __pyx_t_5 = PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_5));
     __pyx_t_6 = PyObject_RichCompare(((PyObject *)__pyx_t_5), ((PyObject *)__pyx_n_b__O), Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
@@ -6415,6 +6556,7 @@ static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) {
 static void __pyx_memoryview_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) {
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
+  int __pyx_t_2;
   __Pyx_RefNannySetupContext("__dealloc__", 0);
 
   /* "View.MemoryView":346
@@ -6425,7 +6567,8 @@ static void __pyx_memoryview_MemoryView_10memoryview_2__dealloc__(struct __pyx_m
  * 
  */
   __pyx_t_1 = (__pyx_v_self->obj != Py_None);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":347
  *     def __dealloc__(memoryview self):
@@ -6446,8 +6589,8 @@ static void __pyx_memoryview_MemoryView_10memoryview_2__dealloc__(struct __pyx_m
  *             PyThread_free_lock(self.lock)
  * 
  */
-  __pyx_t_1 = (__pyx_v_self->lock != NULL);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((__pyx_v_self->lock != NULL) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":350
  * 
@@ -6541,8 +6684,7 @@ static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__py
       }
       __Pyx_GOTREF(__pyx_t_5);
     }
-    __Pyx_XDECREF(__pyx_v_idx);
-    __pyx_v_idx = __pyx_t_5;
+    __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5);
     __pyx_t_5 = 0;
     __pyx_v_dim = __pyx_t_1;
     __pyx_t_1 = (__pyx_t_1 + 1);
@@ -6609,12 +6751,13 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
-  PyObject *__pyx_t_2 = NULL;
+  int __pyx_t_2;
   PyObject *__pyx_t_3 = NULL;
   PyObject *__pyx_t_4 = NULL;
   PyObject *__pyx_t_5 = NULL;
-  PyObject *(*__pyx_t_6)(PyObject *);
-  char *__pyx_t_7;
+  PyObject *__pyx_t_6 = NULL;
+  PyObject *(*__pyx_t_7)(PyObject *);
+  char *__pyx_t_8;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -6628,7 +6771,8 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  * 
  */
   __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":364
  *     def __getitem__(memoryview self, object index):
@@ -6652,10 +6796,10 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  * 
  *         cdef char *itemp
  */
-  __pyx_t_2 = ((PyObject *)_unellipsify(__pyx_v_index, __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  if (likely(PyTuple_CheckExact(__pyx_t_2))) {
-    PyObject* sequence = __pyx_t_2;
+  __pyx_t_3 = ((PyObject *)_unellipsify(__pyx_v_index, __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  if (likely(PyTuple_CheckExact(__pyx_t_3))) {
+    PyObject* sequence = __pyx_t_3;
     #if CYTHON_COMPILING_IN_CPYTHON
     Py_ssize_t size = Py_SIZE(sequence);
     #else
@@ -6667,43 +6811,45 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
       {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     #if CYTHON_COMPILING_IN_CPYTHON
-    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
-    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
-    __Pyx_INCREF(__pyx_t_3);
+    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
+    __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
     __Pyx_INCREF(__pyx_t_4);
+    __Pyx_INCREF(__pyx_t_5);
     #else
-    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
     #endif
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   } else if (1) {
     __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   } else
   {
     Py_ssize_t index = -1;
-    __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
-    index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L4_unpacking_failed;
-    __Pyx_GOTREF(__pyx_t_3);
-    index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed;
+    __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
+    index = 0; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed;
     __Pyx_GOTREF(__pyx_t_4);
-    if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_6 = NULL;
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L4_unpacking_failed;
+    __Pyx_GOTREF(__pyx_t_5);
+    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = NULL;
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
     goto __pyx_L5_unpacking_done;
     __pyx_L4_unpacking_failed:;
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_6 = NULL;
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __pyx_t_7 = NULL;
     if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_L5_unpacking_done:;
   }
-  __pyx_v_have_slices = __pyx_t_3;
-  __pyx_t_3 = 0;
-  __pyx_v_indices = __pyx_t_4;
+  __pyx_v_have_slices = __pyx_t_4;
   __pyx_t_4 = 0;
+  __pyx_v_indices = __pyx_t_5;
+  __pyx_t_5 = 0;
 
   /* "View.MemoryView":369
  * 
@@ -6712,8 +6858,8 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  *             return memview_slice(self, indices)
  *         else:
  */
-  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__pyx_t_1) {
+  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":370
  *         cdef char *itemp
@@ -6723,10 +6869,10 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  *             itemp = self.get_item_pointer(indices)
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_2 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_r = __pyx_t_2;
-    __pyx_t_2 = 0;
+    __pyx_t_3 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_r = __pyx_t_3;
+    __pyx_t_3 = 0;
     goto __pyx_L0;
     goto __pyx_L6;
   }
@@ -6739,8 +6885,8 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  *             return self.convert_item_to_object(itemp)
  * 
  */
-    __pyx_t_7 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_v_itemp = __pyx_t_7;
+    __pyx_t_8 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_8 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_v_itemp = __pyx_t_8;
 
     /* "View.MemoryView":373
  *         else:
@@ -6750,10 +6896,10 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  *     def __setitem__(memoryview self, object index, object value):
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_r = __pyx_t_2;
-    __pyx_t_2 = 0;
+    __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_r = __pyx_t_3;
+    __pyx_t_3 = 0;
     goto __pyx_L0;
   }
   __pyx_L6:;
@@ -6761,10 +6907,10 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_5);
+  __Pyx_XDECREF(__pyx_t_6);
   __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
@@ -6839,7 +6985,9 @@ static int __pyx_memoryview_MemoryView_10memoryview_6__setitem__(struct __pyx_me
     __Pyx_INCREF(__pyx_t_3);
     #else
     __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
     __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
     #endif
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   } else if (1) {
@@ -6868,8 +7016,7 @@ static int __pyx_memoryview_MemoryView_10memoryview_6__setitem__(struct __pyx_me
   }
   __pyx_v_have_slices = __pyx_t_2;
   __pyx_t_2 = 0;
-  __Pyx_DECREF(__pyx_v_index);
-  __pyx_v_index = __pyx_t_3;
+  __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_3);
   __pyx_t_3 = 0;
 
   /* "View.MemoryView":378
@@ -6982,9 +7129,9 @@ static int __pyx_memoryview_MemoryView_10memoryview_6__setitem__(struct __pyx_me
 static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
+  int __pyx_t_1;
   int __pyx_t_2;
-  int __pyx_t_3;
+  PyObject *__pyx_t_3 = NULL;
   PyObject *__pyx_t_4 = NULL;
   PyObject *__pyx_t_5 = NULL;
   PyObject *__pyx_t_6 = NULL;
@@ -7004,12 +7151,9 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
  *             try:
  *                 obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS,
  */
-  __pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryview_type));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = (!__pyx_t_2);
-  if (__pyx_t_3) {
+  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, ((PyObject *)__pyx_memoryview_type)); 
+  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":389
  *     cdef is_slice(self, obj):
@@ -7019,10 +7163,10 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
  *                                  self.dtype_is_object)
  */
     {
-      __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
+      __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
+      __Pyx_XGOTREF(__pyx_t_3);
       __Pyx_XGOTREF(__pyx_t_4);
       __Pyx_XGOTREF(__pyx_t_5);
-      __Pyx_XGOTREF(__pyx_t_6);
       /*try:*/ {
 
         /* "View.MemoryView":390
@@ -7032,8 +7176,8 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
  *                                  self.dtype_is_object)
  *             except TypeError:
  */
-        __pyx_t_1 = PyInt_FromLong((__pyx_v_self->flags | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
-        __Pyx_GOTREF(__pyx_t_1);
+        __pyx_t_6 = PyInt_FromLong((__pyx_v_self->flags | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+        __Pyx_GOTREF(__pyx_t_6);
 
         /* "View.MemoryView":391
  *             try:
@@ -7049,25 +7193,24 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
         __Pyx_INCREF(__pyx_v_obj);
         PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj);
         __Pyx_GIVEREF(__pyx_v_obj);
-        PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_1);
-        __Pyx_GIVEREF(__pyx_t_1);
+        PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
+        __Pyx_GIVEREF(__pyx_t_6);
         PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
         __Pyx_GIVEREF(__pyx_t_7);
-        __pyx_t_1 = 0;
+        __pyx_t_6 = 0;
         __pyx_t_7 = 0;
         __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject *)__pyx_memoryview_type)), ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
         __Pyx_GOTREF(__pyx_t_7);
         __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
-        __Pyx_DECREF(__pyx_v_obj);
-        __pyx_v_obj = __pyx_t_7;
+        __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7);
         __pyx_t_7 = 0;
       }
+      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
       goto __pyx_L11_try_end;
       __pyx_L4_error:;
-      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
       __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
 
@@ -7081,10 +7224,10 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
       __pyx_t_9 = PyErr_ExceptionMatches(__pyx_builtin_TypeError);
       if (__pyx_t_9) {
         __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
-        if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
+        if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
         __Pyx_GOTREF(__pyx_t_7);
         __Pyx_GOTREF(__pyx_t_8);
-        __Pyx_GOTREF(__pyx_t_1);
+        __Pyx_GOTREF(__pyx_t_6);
 
         /* "View.MemoryView":393
  *                                  self.dtype_is_object)
@@ -7096,32 +7239,32 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
         __Pyx_XDECREF(__pyx_r);
         __Pyx_INCREF(Py_None);
         __pyx_r = Py_None;
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
         goto __pyx_L7_except_return;
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
         goto __pyx_L5_exception_handled;
       }
       __pyx_L6_except_error:;
+      __Pyx_XGIVEREF(__pyx_t_3);
       __Pyx_XGIVEREF(__pyx_t_4);
       __Pyx_XGIVEREF(__pyx_t_5);
-      __Pyx_XGIVEREF(__pyx_t_6);
-      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
+      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
       goto __pyx_L1_error;
       __pyx_L7_except_return:;
+      __Pyx_XGIVEREF(__pyx_t_3);
       __Pyx_XGIVEREF(__pyx_t_4);
       __Pyx_XGIVEREF(__pyx_t_5);
-      __Pyx_XGIVEREF(__pyx_t_6);
-      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
+      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
       goto __pyx_L0;
       __pyx_L5_exception_handled:;
+      __Pyx_XGIVEREF(__pyx_t_3);
       __Pyx_XGIVEREF(__pyx_t_4);
       __Pyx_XGIVEREF(__pyx_t_5);
-      __Pyx_XGIVEREF(__pyx_t_6);
-      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
+      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
       __pyx_L11_try_end:;
     }
     goto __pyx_L3;
@@ -7143,7 +7286,7 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_XDECREF(__pyx_t_6);
   __Pyx_XDECREF(__pyx_t_7);
   __Pyx_XDECREF(__pyx_t_8);
   __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -7169,11 +7312,9 @@ static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryvi
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
-  PyObject *__pyx_t_2 = NULL;
-  PyObject *__pyx_t_3 = NULL;
+  int __pyx_t_2;
+  int __pyx_t_3;
   int __pyx_t_4;
-  int __pyx_t_5;
-  int __pyx_t_6;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -7187,8 +7328,6 @@ static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryvi
  *                                  src.ndim, dst.ndim, self.dtype_is_object)
  */
   if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_1 = __pyx_v_src;
-  __Pyx_INCREF(__pyx_t_1);
 
   /* "View.MemoryView":402
  * 
@@ -7198,8 +7337,6 @@ static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryvi
  * 
  */
   if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_2 = __pyx_v_dst;
-  __Pyx_INCREF(__pyx_t_2);
 
   /* "View.MemoryView":403
  *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
@@ -7208,24 +7345,20 @@ static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryvi
  * 
  *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):
  */
-  __pyx_t_3 = PyObject_GetAttr(__pyx_v_src, __pyx_n_s__ndim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = PyObject_GetAttr(__pyx_v_dst, __pyx_n_s__ndim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_6 = __pyx_memoryview_copy_contents((__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_t_1), (&__pyx_v_src_slice))[0]), (__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_t_2), (&__pyx_v_dst_slice))[0]), __pyx_t_4, __pyx_t_5, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s__ndim); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __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_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s__ndim); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_4 = __pyx_memoryview_copy_contents((__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice))[0]), (__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice))[0]), __pyx_t_2, __pyx_t_3, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_XDECREF(__pyx_t_3);
   __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
@@ -7287,7 +7420,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor
  *             tmp = malloc(self.view.itemsize)
  *             if tmp == NULL:
  */
-  __pyx_t_1 = (((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array)));
+  __pyx_t_1 = ((((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":414
@@ -7306,7 +7439,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor
  *                 raise MemoryError
  *             item = tmp
  */
-    __pyx_t_1 = (__pyx_v_tmp == NULL);
+    __pyx_t_1 = ((__pyx_v_tmp == NULL) != 0);
     if (__pyx_t_1) {
 
       /* "View.MemoryView":416
@@ -7351,7 +7484,8 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor
  *             (<PyObject **> item)[0] = <PyObject *> value
  *         else:
  */
-  if (__pyx_v_self->dtype_is_object) {
+  __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
+  if (__pyx_t_1) {
 
     /* "View.MemoryView":422
  * 
@@ -7461,7 +7595,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor
  *             assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
  *         slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
  */
-  __pyx_t_1 = (__pyx_v_self->view.suboffsets != NULL);
+  __pyx_t_1 = ((__pyx_v_self->view.suboffsets != NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":433
@@ -7610,9 +7744,9 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview
  *         try:
  *             result = struct.unpack(self.view.format, bytesitem)
  */
-  __pyx_t_1 = PyBytes_FromStringAndSize(((const char*)__pyx_v_itemp) + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  __pyx_v_bytesitem = __pyx_t_1;
+  __pyx_v_bytesitem = ((PyObject*)__pyx_t_1);
   __pyx_t_1 = 0;
 
   /* "View.MemoryView":449
@@ -7636,9 +7770,9 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview
  *         except struct.error:
  *             raise ValueError("Unable to convert item to object")
  */
-      __pyx_t_1 = PyObject_GetAttr(__pyx_v_struct, __pyx_n_s__unpack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s__unpack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_5 = PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_5));
       __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       __Pyx_GOTREF(__pyx_t_6);
@@ -7665,7 +7799,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview
  *             return result
  */
       __pyx_t_7 = strlen(__pyx_v_self->view.format); 
-      __pyx_t_8 = (__pyx_t_7 == 1);
+      __pyx_t_8 = ((__pyx_t_7 == 1) != 0);
       if (__pyx_t_8) {
 
         /* "View.MemoryView":455
@@ -7676,7 +7810,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview
  * 
  */
         __Pyx_XDECREF(__pyx_r);
-        __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_result, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
+        __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_result, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_5) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
         __Pyx_GOTREF(__pyx_t_5);
         __pyx_r = __pyx_t_5;
         __pyx_t_5 = 0;
@@ -7713,7 +7847,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview
  *             raise ValueError("Unable to convert item to object")
  *         else:
  */
-    __pyx_t_5 = PyObject_GetAttr(__pyx_v_struct, __pyx_n_s__error); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
+    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s__error); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __pyx_t_9 = PyErr_ExceptionMatches(__pyx_t_5);
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
@@ -7796,15 +7930,16 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
   int __pyx_t_2;
-  PyObject *__pyx_t_3 = NULL;
+  int __pyx_t_3;
   PyObject *__pyx_t_4 = NULL;
   PyObject *__pyx_t_5 = NULL;
-  Py_ssize_t __pyx_t_6;
-  PyObject *__pyx_t_7 = NULL;
-  char *__pyx_t_8;
+  PyObject *__pyx_t_6 = NULL;
+  Py_ssize_t __pyx_t_7;
+  PyObject *__pyx_t_8 = NULL;
   char *__pyx_t_9;
   char *__pyx_t_10;
   char *__pyx_t_11;
+  char *__pyx_t_12;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -7829,11 +7964,9 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  *             bytesvalue = struct.pack(self.view.format, *value)
  *         else:
  */
-  __pyx_t_1 = ((PyObject *)((PyObject*)(&PyTuple_Type)));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_value, __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (__pyx_t_2) {
+  __pyx_t_2 = PyTuple_Check(__pyx_v_value); 
+  __pyx_t_3 = (__pyx_t_2 != 0);
+  if (__pyx_t_3) {
 
     /* "View.MemoryView":467
  * 
@@ -7842,28 +7975,28 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  *         else:
  *             bytesvalue = struct.pack(self.view.format, value)
  */
-    __pyx_t_1 = PyObject_GetAttr(__pyx_v_struct, __pyx_n_s__pack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s__pack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_3 = PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
-    __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
-    __pyx_t_3 = 0;
-    __pyx_t_3 = PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-    __pyx_t_5 = PyNumber_Add(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+    __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4));
+    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
+    __pyx_t_4 = 0;
+    __pyx_t_4 = PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+    __pyx_t_6 = PyNumber_Add(((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
+    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-    __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
-    if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_v_bytesvalue = ((PyObject*)__pyx_t_3);
-    __pyx_t_3 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+    if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_4)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
+    __pyx_t_4 = 0;
     goto __pyx_L3;
   }
   /*else*/ {
@@ -7875,25 +8008,25 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  * 
  *         for i, c in enumerate(bytesvalue):
  */
-    __pyx_t_3 = PyObject_GetAttr(__pyx_v_struct, __pyx_n_s__pack); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_5 = PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s__pack); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
     __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_5));
-    __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
+    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_6));
+    __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
     __Pyx_INCREF(__pyx_v_value);
     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_value);
     __Pyx_GIVEREF(__pyx_v_value);
-    __pyx_t_5 = 0;
-    __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __pyx_t_6 = 0;
+    __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-    if (!(likely(PyBytes_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_5)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_v_bytesvalue = ((PyObject*)__pyx_t_5);
-    __pyx_t_5 = 0;
+    if (!(likely(PyBytes_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_6)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_v_bytesvalue = ((PyObject*)__pyx_t_6);
+    __pyx_t_6 = 0;
   }
   __pyx_L3:;
 
@@ -7904,18 +8037,18 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  *             itemp[i] = c
  * 
  */
-  __pyx_t_6 = 0;
+  __pyx_t_7 = 0;
   if (unlikely(((PyObject *)__pyx_v_bytesvalue) == Py_None)) {
     PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   __Pyx_INCREF(((PyObject *)__pyx_v_bytesvalue));
-  __pyx_t_7 = __pyx_v_bytesvalue;
-  __pyx_t_9 = PyBytes_AS_STRING(__pyx_t_7);
-  __pyx_t_10 = (__pyx_t_9 + PyBytes_GET_SIZE(__pyx_t_7));
-  for (__pyx_t_11 = __pyx_t_9; __pyx_t_11 < __pyx_t_10; __pyx_t_11++) {
-    __pyx_t_8 = __pyx_t_11;
-    __pyx_v_c = (__pyx_t_8[0]);
+  __pyx_t_8 = __pyx_v_bytesvalue;
+  __pyx_t_10 = PyBytes_AS_STRING(__pyx_t_8);
+  __pyx_t_11 = (__pyx_t_10 + PyBytes_GET_SIZE(__pyx_t_8));
+  for (__pyx_t_12 = __pyx_t_10; __pyx_t_12 < __pyx_t_11; __pyx_t_12++) {
+    __pyx_t_9 = __pyx_t_12;
+    __pyx_v_c = (__pyx_t_9[0]);
 
     /* "View.MemoryView":472
  * 
@@ -7924,7 +8057,7 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  * 
  *     @cname('getbuffer')
  */
-    __pyx_v_i = __pyx_t_6;
+    __pyx_v_i = __pyx_t_7;
 
     /* "View.MemoryView":471
  *             bytesvalue = struct.pack(self.view.format, value)
@@ -7933,7 +8066,7 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  *             itemp[i] = c
  * 
  */
-    __pyx_t_6 = (__pyx_t_6 + 1);
+    __pyx_t_7 = (__pyx_t_7 + 1);
 
     /* "View.MemoryView":472
  * 
@@ -7944,16 +8077,16 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  */
     (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c;
   }
-  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_5);
-  __Pyx_XDECREF(((PyObject *)__pyx_t_7));
+  __Pyx_XDECREF(__pyx_t_6);
+  __Pyx_XDECREF(((PyObject *)__pyx_t_8));
   __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
@@ -7965,8 +8098,8 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
 }
 
 /* Python wrapper */
-static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
-static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
+static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
+static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
@@ -7987,6 +8120,11 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
+  Py_ssize_t *__pyx_t_2;
+  char *__pyx_t_3;
+  void *__pyx_t_4;
+  int __pyx_t_5;
+  Py_ssize_t __pyx_t_6;
   __Pyx_RefNannySetupContext("__getbuffer__", 0);
   if (__pyx_v_info != NULL) {
     __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
@@ -8000,7 +8138,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *             info.shape = self.view.shape
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_flags & PyBUF_STRIDES);
+  __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":477
@@ -8010,7 +8148,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         else:
  *             info.shape = NULL
  */
-    __pyx_v_info->shape = __pyx_v_self->view.shape;
+    __pyx_t_2 = __pyx_v_self->view.shape;
+    __pyx_v_info->shape = __pyx_t_2;
     goto __pyx_L3;
   }
   /*else*/ {
@@ -8033,7 +8172,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *             info.strides = self.view.strides
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_flags & PyBUF_STRIDES);
+  __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":482
@@ -8043,7 +8182,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         else:
  *             info.strides = NULL
  */
-    __pyx_v_info->strides = __pyx_v_self->view.strides;
+    __pyx_t_2 = __pyx_v_self->view.strides;
+    __pyx_v_info->strides = __pyx_t_2;
     goto __pyx_L4;
   }
   /*else*/ {
@@ -8066,7 +8206,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *             info.suboffsets = self.view.suboffsets
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_flags & PyBUF_INDIRECT);
+  __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":487
@@ -8076,7 +8216,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         else:
  *             info.suboffsets = NULL
  */
-    __pyx_v_info->suboffsets = __pyx_v_self->view.suboffsets;
+    __pyx_t_2 = __pyx_v_self->view.suboffsets;
+    __pyx_v_info->suboffsets = __pyx_t_2;
     goto __pyx_L5;
   }
   /*else*/ {
@@ -8099,7 +8240,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *             info.format = self.view.format
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_flags & PyBUF_FORMAT);
+  __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":492
@@ -8109,7 +8250,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         else:
  *             info.format = NULL
  */
-    __pyx_v_info->format = __pyx_v_self->view.format;
+    __pyx_t_3 = __pyx_v_self->view.format;
+    __pyx_v_info->format = __pyx_t_3;
     goto __pyx_L6;
   }
   /*else*/ {
@@ -8132,7 +8274,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         info.ndim = self.view.ndim
  *         info.itemsize = self.view.itemsize
  */
-  __pyx_v_info->buf = __pyx_v_self->view.buf;
+  __pyx_t_4 = __pyx_v_self->view.buf;
+  __pyx_v_info->buf = __pyx_t_4;
 
   /* "View.MemoryView":497
  * 
@@ -8141,7 +8284,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         info.itemsize = self.view.itemsize
  *         info.len = self.view.len
  */
-  __pyx_v_info->ndim = __pyx_v_self->view.ndim;
+  __pyx_t_5 = __pyx_v_self->view.ndim;
+  __pyx_v_info->ndim = __pyx_t_5;
 
   /* "View.MemoryView":498
  *         info.buf = self.view.buf
@@ -8150,7 +8294,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         info.len = self.view.len
  *         info.readonly = 0
  */
-  __pyx_v_info->itemsize = __pyx_v_self->view.itemsize;
+  __pyx_t_6 = __pyx_v_self->view.itemsize;
+  __pyx_v_info->itemsize = __pyx_t_6;
 
   /* "View.MemoryView":499
  *         info.ndim = self.view.ndim
@@ -8159,7 +8304,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         info.readonly = 0
  *         info.obj = self
  */
-  __pyx_v_info->len = __pyx_v_self->view.len;
+  __pyx_t_6 = __pyx_v_self->view.len;
+  __pyx_v_info->len = __pyx_t_6;
 
   /* "View.MemoryView":500
  *         info.itemsize = self.view.itemsize
@@ -8359,10 +8505,10 @@ static PyObject *__pyx_memoryview_get_shape_MemoryView_10memoryview_5shape___get
     __pyx_v_i = __pyx_t_3;
     __pyx_t_4 = PyInt_FromSsize_t((__pyx_v_self->view.shape[__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    if (unlikely(__Pyx_PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   }
-  __pyx_t_4 = ((PyObject *)PyList_AsTuple(__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = ((PyObject *)PyList_AsTuple(((PyObject*)__pyx_t_1))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_4));
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   __pyx_r = ((PyObject *)__pyx_t_4);
@@ -8422,7 +8568,7 @@ static PyObject *__pyx_memoryview_get_strides_MemoryView_10memoryview_7strides__
  * 
  *                 raise ValueError("Buffer view does not expose strides")
  */
-  __pyx_t_1 = (__pyx_v_self->view.strides == NULL);
+  __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":528
@@ -8456,10 +8602,10 @@ static PyObject *__pyx_memoryview_get_strides_MemoryView_10memoryview_7strides__
     __pyx_v_i = __pyx_t_4;
     __pyx_t_5 = PyInt_FromSsize_t((__pyx_v_self->view.strides[__pyx_v_i])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    if (unlikely(__Pyx_PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
   }
-  __pyx_t_5 = ((PyObject *)PyList_AsTuple(__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = ((PyObject *)PyList_AsTuple(((PyObject*)__pyx_t_2))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_5));
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __pyx_r = ((PyObject *)__pyx_t_5);
@@ -8519,7 +8665,7 @@ static PyObject *__pyx_memoryview_get_suboffsets_MemoryView_10memoryview_10subof
  *                 return [-1] * self.view.ndim
  * 
  */
-  __pyx_t_1 = (__pyx_v_self->view.suboffsets == NULL);
+  __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":536
@@ -8561,10 +8707,10 @@ static PyObject *__pyx_memoryview_get_suboffsets_MemoryView_10memoryview_10subof
     __pyx_v_i = __pyx_t_4;
     __pyx_t_5 = PyInt_FromSsize_t((__pyx_v_self->view.suboffsets[__pyx_v_i])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    if (unlikely(__Pyx_PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
   }
-  __pyx_t_5 = ((PyObject *)PyList_AsTuple(__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = ((PyObject *)PyList_AsTuple(((PyObject*)__pyx_t_2))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_5));
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __pyx_r = ((PyObject *)__pyx_t_5);
@@ -8730,7 +8876,7 @@ static PyObject *__pyx_memoryview_get_nbytes_MemoryView_10memoryview_6nbytes___g
  *     property size:
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
@@ -8781,10 +8927,11 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
-  PyObject *__pyx_t_2 = NULL;
+  int __pyx_t_2;
   PyObject *__pyx_t_3 = NULL;
-  Py_ssize_t __pyx_t_4;
-  PyObject *(*__pyx_t_5)(PyObject *);
+  PyObject *__pyx_t_4 = NULL;
+  Py_ssize_t __pyx_t_5;
+  PyObject *(*__pyx_t_6)(PyObject *);
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -8798,7 +8945,8 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__
  * 
  */
   __pyx_t_1 = (__pyx_v_self->_size == Py_None);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":559
  *         def __get__(self):
@@ -8817,46 +8965,45 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__
  *                     result *= length
  * 
  */
-    __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
-      __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
-      __pyx_t_5 = NULL;
+    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) {
+      __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
+      __pyx_t_6 = NULL;
     } else {
-      __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext;
+      __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_4);
+      __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext;
     }
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     for (;;) {
-      if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_3)) {
-        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
+      if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_4)) {
+        if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
         #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         #else
-        __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         #endif
-      } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_3)) {
-        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
+      } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_4)) {
+        if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
         #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         #else
-        __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         #endif
       } else {
-        __pyx_t_2 = __pyx_t_5(__pyx_t_3);
-        if (unlikely(!__pyx_t_2)) {
+        __pyx_t_3 = __pyx_t_6(__pyx_t_4);
+        if (unlikely(!__pyx_t_3)) {
           if (PyErr_Occurred()) {
             if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
             else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           }
           break;
         }
-        __Pyx_GOTREF(__pyx_t_2);
+        __Pyx_GOTREF(__pyx_t_3);
       }
-      __Pyx_XDECREF(__pyx_v_length);
-      __pyx_v_length = __pyx_t_2;
-      __pyx_t_2 = 0;
+      __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_3);
+      __pyx_t_3 = 0;
 
       /* "View.MemoryView":562
  * 
@@ -8865,13 +9012,12 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__
  * 
  *                 self._size = result
  */
-      __pyx_t_2 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(__pyx_v_result);
-      __pyx_v_result = __pyx_t_2;
-      __pyx_t_2 = 0;
+      __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_3);
+      __pyx_t_3 = 0;
     }
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
     /* "View.MemoryView":564
  *                     result *= length
@@ -8904,8 +9050,8 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
+  __Pyx_XDECREF(__pyx_t_4);
   __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
@@ -8948,7 +9094,7 @@ static Py_ssize_t __pyx_memoryview_MemoryView_10memoryview_10__len__(struct __py
  *             return self.view.shape[0]
  * 
  */
-  __pyx_t_1 = (__pyx_v_self->view.ndim >= 1);
+  __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":570
@@ -9018,12 +9164,12 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_12__repr__(struct __py
  * 
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__base); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__base); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____name__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s____name__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
@@ -9108,12 +9254,12 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_14__str__(struct __pyx
  * 
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__base); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__base); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____name__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s____name__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -9529,30 +9675,26 @@ static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, in
 /* "View.MemoryView":624
  * 
  * @cname('__pyx_memoryview_check')
- * cdef bint memoryview_check(object o):             # <<<<<<<<<<<<<<
+ * cdef inline bint memoryview_check(object o):             # <<<<<<<<<<<<<<
  *     return isinstance(o, memoryview)
  * 
  */
 
-static int __pyx_memoryview_check(PyObject *__pyx_v_o) {
+static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
-  int __pyx_t_2;
+  int __pyx_t_1;
   __Pyx_RefNannySetupContext("memoryview_check", 0);
 
   /* "View.MemoryView":625
  * @cname('__pyx_memoryview_check')
- * cdef bint memoryview_check(object o):
+ * cdef inline bint memoryview_check(object o):
  *     return isinstance(o, memoryview)             # <<<<<<<<<<<<<<
  * 
  * cdef tuple _unellipsify(object index, int ndim):
  */
-  __pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryview_type));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_o, __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_r = __pyx_t_2;
+  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, ((PyObject *)__pyx_memoryview_type)); 
+  __pyx_r = __pyx_t_1;
   goto __pyx_L0;
 
   __pyx_r = 0;
@@ -9579,9 +9721,9 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
   PyObject *__pyx_v_nslices = NULL;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
+  int __pyx_t_1;
   int __pyx_t_2;
-  int __pyx_t_3;
+  PyObject *__pyx_t_3 = NULL;
   PyObject *__pyx_t_4 = NULL;
   Py_ssize_t __pyx_t_5;
   PyObject *(*__pyx_t_6)(PyObject *);
@@ -9603,12 +9745,9 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *         tup = (index,)
  *     else:
  */
-  __pyx_t_1 = ((PyObject *)((PyObject*)(&PyTuple_Type)));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_index, __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = (!__pyx_t_2);
-  if (__pyx_t_3) {
+  __pyx_t_1 = PyTuple_Check(__pyx_v_index); 
+  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":633
  *     """
@@ -9617,13 +9756,13 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *     else:
  *         tup = index
  */
-    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
     __Pyx_INCREF(__pyx_v_index);
-    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_index);
+    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index);
     __Pyx_GIVEREF(__pyx_v_index);
-    __pyx_v_tup = ((PyObject *)__pyx_t_1);
-    __pyx_t_1 = 0;
+    __pyx_v_tup = ((PyObject *)__pyx_t_3);
+    __pyx_t_3 = 0;
     goto __pyx_L3;
   }
   /*else*/ {
@@ -9647,10 +9786,10 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *     have_slices = False
  *     seen_ellipsis = False
  */
-  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_v_result = __pyx_t_1;
-  __pyx_t_1 = 0;
+  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_v_result = ((PyObject*)__pyx_t_3);
+  __pyx_t_3 = 0;
 
   /* "View.MemoryView":638
  * 
@@ -9659,10 +9798,10 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *     seen_ellipsis = False
  *     for idx, item in enumerate(tup):
  */
-  __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_v_have_slices = __pyx_t_1;
-  __pyx_t_1 = 0;
+  __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_v_have_slices = __pyx_t_3;
+  __pyx_t_3 = 0;
 
   /* "View.MemoryView":639
  *     result = []
@@ -9681,7 +9820,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *             if not seen_ellipsis:
  */
   __Pyx_INCREF(__pyx_int_0);
-  __pyx_t_1 = __pyx_int_0;
+  __pyx_t_3 = __pyx_int_0;
   if (PyList_CheckExact(__pyx_v_tup) || PyTuple_CheckExact(__pyx_v_tup)) {
     __pyx_t_4 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
     __pyx_t_6 = NULL;
@@ -9716,16 +9855,14 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
       }
       __Pyx_GOTREF(__pyx_t_7);
     }
-    __Pyx_XDECREF(__pyx_v_item);
-    __pyx_v_item = __pyx_t_7;
+    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7);
     __pyx_t_7 = 0;
-    __Pyx_INCREF(__pyx_t_1);
-    __Pyx_XDECREF(__pyx_v_idx);
-    __pyx_v_idx = __pyx_t_1;
-    __pyx_t_7 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_INCREF(__pyx_t_3);
+    __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3);
+    __pyx_t_7 = PyNumber_Add(__pyx_t_3, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
-    __Pyx_DECREF(__pyx_t_1);
-    __pyx_t_1 = __pyx_t_7;
+    __Pyx_DECREF(__pyx_t_3);
+    __pyx_t_3 = __pyx_t_7;
     __pyx_t_7 = 0;
 
     /* "View.MemoryView":641
@@ -9735,8 +9872,9 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *             if not seen_ellipsis:
  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
  */
-    __pyx_t_3 = (__pyx_v_item == __pyx_builtin_Ellipsis);
-    if (__pyx_t_3) {
+    __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis);
+    __pyx_t_1 = (__pyx_t_2 != 0);
+    if (__pyx_t_1) {
 
       /* "View.MemoryView":642
  *     for idx, item in enumerate(tup):
@@ -9745,8 +9883,8 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
  *                 seen_ellipsis = True
  */
-      __pyx_t_3 = (!__pyx_v_seen_ellipsis);
-      if (__pyx_t_3) {
+      __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0);
+      if (__pyx_t_1) {
 
         /* "View.MemoryView":643
  *         if item is Ellipsis:
@@ -9755,7 +9893,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *                 seen_ellipsis = True
  *             else:
  */
-        __pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_v_result), __pyx_n_s__extend); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_result), __pyx_n_s__extend); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_7);
         __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_33), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_8);
@@ -9802,7 +9940,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  */
         __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_34), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_10);
-        __pyx_t_11 = PyList_Append(__pyx_v_result, __pyx_t_10); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_10); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
       }
       __pyx_L7:;
@@ -9816,8 +9954,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  */
       __pyx_t_10 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_10);
-      __Pyx_DECREF(__pyx_v_have_slices);
-      __pyx_v_have_slices = __pyx_t_10;
+      __Pyx_DECREF_SET(__pyx_v_have_slices, __pyx_t_10);
       __pyx_t_10 = 0;
       goto __pyx_L6;
     }
@@ -9830,14 +9967,11 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *                 raise TypeError("Cannot index with type '%s'" % type(item))
  * 
  */
-      __pyx_t_10 = ((PyObject *)((PyObject*)(&PySlice_Type)));
-      __Pyx_INCREF(__pyx_t_10);
-      __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_item, __pyx_t_10); 
-      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-      __pyx_t_2 = (!__pyx_t_3);
+      __pyx_t_1 = PySlice_Check(__pyx_v_item); 
+      __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
       if (__pyx_t_2) {
-        __pyx_t_3 = (!PyIndex_Check(__pyx_v_item));
-        __pyx_t_12 = __pyx_t_3;
+        __pyx_t_1 = ((!(__Pyx_PyIndex_Check(__pyx_v_item) != 0)) != 0);
+        __pyx_t_12 = __pyx_t_1;
       } else {
         __pyx_t_12 = __pyx_t_2;
       }
@@ -9876,10 +10010,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  */
       __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       if (!__pyx_t_12) {
-        __pyx_t_10 = ((PyObject *)((PyObject*)(&PySlice_Type)));
-        __Pyx_INCREF(__pyx_t_10);
-        __pyx_t_12 = __Pyx_TypeCheck(__pyx_v_item, __pyx_t_10); 
-        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+        __pyx_t_12 = PySlice_Check(__pyx_v_item); 
         __pyx_t_10 = __Pyx_PyBool_FromLong(__pyx_t_12); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_10);
         __pyx_t_8 = __pyx_t_10;
@@ -9888,8 +10019,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
         __Pyx_INCREF(__pyx_v_have_slices);
         __pyx_t_8 = __pyx_v_have_slices;
       }
-      __Pyx_DECREF(__pyx_v_have_slices);
-      __pyx_v_have_slices = __pyx_t_8;
+      __Pyx_DECREF_SET(__pyx_v_have_slices, __pyx_t_8);
       __pyx_t_8 = 0;
 
       /* "View.MemoryView":653
@@ -9899,12 +10029,12 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  * 
  *     nslices = ndim - len(result)
  */
-      __pyx_t_11 = PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     __pyx_L6:;
   }
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
   /* "View.MemoryView":655
  *             result.append(item)
@@ -9914,10 +10044,10 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *         result.extend([slice(None)] * nslices)
  */
   __pyx_t_5 = PyList_GET_SIZE(((PyObject *)__pyx_v_result)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_1 = PyInt_FromSsize_t((__pyx_v_ndim - __pyx_t_5)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_v_nslices = __pyx_t_1;
-  __pyx_t_1 = 0;
+  __pyx_t_3 = PyInt_FromSsize_t((__pyx_v_ndim - __pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_v_nslices = __pyx_t_3;
+  __pyx_t_3 = 0;
 
   /* "View.MemoryView":656
  * 
@@ -9936,8 +10066,8 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  * 
  *     return have_slices or nslices, tuple(result)
  */
-    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_result), __pyx_n_s__extend); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_result), __pyx_n_s__extend); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
     __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_36), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -9955,9 +10085,9 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
     PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
     __pyx_t_8 = 0;
-    __pyx_t_8 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_8 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_8);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
     goto __pyx_L9;
@@ -9982,22 +10112,22 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
   }
   __pyx_t_4 = ((PyObject *)PyList_AsTuple(__pyx_v_result)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8);
+  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_8);
   __Pyx_GIVEREF(__pyx_t_8);
-  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_t_4));
+  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_t_4));
   __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
   __pyx_t_8 = 0;
   __pyx_t_4 = 0;
-  __pyx_r = __pyx_t_1;
-  __pyx_t_1 = 0;
+  __pyx_r = ((PyObject*)__pyx_t_3);
+  __pyx_t_3 = 0;
   goto __pyx_L0;
 
   __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_7);
   __Pyx_XDECREF(__pyx_t_8);
@@ -10055,7 +10185,7 @@ static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __
  *             raise ValueError("Indirect dimensions not supported")
  * 
  */
-    __pyx_t_3 = ((__pyx_v_suboffsets[__pyx_v_i]) >= 0);
+    __pyx_t_3 = (((__pyx_v_suboffsets[__pyx_v_i]) >= 0) != 0);
     if (__pyx_t_3) {
 
       /* "View.MemoryView":665
@@ -10114,15 +10244,18 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
   PyObject *__pyx_v_index = NULL;
   struct __pyx_memoryview_obj *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
+  int __pyx_t_1;
   int __pyx_t_2;
-  int __pyx_t_3;
-  Py_ssize_t __pyx_t_4;
-  PyObject *(*__pyx_t_5)(PyObject *);
+  struct __pyx_memoryview_obj *__pyx_t_3;
+  char *__pyx_t_4;
+  int __pyx_t_5;
   PyObject *__pyx_t_6 = NULL;
-  int __pyx_t_7;
-  Py_ssize_t __pyx_t_8;
+  Py_ssize_t __pyx_t_7;
+  PyObject *(*__pyx_t_8)(PyObject *);
   PyObject *__pyx_t_9 = NULL;
+  Py_ssize_t __pyx_t_10;
+  int __pyx_t_11;
+  PyObject *__pyx_t_12 = NULL;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -10155,7 +10288,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *     if isinstance(memview, _memoryviewslice):
  */
   #ifndef CYTHON_WITHOUT_ASSERTIONS
-  if (unlikely(!(__pyx_v_memview->view.ndim > 0))) {
+  if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) {
     PyErr_SetNone(PyExc_AssertionError);
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
@@ -10168,10 +10301,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *         memviewsliceobj = memview
  *         p_src = &memviewsliceobj.from_slice
  */
-  __pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryviewslice_type));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), ((PyObject *)__pyx_memoryviewslice_type)); 
+  __pyx_t_2 = (__pyx_t_1 != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":687
@@ -10224,7 +10355,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *     dst.data = p_src.data
  * 
  */
-  __pyx_v_dst.memview = __pyx_v_p_src->memview;
+  __pyx_t_3 = __pyx_v_p_src->memview;
+  __pyx_v_dst.memview = __pyx_t_3;
 
   /* "View.MemoryView":698
  * 
@@ -10233,7 +10365,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  * 
  * 
  */
-  __pyx_v_dst.data = __pyx_v_p_src->data;
+  __pyx_t_4 = __pyx_v_p_src->data;
+  __pyx_v_dst.data = __pyx_t_4;
 
   /* "View.MemoryView":703
  * 
@@ -10260,46 +10393,45 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *         if PyIndex_Check(index):
  *             slice_memviewslice(
  */
-  __pyx_t_3 = 0;
+  __pyx_t_5 = 0;
   if (PyList_CheckExact(__pyx_v_indices) || PyTuple_CheckExact(__pyx_v_indices)) {
-    __pyx_t_1 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0;
-    __pyx_t_5 = NULL;
+    __pyx_t_6 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_6); __pyx_t_7 = 0;
+    __pyx_t_8 = NULL;
   } else {
-    __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext;
+    __pyx_t_7 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __pyx_t_8 = Py_TYPE(__pyx_t_6)->tp_iternext;
   }
   for (;;) {
-    if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_1)) {
-      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
+    if (!__pyx_t_8 && PyList_CheckExact(__pyx_t_6)) {
+      if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_6)) break;
       #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       #else
-      __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       #endif
-    } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_1)) {
-      if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+    } else if (!__pyx_t_8 && PyTuple_CheckExact(__pyx_t_6)) {
+      if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
       #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       #else
-      __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       #endif
     } else {
-      __pyx_t_6 = __pyx_t_5(__pyx_t_1);
-      if (unlikely(!__pyx_t_6)) {
+      __pyx_t_9 = __pyx_t_8(__pyx_t_6);
+      if (unlikely(!__pyx_t_9)) {
         if (PyErr_Occurred()) {
           if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
           else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         }
         break;
       }
-      __Pyx_GOTREF(__pyx_t_6);
+      __Pyx_GOTREF(__pyx_t_9);
     }
-    __Pyx_XDECREF(__pyx_v_index);
-    __pyx_v_index = __pyx_t_6;
-    __pyx_t_6 = 0;
-    __pyx_v_dim = __pyx_t_3;
-    __pyx_t_3 = (__pyx_t_3 + 1);
+    __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9);
+    __pyx_t_9 = 0;
+    __pyx_v_dim = __pyx_t_5;
+    __pyx_t_5 = (__pyx_t_5 + 1);
 
     /* "View.MemoryView":709
  * 
@@ -10308,8 +10440,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             slice_memviewslice(
  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
  */
-    __pyx_t_7 = PyIndex_Check(__pyx_v_index);
-    if (__pyx_t_7) {
+    __pyx_t_2 = (__Pyx_PyIndex_Check(__pyx_v_index) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":713
  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
@@ -10318,7 +10450,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *                 0, 0, 0, # have_{start,stop,step}
  *                 False)
  */
-      __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
       /* "View.MemoryView":715
  *                 index, 0, 0, # start, stop, step
@@ -10327,7 +10459,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *         elif index is None:
  *             p_dst.shape[new_ndim] = 1
  */
-      __pyx_t_7 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_8, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_10, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L6;
     }
 
@@ -10339,7 +10471,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             p_dst.strides[new_ndim] = 0
  */
     __pyx_t_2 = (__pyx_v_index == Py_None);
-    if (__pyx_t_2) {
+    __pyx_t_1 = (__pyx_t_2 != 0);
+    if (__pyx_t_1) {
 
       /* "View.MemoryView":717
  *                 False)
@@ -10387,20 +10520,20 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             stop = index.stop or 0
  *             step = index.step or 0
  */
-      __pyx_t_6 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_6);
-      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      if (!__pyx_t_2) {
-        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
+      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      if (!__pyx_t_1) {
+        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
         __Pyx_INCREF(__pyx_int_0);
-        __pyx_t_9 = __pyx_int_0;
+        __pyx_t_12 = __pyx_int_0;
       } else {
-        __pyx_t_9 = __pyx_t_6;
-        __pyx_t_6 = 0;
+        __pyx_t_12 = __pyx_t_9;
+        __pyx_t_9 = 0;
       }
-      __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_v_start = __pyx_t_8;
+      __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_12); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+      __pyx_v_start = __pyx_t_10;
 
       /* "View.MemoryView":723
  *         else:
@@ -10409,20 +10542,20 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             step = index.step or 0
  * 
  */
-      __pyx_t_9 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__stop); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      if (!__pyx_t_2) {
-        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__stop); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_12);
+      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      if (!__pyx_t_1) {
+        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
         __Pyx_INCREF(__pyx_int_0);
-        __pyx_t_6 = __pyx_int_0;
+        __pyx_t_9 = __pyx_int_0;
       } else {
-        __pyx_t_6 = __pyx_t_9;
-        __pyx_t_9 = 0;
+        __pyx_t_9 = __pyx_t_12;
+        __pyx_t_12 = 0;
       }
-      __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-      __pyx_v_stop = __pyx_t_8;
+      __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_v_stop = __pyx_t_10;
 
       /* "View.MemoryView":724
  *             start = index.start or 0
@@ -10431,20 +10564,20 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  * 
  *             have_start = index.start is not None
  */
-      __pyx_t_6 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_6);
-      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      if (!__pyx_t_2) {
-        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
+      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      if (!__pyx_t_1) {
+        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
         __Pyx_INCREF(__pyx_int_0);
-        __pyx_t_9 = __pyx_int_0;
+        __pyx_t_12 = __pyx_int_0;
       } else {
-        __pyx_t_9 = __pyx_t_6;
-        __pyx_t_6 = 0;
+        __pyx_t_12 = __pyx_t_9;
+        __pyx_t_9 = 0;
       }
-      __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_v_step = __pyx_t_8;
+      __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_12); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+      __pyx_v_step = __pyx_t_10;
 
       /* "View.MemoryView":726
  *             step = index.step or 0
@@ -10453,11 +10586,11 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             have_stop = index.stop is not None
  *             have_step = index.step is not None
  */
-      __pyx_t_9 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_2 = (__pyx_t_9 != Py_None);
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_v_have_start = __pyx_t_2;
+      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_12);
+      __pyx_t_1 = (__pyx_t_12 != Py_None);
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+      __pyx_v_have_start = __pyx_t_1;
 
       /* "View.MemoryView":727
  * 
@@ -10466,11 +10599,11 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             have_step = index.step is not None
  * 
  */
-      __pyx_t_9 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__stop); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_2 = (__pyx_t_9 != Py_None);
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_v_have_stop = __pyx_t_2;
+      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__stop); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_12);
+      __pyx_t_1 = (__pyx_t_12 != Py_None);
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+      __pyx_v_have_stop = __pyx_t_1;
 
       /* "View.MemoryView":728
  *             have_start = index.start is not None
@@ -10479,11 +10612,11 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  * 
  *             slice_memviewslice(
  */
-      __pyx_t_9 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_2 = (__pyx_t_9 != Py_None);
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_v_have_step = __pyx_t_2;
+      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_12);
+      __pyx_t_1 = (__pyx_t_12 != Py_None);
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+      __pyx_v_have_step = __pyx_t_1;
 
       /* "View.MemoryView":735
  *                 start, stop, step,
@@ -10492,7 +10625,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             new_ndim += 1
  * 
  */
-      __pyx_t_7 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
       /* "View.MemoryView":736
  *                 have_start, have_stop, have_step,
@@ -10505,7 +10638,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
     }
     __pyx_L6:;
   }
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
 
   /* "View.MemoryView":738
  *             new_ndim += 1
@@ -10514,10 +10647,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *         return memoryview_fromslice(dst, new_ndim,
  *                                     memviewsliceobj.to_object_func,
  */
-  __pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryviewslice_type));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), ((PyObject *)__pyx_memoryviewslice_type)); 
+  __pyx_t_2 = (__pyx_t_1 != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":739
@@ -10545,11 +10676,11 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *     else:
  *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,
  */
-    __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_1);
-    __pyx_t_1 = 0;
+    __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_6);
+    __pyx_t_6 = 0;
     goto __pyx_L0;
     goto __pyx_L7;
   }
@@ -10571,11 +10702,11 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  * 
  * 
  */
-    __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_1);
-    __pyx_t_1 = 0;
+    __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_6);
+    __pyx_t_6 = 0;
     goto __pyx_L0;
   }
   __pyx_L7:;
@@ -10583,9 +10714,9 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
   __pyx_r = ((struct __pyx_memoryview_obj *)Py_None); __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_6);
   __Pyx_XDECREF(__pyx_t_9);
+  __Pyx_XDECREF(__pyx_t_12);
   __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
@@ -10612,7 +10743,6 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
   int __pyx_t_2;
   int __pyx_t_3;
   int __pyx_t_4;
-  Py_ssize_t __pyx_t_5;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -10624,7 +10754,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  * 
  *         if start < 0:
  */
-  __pyx_t_1 = (!__pyx_v_is_slice);
+  __pyx_t_1 = ((!(__pyx_v_is_slice != 0)) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":791
@@ -10634,7 +10764,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             start += shape
  *         if not 0 <= start < shape:
  */
-    __pyx_t_1 = (__pyx_v_start < 0);
+    __pyx_t_1 = ((__pyx_v_start < 0) != 0);
     if (__pyx_t_1) {
 
       /* "View.MemoryView":792
@@ -10660,7 +10790,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
     if (__pyx_t_1) {
       __pyx_t_1 = (__pyx_v_start < __pyx_v_shape);
     }
-    __pyx_t_2 = (!__pyx_t_1);
+    __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":794
@@ -10701,11 +10831,11 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
  * 
  */
-    if (__pyx_v_have_step) {
+    if ((__pyx_v_have_step != 0)) {
       __pyx_t_4 = (__pyx_v_step == 0);
       __pyx_t_2 = __pyx_t_4;
     } else {
-      __pyx_t_2 = __pyx_v_have_step;
+      __pyx_t_2 = (__pyx_v_have_step != 0);
     }
     if (__pyx_t_2) {
 
@@ -10728,7 +10858,8 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             if start < 0:
  *                 start += shape
  */
-    if (__pyx_v_have_start) {
+    __pyx_t_2 = (__pyx_v_have_start != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":804
  * 
@@ -10737,7 +10868,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 start += shape
  *                 if start < 0:
  */
-      __pyx_t_2 = (__pyx_v_start < 0);
+      __pyx_t_2 = ((__pyx_v_start < 0) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":805
@@ -10756,7 +10887,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                     start = 0
  *             elif start >= shape:
  */
-        __pyx_t_2 = (__pyx_v_start < 0);
+        __pyx_t_2 = ((__pyx_v_start < 0) != 0);
         if (__pyx_t_2) {
 
           /* "View.MemoryView":807
@@ -10780,7 +10911,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 if negative_step:
  *                     start = shape - 1
  */
-      __pyx_t_2 = (__pyx_v_start >= __pyx_v_shape);
+      __pyx_t_2 = ((__pyx_v_start >= __pyx_v_shape) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":809
@@ -10790,7 +10921,8 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                     start = shape - 1
  *                 else:
  */
-        if (__pyx_v_negative_step) {
+        __pyx_t_2 = (__pyx_v_negative_step != 0);
+        if (__pyx_t_2) {
 
           /* "View.MemoryView":810
  *             elif start >= shape:
@@ -10828,7 +10960,8 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 start = shape - 1
  *             else:
  */
-      if (__pyx_v_negative_step) {
+      __pyx_t_2 = (__pyx_v_negative_step != 0);
+      if (__pyx_t_2) {
 
         /* "View.MemoryView":815
  *         else:
@@ -10862,7 +10995,8 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             if stop < 0:
  *                 stop += shape
  */
-    if (__pyx_v_have_stop) {
+    __pyx_t_2 = (__pyx_v_have_stop != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":820
  * 
@@ -10871,7 +11005,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 stop += shape
  *                 if stop < 0:
  */
-      __pyx_t_2 = (__pyx_v_stop < 0);
+      __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":821
@@ -10890,7 +11024,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                     stop = 0
  *             elif stop > shape:
  */
-        __pyx_t_2 = (__pyx_v_stop < 0);
+        __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
         if (__pyx_t_2) {
 
           /* "View.MemoryView":823
@@ -10914,7 +11048,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 stop = shape
  *         else:
  */
-      __pyx_t_2 = (__pyx_v_stop > __pyx_v_shape);
+      __pyx_t_2 = ((__pyx_v_stop > __pyx_v_shape) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":825
@@ -10939,7 +11073,8 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 stop = -1
  *             else:
  */
-      if (__pyx_v_negative_step) {
+      __pyx_t_2 = (__pyx_v_negative_step != 0);
+      if (__pyx_t_2) {
 
         /* "View.MemoryView":828
  *         else:
@@ -10973,7 +11108,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             step = 1
  * 
  */
-    __pyx_t_2 = (!__pyx_v_have_step);
+    __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":833
@@ -10993,23 +11128,23 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *         with cython.cdivision(True):
  *             new_shape = (stop - start) // step             # <<<<<<<<<<<<<<
  * 
- *             if (stop - start) % step:
+ *             if (stop - start) - step * new_shape:
  */
     __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step);
 
     /* "View.MemoryView":839
  *             new_shape = (stop - start) // step
  * 
- *             if (stop - start) % step:             # <<<<<<<<<<<<<<
+ *             if (stop - start) - step * new_shape:             # <<<<<<<<<<<<<<
  *                 new_shape += 1
  * 
  */
-    __pyx_t_5 = ((__pyx_v_stop - __pyx_v_start) % __pyx_v_step);
-    if (__pyx_t_5) {
+    __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":840
  * 
- *             if (stop - start) % step:
+ *             if (stop - start) - step * new_shape:
  *                 new_shape += 1             # <<<<<<<<<<<<<<
  * 
  *         if new_shape < 0:
@@ -11026,7 +11161,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             new_shape = 0
  * 
  */
-    __pyx_t_2 = (__pyx_v_new_shape < 0);
+    __pyx_t_2 = ((__pyx_v_new_shape < 0) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":843
@@ -11077,7 +11212,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *         dst.data += start * stride
  *     else:
  */
-  __pyx_t_2 = ((__pyx_v_suboffset_dim[0]) < 0);
+  __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":852
@@ -11111,7 +11246,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *         if not is_slice:
  *             if new_ndim == 0:
  */
-  __pyx_t_2 = (__pyx_v_suboffset >= 0);
+  __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":857
@@ -11121,7 +11256,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             if new_ndim == 0:
  *                 dst.data = (<char **> dst.data)[0] + suboffset
  */
-    __pyx_t_2 = (!__pyx_v_is_slice);
+    __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":858
@@ -11131,7 +11266,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 dst.data = (<char **> dst.data)[0] + suboffset
  *             else:
  */
-      __pyx_t_2 = (__pyx_v_new_ndim == 0);
+      __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":859
@@ -11205,11 +11340,11 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  * 
  * @cname('__pyx_pybuffer_index')
  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,             # <<<<<<<<<<<<<<
- *                           int dim) except NULL:
+ *                           Py_ssize_t dim) except NULL:
  *     cdef Py_ssize_t shape, stride, suboffset = -1
  */
 
-static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, int __pyx_v_dim) {
+static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) {
   Py_ssize_t __pyx_v_shape;
   Py_ssize_t __pyx_v_stride;
   Py_ssize_t __pyx_v_suboffset;
@@ -11217,9 +11352,10 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
   char *__pyx_v_resultp;
   char *__pyx_r;
   __Pyx_RefNannyDeclarations
-  int __pyx_t_1;
-  PyObject *__pyx_t_2 = NULL;
+  Py_ssize_t __pyx_t_1;
+  int __pyx_t_2;
   PyObject *__pyx_t_3 = NULL;
+  PyObject *__pyx_t_4 = NULL;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -11227,7 +11363,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
 
   /* "View.MemoryView":874
  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,
- *                           int dim) except NULL:
+ *                           Py_ssize_t dim) except NULL:
  *     cdef Py_ssize_t shape, stride, suboffset = -1             # <<<<<<<<<<<<<<
  *     cdef Py_ssize_t itemsize = view.itemsize
  *     cdef char *resultp
@@ -11235,13 +11371,14 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
   __pyx_v_suboffset = -1;
 
   /* "View.MemoryView":875
- *                           int dim) except NULL:
+ *                           Py_ssize_t dim) except NULL:
  *     cdef Py_ssize_t shape, stride, suboffset = -1
  *     cdef Py_ssize_t itemsize = view.itemsize             # <<<<<<<<<<<<<<
  *     cdef char *resultp
  * 
  */
-  __pyx_v_itemsize = __pyx_v_view->itemsize;
+  __pyx_t_1 = __pyx_v_view->itemsize;
+  __pyx_v_itemsize = __pyx_t_1;
 
   /* "View.MemoryView":878
  *     cdef char *resultp
@@ -11250,8 +11387,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *         shape = view.len / itemsize
  *         stride = itemsize
  */
-  __pyx_t_1 = (__pyx_v_view->ndim == 0);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":879
  * 
@@ -11261,11 +11398,23 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *     else:
  */
     if (unlikely(__pyx_v_itemsize == 0)) {
+      #ifdef WITH_THREAD
+      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+      #endif
       PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero");
+      #ifdef WITH_THREAD
+      PyGILState_Release(__pyx_gilstate_save);
+      #endif
       {__pyx_filename = __pyx_f[2]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     else if (sizeof(Py_ssize_t) == sizeof(long) && unlikely(__pyx_v_itemsize == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) {
+      #ifdef WITH_THREAD
+      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+      #endif
       PyErr_Format(PyExc_OverflowError, "value too large to perform division");
+      #ifdef WITH_THREAD
+      PyGILState_Release(__pyx_gilstate_save);
+      #endif
       {__pyx_filename = __pyx_f[2]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize);
@@ -11307,8 +11456,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *             suboffset = view.suboffsets[dim]
  * 
  */
-    __pyx_t_1 = (__pyx_v_view->suboffsets != NULL);
-    if (__pyx_t_1) {
+    __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":885
  *         stride = view.strides[dim]
@@ -11331,8 +11480,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *         index += view.shape[dim]
  *         if index < 0:
  */
-  __pyx_t_1 = (__pyx_v_index < 0);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((__pyx_v_index < 0) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":888
  * 
@@ -11350,8 +11499,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
  * 
  */
-    __pyx_t_1 = (__pyx_v_index < 0);
-    if (__pyx_t_1) {
+    __pyx_t_2 = ((__pyx_v_index < 0) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":890
  *         index += view.shape[dim]
@@ -11360,21 +11509,21 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  * 
  *     if index >= shape:
  */
-      __pyx_t_2 = PyInt_FromLong(__pyx_v_dim); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_42), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3));
-      __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
-      __pyx_t_3 = 0;
-      __pyx_t_3 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
-      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+      __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_42), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
+      __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
+      __pyx_t_4 = 0;
+      __pyx_t_4 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_4);
+      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
+      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
       {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L6;
     }
@@ -11390,8 +11539,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
  * 
  */
-  __pyx_t_1 = (__pyx_v_index >= __pyx_v_shape);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":893
  * 
@@ -11400,21 +11549,21 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  * 
  *     resultp = bufp + index * stride
  */
-    __pyx_t_3 = PyInt_FromLong(__pyx_v_dim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_42), __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
+    __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
+    __pyx_t_3 = 0;
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_42), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
-    __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
-    __pyx_t_2 = 0;
-    __pyx_t_2 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L7;
   }
@@ -11436,8 +11585,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *         resultp = (<char **> resultp)[0] + suboffset
  * 
  */
-  __pyx_t_1 = (__pyx_v_suboffset >= 0);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":897
  *     resultp = bufp + index * stride
@@ -11464,8 +11613,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
   __pyx_r = 0;
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
+  __Pyx_XDECREF(__pyx_t_4);
   __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
@@ -11488,14 +11637,15 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
   int __pyx_v_i;
   int __pyx_v_j;
   int __pyx_r;
-  long __pyx_t_1;
-  int __pyx_t_2;
-  Py_ssize_t __pyx_t_3;
+  int __pyx_t_1;
+  Py_ssize_t *__pyx_t_2;
+  long __pyx_t_3;
   Py_ssize_t __pyx_t_4;
-  int __pyx_t_5;
+  Py_ssize_t __pyx_t_5;
   int __pyx_t_6;
   int __pyx_t_7;
   int __pyx_t_8;
+  int __pyx_t_9;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -11507,7 +11657,8 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  * 
  *     cdef Py_ssize_t *shape = memslice.shape
  */
-  __pyx_v_ndim = __pyx_v_memslice->memview->view.ndim;
+  __pyx_t_1 = __pyx_v_memslice->memview->view.ndim;
+  __pyx_v_ndim = __pyx_t_1;
 
   /* "View.MemoryView":908
  *     cdef int ndim = memslice.memview.view.ndim
@@ -11516,7 +11667,8 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  *     cdef Py_ssize_t *strides = memslice.strides
  * 
  */
-  __pyx_v_shape = __pyx_v_memslice->shape;
+  __pyx_t_2 = __pyx_v_memslice->shape;
+  __pyx_v_shape = __pyx_t_2;
 
   /* "View.MemoryView":909
  * 
@@ -11525,7 +11677,8 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  * 
  * 
  */
-  __pyx_v_strides = __pyx_v_memslice->strides;
+  __pyx_t_2 = __pyx_v_memslice->strides;
+  __pyx_v_strides = __pyx_t_2;
 
   /* "View.MemoryView":913
  * 
@@ -11534,9 +11687,9 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  *         j = ndim - 1 - i
  *         strides[i], strides[j] = strides[j], strides[i]
  */
-  __pyx_t_1 = __Pyx_div_long(__pyx_v_ndim, 2);
-  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
-    __pyx_v_i = __pyx_t_2;
+  __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2);
+  for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_3; __pyx_t_1+=1) {
+    __pyx_v_i = __pyx_t_1;
 
     /* "View.MemoryView":914
  *     cdef int i, j
@@ -11554,10 +11707,10 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  *         shape[i], shape[j] = shape[j], shape[i]
  * 
  */
-    __pyx_t_3 = (__pyx_v_strides[__pyx_v_j]);
-    __pyx_t_4 = (__pyx_v_strides[__pyx_v_i]);
-    (__pyx_v_strides[__pyx_v_i]) = __pyx_t_3;
-    (__pyx_v_strides[__pyx_v_j]) = __pyx_t_4;
+    __pyx_t_4 = (__pyx_v_strides[__pyx_v_j]);
+    __pyx_t_5 = (__pyx_v_strides[__pyx_v_i]);
+    (__pyx_v_strides[__pyx_v_i]) = __pyx_t_4;
+    (__pyx_v_strides[__pyx_v_j]) = __pyx_t_5;
 
     /* "View.MemoryView":916
  *         j = ndim - 1 - i
@@ -11566,10 +11719,10 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  * 
  *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
  */
-    __pyx_t_4 = (__pyx_v_shape[__pyx_v_j]);
-    __pyx_t_3 = (__pyx_v_shape[__pyx_v_i]);
-    (__pyx_v_shape[__pyx_v_i]) = __pyx_t_4;
-    (__pyx_v_shape[__pyx_v_j]) = __pyx_t_3;
+    __pyx_t_5 = (__pyx_v_shape[__pyx_v_j]);
+    __pyx_t_4 = (__pyx_v_shape[__pyx_v_i]);
+    (__pyx_v_shape[__pyx_v_i]) = __pyx_t_5;
+    (__pyx_v_shape[__pyx_v_j]) = __pyx_t_4;
 
     /* "View.MemoryView":918
  *         shape[i], shape[j] = shape[j], shape[i]
@@ -11578,14 +11731,14 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
  * 
  */
-    __pyx_t_5 = ((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0);
-    if (!__pyx_t_5) {
-      __pyx_t_6 = ((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0);
-      __pyx_t_7 = __pyx_t_6;
+    __pyx_t_6 = (((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0) != 0);
+    if (!__pyx_t_6) {
+      __pyx_t_7 = (((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0) != 0);
+      __pyx_t_8 = __pyx_t_7;
     } else {
-      __pyx_t_7 = __pyx_t_5;
+      __pyx_t_8 = __pyx_t_6;
     }
-    if (__pyx_t_7) {
+    if (__pyx_t_8) {
 
       /* "View.MemoryView":919
  * 
@@ -11594,7 +11747,7 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  * 
  *     return 1
  */
-      __pyx_t_8 = __pyx_memoryview_err(__pyx_builtin_ValueError, __pyx_k_43); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = __pyx_memoryview_err(__pyx_builtin_ValueError, __pyx_k_43); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L5;
     }
     __pyx_L5:;
@@ -11685,7 +11838,7 @@ static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memor
  *             return self.to_object_func(itemp)
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_self->to_object_func != NULL);
+  __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":943
@@ -11759,7 +11912,7 @@ static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memo
  *             self.to_dtype_func(itemp, value)
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_self->to_dtype_func != NULL);
+  __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":949
@@ -11858,8 +12011,11 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
   int __pyx_t_1;
   PyObject *__pyx_t_2 = NULL;
   PyObject *__pyx_t_3 = NULL;
-  int __pyx_t_4;
-  int __pyx_t_5;
+  __Pyx_TypeInfo *__pyx_t_4;
+  Py_buffer __pyx_t_5;
+  Py_ssize_t __pyx_t_6;
+  int __pyx_t_7;
+  int __pyx_t_8;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -11872,7 +12028,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
  *         return None
  * 
  */
-  __pyx_t_1 = (((PyObject *)__pyx_v_memviewslice.memview) == Py_None);
+  __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":972
@@ -11941,7 +12097,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
  *     result.typeinfo = memviewslice.memview.typeinfo
  * 
  */
-  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s__base); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s__base); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_GIVEREF(__pyx_t_2);
   __Pyx_GOTREF(__pyx_v_result->from_object);
@@ -11956,7 +12112,8 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
  * 
  *     result.view = memviewslice.memview.view
  */
-  __pyx_v_result->__pyx_base.typeinfo = __pyx_v_memviewslice.memview->typeinfo;
+  __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo;
+  __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4;
 
   /* "View.MemoryView":985
  *     result.typeinfo = memviewslice.memview.typeinfo
@@ -11965,7 +12122,8 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
  *     result.view.buf = <void *> memviewslice.data
  *     result.view.ndim = ndim
  */
-  __pyx_v_result->__pyx_base.view = __pyx_v_memviewslice.memview->view;
+  __pyx_t_5 = __pyx_v_memviewslice.memview->view;
+  __pyx_v_result->__pyx_base.view = __pyx_t_5;
 
   /* "View.MemoryView":986
  * 
@@ -12046,7 +12204,8 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
  *     for i in range(ndim):
  *         result.view.len *= result.view.shape[i]
  */
-  __pyx_v_result->__pyx_base.view.len = __pyx_v_result->__pyx_base.view.itemsize;
+  __pyx_t_6 = __pyx_v_result->__pyx_base.view.itemsize;
+  __pyx_v_result->__pyx_base.view.len = __pyx_t_6;
 
   /* "View.MemoryView":998
  * 
@@ -12055,9 +12214,9 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
  *         result.view.len *= result.view.shape[i]
  * 
  */
-  __pyx_t_4 = __pyx_v_ndim;
-  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
-    __pyx_v_i = __pyx_t_5;
+  __pyx_t_7 = __pyx_v_ndim;
+  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
+    __pyx_v_i = __pyx_t_8;
 
     /* "View.MemoryView":999
  *     result.view.len = result.view.itemsize
@@ -12125,7 +12284,7 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p
   struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0;
   __Pyx_memviewslice *__pyx_r;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
+  int __pyx_t_1;
   int __pyx_t_2;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
@@ -12139,10 +12298,8 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p
  *         obj = memview
  *         return &obj.from_slice
  */
-  __pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryviewslice_type));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), ((PyObject *)__pyx_memoryviewslice_type)); 
+  __pyx_t_2 = (__pyx_t_1 != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":1011
@@ -12193,7 +12350,6 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p
   __pyx_r = 0;
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
   __Pyx_WriteUnraisable("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
@@ -12216,9 +12372,10 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem
   Py_ssize_t *__pyx_v_strides;
   Py_ssize_t *__pyx_v_suboffsets;
   __Pyx_RefNannyDeclarations
-  int __pyx_t_1;
+  Py_ssize_t *__pyx_t_1;
   int __pyx_t_2;
   int __pyx_t_3;
+  int __pyx_t_4;
   __Pyx_RefNannySetupContext("slice_copy", 0);
 
   /* "View.MemoryView":1022
@@ -12228,7 +12385,8 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem
  *     strides = memview.view.strides
  *     suboffsets = memview.view.suboffsets
  */
-  __pyx_v_shape = __pyx_v_memview->view.shape;
+  __pyx_t_1 = __pyx_v_memview->view.shape;
+  __pyx_v_shape = __pyx_t_1;
 
   /* "View.MemoryView":1023
  * 
@@ -12237,7 +12395,8 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem
  *     suboffsets = memview.view.suboffsets
  * 
  */
-  __pyx_v_strides = __pyx_v_memview->view.strides;
+  __pyx_t_1 = __pyx_v_memview->view.strides;
+  __pyx_v_strides = __pyx_t_1;
 
   /* "View.MemoryView":1024
  *     shape = memview.view.shape
@@ -12246,7 +12405,8 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem
  * 
  *     dst.memview = <__pyx_memoryview *> memview
  */
-  __pyx_v_suboffsets = __pyx_v_memview->view.suboffsets;
+  __pyx_t_1 = __pyx_v_memview->view.suboffsets;
+  __pyx_v_suboffsets = __pyx_t_1;
 
   /* "View.MemoryView":1026
  *     suboffsets = memview.view.suboffsets
@@ -12273,9 +12433,9 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem
  *         dst.shape[dim] = shape[dim]
  *         dst.strides[dim] = strides[dim]
  */
-  __pyx_t_1 = __pyx_v_memview->view.ndim;
-  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
-    __pyx_v_dim = __pyx_t_2;
+  __pyx_t_2 = __pyx_v_memview->view.ndim;
+  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
+    __pyx_v_dim = __pyx_t_3;
 
     /* "View.MemoryView":1030
  * 
@@ -12302,8 +12462,8 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem
  *             dst.suboffsets[dim] = -1
  *         else:
  */
-    __pyx_t_3 = (__pyx_v_suboffsets == NULL);
-    if (__pyx_t_3) {
+    __pyx_t_4 = ((__pyx_v_suboffsets == NULL) != 0);
+    if (__pyx_t_4) {
 
       /* "View.MemoryView":1033
  *         dst.strides[dim] = strides[dim]
@@ -12398,8 +12558,11 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview
   int (*__pyx_v_to_dtype_func)(char *, PyObject *);
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
+  int __pyx_t_1;
   int __pyx_t_2;
+  PyObject *(*__pyx_t_3)(char *);
+  int (*__pyx_t_4)(char *, PyObject *);
+  PyObject *__pyx_t_5 = NULL;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -12412,10 +12575,8 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview
  *         to_object_func = (<_memoryviewslice> memview).to_object_func
  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
  */
-  __pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryviewslice_type));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), ((PyObject *)__pyx_memoryviewslice_type)); 
+  __pyx_t_2 = (__pyx_t_1 != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":1053
@@ -12425,7 +12586,8 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview
  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
  *     else:
  */
-    __pyx_v_to_object_func = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
+    __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
+    __pyx_v_to_object_func = __pyx_t_3;
 
     /* "View.MemoryView":1054
  *     if isinstance(memview, _memoryviewslice):
@@ -12434,7 +12596,8 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview
  *     else:
  *         to_object_func = NULL
  */
-    __pyx_v_to_dtype_func = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
+    __pyx_t_4 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
+    __pyx_v_to_dtype_func = __pyx_t_4;
     goto __pyx_L3;
   }
   /*else*/ {
@@ -12475,16 +12638,16 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview
  * 
  * 
  */
-  __pyx_t_1 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_r = __pyx_t_1;
-  __pyx_t_1 = 0;
+  __pyx_t_5 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
+  __pyx_r = __pyx_t_5;
+  __pyx_t_5 = 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_5);
   __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
@@ -12512,7 +12675,7 @@ static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) {
  *         return -arg
  *     else:
  */
-  __pyx_t_1 = (__pyx_v_arg < 0);
+  __pyx_t_1 = ((__pyx_v_arg < 0) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":1069
@@ -12597,7 +12760,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _
  *             c_stride = mslice.strides[i]
  *             break
  */
-    __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1);
+    __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":1084
@@ -12641,7 +12804,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _
  *             f_stride = mslice.strides[i]
  *             break
  */
-    __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1);
+    __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":1089
@@ -12674,7 +12837,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _
  *         return 'C'
  *     else:
  */
-  __pyx_t_2 = (abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride));
+  __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":1093
@@ -12771,7 +12934,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v
  *        if (src_stride > 0 and dst_stride > 0 and
  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
  */
-  __pyx_t_1 = (__pyx_v_ndim == 1);
+  __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":1111
@@ -12781,9 +12944,9 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v
  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
  *            memcpy(dst_data, src_data, itemsize * dst_extent)
  */
-    __pyx_t_1 = (__pyx_v_src_stride > 0);
+    __pyx_t_1 = ((__pyx_v_src_stride > 0) != 0);
     if (__pyx_t_1) {
-      __pyx_t_2 = (__pyx_v_dst_stride > 0);
+      __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":1112
@@ -12797,7 +12960,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v
         if (__pyx_t_3) {
           __pyx_t_3 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride));
         }
-        __pyx_t_4 = __pyx_t_3;
+        __pyx_t_4 = (__pyx_t_3 != 0);
       } else {
         __pyx_t_4 = __pyx_t_2;
       }
@@ -12939,8 +13102,9 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_sr
   int __pyx_v_i;
   Py_ssize_t __pyx_v_size;
   Py_ssize_t __pyx_r;
-  int __pyx_t_1;
+  Py_ssize_t __pyx_t_1;
   int __pyx_t_2;
+  int __pyx_t_3;
 
   /* "View.MemoryView":1138
  *     "Return the size of the memory occupied by the slice in number of bytes"
@@ -12949,7 +13113,8 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_sr
  * 
  *     for i in range(ndim):
  */
-  __pyx_v_size = __pyx_v_src->memview->view.itemsize;
+  __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
+  __pyx_v_size = __pyx_t_1;
 
   /* "View.MemoryView":1140
  *     cdef Py_ssize_t size = src.memview.view.itemsize
@@ -12958,9 +13123,9 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_sr
  *         size *= src.shape[i]
  * 
  */
-  __pyx_t_1 = __pyx_v_ndim;
-  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
-    __pyx_v_i = __pyx_t_2;
+  __pyx_t_2 = __pyx_v_ndim;
+  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
+    __pyx_v_i = __pyx_t_3;
 
     /* "View.MemoryView":1141
  * 
@@ -13009,7 +13174,7 @@ static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_
  *         for idx in range(ndim):
  *             strides[idx] = stride
  */
-  __pyx_t_1 = (__pyx_v_order == 'F');
+  __pyx_t_1 = ((__pyx_v_order == 'F') != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":1156
@@ -13105,9 +13270,11 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
   size_t __pyx_v_itemsize;
   size_t __pyx_v_size;
   void *__pyx_r;
-  int __pyx_t_1;
+  Py_ssize_t __pyx_t_1;
   int __pyx_t_2;
   int __pyx_t_3;
+  struct __pyx_memoryview_obj *__pyx_t_4;
+  int __pyx_t_5;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -13119,7 +13286,8 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *     cdef size_t size = slice_get_size(src, ndim)
  * 
  */
-  __pyx_v_itemsize = __pyx_v_src->memview->view.itemsize;
+  __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
+  __pyx_v_itemsize = __pyx_t_1;
 
   /* "View.MemoryView":1179
  * 
@@ -13146,8 +13314,8 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *         _err(MemoryError, NULL)
  * 
  */
-  __pyx_t_1 = (!(__pyx_v_result != 0));
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":1183
  *     result = malloc(size)
@@ -13156,7 +13324,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  * 
  * 
  */
-    __pyx_t_2 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L3;
   }
   __pyx_L3:;
@@ -13177,7 +13345,8 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *     for i in range(ndim):
  *         tmpslice.shape[i] = src.shape[i]
  */
-  __pyx_v_tmpslice->memview = __pyx_v_src->memview;
+  __pyx_t_4 = __pyx_v_src->memview;
+  __pyx_v_tmpslice->memview = __pyx_t_4;
 
   /* "View.MemoryView":1188
  *     tmpslice.data = <char *> result
@@ -13186,9 +13355,9 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *         tmpslice.shape[i] = src.shape[i]
  *         tmpslice.suboffsets[i] = -1
  */
-  __pyx_t_2 = __pyx_v_ndim;
-  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
-    __pyx_v_i = __pyx_t_3;
+  __pyx_t_3 = __pyx_v_ndim;
+  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_3; __pyx_t_5+=1) {
+    __pyx_v_i = __pyx_t_5;
 
     /* "View.MemoryView":1189
  *     tmpslice.memview = src.memview
@@ -13225,9 +13394,9 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *         if tmpslice.shape[i] == 1:
  *             tmpslice.strides[i] = 0
  */
-  __pyx_t_2 = __pyx_v_ndim;
-  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
-    __pyx_v_i = __pyx_t_3;
+  __pyx_t_3 = __pyx_v_ndim;
+  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_3; __pyx_t_5+=1) {
+    __pyx_v_i = __pyx_t_5;
 
     /* "View.MemoryView":1197
  * 
@@ -13236,8 +13405,8 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *             tmpslice.strides[i] = 0
  * 
  */
-    __pyx_t_1 = ((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1);
-    if (__pyx_t_1) {
+    __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1198
  *     for i in range(ndim):
@@ -13259,8 +13428,8 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *         memcpy(result, src.data, size)
  *     else:
  */
-  __pyx_t_1 = __pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":1201
  * 
@@ -13488,7 +13657,7 @@ static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) {
  *         raise error(msg.decode('ascii'))
  *     else:
  */
-  __pyx_t_1 = (__pyx_v_msg != NULL);
+  __pyx_t_1 = ((__pyx_v_msg != NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":1222
@@ -13561,11 +13730,13 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
   __Pyx_memviewslice __pyx_v_tmp;
   int __pyx_v_ndim;
   int __pyx_r;
-  int __pyx_t_1;
+  Py_ssize_t __pyx_t_1;
   int __pyx_t_2;
   int __pyx_t_3;
   int __pyx_t_4;
-  void *__pyx_t_5;
+  int __pyx_t_5;
+  void *__pyx_t_6;
+  int __pyx_t_7;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -13586,7 +13757,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *     cdef int i
  *     cdef char order = get_best_order(&src, src_ndim)
  */
-  __pyx_v_itemsize = __pyx_v_src.memview->view.itemsize;
+  __pyx_t_1 = __pyx_v_src.memview->view.itemsize;
+  __pyx_v_itemsize = __pyx_t_1;
 
   /* "View.MemoryView":1238
  *     cdef size_t itemsize = src.memview.view.itemsize
@@ -13622,8 +13794,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *         broadcast_leading(&src, src_ndim, dst_ndim)
  *     elif dst_ndim < src_ndim:
  */
-  __pyx_t_1 = (__pyx_v_src_ndim < __pyx_v_dst_ndim);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":1244
  * 
@@ -13643,8 +13815,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *         broadcast_leading(&dst, dst_ndim, src_ndim)
  * 
  */
-  __pyx_t_1 = (__pyx_v_dst_ndim < __pyx_v_src_ndim);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":1246
  *         broadcast_leading(&src, src_ndim, dst_ndim)
@@ -13665,14 +13837,14 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  *     for i in range(ndim):
  */
-  __pyx_t_2 = __pyx_v_dst_ndim;
-  __pyx_t_3 = __pyx_v_src_ndim;
-  if ((__pyx_t_2 > __pyx_t_3)) {
-    __pyx_t_4 = __pyx_t_2;
+  __pyx_t_3 = __pyx_v_dst_ndim;
+  __pyx_t_4 = __pyx_v_src_ndim;
+  if (((__pyx_t_3 > __pyx_t_4) != 0)) {
+    __pyx_t_5 = __pyx_t_3;
   } else {
-    __pyx_t_4 = __pyx_t_3;
+    __pyx_t_5 = __pyx_t_4;
   }
-  __pyx_v_ndim = __pyx_t_4;
+  __pyx_v_ndim = __pyx_t_5;
 
   /* "View.MemoryView":1250
  *     cdef int ndim = max(src_ndim, dst_ndim)
@@ -13681,9 +13853,9 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *         if src.shape[i] != dst.shape[i]:
  *             if src.shape[i] == 1:
  */
-  __pyx_t_4 = __pyx_v_ndim;
-  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_4; __pyx_t_2+=1) {
-    __pyx_v_i = __pyx_t_2;
+  __pyx_t_5 = __pyx_v_ndim;
+  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_5; __pyx_t_3+=1) {
+    __pyx_v_i = __pyx_t_3;
 
     /* "View.MemoryView":1251
  * 
@@ -13692,8 +13864,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *             if src.shape[i] == 1:
  *                 broadcasting = True
  */
-    __pyx_t_1 = ((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i]));
-    if (__pyx_t_1) {
+    __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1252
  *     for i in range(ndim):
@@ -13702,8 +13874,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *                 broadcasting = True
  *                 src.strides[i] = 0
  */
-      __pyx_t_1 = ((__pyx_v_src.shape[__pyx_v_i]) == 1);
-      if (__pyx_t_1) {
+      __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0);
+      if (__pyx_t_2) {
 
         /* "View.MemoryView":1253
  *         if src.shape[i] != dst.shape[i]:
@@ -13733,7 +13905,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  *         if src.suboffsets[i] >= 0:
  */
-        __pyx_t_3 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_4 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       }
       __pyx_L7:;
       goto __pyx_L6;
@@ -13747,8 +13919,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *             _err_dim(ValueError, "Dimension %d is not direct", i)
  * 
  */
-    __pyx_t_1 = ((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0);
-    if (__pyx_t_1) {
+    __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1259
  * 
@@ -13757,7 +13929,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  *     if slices_overlap(&src, &dst, ndim, itemsize):
  */
-      __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, __pyx_k_45, __pyx_v_i); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, __pyx_k_45, __pyx_v_i); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L8;
     }
     __pyx_L8:;
@@ -13770,8 +13942,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  *         if not slice_is_contig(&src, order, ndim):
  */
-  __pyx_t_1 = __pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":1263
  *     if slices_overlap(&src, &dst, ndim, itemsize):
@@ -13780,8 +13952,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *             order = get_best_order(&dst, ndim)
  * 
  */
-    __pyx_t_1 = (!__pyx_memviewslice_is_contig((&__pyx_v_src), __pyx_v_order, __pyx_v_ndim));
-    if (__pyx_t_1) {
+    __pyx_t_2 = ((!(__pyx_memviewslice_is_contig((&__pyx_v_src), __pyx_v_order, __pyx_v_ndim) != 0)) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1264
  * 
@@ -13802,8 +13974,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *         src = tmp
  * 
  */
-    __pyx_t_5 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_v_tmpdata = __pyx_t_5;
+    __pyx_t_6 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_v_tmpdata = __pyx_t_6;
 
     /* "View.MemoryView":1267
  * 
@@ -13824,8 +13996,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  * 
  */
-  __pyx_t_1 = (!__pyx_v_broadcasting);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":1272
  * 
@@ -13834,8 +14006,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *             direct_copy = slice_is_contig(&dst, 'C', ndim)
  *         elif slice_is_contig(&src, 'F', ndim):
  */
-    __pyx_t_1 = __pyx_memviewslice_is_contig((&__pyx_v_src), 'C', __pyx_v_ndim);
-    if (__pyx_t_1) {
+    __pyx_t_2 = (__pyx_memviewslice_is_contig((&__pyx_v_src), 'C', __pyx_v_ndim) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1273
  * 
@@ -13855,8 +14027,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *             direct_copy = slice_is_contig(&dst, 'F', ndim)
  * 
  */
-    __pyx_t_1 = __pyx_memviewslice_is_contig((&__pyx_v_src), 'F', __pyx_v_ndim);
-    if (__pyx_t_1) {
+    __pyx_t_2 = (__pyx_memviewslice_is_contig((&__pyx_v_src), 'F', __pyx_v_ndim) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1275
  *             direct_copy = slice_is_contig(&dst, 'C', ndim)
@@ -13877,7 +14049,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  *             refcount_copying(&dst, dtype_is_object, ndim, False)
  */
-    if (__pyx_v_direct_copy) {
+    __pyx_t_2 = (__pyx_v_direct_copy != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1279
  *         if direct_copy:
@@ -13929,11 +14102,12 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  * 
  */
-  __pyx_t_1 = (__pyx_v_order == 'F');
-  if (__pyx_t_1) {
-    __pyx_t_1 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
+  __pyx_t_2 = (__pyx_v_order == 'F');
+  if (__pyx_t_2) {
+    __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
   }
-  if (__pyx_t_1) {
+  __pyx_t_7 = (__pyx_t_2 != 0);
+  if (__pyx_t_7) {
 
     /* "View.MemoryView":1287
  * 
@@ -13942,7 +14116,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *         transpose_memslice(&dst)
  * 
  */
-    __pyx_t_4 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_4 == 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
     /* "View.MemoryView":1288
  * 
@@ -13951,7 +14125,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  *     refcount_copying(&dst, dtype_is_object, ndim, False)
  */
-    __pyx_t_4 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_4 == 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L14;
   }
   __pyx_L14:;
@@ -14130,6 +14304,7 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_slice
  */
 
 static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) {
+  int __pyx_t_1;
 
   /* "View.MemoryView":1324
  * 
@@ -14138,7 +14313,8 @@ static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, i
  *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,
  *                                            dst.strides, ndim, inc)
  */
-  if (__pyx_v_dtype_is_object) {
+  __pyx_t_1 = (__pyx_v_dtype_is_object != 0);
+  if (__pyx_t_1) {
 
     /* "View.MemoryView":1326
  *     if dtype_is_object:
@@ -14218,7 +14394,7 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss
  *             if inc:
  *                 Py_INCREF((<PyObject **> data)[0])
  */
-    __pyx_t_3 = (__pyx_v_ndim == 1);
+    __pyx_t_3 = ((__pyx_v_ndim == 1) != 0);
     if (__pyx_t_3) {
 
       /* "View.MemoryView":1341
@@ -14228,7 +14404,8 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss
  *                 Py_INCREF((<PyObject **> data)[0])
  *             else:
  */
-      if (__pyx_v_inc) {
+      __pyx_t_3 = (__pyx_v_inc != 0);
+      if (__pyx_t_3) {
 
         /* "View.MemoryView":1342
  *         if ndim == 1:
@@ -14360,7 +14537,7 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t
  *         for i in range(extent):
  *             memcpy(data, item, itemsize)
  */
-  __pyx_t_1 = (__pyx_v_ndim == 1);
+  __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":1373
@@ -14429,60 +14606,77 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t
   __pyx_L3:;
 
 }
+static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;
 
-static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
-  struct __pyx_array_obj *p;
-  PyObject *o = (*t->tp_alloc)(t, 0);
-  if (!o) return 0;
-  p = ((struct __pyx_array_obj *)o);
-  p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
-  p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
-  if (__pyx_array___cinit__(o, a, k) < 0) {
+static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
+  struct __pyx_memoryview_obj *p;
+  PyObject *o;
+  o = (*t->tp_alloc)(t, 0);
+  if (unlikely(!o)) return 0;
+  p = ((struct __pyx_memoryview_obj *)o);
+  p->__pyx_vtab = __pyx_vtabptr_memoryview;
+  p->obj = Py_None; Py_INCREF(Py_None);
+  p->_size = Py_None; Py_INCREF(Py_None);
+  p->_array_interface = Py_None; Py_INCREF(Py_None);
+  p->view.obj = NULL;
+  if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) {
     Py_DECREF(o); o = 0;
   }
   return o;
 }
 
-static void __pyx_tp_dealloc_array(PyObject *o) {
-  struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
+static void __pyx_tp_dealloc_memoryview(PyObject *o) {
+  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
+  PyObject_GC_UnTrack(o);
   {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
     ++Py_REFCNT(o);
-    __pyx_array___dealloc__(o);
+    __pyx_memoryview___dealloc__(o);
     if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
     --Py_REFCNT(o);
     PyErr_Restore(etype, eval, etb);
   }
-  Py_CLEAR(p->mode);
-  Py_CLEAR(p->_format);
+  Py_CLEAR(p->obj);
+  Py_CLEAR(p->_size);
+  Py_CLEAR(p->_array_interface);
   (*Py_TYPE(o)->tp_free)(o);
 }
 
-static int __pyx_tp_traverse_array(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) {
   int e;
-  struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
-  if (p->mode) {
-    e = (*v)(p->mode, a); if (e) return e;
+  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
+  if (p->obj) {
+    e = (*v)(p->obj, a); if (e) return e;
   }
-  if (p->_format) {
-    e = (*v)(p->_format, a); if (e) return e;
+  if (p->_size) {
+    e = (*v)(p->_size, a); if (e) return e;
+  }
+  if (p->_array_interface) {
+    e = (*v)(p->_array_interface, a); if (e) return e;
+  }
+  if (p->view.obj) {
+    e = (*v)(p->view.obj, a); if (e) return e;
   }
   return 0;
 }
 
-static int __pyx_tp_clear_array(PyObject *o) {
-  struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
+static int __pyx_tp_clear_memoryview(PyObject *o) {
+  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
   PyObject* tmp;
-  tmp = ((PyObject*)p->mode);
-  p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
+  tmp = ((PyObject*)p->obj);
+  p->obj = Py_None; Py_INCREF(Py_None);
   Py_XDECREF(tmp);
-  tmp = ((PyObject*)p->_format);
-  p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
+  tmp = ((PyObject*)p->_size);
+  p->_size = Py_None; Py_INCREF(Py_None);
+  Py_XDECREF(tmp);
+  tmp = ((PyObject*)p->_array_interface);
+  p->_array_interface = Py_None; Py_INCREF(Py_None);
   Py_XDECREF(tmp);
+  Py_CLEAR(p->view.obj);
   return 0;
 }
-static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
+static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
   PyObject *r;
   PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
   r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
@@ -14490,9 +14684,9 @@ static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
   return r;
 }
 
-static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) {
+static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) {
   if (v) {
-    return __pyx_array___setitem__(o, i, v);
+    return __pyx_memoryview___setitem__(o, i, v);
   }
   else {
     PyErr_Format(PyExc_NotImplementedError,
@@ -14501,92 +14695,68 @@ static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) {
   }
 }
 
-static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) {
-  PyObject *v = PyObject_GenericGetAttr(o, n);
-  if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
-    PyErr_Clear();
-    v = __pyx_array___getattr__(o, n);
-  }
-  return v;
+static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_transpose(o);
 }
 
-static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) {
-  return get_memview(o);
+static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview__get__base(o);
 }
 
-static PyMethodDef __pyx_methods_array[] = {
-  {__Pyx_NAMESTR("__getattr__"), (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, __Pyx_DOCSTR(0)},
+static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_shape(o);
+}
+
+static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_strides(o);
+}
+
+static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_suboffsets(o);
+}
+
+static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_ndim(o);
+}
+
+static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_itemsize(o);
+}
+
+static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_nbytes(o);
+}
+
+static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_size(o);
+}
+
+static PyMethodDef __pyx_methods_memoryview[] = {
+  {__Pyx_NAMESTR("is_c_contig"), (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, __Pyx_DOCSTR(0)},
+  {__Pyx_NAMESTR("is_f_contig"), (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, __Pyx_DOCSTR(0)},
+  {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, __Pyx_DOCSTR(0)},
+  {__Pyx_NAMESTR("copy_fortran"), (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, __Pyx_DOCSTR(0)},
   {0, 0, 0, 0}
 };
 
-static struct PyGetSetDef __pyx_getsets_array[] = {
-  {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, 0, 0},
+static struct PyGetSetDef __pyx_getsets_memoryview[] = {
+  {(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, 0, 0},
+  {(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, 0, 0},
+  {(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, 0, 0},
+  {(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, 0, 0},
+  {(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, 0, 0},
+  {(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, 0, 0},
+  {(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, 0, 0},
+  {(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, 0, 0},
+  {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, 0, 0},
   {0, 0, 0, 0, 0}
 };
 
-static PyNumberMethods __pyx_tp_as_number_array = {
-  0, /*nb_add*/
-  0, /*nb_subtract*/
-  0, /*nb_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_divide*/
-  #endif
-  0, /*nb_remainder*/
-  0, /*nb_divmod*/
-  0, /*nb_power*/
-  0, /*nb_negative*/
-  0, /*nb_positive*/
-  0, /*nb_absolute*/
-  0, /*nb_nonzero*/
-  0, /*nb_invert*/
-  0, /*nb_lshift*/
-  0, /*nb_rshift*/
-  0, /*nb_and*/
-  0, /*nb_xor*/
-  0, /*nb_or*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_coerce*/
-  #endif
-  0, /*nb_int*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_long*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*nb_float*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_oct*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_hex*/
-  #endif
-  0, /*nb_inplace_add*/
-  0, /*nb_inplace_subtract*/
-  0, /*nb_inplace_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_inplace_divide*/
-  #endif
-  0, /*nb_inplace_remainder*/
-  0, /*nb_inplace_power*/
-  0, /*nb_inplace_lshift*/
-  0, /*nb_inplace_rshift*/
-  0, /*nb_inplace_and*/
-  0, /*nb_inplace_xor*/
-  0, /*nb_inplace_or*/
-  0, /*nb_floor_divide*/
-  0, /*nb_true_divide*/
-  0, /*nb_inplace_floor_divide*/
-  0, /*nb_inplace_true_divide*/
-  #if PY_VERSION_HEX >= 0x02050000
-  0, /*nb_index*/
-  #endif
-};
-
-static PySequenceMethods __pyx_tp_as_sequence_array = {
-  0, /*sq_length*/
+static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
+  __pyx_memoryview___len__, /*sq_length*/
   0, /*sq_concat*/
   0, /*sq_repeat*/
-  __pyx_sq_item_array, /*sq_item*/
+  __pyx_sq_item_memoryview, /*sq_item*/
   0, /*sq_slice*/
   0, /*sq_ass_item*/
   0, /*sq_ass_slice*/
@@ -14595,13 +14765,13 @@ static PySequenceMethods __pyx_tp_as_sequence_array = {
   0, /*sq_inplace_repeat*/
 };
 
-static PyMappingMethods __pyx_tp_as_mapping_array = {
-  0, /*mp_length*/
-  __pyx_array___getitem__, /*mp_subscript*/
-  __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/
+static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
+  __pyx_memoryview___len__, /*mp_length*/
+  __pyx_memoryview___getitem__, /*mp_subscript*/
+  __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/
 };
 
-static PyBufferProcs __pyx_tp_as_buffer_array = {
+static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
   #if PY_MAJOR_VERSION < 3
   0, /*bf_getreadbuffer*/
   #endif
@@ -14615,19 +14785,19 @@ static PyBufferProcs __pyx_tp_as_buffer_array = {
   0, /*bf_getcharbuffer*/
   #endif
   #if PY_VERSION_HEX >= 0x02060000
-  __pyx_array_getbuffer, /*bf_getbuffer*/
+  __pyx_memoryview_getbuffer, /*bf_getbuffer*/
   #endif
   #if PY_VERSION_HEX >= 0x02060000
   0, /*bf_releasebuffer*/
   #endif
 };
 
-static PyTypeObject __pyx_type___pyx_array = {
+static PyTypeObject __pyx_type___pyx_memoryview = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("relabel.array"), /*tp_name*/
-  sizeof(struct __pyx_array_obj), /*tp_basicsize*/
+  __Pyx_NAMESTR("relabel.memoryview"), /*tp_name*/
+  sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_array, /*tp_dealloc*/
+  __pyx_tp_dealloc_memoryview, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -14636,27 +14806,27 @@ static PyTypeObject __pyx_type___pyx_array = {
   #else
   0, /*reserved*/
   #endif
-  0, /*tp_repr*/
-  &__pyx_tp_as_number_array, /*tp_as_number*/
-  &__pyx_tp_as_sequence_array, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping_array, /*tp_as_mapping*/
+  __pyx_memoryview___repr__, /*tp_repr*/
+  0, /*tp_as_number*/
+  &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/
+  &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/
   0, /*tp_hash*/
   0, /*tp_call*/
-  0, /*tp_str*/
-  __pyx_tp_getattro_array, /*tp_getattro*/
+  __pyx_memoryview___str__, /*tp_str*/
+  0, /*tp_getattro*/
   0, /*tp_setattro*/
-  &__pyx_tp_as_buffer_array, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+  &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
   0, /*tp_doc*/
-  __pyx_tp_traverse_array, /*tp_traverse*/
-  __pyx_tp_clear_array, /*tp_clear*/
+  __pyx_tp_traverse_memoryview, /*tp_traverse*/
+  __pyx_tp_clear_memoryview, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
   0, /*tp_iter*/
   0, /*tp_iternext*/
-  __pyx_methods_array, /*tp_methods*/
+  __pyx_methods_memoryview, /*tp_methods*/
   0, /*tp_members*/
-  __pyx_getsets_array, /*tp_getset*/
+  __pyx_getsets_memoryview, /*tp_getset*/
   0, /*tp_base*/
   0, /*tp_dict*/
   0, /*tp_descr_get*/
@@ -14664,7 +14834,7 @@ static PyTypeObject __pyx_type___pyx_array = {
   0, /*tp_dictoffset*/
   0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_array, /*tp_new*/
+  __pyx_tp_new_memoryview, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -14676,108 +14846,112 @@ static PyTypeObject __pyx_type___pyx_array = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
-static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
-  struct __pyx_MemviewEnum_obj *p;
-  PyObject *o = (*t->tp_alloc)(t, 0);
-  if (!o) return 0;
-  p = ((struct __pyx_MemviewEnum_obj *)o);
-  p->name = Py_None; Py_INCREF(Py_None);
+static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
+  struct __pyx_array_obj *p;
+  PyObject *o;
+  o = (*t->tp_alloc)(t, 0);
+  if (unlikely(!o)) return 0;
+  p = ((struct __pyx_array_obj *)o);
+  p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
+  p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
+  if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) {
+    Py_DECREF(o); o = 0;
+  }
   return o;
 }
 
-static void __pyx_tp_dealloc_Enum(PyObject *o) {
-  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
-  Py_CLEAR(p->name);
+static void __pyx_tp_dealloc_array(PyObject *o) {
+  struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
+  PyObject_GC_UnTrack(o);
+  {
+    PyObject *etype, *eval, *etb;
+    PyErr_Fetch(&etype, &eval, &etb);
+    ++Py_REFCNT(o);
+    __pyx_array___dealloc__(o);
+    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
+    --Py_REFCNT(o);
+    PyErr_Restore(etype, eval, etb);
+  }
+  Py_CLEAR(p->mode);
+  Py_CLEAR(p->_format);
   (*Py_TYPE(o)->tp_free)(o);
 }
 
-static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_array(PyObject *o, visitproc v, void *a) {
   int e;
-  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
-  if (p->name) {
-    e = (*v)(p->name, a); if (e) return e;
+  struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
+  if (p->mode) {
+    e = (*v)(p->mode, a); if (e) return e;
+  }
+  if (p->_format) {
+    e = (*v)(p->_format, a); if (e) return e;
   }
   return 0;
 }
 
-static int __pyx_tp_clear_Enum(PyObject *o) {
-  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
+static int __pyx_tp_clear_array(PyObject *o) {
+  struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
   PyObject* tmp;
-  tmp = ((PyObject*)p->name);
-  p->name = Py_None; Py_INCREF(Py_None);
+  tmp = ((PyObject*)p->mode);
+  p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
+  Py_XDECREF(tmp);
+  tmp = ((PyObject*)p->_format);
+  p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
   Py_XDECREF(tmp);
   return 0;
 }
+static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
+  PyObject *r;
+  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
+  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
+  Py_DECREF(x);
+  return r;
+}
 
-static PyMethodDef __pyx_methods_Enum[] = {
+static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) {
+  if (v) {
+    return __pyx_array___setitem__(o, i, v);
+  }
+  else {
+    PyErr_Format(PyExc_NotImplementedError,
+      "Subscript deletion not supported by %s", Py_TYPE(o)->tp_name);
+    return -1;
+  }
+}
+
+static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) {
+  PyObject *v = PyObject_GenericGetAttr(o, n);
+  if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
+    PyErr_Clear();
+    v = __pyx_array___getattr__(o, n);
+  }
+  return v;
+}
+
+static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) {
+  return get_memview(o);
+}
+
+static PyMethodDef __pyx_methods_array[] = {
+  {__Pyx_NAMESTR("__getattr__"), (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, __Pyx_DOCSTR(0)},
   {0, 0, 0, 0}
 };
 
-static PyNumberMethods __pyx_tp_as_number_Enum = {
-  0, /*nb_add*/
-  0, /*nb_subtract*/
-  0, /*nb_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_divide*/
-  #endif
-  0, /*nb_remainder*/
-  0, /*nb_divmod*/
-  0, /*nb_power*/
-  0, /*nb_negative*/
-  0, /*nb_positive*/
-  0, /*nb_absolute*/
-  0, /*nb_nonzero*/
-  0, /*nb_invert*/
-  0, /*nb_lshift*/
-  0, /*nb_rshift*/
-  0, /*nb_and*/
-  0, /*nb_xor*/
-  0, /*nb_or*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_coerce*/
-  #endif
-  0, /*nb_int*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_long*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*nb_float*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_oct*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_hex*/
-  #endif
-  0, /*nb_inplace_add*/
-  0, /*nb_inplace_subtract*/
-  0, /*nb_inplace_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_inplace_divide*/
-  #endif
-  0, /*nb_inplace_remainder*/
-  0, /*nb_inplace_power*/
-  0, /*nb_inplace_lshift*/
-  0, /*nb_inplace_rshift*/
-  0, /*nb_inplace_and*/
-  0, /*nb_inplace_xor*/
-  0, /*nb_inplace_or*/
-  0, /*nb_floor_divide*/
-  0, /*nb_true_divide*/
-  0, /*nb_inplace_floor_divide*/
-  0, /*nb_inplace_true_divide*/
-  #if PY_VERSION_HEX >= 0x02050000
-  0, /*nb_index*/
-  #endif
+static struct PyGetSetDef __pyx_getsets_array[] = {
+  {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, 0, 0},
+  {0, 0, 0, 0, 0}
 };
 
-static PySequenceMethods __pyx_tp_as_sequence_Enum = {
+static PySequenceMethods __pyx_tp_as_sequence_array = {
   0, /*sq_length*/
   0, /*sq_concat*/
   0, /*sq_repeat*/
-  0, /*sq_item*/
+  __pyx_sq_item_array, /*sq_item*/
   0, /*sq_slice*/
   0, /*sq_ass_item*/
   0, /*sq_ass_slice*/
@@ -14786,13 +14960,13 @@ static PySequenceMethods __pyx_tp_as_sequence_Enum = {
   0, /*sq_inplace_repeat*/
 };
 
-static PyMappingMethods __pyx_tp_as_mapping_Enum = {
+static PyMappingMethods __pyx_tp_as_mapping_array = {
   0, /*mp_length*/
-  0, /*mp_subscript*/
-  0, /*mp_ass_subscript*/
+  __pyx_array___getitem__, /*mp_subscript*/
+  __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/
 };
 
-static PyBufferProcs __pyx_tp_as_buffer_Enum = {
+static PyBufferProcs __pyx_tp_as_buffer_array = {
   #if PY_MAJOR_VERSION < 3
   0, /*bf_getreadbuffer*/
   #endif
@@ -14806,19 +14980,19 @@ static PyBufferProcs __pyx_tp_as_buffer_Enum = {
   0, /*bf_getcharbuffer*/
   #endif
   #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_getbuffer*/
+  __pyx_array_getbuffer, /*bf_getbuffer*/
   #endif
   #if PY_VERSION_HEX >= 0x02060000
   0, /*bf_releasebuffer*/
   #endif
 };
 
-static PyTypeObject __pyx_type___pyx_MemviewEnum = {
+static PyTypeObject __pyx_type___pyx_array = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("relabel.Enum"), /*tp_name*/
-  sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/
+  __Pyx_NAMESTR("relabel.array"), /*tp_name*/
+  sizeof(struct __pyx_array_obj), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_Enum, /*tp_dealloc*/
+  __pyx_tp_dealloc_array, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -14827,35 +15001,35 @@ static PyTypeObject __pyx_type___pyx_MemviewEnum = {
   #else
   0, /*reserved*/
   #endif
-  __pyx_MemviewEnum___repr__, /*tp_repr*/
-  &__pyx_tp_as_number_Enum, /*tp_as_number*/
-  &__pyx_tp_as_sequence_Enum, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping_Enum, /*tp_as_mapping*/
+  0, /*tp_repr*/
+  0, /*tp_as_number*/
+  &__pyx_tp_as_sequence_array, /*tp_as_sequence*/
+  &__pyx_tp_as_mapping_array, /*tp_as_mapping*/
   0, /*tp_hash*/
   0, /*tp_call*/
   0, /*tp_str*/
-  0, /*tp_getattro*/
+  __pyx_tp_getattro_array, /*tp_getattro*/
   0, /*tp_setattro*/
-  &__pyx_tp_as_buffer_Enum, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+  &__pyx_tp_as_buffer_array, /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
   0, /*tp_doc*/
-  __pyx_tp_traverse_Enum, /*tp_traverse*/
-  __pyx_tp_clear_Enum, /*tp_clear*/
+  __pyx_tp_traverse_array, /*tp_traverse*/
+  __pyx_tp_clear_array, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
   0, /*tp_iter*/
   0, /*tp_iternext*/
-  __pyx_methods_Enum, /*tp_methods*/
+  __pyx_methods_array, /*tp_methods*/
   0, /*tp_members*/
-  0, /*tp_getset*/
+  __pyx_getsets_array, /*tp_getset*/
   0, /*tp_base*/
   0, /*tp_dict*/
   0, /*tp_descr_get*/
   0, /*tp_descr_set*/
   0, /*tp_dictoffset*/
-  __pyx_MemviewEnum___init__, /*tp_init*/
+  0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_Enum, /*tp_new*/
+  __pyx_tp_new_array, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -14867,255 +15041,56 @@ static PyTypeObject __pyx_type___pyx_MemviewEnum = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
-static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;
 
-static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
-  struct __pyx_memoryview_obj *p;
-  PyObject *o = (*t->tp_alloc)(t, 0);
-  if (!o) return 0;
-  p = ((struct __pyx_memoryview_obj *)o);
-  p->__pyx_vtab = __pyx_vtabptr_memoryview;
-  p->obj = Py_None; Py_INCREF(Py_None);
-  p->_size = Py_None; Py_INCREF(Py_None);
-  p->_array_interface = Py_None; Py_INCREF(Py_None);
-  p->view.obj = NULL;
-  if (__pyx_memoryview___cinit__(o, a, k) < 0) {
-    Py_DECREF(o); o = 0;
-  }
+static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+  struct __pyx_MemviewEnum_obj *p;
+  PyObject *o;
+  o = (*t->tp_alloc)(t, 0);
+  if (unlikely(!o)) return 0;
+  p = ((struct __pyx_MemviewEnum_obj *)o);
+  p->name = Py_None; Py_INCREF(Py_None);
   return o;
 }
 
-static void __pyx_tp_dealloc_memoryview(PyObject *o) {
-  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
-  {
-    PyObject *etype, *eval, *etb;
-    PyErr_Fetch(&etype, &eval, &etb);
-    ++Py_REFCNT(o);
-    __pyx_memoryview___dealloc__(o);
-    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
-    --Py_REFCNT(o);
-    PyErr_Restore(etype, eval, etb);
-  }
-  Py_CLEAR(p->obj);
-  Py_CLEAR(p->_size);
-  Py_CLEAR(p->_array_interface);
+static void __pyx_tp_dealloc_Enum(PyObject *o) {
+  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
+  PyObject_GC_UnTrack(o);
+  Py_CLEAR(p->name);
   (*Py_TYPE(o)->tp_free)(o);
 }
 
-static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) {
   int e;
-  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
-  if (p->obj) {
-    e = (*v)(p->obj, a); if (e) return e;
-  }
-  if (p->_size) {
-    e = (*v)(p->_size, a); if (e) return e;
-  }
-  if (p->_array_interface) {
-    e = (*v)(p->_array_interface, a); if (e) return e;
-  }
-  if (p->view.obj) {
-    e = (*v)(p->view.obj, a); if (e) return e;
+  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
+  if (p->name) {
+    e = (*v)(p->name, a); if (e) return e;
   }
   return 0;
 }
 
-static int __pyx_tp_clear_memoryview(PyObject *o) {
-  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
+static int __pyx_tp_clear_Enum(PyObject *o) {
+  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
   PyObject* tmp;
-  tmp = ((PyObject*)p->obj);
-  p->obj = Py_None; Py_INCREF(Py_None);
-  Py_XDECREF(tmp);
-  tmp = ((PyObject*)p->_size);
-  p->_size = Py_None; Py_INCREF(Py_None);
-  Py_XDECREF(tmp);
-  tmp = ((PyObject*)p->_array_interface);
-  p->_array_interface = Py_None; Py_INCREF(Py_None);
+  tmp = ((PyObject*)p->name);
+  p->name = Py_None; Py_INCREF(Py_None);
   Py_XDECREF(tmp);
-  Py_CLEAR(p->view.obj);
   return 0;
 }
-static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
-  PyObject *r;
-  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
-  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
-  Py_DECREF(x);
-  return r;
-}
-
-static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) {
-  if (v) {
-    return __pyx_memoryview___setitem__(o, i, v);
-  }
-  else {
-    PyErr_Format(PyExc_NotImplementedError,
-      "Subscript deletion not supported by %s", Py_TYPE(o)->tp_name);
-    return -1;
-  }
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_transpose(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview__get__base(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_shape(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_strides(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_suboffsets(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_ndim(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_itemsize(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_nbytes(o);
-}
 
-static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_size(o);
-}
-
-static PyMethodDef __pyx_methods_memoryview[] = {
-  {__Pyx_NAMESTR("is_c_contig"), (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, __Pyx_DOCSTR(0)},
-  {__Pyx_NAMESTR("is_f_contig"), (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, __Pyx_DOCSTR(0)},
-  {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, __Pyx_DOCSTR(0)},
-  {__Pyx_NAMESTR("copy_fortran"), (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, __Pyx_DOCSTR(0)},
+static PyMethodDef __pyx_methods_Enum[] = {
   {0, 0, 0, 0}
 };
 
-static struct PyGetSetDef __pyx_getsets_memoryview[] = {
-  {(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, 0, 0},
-  {(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, 0, 0},
-  {(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, 0, 0},
-  {(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, 0, 0},
-  {(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, 0, 0},
-  {(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, 0, 0},
-  {(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, 0, 0},
-  {(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, 0, 0},
-  {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, 0, 0},
-  {0, 0, 0, 0, 0}
-};
-
-static PyNumberMethods __pyx_tp_as_number_memoryview = {
-  0, /*nb_add*/
-  0, /*nb_subtract*/
-  0, /*nb_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_divide*/
-  #endif
-  0, /*nb_remainder*/
-  0, /*nb_divmod*/
-  0, /*nb_power*/
-  0, /*nb_negative*/
-  0, /*nb_positive*/
-  0, /*nb_absolute*/
-  0, /*nb_nonzero*/
-  0, /*nb_invert*/
-  0, /*nb_lshift*/
-  0, /*nb_rshift*/
-  0, /*nb_and*/
-  0, /*nb_xor*/
-  0, /*nb_or*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_coerce*/
-  #endif
-  0, /*nb_int*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_long*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*nb_float*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_oct*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_hex*/
-  #endif
-  0, /*nb_inplace_add*/
-  0, /*nb_inplace_subtract*/
-  0, /*nb_inplace_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_inplace_divide*/
-  #endif
-  0, /*nb_inplace_remainder*/
-  0, /*nb_inplace_power*/
-  0, /*nb_inplace_lshift*/
-  0, /*nb_inplace_rshift*/
-  0, /*nb_inplace_and*/
-  0, /*nb_inplace_xor*/
-  0, /*nb_inplace_or*/
-  0, /*nb_floor_divide*/
-  0, /*nb_true_divide*/
-  0, /*nb_inplace_floor_divide*/
-  0, /*nb_inplace_true_divide*/
-  #if PY_VERSION_HEX >= 0x02050000
-  0, /*nb_index*/
-  #endif
-};
-
-static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
-  __pyx_memoryview___len__, /*sq_length*/
-  0, /*sq_concat*/
-  0, /*sq_repeat*/
-  __pyx_sq_item_memoryview, /*sq_item*/
-  0, /*sq_slice*/
-  0, /*sq_ass_item*/
-  0, /*sq_ass_slice*/
-  0, /*sq_contains*/
-  0, /*sq_inplace_concat*/
-  0, /*sq_inplace_repeat*/
-};
-
-static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
-  __pyx_memoryview___len__, /*mp_length*/
-  __pyx_memoryview___getitem__, /*mp_subscript*/
-  __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/
-};
-
-static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getreadbuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getwritebuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getsegcount*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getcharbuffer*/
-  #endif
-  #if PY_VERSION_HEX >= 0x02060000
-  __pyx_memoryview_getbuffer, /*bf_getbuffer*/
-  #endif
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_releasebuffer*/
-  #endif
-};
-
-static PyTypeObject __pyx_type___pyx_memoryview = {
+static PyTypeObject __pyx_type___pyx_MemviewEnum = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("relabel.memoryview"), /*tp_name*/
-  sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/
+  __Pyx_NAMESTR("relabel.Enum"), /*tp_name*/
+  sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_memoryview, /*tp_dealloc*/
+  __pyx_tp_dealloc_Enum, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -15124,35 +15099,35 @@ static PyTypeObject __pyx_type___pyx_memoryview = {
   #else
   0, /*reserved*/
   #endif
-  __pyx_memoryview___repr__, /*tp_repr*/
-  &__pyx_tp_as_number_memoryview, /*tp_as_number*/
-  &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/
+  __pyx_MemviewEnum___repr__, /*tp_repr*/
+  0, /*tp_as_number*/
+  0, /*tp_as_sequence*/
+  0, /*tp_as_mapping*/
   0, /*tp_hash*/
   0, /*tp_call*/
-  __pyx_memoryview___str__, /*tp_str*/
+  0, /*tp_str*/
   0, /*tp_getattro*/
   0, /*tp_setattro*/
-  &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+  0, /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
   0, /*tp_doc*/
-  __pyx_tp_traverse_memoryview, /*tp_traverse*/
-  __pyx_tp_clear_memoryview, /*tp_clear*/
+  __pyx_tp_traverse_Enum, /*tp_traverse*/
+  __pyx_tp_clear_Enum, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
   0, /*tp_iter*/
   0, /*tp_iternext*/
-  __pyx_methods_memoryview, /*tp_methods*/
+  __pyx_methods_Enum, /*tp_methods*/
   0, /*tp_members*/
-  __pyx_getsets_memoryview, /*tp_getset*/
+  0, /*tp_getset*/
   0, /*tp_base*/
   0, /*tp_dict*/
   0, /*tp_descr_get*/
   0, /*tp_descr_set*/
   0, /*tp_dictoffset*/
-  0, /*tp_init*/
+  __pyx_MemviewEnum___init__, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_memoryview, /*tp_new*/
+  __pyx_tp_new_Enum, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -15164,13 +15139,16 @@ static PyTypeObject __pyx_type___pyx_memoryview = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice;
 
 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) {
   struct __pyx_memoryviewslice_obj *p;
   PyObject *o = __pyx_tp_new_memoryview(t, a, k);
-  if (!o) return 0;
+  if (unlikely(!o)) return 0;
   p = ((struct __pyx_memoryviewslice_obj *)o);
   p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice;
   p->from_object = Py_None; Py_INCREF(Py_None);
@@ -15180,6 +15158,7 @@ static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyO
 
 static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) {
   struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
+  PyObject_GC_UnTrack(o);
   {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
@@ -15190,6 +15169,7 @@ static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) {
     PyErr_Restore(etype, eval, etb);
   }
   Py_CLEAR(p->from_object);
+  PyObject_GC_Track(o);
   __pyx_tp_dealloc_memoryview(o);
 }
 
@@ -15215,130 +15195,16 @@ static int __pyx_tp_clear__memoryviewslice(PyObject *o) {
 }
 
 static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryviewslice__get__base(o);
-}
-
-static PyMethodDef __pyx_methods__memoryviewslice[] = {
-  {0, 0, 0, 0}
-};
-
-static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = {
-  {(char *)"base", __pyx_getprop___pyx_memoryviewslice_base, 0, 0, 0},
-  {0, 0, 0, 0, 0}
-};
-
-static PyNumberMethods __pyx_tp_as_number__memoryviewslice = {
-  0, /*nb_add*/
-  0, /*nb_subtract*/
-  0, /*nb_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_divide*/
-  #endif
-  0, /*nb_remainder*/
-  0, /*nb_divmod*/
-  0, /*nb_power*/
-  0, /*nb_negative*/
-  0, /*nb_positive*/
-  0, /*nb_absolute*/
-  0, /*nb_nonzero*/
-  0, /*nb_invert*/
-  0, /*nb_lshift*/
-  0, /*nb_rshift*/
-  0, /*nb_and*/
-  0, /*nb_xor*/
-  0, /*nb_or*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_coerce*/
-  #endif
-  0, /*nb_int*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_long*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*nb_float*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_oct*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_hex*/
-  #endif
-  0, /*nb_inplace_add*/
-  0, /*nb_inplace_subtract*/
-  0, /*nb_inplace_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_inplace_divide*/
-  #endif
-  0, /*nb_inplace_remainder*/
-  0, /*nb_inplace_power*/
-  0, /*nb_inplace_lshift*/
-  0, /*nb_inplace_rshift*/
-  0, /*nb_inplace_and*/
-  0, /*nb_inplace_xor*/
-  0, /*nb_inplace_or*/
-  0, /*nb_floor_divide*/
-  0, /*nb_true_divide*/
-  0, /*nb_inplace_floor_divide*/
-  0, /*nb_inplace_true_divide*/
-  #if PY_VERSION_HEX >= 0x02050000
-  0, /*nb_index*/
-  #endif
-};
-
-static PySequenceMethods __pyx_tp_as_sequence__memoryviewslice = {
-  #if CYTHON_COMPILING_IN_PYPY
-  __pyx_memoryview___len__, /*sq_length*/
-  #else
-  0, /*sq_length*/
-  #endif
-  0, /*sq_concat*/
-  0, /*sq_repeat*/
-  0, /*sq_item*/
-  0, /*sq_slice*/
-  0, /*sq_ass_item*/
-  0, /*sq_ass_slice*/
-  0, /*sq_contains*/
-  0, /*sq_inplace_concat*/
-  0, /*sq_inplace_repeat*/
-};
+  return __pyx_memoryviewslice__get__base(o);
+}
 
-static PyMappingMethods __pyx_tp_as_mapping__memoryviewslice = {
-  #if CYTHON_COMPILING_IN_PYPY
-  __pyx_memoryview___len__, /*mp_length*/
-  #else
-  0, /*mp_length*/
-  #endif
-  #if CYTHON_COMPILING_IN_PYPY
-  __pyx_memoryview___getitem__, /*mp_subscript*/
-  #else
-  0, /*mp_subscript*/
-  #endif
-  0, /*mp_ass_subscript*/
+static PyMethodDef __pyx_methods__memoryviewslice[] = {
+  {0, 0, 0, 0}
 };
 
-static PyBufferProcs __pyx_tp_as_buffer__memoryviewslice = {
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getreadbuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getwritebuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getsegcount*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getcharbuffer*/
-  #endif
-  #if CYTHON_COMPILING_IN_PYPY
-  __pyx_memoryview_getbuffer, /*bf_getbuffer*/
-  #else
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_getbuffer*/
-  #endif
-  #endif
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_releasebuffer*/
-  #endif
+static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = {
+  {(char *)"base", __pyx_getprop___pyx_memoryviewslice_base, 0, 0, 0},
+  {0, 0, 0, 0, 0}
 };
 
 static PyTypeObject __pyx_type___pyx_memoryviewslice = {
@@ -15360,9 +15226,9 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = {
   #else
   0, /*tp_repr*/
   #endif
-  &__pyx_tp_as_number__memoryviewslice, /*tp_as_number*/
-  &__pyx_tp_as_sequence__memoryviewslice, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping__memoryviewslice, /*tp_as_mapping*/
+  0, /*tp_as_number*/
+  0, /*tp_as_sequence*/
+  0, /*tp_as_mapping*/
   0, /*tp_hash*/
   0, /*tp_call*/
   #if CYTHON_COMPILING_IN_PYPY
@@ -15372,8 +15238,8 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = {
   #endif
   0, /*tp_getattro*/
   0, /*tp_setattro*/
-  &__pyx_tp_as_buffer__memoryviewslice, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+  0, /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
   __Pyx_DOCSTR("Internal class for passing memoryview slices to Python"), /*tp_doc*/
   __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/
   __pyx_tp_clear__memoryviewslice, /*tp_clear*/
@@ -15403,6 +15269,9 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
 static PyMethodDef __pyx_methods[] = {
@@ -15411,7 +15280,11 @@ static PyMethodDef __pyx_methods[] = {
 
 #if PY_MAJOR_VERSION >= 3
 static struct PyModuleDef __pyx_moduledef = {
+  #if PY_VERSION_HEX < 0x03020000
+    { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
+  #else
     PyModuleDef_HEAD_INIT,
+  #endif
     __Pyx_NAMESTR("relabel"),
     0, /* m_doc */
     -1, /* m_size */
@@ -15467,10 +15340,13 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s____class__, __pyx_k____class__, sizeof(__pyx_k____class__), 0, 0, 1, 1},
   {&__pyx_n_s____contact__, __pyx_k____contact__, sizeof(__pyx_k____contact__), 0, 0, 1, 1},
   {&__pyx_n_s____date__, __pyx_k____date__, sizeof(__pyx_k____date__), 0, 0, 1, 1},
+  {&__pyx_n_s____import__, __pyx_k____import__, sizeof(__pyx_k____import__), 0, 0, 1, 1},
   {&__pyx_n_s____license__, __pyx_k____license__, sizeof(__pyx_k____license__), 0, 0, 1, 1},
   {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
   {&__pyx_n_s____name__, __pyx_k____name__, sizeof(__pyx_k____name__), 0, 0, 1, 1},
   {&__pyx_n_s____pyx_getbuffer, __pyx_k____pyx_getbuffer, sizeof(__pyx_k____pyx_getbuffer), 0, 0, 1, 1},
+  {&__pyx_n_s____pyx_releasebuffer, __pyx_k____pyx_releasebuffer, sizeof(__pyx_k____pyx_releasebuffer), 0, 0, 1, 1},
+  {&__pyx_n_s____pyx_vtable__, __pyx_k____pyx_vtable__, sizeof(__pyx_k____pyx_vtable__), 0, 0, 1, 1},
   {&__pyx_n_s____status__, __pyx_k____status__, sizeof(__pyx_k____status__), 0, 0, 1, 1},
   {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
   {&__pyx_n_s__allocate_buffer, __pyx_k__allocate_buffer, sizeof(__pyx_k__allocate_buffer), 0, 0, 1, 1},
@@ -15536,20 +15412,20 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {0, 0, 0, 0, 0, 0, 0}
 };
 static int __Pyx_InitCachedBuiltins(void) {
-  __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_MemoryError = __Pyx_GetName(__pyx_b, __pyx_n_s__MemoryError); if (!__pyx_builtin_MemoryError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_enumerate = __Pyx_GetName(__pyx_b, __pyx_n_s__enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_Ellipsis = __Pyx_GetName(__pyx_b, __pyx_n_s__Ellipsis); if (!__pyx_builtin_Ellipsis) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s__MemoryError); if (!__pyx_builtin_MemoryError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s__enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s__Ellipsis); if (!__pyx_builtin_Ellipsis) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   #if PY_MAJOR_VERSION >= 3
-  __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   #else
-  __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__xrange); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s__xrange); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   #endif
-  __pyx_builtin_id = __Pyx_GetName(__pyx_b, __pyx_n_s__id); if (!__pyx_builtin_id) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_IndexError = __Pyx_GetName(__pyx_b, __pyx_n_s__IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s__id); if (!__pyx_builtin_id) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s__IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   return 0;
   __pyx_L1_error:;
   return -1;
@@ -15566,11 +15442,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
  */
-  __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_2 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_1)); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_2);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_kp_u_1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_1));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2));
 
   /* "numpy.pxd":219
@@ -15580,11 +15453,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *             info.buf = PyArray_DATA(self)
  */
-  __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_4 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_3)); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_4);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_3));
-  PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_kp_u_3));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4));
 
   /* "numpy.pxd":257
@@ -15594,11 +15464,8 @@ static int __Pyx_InitCachedConstants(void) {
  *                 if   t == NPY_BYTE:        f = "b"
  *                 elif t == NPY_UBYTE:       f = "B"
  */
-  __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_6 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_5)); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_6);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_5));
-  PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_kp_u_5));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6));
 
   /* "numpy.pxd":799
@@ -15608,11 +15475,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *         if ((child.byteorder == c'>' and little_endian) or
  */
-  __pyx_k_tuple_9 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_9 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_8)); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_9);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_8));
-  PyTuple_SET_ITEM(__pyx_k_tuple_9, 0, ((PyObject *)__pyx_kp_u_8));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_8));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9));
 
   /* "numpy.pxd":803
@@ -15622,11 +15486,8 @@ static int __Pyx_InitCachedConstants(void) {
  *             # One could encode it in the format string and have Cython
  *             # complain instead, BUT: < and > in format strings also imply
  */
-  __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_10 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_5)); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_10);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_5));
-  PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_kp_u_5));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10));
 
   /* "numpy.pxd":823
@@ -15636,11 +15497,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *             # Until ticket #99 is fixed, use integers to avoid warnings
  */
-  __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_12 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_11)); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_12);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_11));
-  PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_u_11));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_11));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12));
 
   /* "View.MemoryView":124
@@ -15650,11 +15508,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *         if self.itemsize <= 0:
  */
-  __pyx_k_tuple_14 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_14 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_13)); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_14);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_13));
-  PyTuple_SET_ITEM(__pyx_k_tuple_14, 0, ((PyObject *)__pyx_kp_s_13));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_13));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14));
 
   /* "View.MemoryView":127
@@ -15664,11 +15519,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *         encode = getattr(format, 'encode', None)
  */
-  __pyx_k_tuple_16 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_16 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_15)); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_16);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_15));
-  PyTuple_SET_ITEM(__pyx_k_tuple_16, 0, ((PyObject *)__pyx_kp_s_15));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_15));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16));
 
   /* "View.MemoryView":131
@@ -15678,11 +15530,8 @@ static int __Pyx_InitCachedConstants(void) {
  *         self._format = format
  *         self.format = self._format
  */
-  __pyx_k_tuple_17 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_17 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__ASCII)); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_17);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__ASCII));
-  PyTuple_SET_ITEM(__pyx_k_tuple_17, 0, ((PyObject *)__pyx_n_s__ASCII));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ASCII));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17));
 
   /* "View.MemoryView":141
@@ -15692,11 +15541,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  * 
  */
-  __pyx_k_tuple_19 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_19 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_18)); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_19);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_18));
-  PyTuple_SET_ITEM(__pyx_k_tuple_19, 0, ((PyObject *)__pyx_kp_s_18));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_18));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_19));
 
   /* "View.MemoryView":166
@@ -15706,11 +15552,8 @@ static int __Pyx_InitCachedConstants(void) {
  *         self.mode = mode
  * 
  */
-  __pyx_k_tuple_22 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_22)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_22 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__ASCII)); if (unlikely(!__pyx_k_tuple_22)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_22);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__ASCII));
-  PyTuple_SET_ITEM(__pyx_k_tuple_22, 0, ((PyObject *)__pyx_n_s__ASCII));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ASCII));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_22));
 
   /* "View.MemoryView":174
@@ -15720,11 +15563,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *             if self.dtype_is_object:
  */
-  __pyx_k_tuple_24 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_24)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_24 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_23)); if (unlikely(!__pyx_k_tuple_24)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_24);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_23));
-  PyTuple_SET_ITEM(__pyx_k_tuple_24, 0, ((PyObject *)__pyx_kp_s_23));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_23));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_24));
 
   /* "View.MemoryView":190
@@ -15734,11 +15574,8 @@ static int __Pyx_InitCachedConstants(void) {
  *         info.buf = self.data
  *         info.len = self.len
  */
-  __pyx_k_tuple_26 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_26)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_26 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_25)); if (unlikely(!__pyx_k_tuple_26)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_26);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_25));
-  PyTuple_SET_ITEM(__pyx_k_tuple_26, 0, ((PyObject *)__pyx_kp_s_25));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_25));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_26));
 
   /* "View.MemoryView":452
@@ -15748,11 +15585,8 @@ static int __Pyx_InitCachedConstants(void) {
  *         else:
  *             if len(self.view.format) == 1:
  */
-  __pyx_k_tuple_28 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_28)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_28 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_27)); if (unlikely(!__pyx_k_tuple_28)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_28);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_27));
-  PyTuple_SET_ITEM(__pyx_k_tuple_28, 0, ((PyObject *)__pyx_kp_s_27));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_27));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_28));
 
   /* "View.MemoryView":528
@@ -15762,11 +15596,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *             return tuple([self.view.strides[i] for i in xrange(self.view.ndim)])
  */
-  __pyx_k_tuple_30 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_30)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_30 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_29)); if (unlikely(!__pyx_k_tuple_30)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_30);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_29));
-  PyTuple_SET_ITEM(__pyx_k_tuple_30, 0, ((PyObject *)__pyx_kp_s_29));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_29));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_30));
 
   /* "View.MemoryView":643
@@ -15776,11 +15607,8 @@ static int __Pyx_InitCachedConstants(void) {
  *                 seen_ellipsis = True
  *             else:
  */
-  __pyx_k_tuple_33 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_33)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_33 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_k_tuple_33)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_33);
-  __Pyx_INCREF(Py_None);
-  PyTuple_SET_ITEM(__pyx_k_tuple_33, 0, Py_None);
-  __Pyx_GIVEREF(Py_None);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_33));
 
   /* "View.MemoryView":646
@@ -15790,11 +15618,8 @@ static int __Pyx_InitCachedConstants(void) {
  *             have_slices = True
  *         else:
  */
-  __pyx_k_tuple_34 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_34)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_34 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_k_tuple_34)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_34);
-  __Pyx_INCREF(Py_None);
-  PyTuple_SET_ITEM(__pyx_k_tuple_34, 0, Py_None);
-  __Pyx_GIVEREF(Py_None);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_34));
 
   /* "View.MemoryView":657
@@ -15804,11 +15629,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *     return have_slices or nslices, tuple(result)
  */
-  __pyx_k_tuple_36 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_36)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_36 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_k_tuple_36)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_36);
-  __Pyx_INCREF(Py_None);
-  PyTuple_SET_ITEM(__pyx_k_tuple_36, 0, Py_None);
-  __Pyx_GIVEREF(Py_None);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_36));
 
   /* "View.MemoryView":665
@@ -15818,11 +15640,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  * 
  */
-  __pyx_k_tuple_38 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_38)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_38 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_37)); if (unlikely(!__pyx_k_tuple_38)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_38);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_37));
-  PyTuple_SET_ITEM(__pyx_k_tuple_38, 0, ((PyObject *)__pyx_kp_s_37));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_37));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_38));
 
   /* "relabel.pyx":13
@@ -15832,56 +15651,8 @@ static int __Pyx_InitCachedConstants(void) {
  *               numpy.ndarray data not None, \
  *               numpy.ndarray blured not None):
  */
-  __pyx_k_tuple_49 = PyTuple_New(16); if (unlikely(!__pyx_k_tuple_49)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_49 = PyTuple_Pack(16, ((PyObject *)__pyx_n_s__label), ((PyObject *)__pyx_n_s__data), ((PyObject *)__pyx_n_s__blured), ((PyObject *)__pyx_n_s__clabel), ((PyObject *)__pyx_n_s__cdata), ((PyObject *)__pyx_n_s__cblured), ((PyObject *)__pyx_n_s__maxLabel), ((PyObject *)__pyx_n_s__count), ((PyObject *)__pyx_n_s__maxData), ((PyObject *)__pyx_n_s__maxBlured), ((PyObject *)__pyx_n_s__maxDelta), ((PyObject *)__pyx_n_s__s), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__idx), ( [...]
   __Pyx_GOTREF(__pyx_k_tuple_49);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__label));
-  PyTuple_SET_ITEM(__pyx_k_tuple_49, 0, ((PyObject *)__pyx_n_s__label));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__label));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__data));
-  PyTuple_SET_ITEM(__pyx_k_tuple_49, 1, ((PyObject *)__pyx_n_s__data));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__data));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__blured));
-  PyTuple_SET_ITEM(__pyx_k_tuple_49, 2, ((PyObject *)__pyx_n_s__blured));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__blured));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__clabel));
-  PyTuple_SET_ITEM(__pyx_k_tuple_49, 3, ((PyObject *)__pyx_n_s__clabel));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__clabel));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cdata));
-  PyTuple_SET_ITEM(__pyx_k_tuple_49, 4, ((PyObject *)__pyx_n_s__cdata));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cdata));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cblured));
-  PyTuple_SET_ITEM(__pyx_k_tuple_49, 5, ((PyObject *)__pyx_n_s__cblured));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cblured));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__maxLabel));
-  PyTuple_SET_ITEM(__pyx_k_tuple_49, 6, ((PyObject *)__pyx_n_s__maxLabel));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__maxLabel));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__count));
-  PyTuple_SET_ITEM(__pyx_k_tuple_49, 7, ((PyObject *)__pyx_n_s__count));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__count));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__maxData));
-  PyTuple_SET_ITEM(__pyx_k_tuple_49, 8, ((PyObject *)__pyx_n_s__maxData));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__maxData));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__maxBlured));
-  PyTuple_SET_ITEM(__pyx_k_tuple_49, 9, ((PyObject *)__pyx_n_s__maxBlured));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__maxBlured));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__maxDelta));
-  PyTuple_SET_ITEM(__pyx_k_tuple_49, 10, ((PyObject *)__pyx_n_s__maxDelta));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__maxDelta));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__s));
-  PyTuple_SET_ITEM(__pyx_k_tuple_49, 11, ((PyObject *)__pyx_n_s__s));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__s));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
-  PyTuple_SET_ITEM(__pyx_k_tuple_49, 12, ((PyObject *)__pyx_n_s__i));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
-  PyTuple_SET_ITEM(__pyx_k_tuple_49, 13, ((PyObject *)__pyx_n_s__idx));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__d));
-  PyTuple_SET_ITEM(__pyx_k_tuple_49, 14, ((PyObject *)__pyx_n_s__d));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__d));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__b));
-  PyTuple_SET_ITEM(__pyx_k_tuple_49, 15, ((PyObject *)__pyx_n_s__b));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__b));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_49));
   __pyx_k_codeobj_50 = (PyObject*)__Pyx_PyCode_New(3, 0, 16, 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__countThem, 13, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_50)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
@@ -15892,11 +15663,8 @@ static int __Pyx_InitCachedConstants(void) {
  * cdef strided = Enum("<strided and direct>") # default
  * cdef indirect = Enum("<strided and indirect>")
  */
-  __pyx_k_tuple_54 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_54)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_54 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_53)); if (unlikely(!__pyx_k_tuple_54)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_54);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_53));
-  PyTuple_SET_ITEM(__pyx_k_tuple_54, 0, ((PyObject *)__pyx_kp_s_53));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_53));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_54));
 
   /* "View.MemoryView":283
@@ -15906,11 +15674,8 @@ static int __Pyx_InitCachedConstants(void) {
  * cdef indirect = Enum("<strided and indirect>")
  * 
  */
-  __pyx_k_tuple_56 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_56)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_56 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_55)); if (unlikely(!__pyx_k_tuple_56)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_56);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_55));
-  PyTuple_SET_ITEM(__pyx_k_tuple_56, 0, ((PyObject *)__pyx_kp_s_55));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_55));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_56));
 
   /* "View.MemoryView":284
@@ -15920,11 +15685,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  * 
  */
-  __pyx_k_tuple_58 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_58)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_58 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_57)); if (unlikely(!__pyx_k_tuple_58)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_58);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_57));
-  PyTuple_SET_ITEM(__pyx_k_tuple_58, 0, ((PyObject *)__pyx_kp_s_57));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_57));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_58));
 
   /* "View.MemoryView":287
@@ -15934,11 +15696,8 @@ static int __Pyx_InitCachedConstants(void) {
  * cdef indirect_contiguous = Enum("<contiguous and indirect>")
  * 
  */
-  __pyx_k_tuple_60 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_60)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_60 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_59)); if (unlikely(!__pyx_k_tuple_60)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_60);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_59));
-  PyTuple_SET_ITEM(__pyx_k_tuple_60, 0, ((PyObject *)__pyx_kp_s_59));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_59));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_60));
 
   /* "View.MemoryView":288
@@ -15948,11 +15707,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  * 
  */
-  __pyx_k_tuple_62 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_62)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_62 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_61)); if (unlikely(!__pyx_k_tuple_62)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_62);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_61));
-  PyTuple_SET_ITEM(__pyx_k_tuple_62, 0, ((PyObject *)__pyx_kp_s_61));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_61));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_62));
   __Pyx_RefNannyFinishContext();
   return 0;
@@ -15981,6 +15737,9 @@ PyMODINIT_FUNC PyInit_relabel(void)
 #endif
 {
   PyObject *__pyx_t_1 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannyDeclarations
   #if CYTHON_REFNANNY
   __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
@@ -16018,6 +15777,16 @@ PyMODINIT_FUNC PyInit_relabel(void)
   __pyx_m = PyModule_Create(&__pyx_moduledef);
   #endif
   if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  Py_INCREF(__pyx_d);
+  #if PY_MAJOR_VERSION >= 3
+  {
+    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (!PyDict_GetItemString(modules, "relabel")) {
+      if (unlikely(PyDict_SetItemString(modules, "relabel", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    }
+  }
+  #endif
   __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   #if CYTHON_COMPILING_IN_PYPY
   Py_INCREF(__pyx_b);
@@ -16025,6 +15794,9 @@ PyMODINIT_FUNC PyInit_relabel(void)
   if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
   /*--- Initialize various global constants etc. ---*/
   if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
+  if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  #endif
   if (__pyx_module_is_main_relabel) {
     if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
   }
@@ -16041,12 +15813,6 @@ PyMODINIT_FUNC PyInit_relabel(void)
   /*--- Variable export code ---*/
   /*--- Function export code ---*/
   /*--- Type init code ---*/
-  if (PyType_Ready(&__pyx_type___pyx_array) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "array", (PyObject *)&__pyx_type___pyx_array) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_array_type = &__pyx_type___pyx_array;
-  if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "Enum", (PyObject *)&__pyx_type___pyx_MemviewEnum) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
   __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview;
   __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer;
   __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice;
@@ -16057,8 +15823,11 @@ PyMODINIT_FUNC PyInit_relabel(void)
   __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object;
   if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "memoryview", (PyObject *)&__pyx_type___pyx_memoryview) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_memoryview_type = &__pyx_type___pyx_memoryview;
+  if (PyType_Ready(&__pyx_type___pyx_array) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_array_type = &__pyx_type___pyx_array;
+  if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
   __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice;
   __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview;
   __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object;
@@ -16066,7 +15835,6 @@ PyMODINIT_FUNC PyInit_relabel(void)
   __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type;
   if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "_memoryviewslice", (PyObject *)&__pyx_type___pyx_memoryviewslice) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice;
   /*--- Type import code ---*/
   __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", 
@@ -16091,7 +15859,7 @@ PyMODINIT_FUNC PyInit_relabel(void)
  * __contact__ = "Jerome.kieffer at esrf.fr"
  * __date__ = "20120916"
  */
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____author__, ((PyObject *)__pyx_kp_s_46)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s____author__, ((PyObject *)__pyx_kp_s_46)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   /* "relabel.pyx":3
  * 
@@ -16100,7 +15868,7 @@ PyMODINIT_FUNC PyInit_relabel(void)
  * __date__ = "20120916"
  * __status__ = "stable"
  */
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____contact__, ((PyObject *)__pyx_kp_s_47)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s____contact__, ((PyObject *)__pyx_kp_s_47)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   /* "relabel.pyx":4
  * __author__ = "Jerome Kieffer"
@@ -16109,7 +15877,7 @@ PyMODINIT_FUNC PyInit_relabel(void)
  * __status__ = "stable"
  * __license__ = "GPLv3+"
  */
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____date__, ((PyObject *)__pyx_kp_s__20120916)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s____date__, ((PyObject *)__pyx_kp_s__20120916)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   /* "relabel.pyx":5
  * __contact__ = "Jerome.kieffer at esrf.fr"
@@ -16118,7 +15886,7 @@ PyMODINIT_FUNC PyInit_relabel(void)
  * __license__ = "GPLv3+"
  * import cython
  */
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____status__, ((PyObject *)__pyx_n_s__stable)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s____status__, ((PyObject *)__pyx_n_s__stable)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   /* "relabel.pyx":6
  * __date__ = "20120916"
@@ -16127,7 +15895,7 @@ PyMODINIT_FUNC PyInit_relabel(void)
  * import cython
  * import numpy
  */
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____license__, ((PyObject *)__pyx_kp_s_48)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s____license__, ((PyObject *)__pyx_kp_s_48)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   /* "relabel.pyx":8
  * __license__ = "GPLv3+"
@@ -16138,7 +15906,7 @@ PyMODINIT_FUNC PyInit_relabel(void)
  */
   __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__numpy, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s__numpy, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
   /* "relabel.pyx":13
@@ -16150,7 +15918,7 @@ PyMODINIT_FUNC PyInit_relabel(void)
  */
   __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7relabel_1countThem, NULL, __pyx_n_s__relabel); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__countThem, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s__countThem, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
   /* "relabel.pyx":2
@@ -16161,7 +15929,7 @@ PyMODINIT_FUNC PyInit_relabel(void)
  */
   __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
   /* "View.MemoryView":207
@@ -16187,9 +15955,8 @@ PyMODINIT_FUNC PyInit_relabel(void)
   __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_54), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_XGOTREF(generic);
-  __Pyx_DECREF(generic);
+  __Pyx_DECREF_SET(generic, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
-  generic = __pyx_t_1;
   __pyx_t_1 = 0;
 
   /* "View.MemoryView":283
@@ -16202,9 +15969,8 @@ PyMODINIT_FUNC PyInit_relabel(void)
   __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_56), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_XGOTREF(strided);
-  __Pyx_DECREF(strided);
+  __Pyx_DECREF_SET(strided, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
-  strided = __pyx_t_1;
   __pyx_t_1 = 0;
 
   /* "View.MemoryView":284
@@ -16217,9 +15983,8 @@ PyMODINIT_FUNC PyInit_relabel(void)
   __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_58), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_XGOTREF(indirect);
-  __Pyx_DECREF(indirect);
+  __Pyx_DECREF_SET(indirect, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
-  indirect = __pyx_t_1;
   __pyx_t_1 = 0;
 
   /* "View.MemoryView":287
@@ -16232,9 +15997,8 @@ PyMODINIT_FUNC PyInit_relabel(void)
   __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_60), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_XGOTREF(contiguous);
-  __Pyx_DECREF(contiguous);
+  __Pyx_DECREF_SET(contiguous, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
-  contiguous = __pyx_t_1;
   __pyx_t_1 = 0;
 
   /* "View.MemoryView":288
@@ -16247,9 +16011,8 @@ PyMODINIT_FUNC PyInit_relabel(void)
   __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_62), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_XGOTREF(indirect_contiguous);
-  __Pyx_DECREF(indirect_contiguous);
+  __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
-  indirect_contiguous = __pyx_t_1;
   __pyx_t_1 = 0;
 
   /* "View.MemoryView":503
@@ -16320,17 +16083,15 @@ end:
 }
 #endif /* CYTHON_REFNANNY */
 
-static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
-    PyObject *result;
-    result = PyObject_GetAttr(dict, name);
-    if (!result) {
-        if (dict != __pyx_b) {
-            PyErr_Clear();
-            result = PyObject_GetAttr(__pyx_b, name);
-        }
-        if (!result) {
-            PyErr_SetObject(PyExc_NameError, name);
-        }
+static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
+    PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
+    if (unlikely(!result)) {
+        PyErr_Format(PyExc_NameError,
+#if PY_MAJOR_VERSION >= 3
+            "name '%U' is not defined", name);
+#else
+            "name '%s' is not defined", PyString_AS_STRING(name));
+#endif
     }
     return result;
 }
@@ -16494,6 +16255,23 @@ static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed
     return 0;
 }
 
+static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
+    PyObject *result;
+#if CYTHON_COMPILING_IN_CPYTHON
+    result = PyDict_GetItem(__pyx_d, name);
+    if (result) {
+        Py_INCREF(result);
+    } else {
+#else
+    result = PyObject_GetItem(__pyx_d, name);
+    if (!result) {
+        PyErr_Clear();
+#endif
+        result = __Pyx_GetBuiltinName(name);
+    }
+    return result;
+}
+
 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
     if (unlikely(!type)) {
         PyErr_Format(PyExc_SystemError, "Missing type object");
@@ -16994,247 +16772,61 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha
         if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
         break;
       default:
-        {
-          int number = __Pyx_BufFmt_ExpectNumber(&ts);
-          if (number == -1) return NULL;
-          ctx->new_count = (size_t)number;
-        }
-    }
-  }
-}
-static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) {
-  buf->buf = NULL;
-  buf->obj = NULL;
-  buf->strides = __Pyx_zeros;
-  buf->shape = __Pyx_zeros;
-  buf->suboffsets = __Pyx_minusones;
-}
-static CYTHON_INLINE int __Pyx_GetBufferAndValidate(
-        Py_buffer* buf, PyObject* obj,  __Pyx_TypeInfo* dtype, int flags,
-        int nd, int cast, __Pyx_BufFmt_StackElem* stack)
-{
-  if (obj == Py_None || obj == NULL) {
-    __Pyx_ZeroBuffer(buf);
-    return 0;
-  }
-  buf->buf = NULL;
-  if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail;
-  if (buf->ndim != nd) {
-    PyErr_Format(PyExc_ValueError,
-                 "Buffer has wrong number of dimensions (expected %d, got %d)",
-                 nd, buf->ndim);
-    goto fail;
-  }
-  if (!cast) {
-    __Pyx_BufFmt_Context ctx;
-    __Pyx_BufFmt_Init(&ctx, stack, dtype);
-    if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
-  }
-  if ((unsigned)buf->itemsize != dtype->size) {
-    PyErr_Format(PyExc_ValueError,
-      "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)",
-      buf->itemsize, (buf->itemsize > 1) ? "s" : "",
-      dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : "");
-    goto fail;
-  }
-  if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
-  return 0;
-fail:;
-  __Pyx_ZeroBuffer(buf);
-  return -1;
-}
-static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
-  if (info->buf == NULL) return;
-  if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
-  __Pyx_ReleaseBuffer(info);
-}
-
-static int
-__pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b)
-{
-    int i;
-    if (!a || !b)
-        return 0;
-    if (a == b)
-        return 1;
-    if (a->size != b->size || a->typegroup != b->typegroup ||
-            a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) {
-        if (a->typegroup == 'H' || b->typegroup == 'H') {
-            return a->size == b->size;
-        } else {
-            return 0;
-        }
-    }
-    if (a->ndim) {
-        for (i = 0; i < a->ndim; i++)
-            if (a->arraysize[i] != b->arraysize[i])
-                return 0;
-    }
-    if (a->typegroup == 'S') {
-        if (a->flags != b->flags)
-            return 0;
-        if (a->fields || b->fields) {
-            if (!(a->fields && b->fields))
-                return 0;
-            for (i = 0; a->fields[i].type && b->fields[i].type; i++) {
-                __Pyx_StructField *field_a = a->fields + i;
-                __Pyx_StructField *field_b = b->fields + i;
-                if (field_a->offset != field_b->offset ||
-                    !__pyx_typeinfo_cmp(field_a->type, field_b->type))
-                    return 0;
-            }
-            return !a->fields[i].type && !b->fields[i].type;
-        }
-    }
-    return 1;
-}
-
-static int __Pyx_ValidateAndInit_memviewslice(
-                int *axes_specs,
-                int c_or_f_flag,
-                int buf_flags,
-                int ndim,
-                __Pyx_TypeInfo *dtype,
-                __Pyx_BufFmt_StackElem stack[],
-                __Pyx_memviewslice *memviewslice,
-                PyObject *original_obj)
-{
-    struct __pyx_memoryview_obj *memview, *new_memview;
-    __Pyx_RefNannyDeclarations
-    Py_buffer *buf;
-    int i, spec = 0, retval = -1;
-    __Pyx_BufFmt_Context ctx;
-    int from_memoryview = __pyx_memoryview_check(original_obj);
-    __Pyx_RefNannySetupContext("ValidateAndInit_memviewslice", 0);
-    if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((struct __pyx_memoryview_obj *)
-                                                            original_obj)->typeinfo)) {
-        memview = (struct __pyx_memoryview_obj *) original_obj;
-        new_memview = NULL;
-    } else {
-        memview = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
-                                            original_obj, buf_flags, 0, dtype);
-        new_memview = memview;
-        if (unlikely(!memview))
-            goto fail;
-    }
-    buf = &memview->view;
-    if (buf->ndim != ndim) {
-        PyErr_Format(PyExc_ValueError,
-                "Buffer has wrong number of dimensions (expected %d, got %d)",
-                ndim, buf->ndim);
-        goto fail;
-    }
-    if (new_memview) {
-        __Pyx_BufFmt_Init(&ctx, stack, dtype);
-        if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
-    }
-    if ((unsigned)buf->itemsize != dtype->size) {
-        PyErr_Format(PyExc_ValueError,
-                     "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "u byte%s) "
-                     "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "u byte%s)",
-                     buf->itemsize,
-                     (buf->itemsize > 1) ? "s" : "",
-                     dtype->name,
-                     dtype->size,
-                     (dtype->size > 1) ? "s" : "");
-        goto fail;
-    }
-    for (i = 0; i < ndim; i++) {
-        spec = axes_specs[i];
-        if (buf->strides) {
-            if (spec & __Pyx_MEMVIEW_CONTIG) {
-                if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) {
-                    if (buf->strides[i] != sizeof(void *)) {
-                        PyErr_Format(PyExc_ValueError,
-                            "Buffer is not indirectly contiguous in dimension %d.", i);
-                        goto fail;
-                    }
-                } else if (buf->strides[i] != buf->itemsize) {
-                    PyErr_SetString(PyExc_ValueError,
-                        "Buffer and memoryview are not contiguous in the same dimension.");
-                    goto fail;
-                }
-            }
-            if (spec & __Pyx_MEMVIEW_FOLLOW) {
-                Py_ssize_t stride = buf->strides[i];
-                if (stride < 0)
-                    stride = -stride;
-                if (stride < buf->itemsize) {
-                    PyErr_SetString(PyExc_ValueError,
-                        "Buffer and memoryview are not contiguous in the same dimension.");
-                    goto fail;
-                }
-            }
-        } else {
-            if (spec & __Pyx_MEMVIEW_CONTIG && i != ndim - 1) {
-                PyErr_Format(PyExc_ValueError,
-                             "C-contiguous buffer is not contiguous in "
-                             "dimension %d", i);
-                goto fail;
-            } else if (spec & (__Pyx_MEMVIEW_PTR)) {
-                PyErr_Format(PyExc_ValueError,
-                             "C-contiguous buffer is not indirect in "
-                             "dimension %d", i);
-                goto fail;
-            } else if (buf->suboffsets) {
-                PyErr_SetString(PyExc_ValueError,
-                                "Buffer exposes suboffsets but no strides");
-                goto fail;
-            }
-        }
-        /* Todo: without PyBUF_INDIRECT we may not have suboffset information, i.e., the
-           ptr may not be set to NULL but may be uninitialized? */
-        if (spec & __Pyx_MEMVIEW_DIRECT) {
-            if (buf->suboffsets && buf->suboffsets[i] >= 0) {
-                PyErr_Format(PyExc_ValueError,
-                    "Buffer not compatible with direct access in dimension %d.", i);
-                goto fail;
-            }
-        }
-        if (spec & __Pyx_MEMVIEW_PTR) {
-            if (!buf->suboffsets || (buf->suboffsets && buf->suboffsets[i] < 0)) {
-                PyErr_Format(PyExc_ValueError,
-                    "Buffer is not indirectly accessisble in dimension %d.", i);
-                goto fail;
-            }
-        }
-    }
-    if (buf->strides) {
-        if (c_or_f_flag & __Pyx_IS_F_CONTIG) {
-            Py_ssize_t stride = 1;
-            for (i=0; i<ndim; i++) {
-                if (stride * buf->itemsize != buf->strides[i]) {
-                    PyErr_SetString(PyExc_ValueError,
-                        "Buffer not fortran contiguous.");
-                    goto fail;
-                }
-                stride = stride * buf->shape[i];
-            }
-        } else if (c_or_f_flag & __Pyx_IS_C_CONTIG) {
-            Py_ssize_t stride = 1;
-            for (i = ndim-1; i>-1; i--) {
-                if(stride * buf->itemsize != buf->strides[i]) {
-                    PyErr_SetString(PyExc_ValueError,
-                        "Buffer not C contiguous.");
-                    goto fail;
-                }
-                stride = stride * buf->shape[i];
-            }
+        {
+          int number = __Pyx_BufFmt_ExpectNumber(&ts);
+          if (number == -1) return NULL;
+          ctx->new_count = (size_t)number;
         }
     }
-    if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice,
-                                         new_memview != NULL) == -1)) {
-        goto fail;
-    }
-    retval = 0;
-    goto no_fail;
-fail:
-    Py_XDECREF(new_memview);
-    retval = -1;
-no_fail:
-    __Pyx_RefNannyFinishContext();
-    return retval;
+  }
+}
+static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) {
+  buf->buf = NULL;
+  buf->obj = NULL;
+  buf->strides = __Pyx_zeros;
+  buf->shape = __Pyx_zeros;
+  buf->suboffsets = __Pyx_minusones;
+}
+static CYTHON_INLINE int __Pyx_GetBufferAndValidate(
+        Py_buffer* buf, PyObject* obj,  __Pyx_TypeInfo* dtype, int flags,
+        int nd, int cast, __Pyx_BufFmt_StackElem* stack)
+{
+  if (obj == Py_None || obj == NULL) {
+    __Pyx_ZeroBuffer(buf);
+    return 0;
+  }
+  buf->buf = NULL;
+  if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail;
+  if (buf->ndim != nd) {
+    PyErr_Format(PyExc_ValueError,
+                 "Buffer has wrong number of dimensions (expected %d, got %d)",
+                 nd, buf->ndim);
+    goto fail;
+  }
+  if (!cast) {
+    __Pyx_BufFmt_Context ctx;
+    __Pyx_BufFmt_Init(&ctx, stack, dtype);
+    if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
+  }
+  if ((unsigned)buf->itemsize != dtype->size) {
+    PyErr_Format(PyExc_ValueError,
+      "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)",
+      buf->itemsize, (buf->itemsize > 1) ? "s" : "",
+      dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : "");
+    goto fail;
+  }
+  if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
+  return 0;
+fail:;
+  __Pyx_ZeroBuffer(buf);
+  return -1;
+}
+static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
+  if (info->buf == NULL) return;
+  if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
+  __Pyx_ReleaseBuffer(info);
 }
+
 static int
 __Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview,
                         int ndim,
@@ -17439,24 +17031,23 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
         }
         value = type;
         #if PY_VERSION_HEX < 0x02050000
-            if (PyInstance_Check(type)) {
-                type = (PyObject*) ((PyInstanceObject*)type)->in_class;
-                Py_INCREF(type);
-            }
-            else {
-                type = 0;
-                PyErr_SetString(PyExc_TypeError,
-                    "raise: exception must be an old-style class or instance");
-                goto raise_error;
-            }
-        #else
-            type = (PyObject*) Py_TYPE(type);
+        if (PyInstance_Check(type)) {
+            type = (PyObject*) ((PyInstanceObject*)type)->in_class;
             Py_INCREF(type);
-            if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
-                PyErr_SetString(PyExc_TypeError,
-                    "raise: exception class must be a subclass of BaseException");
-                goto raise_error;
-            }
+        } else {
+            type = 0;
+            PyErr_SetString(PyExc_TypeError,
+                "raise: exception must be an old-style class or instance");
+            goto raise_error;
+        }
+        #else
+        type = (PyObject*) Py_TYPE(type);
+        Py_INCREF(type);
+        if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
+            PyErr_SetString(PyExc_TypeError,
+                "raise: exception class must be a subclass of BaseException");
+            goto raise_error;
+        }
         #endif
     }
     __Pyx_ErrRestore(type, value, tb);
@@ -17488,46 +17079,62 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject
         value = type;
         type = (PyObject*) Py_TYPE(value);
     } else if (PyExceptionClass_Check(type)) {
-        PyObject *args;
-        if (!value)
-            args = PyTuple_New(0);
-        else if (PyTuple_Check(value)) {
-            Py_INCREF(value);
-            args = value;
+        PyObject *instance_class = NULL;
+        if (value && PyExceptionInstance_Check(value)) {
+            instance_class = (PyObject*) Py_TYPE(value);
+            if (instance_class != type) {
+                if (PyObject_IsSubclass(instance_class, type)) {
+                    type = instance_class;
+                } else {
+                    instance_class = NULL;
+                }
+            }
         }
-        else
-            args = PyTuple_Pack(1, value);
-        if (!args)
-            goto bad;
-        owned_instance = PyEval_CallObject(type, args);
-        Py_DECREF(args);
-        if (!owned_instance)
-            goto bad;
-        value = owned_instance;
-        if (!PyExceptionInstance_Check(value)) {
-            PyErr_Format(PyExc_TypeError,
-                         "calling %R should have returned an instance of "
-                         "BaseException, not %R",
-                         type, Py_TYPE(value));
-            goto bad;
+        if (!instance_class) {
+            PyObject *args;
+            if (!value)
+                args = PyTuple_New(0);
+            else if (PyTuple_Check(value)) {
+                Py_INCREF(value);
+                args = value;
+            } else
+                args = PyTuple_Pack(1, value);
+            if (!args)
+                goto bad;
+            owned_instance = PyObject_Call(type, args, NULL);
+            Py_DECREF(args);
+            if (!owned_instance)
+                goto bad;
+            value = owned_instance;
+            if (!PyExceptionInstance_Check(value)) {
+                PyErr_Format(PyExc_TypeError,
+                             "calling %R should have returned an instance of "
+                             "BaseException, not %R",
+                             type, Py_TYPE(value));
+                goto bad;
+            }
         }
     } else {
         PyErr_SetString(PyExc_TypeError,
             "raise: exception class must be a subclass of BaseException");
         goto bad;
     }
+#if PY_VERSION_HEX >= 0x03030000
+    if (cause) {
+#else
     if (cause && cause != Py_None) {
+#endif
         PyObject *fixed_cause;
-        if (PyExceptionClass_Check(cause)) {
+        if (cause == Py_None) {
+            fixed_cause = NULL;
+        } else if (PyExceptionClass_Check(cause)) {
             fixed_cause = PyObject_CallObject(cause, NULL);
             if (fixed_cause == NULL)
                 goto bad;
-        }
-        else if (PyExceptionInstance_Check(cause)) {
+        } else if (PyExceptionInstance_Check(cause)) {
             fixed_cause = cause;
             Py_INCREF(fixed_cause);
-        }
-        else {
+        } else {
             PyErr_SetString(PyExc_TypeError,
                             "exception causes must derive from "
                             "BaseException");
@@ -17611,8 +17218,20 @@ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
     return 0;
 }
 
+static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
+#if CYTHON_COMPILING_IN_CPYTHON
+#if PY_MAJOR_VERSION >= 3
+    if (likely(PyUnicode_Check(n)))
+#else
+    if (likely(PyString_Check(n)))
+#endif
+        return __Pyx_PyObject_GetAttrStr(o, n);
+#endif
+    return PyObject_GetAttr(o, n);
+}
+
 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
-    PyObject *r = PyObject_GetAttr(o, n);
+    PyObject *r = __Pyx_GetAttr(o, n);
     if (!r) {
         if (!PyErr_ExceptionMatches(PyExc_AttributeError))
             goto bad;
@@ -17761,6 +17380,84 @@ bad:
     return -1;
 }
 
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
+    PyObject *r;
+    if (!j) return NULL;
+    r = PyObject_GetItem(o, j);
+    Py_DECREF(j);
+    return r;
+}
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
+                                                              int wraparound, int boundscheck) {
+#if CYTHON_COMPILING_IN_CPYTHON
+    if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o);
+    if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
+        PyObject *r = PyList_GET_ITEM(o, i);
+        Py_INCREF(r);
+        return r;
+    }
+    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+#else
+    return PySequence_GetItem(o, i);
+#endif
+}
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
+                                                              int wraparound, int boundscheck) {
+#if CYTHON_COMPILING_IN_CPYTHON
+    if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o);
+    if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
+        PyObject *r = PyTuple_GET_ITEM(o, i);
+        Py_INCREF(r);
+        return r;
+    }
+    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+#else
+    return PySequence_GetItem(o, i);
+#endif
+}
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
+                                                     int is_list, int wraparound, int boundscheck) {
+#if CYTHON_COMPILING_IN_CPYTHON
+    if (is_list || PyList_CheckExact(o)) {
+        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
+        if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) {
+            PyObject *r = PyList_GET_ITEM(o, n);
+            Py_INCREF(r);
+            return r;
+        }
+    }
+    else if (PyTuple_CheckExact(o)) {
+        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
+        if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
+            PyObject *r = PyTuple_GET_ITEM(o, n);
+            Py_INCREF(r);
+            return r;
+        }
+    } else {
+        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
+        if (likely(m && m->sq_item)) {
+            if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
+                Py_ssize_t l = m->sq_length(o);
+                if (likely(l >= 0)) {
+                    i += l;
+                } else {
+                    if (PyErr_ExceptionMatches(PyExc_OverflowError))
+                        PyErr_Clear();
+                    else
+                        return NULL;
+                }
+            }
+            return m->sq_item(o, i);
+        }
+    }
+#else
+    if (is_list || PySequence_Check(o)) {
+        return PySequence_GetItem(o, i);
+    }
+#endif
+    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+}
+
 static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
     PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
 }
@@ -17772,9 +17469,44 @@ static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
     return q;
 }
 
+static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
+                                  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename) {
+    PyObject *old_exc, *old_val, *old_tb;
+    PyObject *ctx;
+    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
+    #if PY_MAJOR_VERSION < 3
+    ctx = PyString_FromString(name);
+    #else
+    ctx = PyUnicode_FromString(name);
+    #endif
+    __Pyx_ErrRestore(old_exc, old_val, old_tb);
+    if (!ctx) {
+        PyErr_WriteUnraisable(Py_None);
+    } else {
+        PyErr_WriteUnraisable(ctx);
+        Py_DECREF(ctx);
+    }
+}
+
+static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
+#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
+    PyObject *ob = PyCapsule_New(vtable, 0, 0);
+#else
+    PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
+#endif
+    if (!ob)
+        goto bad;
+    if (PyDict_SetItem(dict, __pyx_n_s____pyx_vtable__, ob) < 0)
+        goto bad;
+    Py_DECREF(ob);
+    return 0;
+bad:
+    Py_XDECREF(ob);
+    return -1;
+}
+
 #if PY_MAJOR_VERSION < 3
 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
-    CYTHON_UNUSED PyObject *getbuffer_cobj;
   #if PY_VERSION_HEX >= 0x02060000
     if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
   #endif
@@ -17782,21 +17514,18 @@ static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
         if (PyObject_TypeCheck(obj, __pyx_array_type)) return __pyx_array_getbuffer(obj, view, flags);
         if (PyObject_TypeCheck(obj, __pyx_memoryview_type)) return __pyx_memoryview_getbuffer(obj, view, flags);
   #if PY_VERSION_HEX < 0x02060000
-    if (obj->ob_type->tp_dict &&
-        (getbuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict,
-                                             "__pyx_getbuffer"))) {
-        getbufferproc func;
-      #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0)
-        func = (getbufferproc) PyCapsule_GetPointer(getbuffer_cobj, "getbuffer(obj, view, flags)");
-      #else
-        func = (getbufferproc) PyCObject_AsVoidPtr(getbuffer_cobj);
-      #endif
-        Py_DECREF(getbuffer_cobj);
-        if (!func)
-            goto fail;
-        return func(obj, view, flags);
-    } else {
-        PyErr_Clear();
+    if (obj->ob_type->tp_dict) {
+        PyObject *getbuffer_cobj = PyObject_GetItem(
+            obj->ob_type->tp_dict, __pyx_n_s____pyx_getbuffer);
+        if (getbuffer_cobj) {
+            getbufferproc func = (getbufferproc) PyCObject_AsVoidPtr(getbuffer_cobj);
+            Py_DECREF(getbuffer_cobj);
+            if (!func)
+                goto fail;
+            return func(obj, view, flags);
+        } else {
+            PyErr_Clear();
+        }
     }
   #endif
     PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
@@ -17807,7 +17536,6 @@ fail:
 }
 static void __Pyx_ReleaseBuffer(Py_buffer *view) {
     PyObject *obj = view->obj;
-    CYTHON_UNUSED PyObject *releasebuffer_cobj;
     if (!obj) return;
   #if PY_VERSION_HEX >= 0x02060000
     if (PyObject_CheckBuffer(obj)) {
@@ -17817,22 +17545,19 @@ static void __Pyx_ReleaseBuffer(Py_buffer *view) {
   #endif
         if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) { __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view); return; }
   #if PY_VERSION_HEX < 0x02060000
-    if (obj->ob_type->tp_dict &&
-        (releasebuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict,
-                                                      "__pyx_releasebuffer"))) {
-        releasebufferproc func;
-      #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0)
-        func = (releasebufferproc) PyCapsule_GetPointer(releasebuffer_cobj, "releasebuffer(obj, view)");
-      #else
-        func = (releasebufferproc) PyCObject_AsVoidPtr(releasebuffer_cobj);
-      #endif
-        Py_DECREF(releasebuffer_cobj);
-        if (!func)
-            goto fail;
-        func(obj, view);
-        return;
-    } else {
-        PyErr_Clear();
+    if (obj->ob_type->tp_dict) {
+        PyObject *releasebuffer_cobj = PyObject_GetItem(
+            obj->ob_type->tp_dict, __pyx_n_s____pyx_releasebuffer);
+        if (releasebuffer_cobj) {
+            releasebufferproc func = (releasebufferproc) PyCObject_AsVoidPtr(releasebuffer_cobj);
+            Py_DECREF(releasebuffer_cobj);
+            if (!func)
+                goto fail;
+            func(obj, view);
+            return;
+        } else {
+            PyErr_Clear();
+        }
     }
   #endif
     goto nofail;
@@ -17847,16 +17572,18 @@ nofail:
 #endif /*  PY_MAJOR_VERSION < 3 */
 
 
-      static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) {
-    PyObject *py_import = 0;
+          static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
     PyObject *empty_list = 0;
     PyObject *module = 0;
     PyObject *global_dict = 0;
     PyObject *empty_dict = 0;
     PyObject *list;
-    py_import = __Pyx_GetAttrString(__pyx_b, "__import__");
+    #if PY_VERSION_HEX < 0x03030000
+    PyObject *py_import;
+    py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s____import__);
     if (!py_import)
         goto bad;
+    #endif
     if (from_list)
         list = from_list;
     else {
@@ -17876,13 +17603,17 @@ nofail:
         #if PY_MAJOR_VERSION >= 3
         if (level == -1) {
             if (strchr(__Pyx_MODULE_NAME, '.')) {
-                /* try package relative import first */
+                #if PY_VERSION_HEX < 0x03030000
                 PyObject *py_level = PyInt_FromLong(1);
                 if (!py_level)
                     goto bad;
                 module = PyObject_CallFunctionObjArgs(py_import,
                     name, global_dict, empty_dict, list, py_level, NULL);
                 Py_DECREF(py_level);
+                #else
+                module = PyImport_ImportModuleLevelObject(
+                    name, global_dict, empty_dict, list, 1);
+                #endif
                 if (!module) {
                     if (!PyErr_ExceptionMatches(PyExc_ImportError))
                         goto bad;
@@ -17893,12 +17624,17 @@ nofail:
         }
         #endif
         if (!module) {
+            #if PY_VERSION_HEX < 0x03030000
             PyObject *py_level = PyInt_FromLong(level);
             if (!py_level)
                 goto bad;
             module = PyObject_CallFunctionObjArgs(py_import,
                 name, global_dict, empty_dict, list, py_level, NULL);
             Py_DECREF(py_level);
+            #else
+            module = PyImport_ImportModuleLevelObject(
+                name, global_dict, empty_dict, list, level);
+            #endif
         }
     }
     #else
@@ -17910,16 +17646,18 @@ nofail:
         name, global_dict, empty_dict, list, NULL);
     #endif
 bad:
-    Py_XDECREF(empty_list);
+    #if PY_VERSION_HEX < 0x03030000
     Py_XDECREF(py_import);
+    #endif
+    Py_XDECREF(empty_list);
     Py_XDECREF(empty_dict);
     return module;
 }
 
-PyObject *__pyx_memview_get_float(const char *itemp) {
+static PyObject *__pyx_memview_get_float(const char *itemp) {
     return (PyObject *) PyFloat_FromDouble(*(float *) itemp);
 }
-int __pyx_memview_set_float(const char *itemp, PyObject *obj) {
+static int __pyx_memview_set_float(const char *itemp, PyObject *obj) {
     float value = __pyx_PyFloat_AsFloat(obj);
     if ((value == (float)-1) && PyErr_Occurred())
         return 0;
@@ -18253,7 +17991,7 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
     }
     __Pyx_GOTREF(shape_tuple);
     for(i = 0; i < ndim; i++) {
-        temp_int = PyInt_FromLong(from_mvs->shape[i]);
+        temp_int = PyInt_FromSsize_t(from_mvs->shape[i]);
         if(unlikely(!temp_int)) {
             goto fail;
         } else {
@@ -18291,7 +18029,7 @@ no_fail:
 }
 
 static CYTHON_INLINE PyObject *
-__pyx_capsule_create(void *p, const char *sig)
+__pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig)
 {
     PyObject *cobj;
 #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0)
@@ -18523,10 +18261,15 @@ static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) {
     return (int)__Pyx_PyInt_AsLong(x);
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
     const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -18539,6 +18282,16 @@ static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(unsigned long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (unsigned long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to unsigned long");
@@ -18546,6 +18299,17 @@ static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
             }
             return (unsigned long)PyLong_AsUnsignedLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(unsigned long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(unsigned long) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(unsigned long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (unsigned long)PyLong_AsLong(x);
         }
     } else {
@@ -18558,10 +18322,15 @@ static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
     }
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
     const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -18574,6 +18343,16 @@ static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObje
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to unsigned PY_LONG_LONG");
@@ -18581,6 +18360,17 @@ static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObje
             }
             return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x);
         }
     } else {
@@ -18593,10 +18383,15 @@ static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObje
     }
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
     const long neg_one = (long)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -18609,6 +18404,16 @@ static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to long");
@@ -18616,6 +18421,17 @@ static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
             }
             return (long)PyLong_AsUnsignedLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(long) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (long)PyLong_AsLong(x);
         }
     } else {
@@ -18628,10 +18444,15 @@ static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
     }
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
     const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -18644,6 +18465,16 @@ static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to PY_LONG_LONG");
@@ -18651,6 +18482,17 @@ static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
             }
             return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (PY_LONG_LONG)PyLong_AsLongLong(x);
         }
     } else {
@@ -18663,10 +18505,15 @@ static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
     }
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
     const signed long neg_one = (signed long)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -18679,6 +18526,16 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(signed long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (signed long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to signed long");
@@ -18686,6 +18543,17 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
             }
             return (signed long)PyLong_AsUnsignedLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(signed long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(signed long) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(signed long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (signed long)PyLong_AsLong(x);
         }
     } else {
@@ -18698,10 +18566,15 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
     }
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
     const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -18714,6 +18587,16 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject*
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to signed PY_LONG_LONG");
@@ -18721,6 +18604,17 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject*
             }
             return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (signed PY_LONG_LONG)PyLong_AsLongLong(x);
         }
     } else {
@@ -18733,6 +18627,227 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject*
     }
 }
 
+static int
+__pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b)
+{
+    int i;
+    if (!a || !b)
+        return 0;
+    if (a == b)
+        return 1;
+    if (a->size != b->size || a->typegroup != b->typegroup ||
+            a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) {
+        if (a->typegroup == 'H' || b->typegroup == 'H') {
+            return a->size == b->size;
+        } else {
+            return 0;
+        }
+    }
+    if (a->ndim) {
+        for (i = 0; i < a->ndim; i++)
+            if (a->arraysize[i] != b->arraysize[i])
+                return 0;
+    }
+    if (a->typegroup == 'S') {
+        if (a->flags != b->flags)
+            return 0;
+        if (a->fields || b->fields) {
+            if (!(a->fields && b->fields))
+                return 0;
+            for (i = 0; a->fields[i].type && b->fields[i].type; i++) {
+                __Pyx_StructField *field_a = a->fields + i;
+                __Pyx_StructField *field_b = b->fields + i;
+                if (field_a->offset != field_b->offset ||
+                    !__pyx_typeinfo_cmp(field_a->type, field_b->type))
+                    return 0;
+            }
+            return !a->fields[i].type && !b->fields[i].type;
+        }
+    }
+    return 1;
+}
+
+static int
+__pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec)
+{
+    if (buf->shape[dim] <= 1)
+        return 1;
+    if (buf->strides) {
+        if (spec & __Pyx_MEMVIEW_CONTIG) {
+            if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) {
+                if (buf->strides[dim] != sizeof(void *)) {
+                    PyErr_Format(PyExc_ValueError,
+                                 "Buffer is not indirectly contiguous "
+                                 "in dimension %d.", dim);
+                    goto fail;
+                }
+            } else if (buf->strides[dim] != buf->itemsize) {
+                PyErr_SetString(PyExc_ValueError,
+                                "Buffer and memoryview are not contiguous "
+                                "in the same dimension.");
+                goto fail;
+            }
+        }
+        if (spec & __Pyx_MEMVIEW_FOLLOW) {
+            Py_ssize_t stride = buf->strides[dim];
+            if (stride < 0)
+                stride = -stride;
+            if (stride < buf->itemsize) {
+                PyErr_SetString(PyExc_ValueError,
+                                "Buffer and memoryview are not contiguous "
+                                "in the same dimension.");
+                goto fail;
+            }
+        }
+    } else {
+        if (spec & __Pyx_MEMVIEW_CONTIG && dim != ndim - 1) {
+            PyErr_Format(PyExc_ValueError,
+                         "C-contiguous buffer is not contiguous in "
+                         "dimension %d", dim);
+            goto fail;
+        } else if (spec & (__Pyx_MEMVIEW_PTR)) {
+            PyErr_Format(PyExc_ValueError,
+                         "C-contiguous buffer is not indirect in "
+                         "dimension %d", dim);
+            goto fail;
+        } else if (buf->suboffsets) {
+            PyErr_SetString(PyExc_ValueError,
+                            "Buffer exposes suboffsets but no strides");
+            goto fail;
+        }
+    }
+    return 1;
+fail:
+    return 0;
+}
+static int
+__pyx_check_suboffsets(Py_buffer *buf, int dim, CYTHON_UNUSED int ndim, int spec)
+{
+    if (spec & __Pyx_MEMVIEW_DIRECT) {
+        if (buf->suboffsets && buf->suboffsets[dim] >= 0) {
+            PyErr_Format(PyExc_ValueError,
+                         "Buffer not compatible with direct access "
+                         "in dimension %d.", dim);
+            goto fail;
+        }
+    }
+    if (spec & __Pyx_MEMVIEW_PTR) {
+        if (!buf->suboffsets || (buf->suboffsets && buf->suboffsets[dim] < 0)) {
+            PyErr_Format(PyExc_ValueError,
+                         "Buffer is not indirectly accessisble "
+                         "in dimension %d.", dim);
+            goto fail;
+        }
+    }
+    return 1;
+fail:
+    return 0;
+}
+static int
+__pyx_verify_contig(Py_buffer *buf, int ndim, int c_or_f_flag)
+{
+    int i;
+    if (c_or_f_flag & __Pyx_IS_F_CONTIG) {
+        Py_ssize_t stride = 1;
+        for (i = 0; i < ndim; i++) {
+            if (stride * buf->itemsize != buf->strides[i] &&
+                    buf->shape[i] > 1)
+            {
+                PyErr_SetString(PyExc_ValueError,
+                    "Buffer not fortran contiguous.");
+                goto fail;
+            }
+            stride = stride * buf->shape[i];
+        }
+    } else if (c_or_f_flag & __Pyx_IS_C_CONTIG) {
+        Py_ssize_t stride = 1;
+        for (i = ndim - 1; i >- 1; i--) {
+            if (stride * buf->itemsize != buf->strides[i] &&
+                    buf->shape[i] > 1) {
+                PyErr_SetString(PyExc_ValueError,
+                    "Buffer not C contiguous.");
+                goto fail;
+            }
+            stride = stride * buf->shape[i];
+        }
+    }
+    return 1;
+fail:
+    return 0;
+}
+static int __Pyx_ValidateAndInit_memviewslice(
+                int *axes_specs,
+                int c_or_f_flag,
+                int buf_flags,
+                int ndim,
+                __Pyx_TypeInfo *dtype,
+                __Pyx_BufFmt_StackElem stack[],
+                __Pyx_memviewslice *memviewslice,
+                PyObject *original_obj)
+{
+    struct __pyx_memoryview_obj *memview, *new_memview;
+    __Pyx_RefNannyDeclarations
+    Py_buffer *buf;
+    int i, spec = 0, retval = -1;
+    __Pyx_BufFmt_Context ctx;
+    int from_memoryview = __pyx_memoryview_check(original_obj);
+    __Pyx_RefNannySetupContext("ValidateAndInit_memviewslice", 0);
+    if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((struct __pyx_memoryview_obj *)
+                                                            original_obj)->typeinfo)) {
+        memview = (struct __pyx_memoryview_obj *) original_obj;
+        new_memview = NULL;
+    } else {
+        memview = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
+                                            original_obj, buf_flags, 0, dtype);
+        new_memview = memview;
+        if (unlikely(!memview))
+            goto fail;
+    }
+    buf = &memview->view;
+    if (buf->ndim != ndim) {
+        PyErr_Format(PyExc_ValueError,
+                "Buffer has wrong number of dimensions (expected %d, got %d)",
+                ndim, buf->ndim);
+        goto fail;
+    }
+    if (new_memview) {
+        __Pyx_BufFmt_Init(&ctx, stack, dtype);
+        if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
+    }
+    if ((unsigned) buf->itemsize != dtype->size) {
+        PyErr_Format(PyExc_ValueError,
+                     "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "u byte%s) "
+                     "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "u byte%s)",
+                     buf->itemsize,
+                     (buf->itemsize > 1) ? "s" : "",
+                     dtype->name,
+                     dtype->size,
+                     (dtype->size > 1) ? "s" : "");
+        goto fail;
+    }
+    for (i = 0; i < ndim; i++) {
+        spec = axes_specs[i];
+        if (!__pyx_check_strides(buf, i, ndim, spec))
+            goto fail;
+        if (!__pyx_check_suboffsets(buf, i, ndim, spec))
+            goto fail;
+    }
+    if (buf->strides && !__pyx_verify_contig(buf, ndim, c_or_f_flag))
+        goto fail;
+    if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice,
+                                         new_memview != NULL) == -1)) {
+        goto fail;
+    }
+    retval = 0;
+    goto no_fail;
+fail:
+    Py_XDECREF(new_memview);
+    retval = -1;
+no_fail:
+    __Pyx_RefNannyFinishContext();
+    return retval;
+}
+
 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_uint32_t(PyObject *obj) {
     __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
     __Pyx_BufFmt_StackElem stack[1];
@@ -18777,25 +18892,6 @@ __pyx_fail:
     return result;
 }
 
-static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
-                                  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename) {
-    PyObject *old_exc, *old_val, *old_tb;
-    PyObject *ctx;
-    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
-    #if PY_MAJOR_VERSION < 3
-    ctx = PyString_FromString(name);
-    #else
-    ctx = PyUnicode_FromString(name);
-    #endif
-    __Pyx_ErrRestore(old_exc, old_val, old_tb);
-    if (!ctx) {
-        PyErr_WriteUnraisable(Py_None);
-    } else {
-        PyErr_WriteUnraisable(ctx);
-        Py_DECREF(ctx);
-    }
-}
-
 static int __Pyx_check_binary_version(void) {
     char ctversion[4], rtversion[4];
     PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
@@ -18815,23 +18911,6 @@ static int __Pyx_check_binary_version(void) {
     return 0;
 }
 
-static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
-#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
-    PyObject *ob = PyCapsule_New(vtable, 0, 0);
-#else
-    PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
-#endif
-    if (!ob)
-        goto bad;
-    if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0)
-        goto bad;
-    Py_DECREF(ob);
-    return 0;
-bad:
-    Py_XDECREF(ob);
-    return -1;
-}
-
 #ifndef __PYX_HAVE_RT_ImportModule
 #define __PYX_HAVE_RT_ImportModule
 static PyObject *__Pyx_ImportModule(const char *name) {
@@ -18858,6 +18937,10 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class
     PyObject *result = 0;
     PyObject *py_name = 0;
     char warning[200];
+    Py_ssize_t basicsize;
+#ifdef Py_LIMITED_API
+    PyObject *py_basicsize;
+#endif
     py_module = __Pyx_ImportModule(module_name);
     if (!py_module)
         goto bad;
@@ -18877,7 +18960,19 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class
             module_name, class_name);
         goto bad;
     }
-    if (!strict && (size_t)((PyTypeObject *)result)->tp_basicsize > size) {
+#ifndef Py_LIMITED_API
+    basicsize = ((PyTypeObject *)result)->tp_basicsize;
+#else
+    py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
+    if (!py_basicsize)
+        goto bad;
+    basicsize = PyLong_AsSsize_t(py_basicsize);
+    Py_DECREF(py_basicsize);
+    py_basicsize = 0;
+    if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
+        goto bad;
+#endif
+    if (!strict && (size_t)basicsize > size) {
         PyOS_snprintf(warning, sizeof(warning),
             "%s.%s size changed, may indicate binary incompatibility",
             module_name, class_name);
@@ -18887,7 +18982,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class
         if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
         #endif
     }
-    else if ((size_t)((PyTypeObject *)result)->tp_basicsize != size) {
+    else if ((size_t)basicsize != size) {
         PyErr_Format(PyExc_ValueError,
             "%s.%s has the wrong size, try recompiling",
             module_name, class_name);
@@ -19093,27 +19188,82 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
     return 0;
 }
 
-
-/* Type Conversion Functions */
-
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char* c_str) {
+    return __Pyx_PyUnicode_FromStringAndSize(c_str, strlen(c_str));
+}
+static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
+    Py_ssize_t ignore;
+    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
+}
+static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
+    if (
+#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+            __Pyx_sys_getdefaultencoding_not_ascii &&
+#endif
+            PyUnicode_Check(o)) {
+#if PY_VERSION_HEX < 0x03030000
+        char* defenc_c;
+        PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
+        if (!defenc) return NULL;
+        defenc_c = PyBytes_AS_STRING(defenc);
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+        {
+            char* end = defenc_c + PyBytes_GET_SIZE(defenc);
+            char* c;
+            for (c = defenc_c; c < end; c++) {
+                if ((unsigned char) (*c) >= 128) {
+                    PyUnicode_AsASCIIString(o);
+                    return NULL;
+                }
+            }
+        }
+#endif /*__PYX_DEFAULT_STRING_ENCODING_IS_ASCII*/
+        *length = PyBytes_GET_SIZE(defenc);
+        return defenc_c;
+#else /* PY_VERSION_HEX < 0x03030000 */
+        if (PyUnicode_READY(o) == -1) return NULL;
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+        if (PyUnicode_IS_ASCII(o)) {
+            *length = PyUnicode_GET_DATA_SIZE(o);
+            return PyUnicode_AsUTF8(o);
+        } else {
+            PyUnicode_AsASCIIString(o);
+            return NULL;
+        }
+#else /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
+        return PyUnicode_AsUTF8AndSize(o, length);
+#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
+#endif /* PY_VERSION_HEX < 0x03030000 */
+    } else
+#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII  || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT */
+    {
+        char* result;
+        int r = PyBytes_AsStringAndSize(o, &result, length);
+        if (r < 0) {
+            return NULL;
+        } else {
+            return result;
+        }
+    }
+}
 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
    int is_true = x == Py_True;
    if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
    else return PyObject_IsTrue(x);
 }
-
 static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
   PyNumberMethods *m;
   const char *name = NULL;
   PyObject *res = NULL;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
   if (PyInt_Check(x) || PyLong_Check(x))
 #else
   if (PyLong_Check(x))
 #endif
     return Py_INCREF(x), x;
   m = Py_TYPE(x)->tp_as_number;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
   if (m && m->nb_int) {
     name = "int";
     res = PyNumber_Int(x);
@@ -19129,7 +19279,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
   }
 #endif
   if (res) {
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (!PyInt_Check(res) && !PyLong_Check(res)) {
 #else
     if (!PyLong_Check(res)) {
@@ -19147,7 +19297,6 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
   }
   return res;
 }
-
 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
   Py_ssize_t ival;
   PyObject* x = PyNumber_Index(b);
@@ -19156,7 +19305,6 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
   Py_DECREF(x);
   return ival;
 }
-
 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
 #if PY_VERSION_HEX < 0x02050000
    if (ival <= LONG_MAX)
@@ -19170,14 +19318,12 @@ static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
    return PyInt_FromSize_t(ival);
 #endif
 }
-
 static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
    unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
-   if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) {
-       return (size_t)-1;
-   } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
-       PyErr_SetString(PyExc_OverflowError,
-                       "value too large to convert to size_t");
+   if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
+       if ((val != (unsigned PY_LONG_LONG)-1) || !PyErr_Occurred())
+           PyErr_SetString(PyExc_OverflowError,
+                           "value too large to convert to size_t");
        return (size_t)-1;
    }
    return (size_t)val;
diff --git a/src/reconstruct.c b/src/sparse_csr.c
similarity index 82%
copy from src/reconstruct.c
copy to src/sparse_csr.c
index 597e351..d05829d 100644
--- a/src/reconstruct.c
+++ b/src/sparse_csr.c
@@ -1,6 +1,18 @@
-/* Generated by Cython 0.17.1 on Thu Nov 15 14:44:22 2012 */
+/* Generated by Cython 0.19 on Wed Nov 27 09:54:25 2013 */
 
 #define PY_SSIZE_T_CLEAN
+#ifndef CYTHON_USE_PYLONG_INTERNALS
+#ifdef PYLONG_BITS_IN_DIGIT
+#define CYTHON_USE_PYLONG_INTERNALS 0
+#else
+#include "pyconfig.h"
+#ifdef PYLONG_BITS_IN_DIGIT
+#define CYTHON_USE_PYLONG_INTERNALS 1
+#else
+#define CYTHON_USE_PYLONG_INTERNALS 0
+#endif
+#endif
+#endif
 #include "Python.h"
 #ifndef Py_PYTHON_H
     #error Python headers needed to compile C extensions, please install development version of Python.
@@ -53,12 +65,15 @@
                                 (PyErr_Format(PyExc_TypeError, \
                                               "expected index value, got %.200s", Py_TYPE(o)->tp_name), \
                                  (PyObject*)0))
-  #define PyIndex_Check(o)     (PyNumber_Check(o) && !PyFloat_Check(o) && !PyComplex_Check(o))
+  #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \
+                                  !PyComplex_Check(o))
+  #define PyIndex_Check __Pyx_PyIndex_Check
   #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
   #define __PYX_BUILD_PY_SSIZE_T "i"
 #else
   #define __PYX_BUILD_PY_SSIZE_T "n"
   #define CYTHON_FORMAT_SSIZE_T "z"
+  #define __Pyx_PyIndex_Check PyIndex_Check
 #endif
 #if PY_VERSION_HEX < 0x02060000
   #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
@@ -113,6 +128,9 @@
 #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
   #define Py_TPFLAGS_HAVE_NEWBUFFER 0
 #endif
+#if PY_VERSION_HEX < 0x02060000
+  #define Py_TPFLAGS_HAVE_VERSION_TAG 0
+#endif
 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
   #define CYTHON_PEP393_ENABLED 1
   #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ? \
@@ -152,6 +170,14 @@
   #define PyBytes_Concat               PyString_Concat
   #define PyBytes_ConcatAndDel         PyString_ConcatAndDel
 #endif
+#if PY_MAJOR_VERSION >= 3
+  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
+  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
+#else
+  #define __Pyx_PyBaseString_Check(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj) || \
+                                         PyString_Check(obj) || PyUnicode_Check(obj))
+  #define __Pyx_PyBaseString_CheckExact(obj) (Py_TYPE(obj) == &PyBaseString_Type)
+#endif
 #if PY_VERSION_HEX < 0x02060000
   #define PySet_Check(obj)             PyObject_TypeCheck(obj, &PySet_Type)
   #define PyFrozenSet_Check(obj)       PyObject_TypeCheck(obj, &PyFrozenSet_Type)
@@ -224,6 +250,29 @@
   #define __Pyx_NAMESTR(n) (n)
   #define __Pyx_DOCSTR(n)  (n)
 #endif
+#ifndef CYTHON_INLINE
+  #if defined(__GNUC__)
+    #define CYTHON_INLINE __inline__
+  #elif defined(_MSC_VER)
+    #define CYTHON_INLINE __inline
+  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+    #define CYTHON_INLINE inline
+  #else
+    #define CYTHON_INLINE
+  #endif
+#endif
+#ifdef NAN
+#define __PYX_NAN() ((float) NAN)
+#else
+static CYTHON_INLINE float __PYX_NAN() {
+  /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and
+   a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is
+   a quiet NaN. */
+  float value;
+  memset(&value, 0xFF, sizeof(value));
+  return value;
+}
+#endif
 
 
 #if PY_MAJOR_VERSION >= 3
@@ -246,15 +295,14 @@
 #define _USE_MATH_DEFINES
 #endif
 #include <math.h>
-#define __PYX_HAVE__reconstruct
-#define __PYX_HAVE_API__reconstruct
+#define __PYX_HAVE__sparse_csr
+#define __PYX_HAVE_API__sparse_csr
+#include "string.h"
 #include "stdio.h"
 #include "stdlib.h"
 #include "numpy/arrayobject.h"
 #include "numpy/ufuncobject.h"
-#include "math.h"
 #include "pythread.h"
-#include "string.h"
 #include "pystate.h"
 #ifdef _OPENMP
 #include <omp.h>
@@ -264,21 +312,6 @@
 #define CYTHON_WITHOUT_ASSERTIONS
 #endif
 
-
-/* inline attribute */
-#ifndef CYTHON_INLINE
-  #if defined(__GNUC__)
-    #define CYTHON_INLINE __inline__
-  #elif defined(_MSC_VER)
-    #define CYTHON_INLINE __inline
-  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
-    #define CYTHON_INLINE inline
-  #else
-    #define CYTHON_INLINE
-  #endif
-#endif
-
-/* unused attribute */
 #ifndef CYTHON_UNUSED
 # if defined(__GNUC__)
 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
@@ -292,30 +325,130 @@
 #   define CYTHON_UNUSED
 # endif
 #endif
-
-typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/
-
-
-/* Type Conversion Predeclarations */
-
-#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
-#define __Pyx_PyBytes_AsUString(s)   ((unsigned char*) PyBytes_AsString(s))
-
+typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding;
+                const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/
+
+#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
+#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
+#define __PYX_DEFAULT_STRING_ENCODING ""
+#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
+#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
+static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
+static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
+#define __Pyx_PyBytes_FromString        PyBytes_FromString
+#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char*);
+#if PY_MAJOR_VERSION < 3
+    #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
+    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
+#else
+    #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
+    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
+#endif
+#define __Pyx_PyObject_AsUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
+#define __Pyx_PyObject_FromUString(s)  __Pyx_PyObject_FromString((char*)s)
+#define __Pyx_PyBytes_FromUString(s)   __Pyx_PyBytes_FromString((char*)s)
+#define __Pyx_PyStr_FromUString(s)     __Pyx_PyStr_FromString((char*)s)
+#define __Pyx_PyUnicode_FromUString(s) __Pyx_PyUnicode_FromString((char*)s)
+#if PY_MAJOR_VERSION < 3
+static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
+{
+    const Py_UNICODE *u_end = u;
+    while (*u_end++) ;
+    return u_end - u - 1;
+}
+#else
+#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
+#endif
+#define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
+#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
+#define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
 #define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
 #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
 static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
-
 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
 static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
-
 #if CYTHON_COMPILING_IN_CPYTHON
 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
 #else
 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
 #endif
 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
+#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+static int __Pyx_sys_getdefaultencoding_not_ascii;
+static int __Pyx_init_sys_getdefaultencoding_params() {
+    PyObject* sys = NULL;
+    PyObject* default_encoding = NULL;
+    PyObject* ascii_chars_u = NULL;
+    PyObject* ascii_chars_b = NULL;
+    sys = PyImport_ImportModule("sys");
+    if (sys == NULL) goto bad;
+    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
+    if (default_encoding == NULL) goto bad;
+    if (strcmp(PyBytes_AsString(default_encoding), "ascii") == 0) {
+        __Pyx_sys_getdefaultencoding_not_ascii = 0;
+    } else {
+        const char* default_encoding_c = PyBytes_AS_STRING(default_encoding);
+        char ascii_chars[128];
+        int c;
+        for (c = 0; c < 128; c++) {
+            ascii_chars[c] = c;
+        }
+        __Pyx_sys_getdefaultencoding_not_ascii = 1;
+        ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
+        if (ascii_chars_u == NULL) goto bad;
+        ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
+        if (ascii_chars_b == NULL || strncmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
+            PyErr_Format(
+                PyExc_ValueError,
+                "This module compiled with c_string_encoding=ascii, but default encoding '%s' is not a superset of ascii.",
+                default_encoding_c);
+            goto bad;
+        }
+    }
+    Py_XDECREF(sys);
+    Py_XDECREF(default_encoding);
+    Py_XDECREF(ascii_chars_u);
+    Py_XDECREF(ascii_chars_b);
+    return 0;
+bad:
+    Py_XDECREF(sys);
+    Py_XDECREF(default_encoding);
+    Py_XDECREF(ascii_chars_u);
+    Py_XDECREF(ascii_chars_b);
+    return -1;
+}
+#endif
+#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
+#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
+#else
+#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
+#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
+static char* __PYX_DEFAULT_STRING_ENCODING;
+static int __Pyx_init_sys_getdefaultencoding_params() {
+    PyObject* sys = NULL;
+    PyObject* default_encoding = NULL;
+    char* default_encoding_c;
+    sys = PyImport_ImportModule("sys");
+    if (sys == NULL) goto bad;
+    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
+    if (default_encoding == NULL) goto bad;
+    default_encoding_c = PyBytes_AS_STRING(default_encoding);
+    __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
+    strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
+    Py_DECREF(sys);
+    Py_DECREF(default_encoding);
+    return 0;
+bad:
+    Py_XDECREF(sys);
+    Py_XDECREF(default_encoding);
+    return -1;
+}
+#endif
+#endif
+
 
 #ifdef __GNUC__
   /* Test for GCC > 2.95 */
@@ -330,8 +463,9 @@ static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
   #define likely(x)   (x)
   #define unlikely(x) (x)
 #endif /* __GNUC__ */
-    
+
 static PyObject *__pyx_m;
+static PyObject *__pyx_d;
 static PyObject *__pyx_b;
 static PyObject *__pyx_empty_tuple;
 static PyObject *__pyx_empty_bytes;
@@ -363,7 +497,7 @@ static const char *__pyx_filename;
 
 
 static const char *__pyx_f[] = {
-  "reconstruct.pyx",
+  "sparse_csr.pyx",
   "numpy.pxd",
   "stringsource",
   "type.pxd",
@@ -417,10 +551,9 @@ typedef struct {
     #define CYTHON_ATOMICS 1
 #endif
 #define __pyx_atomic_int_type int
-/* todo: Portland pgcc, maybe OS X's OSAtomicIncrement32,
-   libatomic + autotools-like distutils support? Such a pain... */
-#if CYTHON_ATOMICS && __GNUC__ >= 4 && (__GNUC_MINOR__ > 1 || \
-                    (__GNUC_MINOR__ == 1 && __GNUC_PATHLEVEL >= 2))
+#if CYTHON_ATOMICS && __GNUC__ >= 4 && (__GNUC_MINOR__ > 1 ||           \
+                    (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL >= 2)) && \
+                    !defined(__i386__)
     #define __pyx_atomic_incr_aligned(value, lock) __sync_fetch_and_add(value, 1)
     #define __pyx_atomic_decr_aligned(value, lock) __sync_fetch_and_sub(value, 1)
     #ifdef __PYX_DEBUG_ATOMICS
@@ -876,19 +1009,44 @@ static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice;
 #define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
 #define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
 
-static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
-
-static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/
-
-static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \
-    PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \
-    const char* function_name); /*proto*/
-
-static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
-    Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
+    PyTypeObject* tp = Py_TYPE(obj);
+    if (likely(tp->tp_getattro))
+        return tp->tp_getattro(obj, attr_name);
+#if PY_MAJOR_VERSION < 3
+    if (likely(tp->tp_getattr))
+        return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
+#endif
+    return PyObject_GetAttr(obj, attr_name);
+}
+#else
+#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
+#endif
 
-static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
-    const char *name, int exact); /*proto*/
+static PyObject *__Pyx_GetBuiltinName(PyObject *name); /*proto*/
+
+#define __Pyx_GetItemInt(o, i, size, to_py_func, is_list, wraparound, boundscheck) \
+    (((size) <= sizeof(Py_ssize_t)) ? \
+    __Pyx_GetItemInt_Fast(o, i, is_list, wraparound, boundscheck) : \
+    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
+#define __Pyx_GetItemInt_List(o, i, size, to_py_func, is_list, wraparound, boundscheck) \
+    (((size) <= sizeof(Py_ssize_t)) ? \
+    __Pyx_GetItemInt_List_Fast(o, i, wraparound, boundscheck) : \
+    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
+                                                              int wraparound, int boundscheck);
+#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func, is_list, wraparound, boundscheck) \
+    (((size) <= sizeof(Py_ssize_t)) ? \
+    __Pyx_GetItemInt_Tuple_Fast(o, i, wraparound, boundscheck) : \
+    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
+                                                              int wraparound, int boundscheck);
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
+                                                     int is_list, int wraparound, int boundscheck);
+
+static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); /*proto*/
 
 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/
 
@@ -896,14 +1054,13 @@ static CYTHON_INLINE int  __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* o
     __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack);
 static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);
 
-static void __Pyx_RaiseBufferFallbackError(void); /*proto*/
-
-#include <string.h>
-void __pyx_init_nan(void);
-static float __PYX_NAN;
+static void __Pyx_RaiseBufferIndexError(int axis); /*proto*/
 
-#define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1)
-static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
+#define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0)
+static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(
+        PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop,
+        PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
+        int has_cstart, int has_cstop, int wraparound);
 
 #define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d
 #define __Pyx_MEMVIEW_DIRECT   1
@@ -914,24 +1071,15 @@ static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
 #define __Pyx_MEMVIEW_FOLLOW   32
 #define __Pyx_IS_C_CONTIG 1
 #define __Pyx_IS_F_CONTIG 2
-static int __Pyx_ValidateAndInit_memviewslice(
-                int *axes_specs,
-                int c_or_f_flag,
-                int buf_flags,
-                int ndim,
-                __Pyx_TypeInfo *dtype,
-                __Pyx_BufFmt_StackElem stack[],
-                __Pyx_memviewslice *memviewslice,
-                PyObject *original_obj);
 static int __Pyx_init_memviewslice(
                 struct __pyx_memoryview_obj *memview,
                 int ndim,
                 __Pyx_memviewslice *memviewslice,
                 int memview_is_new_reference);
-static CYTHON_INLINE int __pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
-                                                            PyThread_type_lock lock);
-static CYTHON_INLINE int __pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
-                                                            PyThread_type_lock lock);
+static CYTHON_INLINE int __pyx_add_acquisition_count_locked(
+    __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
+static CYTHON_INLINE int __pyx_sub_acquisition_count_locked(
+    __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
 #define __pyx_get_slice_count_pointer(memview) (memview->acquisition_count_aligned_p)
 #define __pyx_get_slice_count(memview) (*__pyx_get_slice_count_pointer(memview))
 #define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__)
@@ -954,13 +1102,31 @@ static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/
 
 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/
 
+static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
+    Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/
+
+static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/
+
+static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \
+    PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \
+    const char* function_name); /*proto*/
+
+static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
+    const char *name, int exact); /*proto*/
+
+static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); /*proto*/
+
 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); /*proto*/
 
 static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t); /* proto */
 
+#ifndef __PYX_FORCE_INIT_THREADS
+  #define __PYX_FORCE_INIT_THREADS 0
+#endif
+
 #define UNARY_NEG_WOULD_OVERFLOW(x)            (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))
 
-static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
+static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/
 
 static PyObject *get_memview(PyObject *__pyx_v_self); /*proto*/
@@ -973,98 +1139,12 @@ static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
 
 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
 
-static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
-    PyObject *r;
-    if (!j) return NULL;
-    r = PyObject_GetItem(o, j);
-    Py_DECREF(j);
-    return r;
-}
-#define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
-                                                    __Pyx_GetItemInt_List_Fast(o, i) : \
-                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
-static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) {
-#if CYTHON_COMPILING_IN_CPYTHON
-    if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
-        PyObject *r = PyList_GET_ITEM(o, i);
-        Py_INCREF(r);
-        return r;
-    }
-    else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
-        PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
-        Py_INCREF(r);
-        return r;
-    }
-    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
-#else
-    return PySequence_GetItem(o, i);
-#endif
-}
-#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
-                                                    __Pyx_GetItemInt_Tuple_Fast(o, i) : \
-                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
-static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) {
-#if CYTHON_COMPILING_IN_CPYTHON
-    if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
-        PyObject *r = PyTuple_GET_ITEM(o, i);
-        Py_INCREF(r);
-        return r;
-    }
-    else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
-        PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
-        Py_INCREF(r);
-        return r;
-    }
-    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
-#else
-    return PySequence_GetItem(o, i);
-#endif
-}
-#define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
-                                                    __Pyx_GetItemInt_Fast(o, i) : \
-                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
-static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) {
-#if CYTHON_COMPILING_IN_CPYTHON
-    if (PyList_CheckExact(o)) {
-        Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
-        if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) {
-            PyObject *r = PyList_GET_ITEM(o, n);
-            Py_INCREF(r);
-            return r;
-        }
-    }
-    else if (PyTuple_CheckExact(o)) {
-        Py_ssize_t n = (likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
-        if (likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
-            PyObject *r = PyTuple_GET_ITEM(o, n);
-            Py_INCREF(r);
-            return r;
-        }
-    } else {  /* inlined PySequence_GetItem() */
-        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
-        if (likely(m && m->sq_item)) {
-            if (unlikely(i < 0) && likely(m->sq_length)) {
-                Py_ssize_t l = m->sq_length(o);
-                if (unlikely(l < 0)) return NULL;
-                i += l;
-            }
-            return m->sq_item(o, i);
-        }
-    }
-#else
-    if (PySequence_Check(o)) {
-        return PySequence_GetItem(o, i);
-    }
-#endif
-    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
-}
-
-static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
+static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
 static PyObject *__pyx_memoryview_transpose(PyObject *__pyx_v_self); /*proto*/
 static PyObject *__pyx_memoryview__get__base(PyObject *__pyx_v_self); /*proto*/
 static PyObject *__pyx_memoryview_get_shape(PyObject *__pyx_v_self); /*proto*/
 #if CYTHON_COMPILING_IN_CPYTHON
-static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
+static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
     PyListObject* L = (PyListObject*) list;
     Py_ssize_t len = Py_SIZE(list);
     if (likely(L->allocated > len)) {
@@ -1076,7 +1156,7 @@ static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
     return PyList_Append(list, x);
 }
 #else
-#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
+#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
 #endif
 
 static PyObject *__pyx_memoryview_get_strides(PyObject *__pyx_v_self); /*proto*/
@@ -1085,12 +1165,24 @@ static PyObject *__pyx_memoryview_get_ndim(PyObject *__pyx_v_self); /*proto*/
 static PyObject *__pyx_memoryview_get_itemsize(PyObject *__pyx_v_self); /*proto*/
 static PyObject *__pyx_memoryview_get_nbytes(PyObject *__pyx_v_self); /*proto*/
 static PyObject *__pyx_memoryview_get_size(PyObject *__pyx_v_self); /*proto*/
-static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
-
-#ifndef __PYX_FORCE_INIT_THREADS
-  #define __PYX_FORCE_INIT_THREADS 0
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
+    PyListObject* L = (PyListObject*) list;
+    Py_ssize_t len = Py_SIZE(list);
+    if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
+        Py_INCREF(x);
+        PyList_SET_ITEM(list, len, x);
+        Py_SIZE(list) = len+1;
+        return 0;
+    }
+    return PyList_Append(list, x);
+}
+#else
+#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
 #endif
 
+static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
+
 static CYTHON_INLINE long __Pyx_div_long(long, long); /* proto */
 
 static PyObject *__pyx_memoryviewslice__get__base(PyObject *__pyx_v_self); /*proto*/
@@ -1119,9 +1211,11 @@ typedef struct {
 static Py_ssize_t __Pyx_zeros[] = {0, 0, 0, 0, 0, 0, 0, 0};
 static Py_ssize_t __Pyx_minusones[] = {-1, -1, -1, -1, -1, -1, -1, -1};
 
-static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/
+static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /*proto*/
+
+static CYTHON_INLINE npy_uint32 __Pyx_PyInt_from_py_npy_uint32(PyObject *);
 
-static CYTHON_INLINE size_t __Pyx_pow_size_t(size_t, size_t); /* proto */
+static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_uint32(npy_uint32);
 
 #if CYTHON_CCOMPLEX
   #ifdef __cplusplus
@@ -1271,10 +1365,22 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);
 
 static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);
 
-static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_float(PyObject *);
+static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
+
+static int __Pyx_ValidateAndInit_memviewslice(
+                int *axes_specs,
+                int c_or_f_flag,
+                int buf_flags,
+                int ndim,
+                __Pyx_TypeInfo *dtype,
+                __Pyx_BufFmt_StackElem stack[],
+                __Pyx_memviewslice *memviewslice,
+                PyObject *original_obj);
 
 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_int(PyObject *);
 
+static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_float(PyObject *);
+
 static void __Pyx_WriteUnraisable(const char *name, int clineno,
                                   int lineno, const char *filename); /*proto*/
 
@@ -1322,6 +1428,8 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
 
 /* Module declarations from 'cpython.ref' */
 
+/* Module declarations from 'libc.string' */
+
 /* Module declarations from 'libc.stdio' */
 
 /* Module declarations from 'cpython.object' */
@@ -1343,9 +1451,7 @@ static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
 static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
 static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/
 
-/* Module declarations from 'libc.math' */
-
-/* Module declarations from 'reconstruct' */
+/* Module declarations from 'sparse_csr' */
 static PyTypeObject *__pyx_array_type = 0;
 static PyTypeObject *__pyx_MemviewEnum_type = 0;
 static PyTypeObject *__pyx_memoryview_type = 0;
@@ -1355,12 +1461,10 @@ static PyObject *strided = 0;
 static PyObject *indirect = 0;
 static PyObject *contiguous = 0;
 static PyObject *indirect_contiguous = 0;
-static float __pyx_f_11reconstruct_invert_distance(size_t, size_t, size_t, size_t); /*proto*/
-static float __pyx_f_11reconstruct_processPoint(__Pyx_memviewslice, __Pyx_memviewslice, size_t, size_t, size_t, size_t); /*proto*/
 static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/
 static void *__pyx_align_pointer(void *, size_t); /*proto*/
 static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo *); /*proto*/
-static int __pyx_memoryview_check(PyObject *); /*proto*/
+static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/
 static PyObject *_unellipsify(PyObject *, int); /*proto*/
 static PyObject *assert_direct_dimensions(Py_ssize_t *, int); /*proto*/
 static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/
@@ -1390,12 +1494,13 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *, Py_ssize_t *, Py_
 static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size_t, void *, int); /*proto*/
 static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/
 static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t = { "float32_t", NULL, sizeof(__pyx_t_5numpy_float32_t), { 0 }, 0, 'R', 0, 0 };
+static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_uint32_t = { "uint32_t", NULL, sizeof(__pyx_t_5numpy_uint32_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_5numpy_uint32_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_5numpy_uint32_t), 0 };
+static __Pyx_TypeInfo __Pyx_TypeInfo_int = { "int", NULL, sizeof(int), { 0 }, 0, IS_UNSIGNED(int) ? 'U' : 'I', IS_UNSIGNED(int), 0 };
 static __Pyx_TypeInfo __Pyx_TypeInfo_float = { "float", NULL, sizeof(float), { 0 }, 0, 'R', 0, 0 };
-static __Pyx_TypeInfo __Pyx_TypeInfo_int = { "bint", NULL, sizeof(int), { 0 }, 0, IS_UNSIGNED(int) ? 'U' : 'I', IS_UNSIGNED(int), 0 };
-#define __Pyx_MODULE_NAME "reconstruct"
-int __pyx_module_is_main_reconstruct = 0;
+#define __Pyx_MODULE_NAME "sparse_csr"
+int __pyx_module_is_main_sparse_csr = 0;
 
-/* Implementation of 'reconstruct' */
+/* Implementation of 'sparse_csr' */
 static PyObject *__pyx_builtin_range;
 static PyObject *__pyx_builtin_ValueError;
 static PyObject *__pyx_builtin_RuntimeError;
@@ -1406,7 +1511,7 @@ static PyObject *__pyx_builtin_TypeError;
 static PyObject *__pyx_builtin_xrange;
 static PyObject *__pyx_builtin_id;
 static PyObject *__pyx_builtin_IndexError;
-static PyObject *__pyx_pf_11reconstruct_reconstruct(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_data, PyArrayObject *__pyx_v_mask, PyObject *__pyx_v_dummy, PyObject *__pyx_v_delta_dummy); /* proto */
+static PyObject *__pyx_pf_10sparse_csr_LUT_to_CSR(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_lut); /* proto */
 static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
 static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */
 static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer); /* proto */
@@ -1441,12 +1546,17 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_20copy(struct __pyx_me
 static PyObject *__pyx_memoryview_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
 static void __pyx_memoryviewslice_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
 static PyObject *__pyx_memoryviewslice__get__base_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
-static char __pyx_k_2[] = "ndarray is not C contiguous";
-static char __pyx_k_4[] = "ndarray is not Fortran contiguous";
-static char __pyx_k_6[] = "Non-native byte order not supported";
-static char __pyx_k_8[] = "unknown dtype code in numpy.pxd (%d)";
-static char __pyx_k_9[] = "Format string allocated too short, see comment in numpy.pxd";
-static char __pyx_k_12[] = "Format string allocated too short.";
+static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static char __pyx_k_1[] = "ndarray is not C contiguous";
+static char __pyx_k_3[] = "ndarray is not Fortran contiguous";
+static char __pyx_k_5[] = "Non-native byte order not supported";
+static char __pyx_k_7[] = "unknown dtype code in numpy.pxd (%d)";
+static char __pyx_k_8[] = "Format string allocated too short, see comment in numpy.pxd";
+static char __pyx_k_11[] = "Format string allocated too short.";
+static char __pyx_k_13[] = "unknown dtype code substructure in numpy.pxd (%d)";
 static char __pyx_k_14[] = "Empty shape tuple for cython.array";
 static char __pyx_k_16[] = "itemsize <= 0 for cython.array";
 static char __pyx_k_19[] = "unable to allocate shape or strides.";
@@ -1467,7 +1577,7 @@ static char __pyx_k_43[] = "Out of bounds on buffer access (axis %d)";
 static char __pyx_k_44[] = "Cannot transpose memoryview with indirect dimensions";
 static char __pyx_k_45[] = "got differing extents in dimension %d (got %d and %d)";
 static char __pyx_k_46[] = "Dimension %d is not direct";
-static char __pyx_k_49[] = "/users/kieffer/workspace-ssd/pyFAI/src/reconstruct.pyx";
+static char __pyx_k_49[] = "/users/kieffer/workspace-ssd/pyFAI/src/sparse_csr.pyx";
 static char __pyx_k_50[] = "getbuffer(obj, view, flags)";
 static char __pyx_k_51[] = "<strided and direct or indirect>";
 static char __pyx_k_53[] = "<strided and direct>";
@@ -1487,52 +1597,50 @@ static char __pyx_k__f[] = "f";
 static char __pyx_k__g[] = "g";
 static char __pyx_k__h[] = "h";
 static char __pyx_k__i[] = "i";
+static char __pyx_k__j[] = "j";
 static char __pyx_k__l[] = "l";
 static char __pyx_k__q[] = "q";
 static char __pyx_k__Zd[] = "Zd";
 static char __pyx_k__Zf[] = "Zf";
 static char __pyx_k__Zg[] = "Zg";
-static char __pyx_k__d0[] = "d0";
-static char __pyx_k__d1[] = "d1";
 static char __pyx_k__id[] = "id";
-static char __pyx_k__p0[] = "p0";
-static char __pyx_k__p1[] = "p1";
+static char __pyx_k__idx[] = "idx";
+static char __pyx_k__lut[] = "lut";
+static char __pyx_k__num[] = "num";
 static char __pyx_k__obj[] = "obj";
-static char __pyx_k__out[] = "out";
 static char __pyx_k__base[] = "base";
+static char __pyx_k__coef[] = "coef";
 static char __pyx_k__data[] = "data";
-static char __pyx_k__int8[] = "int8";
-static char __pyx_k__mask[] = "mask";
 static char __pyx_k__mode[] = "mode";
 static char __pyx_k__name[] = "name";
+static char __pyx_k__ncol[] = "ncol";
 static char __pyx_k__ndim[] = "ndim";
+static char __pyx_k__nelt[] = "nelt";
+static char __pyx_k__nrow[] = "nrow";
 static char __pyx_k__pack[] = "pack";
 static char __pyx_k__size[] = "size";
 static char __pyx_k__step[] = "step";
 static char __pyx_k__stop[] = "stop";
 static char __pyx_k__ASCII[] = "ASCII";
-static char __pyx_k__cdata[] = "cdata";
-static char __pyx_k__cmask[] = "cmask";
-static char __pyx_k__dtype[] = "dtype";
-static char __pyx_k__dummy[] = "dummy";
 static char __pyx_k__error[] = "error";
 static char __pyx_k__flags[] = "flags";
-static char __pyx_k__int32[] = "int32";
 static char __pyx_k__numpy[] = "numpy";
 static char __pyx_k__range[] = "range";
 static char __pyx_k__shape[] = "shape";
 static char __pyx_k__start[] = "start";
 static char __pyx_k__zeros[] = "zeros";
-static char __pyx_k__astype[] = "astype";
 static char __pyx_k__decode[] = "decode";
 static char __pyx_k__encode[] = "encode";
 static char __pyx_k__extend[] = "extend";
 static char __pyx_k__format[] = "format";
+static char __pyx_k__indptr[] = "indptr";
 static char __pyx_k__struct[] = "struct";
+static char __pyx_k__uint32[] = "uint32";
 static char __pyx_k__unpack[] = "unpack";
 static char __pyx_k__xrange[] = "xrange";
 static char __pyx_k__float32[] = "float32";
 static char __pyx_k__fortran[] = "fortran";
+static char __pyx_k__indices[] = "indices";
 static char __pyx_k__memview[] = "memview";
 static char __pyx_k__Ellipsis[] = "Ellipsis";
 static char __pyx_k____main__[] = "__main__";
@@ -1543,73 +1651,69 @@ static char __pyx_k__TypeError[] = "TypeError";
 static char __pyx_k____class__[] = "__class__";
 static char __pyx_k__enumerate[] = "enumerate";
 static char __pyx_k__IndexError[] = "IndexError";
+static char __pyx_k__LUT_to_CSR[] = "LUT_to_CSR";
 static char __pyx_k__ValueError[] = "ValueError";
-static char __pyx_k__zeros_like[] = "zeros_like";
+static char __pyx_k____import__[] = "__import__";
+static char __pyx_k__sparse_csr[] = "sparse_csr";
 static char __pyx_k__MemoryError[] = "MemoryError";
-static char __pyx_k__delta_dummy[] = "delta_dummy";
-static char __pyx_k__reconstruct[] = "reconstruct";
 static char __pyx_k__RuntimeError[] = "RuntimeError";
 static char __pyx_k____pyx_getbuffer[] = "__pyx_getbuffer";
 static char __pyx_k__allocate_buffer[] = "allocate_buffer";
 static char __pyx_k__dtype_is_object[] = "dtype_is_object";
-static char __pyx_k__ascontiguousarray[] = "ascontiguousarray";
-static PyObject *__pyx_kp_u_12;
+static char __pyx_k____pyx_releasebuffer[] = "__pyx_releasebuffer";
+static PyObject *__pyx_kp_u_1;
+static PyObject *__pyx_kp_u_11;
+static PyObject *__pyx_kp_u_13;
 static PyObject *__pyx_kp_s_14;
 static PyObject *__pyx_kp_s_16;
 static PyObject *__pyx_kp_s_19;
-static PyObject *__pyx_kp_u_2;
 static PyObject *__pyx_kp_s_21;
 static PyObject *__pyx_kp_s_22;
 static PyObject *__pyx_kp_s_24;
 static PyObject *__pyx_kp_s_26;
 static PyObject *__pyx_kp_s_28;
+static PyObject *__pyx_kp_u_3;
 static PyObject *__pyx_kp_s_30;
 static PyObject *__pyx_kp_s_32;
 static PyObject *__pyx_kp_s_33;
 static PyObject *__pyx_kp_s_36;
 static PyObject *__pyx_kp_s_38;
-static PyObject *__pyx_kp_u_4;
 static PyObject *__pyx_kp_s_43;
 static PyObject *__pyx_kp_s_45;
 static PyObject *__pyx_kp_s_49;
+static PyObject *__pyx_kp_u_5;
 static PyObject *__pyx_kp_s_51;
 static PyObject *__pyx_kp_s_53;
 static PyObject *__pyx_kp_s_55;
 static PyObject *__pyx_kp_s_57;
 static PyObject *__pyx_kp_s_59;
-static PyObject *__pyx_kp_u_6;
+static PyObject *__pyx_kp_u_7;
 static PyObject *__pyx_kp_u_8;
-static PyObject *__pyx_kp_u_9;
 static PyObject *__pyx_n_s__ASCII;
 static PyObject *__pyx_n_s__Ellipsis;
 static PyObject *__pyx_n_s__IndexError;
+static PyObject *__pyx_n_s__LUT_to_CSR;
 static PyObject *__pyx_n_s__MemoryError;
 static PyObject *__pyx_n_b__O;
 static PyObject *__pyx_n_s__RuntimeError;
 static PyObject *__pyx_n_s__TypeError;
 static PyObject *__pyx_n_s__ValueError;
 static PyObject *__pyx_n_s____class__;
+static PyObject *__pyx_n_s____import__;
 static PyObject *__pyx_n_s____main__;
 static PyObject *__pyx_n_s____name__;
 static PyObject *__pyx_n_s____pyx_getbuffer;
+static PyObject *__pyx_n_s____pyx_releasebuffer;
 static PyObject *__pyx_n_s____test__;
 static PyObject *__pyx_n_s__allocate_buffer;
-static PyObject *__pyx_n_s__ascontiguousarray;
-static PyObject *__pyx_n_s__astype;
 static PyObject *__pyx_n_s__base;
 static PyObject *__pyx_n_b__c;
 static PyObject *__pyx_n_s__c;
 static PyObject *__pyx_n_u__c;
-static PyObject *__pyx_n_s__cdata;
-static PyObject *__pyx_n_s__cmask;
-static PyObject *__pyx_n_s__d0;
-static PyObject *__pyx_n_s__d1;
+static PyObject *__pyx_n_s__coef;
 static PyObject *__pyx_n_s__data;
 static PyObject *__pyx_n_s__decode;
-static PyObject *__pyx_n_s__delta_dummy;
-static PyObject *__pyx_n_s__dtype;
 static PyObject *__pyx_n_s__dtype_is_object;
-static PyObject *__pyx_n_s__dummy;
 static PyObject *__pyx_n_s__encode;
 static PyObject *__pyx_n_s__enumerate;
 static PyObject *__pyx_n_s__error;
@@ -1621,44 +1725,45 @@ static PyObject *__pyx_n_b__fortran;
 static PyObject *__pyx_n_s__fortran;
 static PyObject *__pyx_n_s__i;
 static PyObject *__pyx_n_s__id;
-static PyObject *__pyx_n_s__int32;
-static PyObject *__pyx_n_s__int8;
+static PyObject *__pyx_n_s__idx;
+static PyObject *__pyx_n_s__indices;
+static PyObject *__pyx_n_s__indptr;
 static PyObject *__pyx_n_s__itemsize;
-static PyObject *__pyx_n_s__l;
-static PyObject *__pyx_n_s__mask;
+static PyObject *__pyx_n_s__j;
+static PyObject *__pyx_n_s__lut;
 static PyObject *__pyx_n_s__memview;
 static PyObject *__pyx_n_s__mode;
 static PyObject *__pyx_n_s__name;
+static PyObject *__pyx_n_s__ncol;
 static PyObject *__pyx_n_s__ndim;
+static PyObject *__pyx_n_s__nelt;
+static PyObject *__pyx_n_s__nrow;
+static PyObject *__pyx_n_s__num;
 static PyObject *__pyx_n_s__numpy;
 static PyObject *__pyx_n_s__obj;
-static PyObject *__pyx_n_s__out;
-static PyObject *__pyx_n_s__p0;
-static PyObject *__pyx_n_s__p1;
 static PyObject *__pyx_n_s__pack;
 static PyObject *__pyx_n_s__range;
-static PyObject *__pyx_n_s__reconstruct;
 static PyObject *__pyx_n_s__shape;
 static PyObject *__pyx_n_s__size;
+static PyObject *__pyx_n_s__sparse_csr;
 static PyObject *__pyx_n_s__start;
 static PyObject *__pyx_n_s__step;
 static PyObject *__pyx_n_s__stop;
 static PyObject *__pyx_n_s__struct;
+static PyObject *__pyx_n_s__uint32;
 static PyObject *__pyx_n_s__unpack;
 static PyObject *__pyx_n_s__xrange;
 static PyObject *__pyx_n_s__zeros;
-static PyObject *__pyx_n_s__zeros_like;
 static PyObject *__pyx_int_0;
 static PyObject *__pyx_int_1;
 static PyObject *__pyx_int_neg_1;
 static PyObject *__pyx_int_15;
-static PyObject *__pyx_k_tuple_1;
-static PyObject *__pyx_k_tuple_3;
-static PyObject *__pyx_k_tuple_5;
-static PyObject *__pyx_k_tuple_7;
+static PyObject *__pyx_k_tuple_2;
+static PyObject *__pyx_k_tuple_4;
+static PyObject *__pyx_k_tuple_6;
+static PyObject *__pyx_k_tuple_9;
 static PyObject *__pyx_k_tuple_10;
-static PyObject *__pyx_k_tuple_11;
-static PyObject *__pyx_k_tuple_13;
+static PyObject *__pyx_k_tuple_12;
 static PyObject *__pyx_k_tuple_15;
 static PyObject *__pyx_k_tuple_17;
 static PyObject *__pyx_k_tuple_18;
@@ -1680,1168 +1785,503 @@ static PyObject *__pyx_k_tuple_58;
 static PyObject *__pyx_k_tuple_60;
 static PyObject *__pyx_k_codeobj_48;
 
-/* "reconstruct.pyx":8
- * from cython.parallel import prange
- * @cython.cdivision(True)
- * cdef float invert_distance(size_t i0,size_t i1, size_t p0,size_t p1)nogil:             # <<<<<<<<<<<<<<
- *     return 1./sqrt(<float>(i0-p0)**2+(i1-p1)**2)
+/* Python wrapper */
+static PyObject *__pyx_pw_10sparse_csr_1LUT_to_CSR(PyObject *__pyx_self, PyObject *__pyx_v_lut); /*proto*/
+static PyMethodDef __pyx_mdef_10sparse_csr_1LUT_to_CSR = {__Pyx_NAMESTR("LUT_to_CSR"), (PyCFunction)__pyx_pw_10sparse_csr_1LUT_to_CSR, METH_O, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pw_10sparse_csr_1LUT_to_CSR(PyObject *__pyx_self, PyObject *__pyx_v_lut) {
+  PyObject *__pyx_r = 0;
+  __Pyx_RefNannyDeclarations
+  __Pyx_RefNannySetupContext("LUT_to_CSR (wrapper)", 0);
+  __pyx_r = __pyx_pf_10sparse_csr_LUT_to_CSR(__pyx_self, ((PyObject *)__pyx_v_lut));
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "sparse_csr.pyx":31
+ * import numpy
  * 
+ * def LUT_to_CSR(lut):             # <<<<<<<<<<<<<<
+ *     cdef int[:,:] idx = lut.idx
+ *     cdef float[:,:] coef = lut.coef
  */
 
-static float __pyx_f_11reconstruct_invert_distance(size_t __pyx_v_i0, size_t __pyx_v_i1, size_t __pyx_v_p0, size_t __pyx_v_p1) {
-  float __pyx_r;
+static PyObject *__pyx_pf_10sparse_csr_LUT_to_CSR(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_lut) {
+  __Pyx_memviewslice __pyx_v_idx = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_coef = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __pyx_t_5numpy_uint32_t __pyx_v_nrow;
+  __pyx_t_5numpy_uint32_t __pyx_v_ncol;
+  __pyx_t_5numpy_uint32_t __pyx_v_nelt;
+  PyArrayObject *__pyx_v_data = 0;
+  PyArrayObject *__pyx_v_indices = 0;
+  PyArrayObject *__pyx_v_indptr = 0;
+  __pyx_t_5numpy_uint32_t __pyx_v_i;
+  __pyx_t_5numpy_uint32_t __pyx_v_j;
+  __Pyx_LocalBuf_ND __pyx_pybuffernd_data;
+  __Pyx_Buffer __pyx_pybuffer_data;
+  __Pyx_LocalBuf_ND __pyx_pybuffernd_indices;
+  __Pyx_Buffer __pyx_pybuffer_indices;
+  __Pyx_LocalBuf_ND __pyx_pybuffernd_indptr;
+  __Pyx_Buffer __pyx_pybuffer_indptr;
+  PyObject *__pyx_r = NULL;
+  __Pyx_RefNannyDeclarations
+  PyObject *__pyx_t_1 = NULL;
+  __Pyx_memviewslice __pyx_t_2 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_t_3 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  PyObject *__pyx_t_4 = NULL;
+  __pyx_t_5numpy_uint32_t __pyx_t_5;
+  PyObject *__pyx_t_6 = NULL;
+  PyObject *__pyx_t_7 = NULL;
+  PyArrayObject *__pyx_t_8 = NULL;
+  PyArrayObject *__pyx_t_9 = NULL;
+  PyArrayObject *__pyx_t_10 = NULL;
+  __pyx_t_5numpy_uint32_t __pyx_t_11;
+  __pyx_t_5numpy_uint32_t __pyx_t_12;
+  int __pyx_t_13;
+  __pyx_t_5numpy_uint32_t __pyx_t_14;
+  __pyx_t_5numpy_uint32_t __pyx_t_15;
+  __pyx_t_5numpy_uint32_t __pyx_t_16;
+  __pyx_t_5numpy_uint32_t __pyx_t_17;
+  int __pyx_t_18;
+  __pyx_t_5numpy_uint32_t __pyx_t_19;
+  __pyx_t_5numpy_uint32_t __pyx_t_20;
+  __pyx_t_5numpy_uint32_t __pyx_t_21;
+  __pyx_t_5numpy_uint32_t __pyx_t_22;
+  __pyx_t_5numpy_uint32_t __pyx_t_23;
+  __pyx_t_5numpy_uint32_t __pyx_t_24;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("LUT_to_CSR", 0);
+  __pyx_pybuffer_data.pybuffer.buf = NULL;
+  __pyx_pybuffer_data.refcount = 0;
+  __pyx_pybuffernd_data.data = NULL;
+  __pyx_pybuffernd_data.rcbuffer = &__pyx_pybuffer_data;
+  __pyx_pybuffer_indices.pybuffer.buf = NULL;
+  __pyx_pybuffer_indices.refcount = 0;
+  __pyx_pybuffernd_indices.data = NULL;
+  __pyx_pybuffernd_indices.rcbuffer = &__pyx_pybuffer_indices;
+  __pyx_pybuffer_indptr.pybuffer.buf = NULL;
+  __pyx_pybuffer_indptr.refcount = 0;
+  __pyx_pybuffernd_indptr.data = NULL;
+  __pyx_pybuffernd_indptr.rcbuffer = &__pyx_pybuffer_indptr;
+
+  /* "sparse_csr.pyx":32
+ * 
+ * def LUT_to_CSR(lut):
+ *     cdef int[:,:] idx = lut.idx             # <<<<<<<<<<<<<<
+ *     cdef float[:,:] coef = lut.coef
+ *     cdef numpy.uint32_t nrow, ncol,nelt =0
+ */
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_lut, __pyx_n_s__idx); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(__pyx_t_1);
+  if (unlikely(!__pyx_t_2.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_v_idx = __pyx_t_2;
+  __pyx_t_2.memview = NULL;
+  __pyx_t_2.data = NULL;
+
+  /* "sparse_csr.pyx":33
+ * def LUT_to_CSR(lut):
+ *     cdef int[:,:] idx = lut.idx
+ *     cdef float[:,:] coef = lut.coef             # <<<<<<<<<<<<<<
+ *     cdef numpy.uint32_t nrow, ncol,nelt =0
+ *     ncol = lut.shape[-1]
+ */
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_lut, __pyx_n_s__coef); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(__pyx_t_1);
+  if (unlikely(!__pyx_t_3.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_v_coef = __pyx_t_3;
+  __pyx_t_3.memview = NULL;
+  __pyx_t_3.data = NULL;
+
+  /* "sparse_csr.pyx":34
+ *     cdef int[:,:] idx = lut.idx
+ *     cdef float[:,:] coef = lut.coef
+ *     cdef numpy.uint32_t nrow, ncol,nelt =0             # <<<<<<<<<<<<<<
+ *     ncol = lut.shape[-1]
+ *     nrow = lut.shape[0]
+ */
+  __pyx_v_nelt = 0;
+
+  /* "sparse_csr.pyx":35
+ *     cdef float[:,:] coef = lut.coef
+ *     cdef numpy.uint32_t nrow, ncol,nelt =0
+ *     ncol = lut.shape[-1]             # <<<<<<<<<<<<<<
+ *     nrow = lut.shape[0]
+ *     cdef numpy.ndarray[numpy.float32_t, ndim=1] data = numpy.zeros(nrow*ncol,numpy.float32)
+ */
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_lut, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_5 = __Pyx_PyInt_from_py_npy_uint32(__pyx_t_4); if (unlikely((__pyx_t_5 == (npy_uint32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __pyx_v_ncol = __pyx_t_5;
 
-  /* "reconstruct.pyx":9
- * @cython.cdivision(True)
- * cdef float invert_distance(size_t i0,size_t i1, size_t p0,size_t p1)nogil:
- *     return 1./sqrt(<float>(i0-p0)**2+(i1-p1)**2)             # <<<<<<<<<<<<<<
- * 
- * @cython.cdivision(True)
+  /* "sparse_csr.pyx":36
+ *     cdef numpy.uint32_t nrow, ncol,nelt =0
+ *     ncol = lut.shape[-1]
+ *     nrow = lut.shape[0]             # <<<<<<<<<<<<<<
+ *     cdef numpy.ndarray[numpy.float32_t, ndim=1] data = numpy.zeros(nrow*ncol,numpy.float32)
+ *     cdef numpy.ndarray[numpy.uint32_t, ndim=1]  indices= numpy.zeros(nrow*ncol,numpy.uint32)
  */
-  __pyx_r = (1. / sqrt((((float)__Pyx_pow_size_t((__pyx_v_i0 - __pyx_v_p0), 2)) + __Pyx_pow_size_t((__pyx_v_i1 - __pyx_v_p1), 2))));
-  goto __pyx_L0;
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_lut, __pyx_n_s__shape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
+  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_4, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __pyx_t_5 = __Pyx_PyInt_from_py_npy_uint32(__pyx_t_1); if (unlikely((__pyx_t_5 == (npy_uint32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_v_nrow = __pyx_t_5;
 
-  __pyx_r = 0;
-  __pyx_L0:;
-  return __pyx_r;
-}
-
-/* "reconstruct.pyx":13
- * @cython.cdivision(True)
- * @cython.boundscheck(False)
- * cdef float processPoint(float[:,:] data,bint[:,:] mask,size_t p0,size_t p1,size_t d0,size_t d1)nogil:             # <<<<<<<<<<<<<<
- *     cdef size_t dist=0, i=0
- *     cdef float sum=0.0, count=0.0,invdst=0.0
- */
-
-static float __pyx_f_11reconstruct_processPoint(__Pyx_memviewslice __pyx_v_data, __Pyx_memviewslice __pyx_v_mask, size_t __pyx_v_p0, size_t __pyx_v_p1, size_t __pyx_v_d0, size_t __pyx_v_d1) {
-  size_t __pyx_v_dist;
-  size_t __pyx_v_i;
-  float __pyx_v_sum;
-  float __pyx_v_count;
-  float __pyx_v_invdst;
-  int __pyx_v_found;
-  size_t __pyx_v_start0;
-  size_t __pyx_v_stop0;
-  size_t __pyx_v_start1;
-  size_t __pyx_v_stop1;
-  float __pyx_r;
-  int __pyx_t_1;
-  size_t __pyx_t_2;
-  size_t __pyx_t_3;
-  size_t __pyx_t_4;
-  size_t __pyx_t_5;
-  size_t __pyx_t_6;
-  size_t __pyx_t_7;
-  size_t __pyx_t_8;
-  size_t __pyx_t_9;
-  size_t __pyx_t_10;
-  size_t __pyx_t_11;
-  size_t __pyx_t_12;
-  size_t __pyx_t_13;
-  size_t __pyx_t_14;
-  size_t __pyx_t_15;
-  size_t __pyx_t_16;
-  size_t __pyx_t_17;
-  size_t __pyx_t_18;
-  size_t __pyx_t_19;
-
-  /* "reconstruct.pyx":14
- * @cython.boundscheck(False)
- * cdef float processPoint(float[:,:] data,bint[:,:] mask,size_t p0,size_t p1,size_t d0,size_t d1)nogil:
- *     cdef size_t dist=0, i=0             # <<<<<<<<<<<<<<
- *     cdef float sum=0.0, count=0.0,invdst=0.0
- *     cdef bint found=0
- */
-  __pyx_v_dist = 0;
-  __pyx_v_i = 0;
-
-  /* "reconstruct.pyx":15
- * cdef float processPoint(float[:,:] data,bint[:,:] mask,size_t p0,size_t p1,size_t d0,size_t d1)nogil:
- *     cdef size_t dist=0, i=0
- *     cdef float sum=0.0, count=0.0,invdst=0.0             # <<<<<<<<<<<<<<
- *     cdef bint found=0
- *     cdef size_t start0=p0, stop0=p0, start1=p1, stop1=p1
- */
-  __pyx_v_sum = 0.0;
-  __pyx_v_count = 0.0;
-  __pyx_v_invdst = 0.0;
-
-  /* "reconstruct.pyx":16
- *     cdef size_t dist=0, i=0
- *     cdef float sum=0.0, count=0.0,invdst=0.0
- *     cdef bint found=0             # <<<<<<<<<<<<<<
- *     cdef size_t start0=p0, stop0=p0, start1=p1, stop1=p1
- *     while not found:
- */
-  __pyx_v_found = 0;
-
-  /* "reconstruct.pyx":17
- *     cdef float sum=0.0, count=0.0,invdst=0.0
- *     cdef bint found=0
- *     cdef size_t start0=p0, stop0=p0, start1=p1, stop1=p1             # <<<<<<<<<<<<<<
- *     while not found:
- *         dist+=1
- */
-  __pyx_v_start0 = __pyx_v_p0;
-  __pyx_v_stop0 = __pyx_v_p0;
-  __pyx_v_start1 = __pyx_v_p1;
-  __pyx_v_stop1 = __pyx_v_p1;
-
-  /* "reconstruct.pyx":18
- *     cdef bint found=0
- *     cdef size_t start0=p0, stop0=p0, start1=p1, stop1=p1
- *     while not found:             # <<<<<<<<<<<<<<
- *         dist+=1
- *         if start0>0:
- */
-  while (1) {
-    __pyx_t_1 = (!__pyx_v_found);
-    if (!__pyx_t_1) break;
-
-    /* "reconstruct.pyx":19
- *     cdef size_t start0=p0, stop0=p0, start1=p1, stop1=p1
- *     while not found:
- *         dist+=1             # <<<<<<<<<<<<<<
- *         if start0>0:
- *             start0=p0-dist
- */
-    __pyx_v_dist = (__pyx_v_dist + 1);
-
-    /* "reconstruct.pyx":20
- *     while not found:
- *         dist+=1
- *         if start0>0:             # <<<<<<<<<<<<<<
- *             start0=p0-dist
- *         else:
- */
-    __pyx_t_1 = (__pyx_v_start0 > 0);
-    if (__pyx_t_1) {
-
-      /* "reconstruct.pyx":21
- *         dist+=1
- *         if start0>0:
- *             start0=p0-dist             # <<<<<<<<<<<<<<
- *         else:
- *             start0=0
- */
-      __pyx_v_start0 = (__pyx_v_p0 - __pyx_v_dist);
-      goto __pyx_L5;
-    }
-    /*else*/ {
-
-      /* "reconstruct.pyx":23
- *             start0=p0-dist
- *         else:
- *             start0=0             # <<<<<<<<<<<<<<
- *         if stop0<d0-1:
- *             stop0=p0+dist
- */
-      __pyx_v_start0 = 0;
-    }
-    __pyx_L5:;
-
-    /* "reconstruct.pyx":24
- *         else:
- *             start0=0
- *         if stop0<d0-1:             # <<<<<<<<<<<<<<
- *             stop0=p0+dist
- *         else:
- */
-    __pyx_t_1 = (__pyx_v_stop0 < (__pyx_v_d0 - 1));
-    if (__pyx_t_1) {
-
-      /* "reconstruct.pyx":25
- *             start0=0
- *         if stop0<d0-1:
- *             stop0=p0+dist             # <<<<<<<<<<<<<<
- *         else:
- *             stop0=d0-1
- */
-      __pyx_v_stop0 = (__pyx_v_p0 + __pyx_v_dist);
-      goto __pyx_L6;
-    }
-    /*else*/ {
-
-      /* "reconstruct.pyx":27
- *             stop0=p0+dist
- *         else:
- *             stop0=d0-1             # <<<<<<<<<<<<<<
- *         if start1>0:
- *             start1=p1-dist
- */
-      __pyx_v_stop0 = (__pyx_v_d0 - 1);
-    }
-    __pyx_L6:;
-
-    /* "reconstruct.pyx":28
- *         else:
- *             stop0=d0-1
- *         if start1>0:             # <<<<<<<<<<<<<<
- *             start1=p1-dist
- *         else:
- */
-    __pyx_t_1 = (__pyx_v_start1 > 0);
-    if (__pyx_t_1) {
-
-      /* "reconstruct.pyx":29
- *             stop0=d0-1
- *         if start1>0:
- *             start1=p1-dist             # <<<<<<<<<<<<<<
- *         else:
- *             start1=0
- */
-      __pyx_v_start1 = (__pyx_v_p1 - __pyx_v_dist);
-      goto __pyx_L7;
-    }
-    /*else*/ {
-
-      /* "reconstruct.pyx":31
- *             start1=p1-dist
- *         else:
- *             start1=0             # <<<<<<<<<<<<<<
- *         if stop1<d1-1:
- *             stop1=p1+dist
- */
-      __pyx_v_start1 = 0;
-    }
-    __pyx_L7:;
-
-    /* "reconstruct.pyx":32
- *         else:
- *             start1=0
- *         if stop1<d1-1:             # <<<<<<<<<<<<<<
- *             stop1=p1+dist
- *         else:
- */
-    __pyx_t_1 = (__pyx_v_stop1 < (__pyx_v_d1 - 1));
-    if (__pyx_t_1) {
-
-      /* "reconstruct.pyx":33
- *             start1=0
- *         if stop1<d1-1:
- *             stop1=p1+dist             # <<<<<<<<<<<<<<
- *         else:
- *             stop1=d1-1
- */
-      __pyx_v_stop1 = (__pyx_v_p1 + __pyx_v_dist);
-      goto __pyx_L8;
-    }
-    /*else*/ {
-
-      /* "reconstruct.pyx":35
- *             stop1=p1+dist
- *         else:
- *             stop1=d1-1             # <<<<<<<<<<<<<<
- *         for i in range(start0,stop0+1):
- *             if mask[i,start1]==0:
- */
-      __pyx_v_stop1 = (__pyx_v_d1 - 1);
-    }
-    __pyx_L8:;
-
-    /* "reconstruct.pyx":36
- *         else:
- *             stop1=d1-1
- *         for i in range(start0,stop0+1):             # <<<<<<<<<<<<<<
- *             if mask[i,start1]==0:
- *                 invdst=invert_distance(i,start1,p0,p1)
- */
-    __pyx_t_2 = (__pyx_v_stop0 + 1);
-    for (__pyx_t_3 = __pyx_v_start0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
-      __pyx_v_i = __pyx_t_3;
-
-      /* "reconstruct.pyx":37
- *             stop1=d1-1
- *         for i in range(start0,stop0+1):
- *             if mask[i,start1]==0:             # <<<<<<<<<<<<<<
- *                 invdst=invert_distance(i,start1,p0,p1)
- *                 count+=invdst
- */
-      __pyx_t_4 = __pyx_v_i;
-      __pyx_t_5 = __pyx_v_start1;
-      __pyx_t_1 = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mask.data + __pyx_t_4 * __pyx_v_mask.strides[0]) ) + __pyx_t_5 * __pyx_v_mask.strides[1]) ))) == 0);
-      if (__pyx_t_1) {
-
-        /* "reconstruct.pyx":38
- *         for i in range(start0,stop0+1):
- *             if mask[i,start1]==0:
- *                 invdst=invert_distance(i,start1,p0,p1)             # <<<<<<<<<<<<<<
- *                 count+=invdst
- *                 sum+=invdst*data[i,start1]
- */
-        __pyx_v_invdst = __pyx_f_11reconstruct_invert_distance(__pyx_v_i, __pyx_v_start1, __pyx_v_p0, __pyx_v_p1);
-
-        /* "reconstruct.pyx":39
- *             if mask[i,start1]==0:
- *                 invdst=invert_distance(i,start1,p0,p1)
- *                 count+=invdst             # <<<<<<<<<<<<<<
- *                 sum+=invdst*data[i,start1]
- *             if mask[i,stop1]==0:
- */
-        __pyx_v_count = (__pyx_v_count + __pyx_v_invdst);
-
-        /* "reconstruct.pyx":40
- *                 invdst=invert_distance(i,start1,p0,p1)
- *                 count+=invdst
- *                 sum+=invdst*data[i,start1]             # <<<<<<<<<<<<<<
- *             if mask[i,stop1]==0:
- *                 invdst=invert_distance(i,stop1,p0,p1)
- */
-        __pyx_t_6 = __pyx_v_i;
-        __pyx_t_7 = __pyx_v_start1;
-        __pyx_v_sum = (__pyx_v_sum + (__pyx_v_invdst * (*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_data.data + __pyx_t_6 * __pyx_v_data.strides[0]) ) + __pyx_t_7 * __pyx_v_data.strides[1]) )))));
-        goto __pyx_L11;
-      }
-      __pyx_L11:;
-
-      /* "reconstruct.pyx":41
- *                 count+=invdst
- *                 sum+=invdst*data[i,start1]
- *             if mask[i,stop1]==0:             # <<<<<<<<<<<<<<
- *                 invdst=invert_distance(i,stop1,p0,p1)
- *                 count+=invdst
- */
-      __pyx_t_8 = __pyx_v_i;
-      __pyx_t_9 = __pyx_v_stop1;
-      __pyx_t_1 = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mask.data + __pyx_t_8 * __pyx_v_mask.strides[0]) ) + __pyx_t_9 * __pyx_v_mask.strides[1]) ))) == 0);
-      if (__pyx_t_1) {
-
-        /* "reconstruct.pyx":42
- *                 sum+=invdst*data[i,start1]
- *             if mask[i,stop1]==0:
- *                 invdst=invert_distance(i,stop1,p0,p1)             # <<<<<<<<<<<<<<
- *                 count+=invdst
- *                 sum+=invdst*data[i,stop1]
- */
-        __pyx_v_invdst = __pyx_f_11reconstruct_invert_distance(__pyx_v_i, __pyx_v_stop1, __pyx_v_p0, __pyx_v_p1);
-
-        /* "reconstruct.pyx":43
- *             if mask[i,stop1]==0:
- *                 invdst=invert_distance(i,stop1,p0,p1)
- *                 count+=invdst             # <<<<<<<<<<<<<<
- *                 sum+=invdst*data[i,stop1]
- *         for i in range(start1+1,stop1):
- */
-        __pyx_v_count = (__pyx_v_count + __pyx_v_invdst);
-
-        /* "reconstruct.pyx":44
- *                 invdst=invert_distance(i,stop1,p0,p1)
- *                 count+=invdst
- *                 sum+=invdst*data[i,stop1]             # <<<<<<<<<<<<<<
- *         for i in range(start1+1,stop1):
- *             if mask[start0,i]==0:
- */
-        __pyx_t_10 = __pyx_v_i;
-        __pyx_t_11 = __pyx_v_stop1;
-        __pyx_v_sum = (__pyx_v_sum + (__pyx_v_invdst * (*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_data.data + __pyx_t_10 * __pyx_v_data.strides[0]) ) + __pyx_t_11 * __pyx_v_data.strides[1]) )))));
-        goto __pyx_L12;
-      }
-      __pyx_L12:;
-    }
-
-    /* "reconstruct.pyx":45
- *                 count+=invdst
- *                 sum+=invdst*data[i,stop1]
- *         for i in range(start1+1,stop1):             # <<<<<<<<<<<<<<
- *             if mask[start0,i]==0:
- *                 invdst=invert_distance(start0,i,p0,p1)
+  /* "sparse_csr.pyx":37
+ *     ncol = lut.shape[-1]
+ *     nrow = lut.shape[0]
+ *     cdef numpy.ndarray[numpy.float32_t, ndim=1] data = numpy.zeros(nrow*ncol,numpy.float32)             # <<<<<<<<<<<<<<
+ *     cdef numpy.ndarray[numpy.uint32_t, ndim=1]  indices= numpy.zeros(nrow*ncol,numpy.uint32)
+ *     cdef numpy.ndarray[numpy.uint32_t, ndim=1] indptr = numpy.zeros(nrow+1,numpy.uint32)
  */
-    __pyx_t_2 = __pyx_v_stop1;
-    for (__pyx_t_3 = (__pyx_v_start1 + 1); __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
-      __pyx_v_i = __pyx_t_3;
-
-      /* "reconstruct.pyx":46
- *                 sum+=invdst*data[i,stop1]
- *         for i in range(start1+1,stop1):
- *             if mask[start0,i]==0:             # <<<<<<<<<<<<<<
- *                 invdst=invert_distance(start0,i,p0,p1)
- *                 count+=invdst
- */
-      __pyx_t_12 = __pyx_v_start0;
-      __pyx_t_13 = __pyx_v_i;
-      __pyx_t_1 = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mask.data + __pyx_t_12 * __pyx_v_mask.strides[0]) ) + __pyx_t_13 * __pyx_v_mask.strides[1]) ))) == 0);
-      if (__pyx_t_1) {
-
-        /* "reconstruct.pyx":47
- *         for i in range(start1+1,stop1):
- *             if mask[start0,i]==0:
- *                 invdst=invert_distance(start0,i,p0,p1)             # <<<<<<<<<<<<<<
- *                 count+=invdst
- *                 sum+=invdst*data[start0,i]
- */
-        __pyx_v_invdst = __pyx_f_11reconstruct_invert_distance(__pyx_v_start0, __pyx_v_i, __pyx_v_p0, __pyx_v_p1);
-
-        /* "reconstruct.pyx":48
- *             if mask[start0,i]==0:
- *                 invdst=invert_distance(start0,i,p0,p1)
- *                 count+=invdst             # <<<<<<<<<<<<<<
- *                 sum+=invdst*data[start0,i]
- *             if mask[stop0,i]==0:
- */
-        __pyx_v_count = (__pyx_v_count + __pyx_v_invdst);
-
-        /* "reconstruct.pyx":49
- *                 invdst=invert_distance(start0,i,p0,p1)
- *                 count+=invdst
- *                 sum+=invdst*data[start0,i]             # <<<<<<<<<<<<<<
- *             if mask[stop0,i]==0:
- *                 invdst=invert_distance(stop0,i,p0,p1)
- */
-        __pyx_t_14 = __pyx_v_start0;
-        __pyx_t_15 = __pyx_v_i;
-        __pyx_v_sum = (__pyx_v_sum + (__pyx_v_invdst * (*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_data.data + __pyx_t_14 * __pyx_v_data.strides[0]) ) + __pyx_t_15 * __pyx_v_data.strides[1]) )))));
-        goto __pyx_L15;
-      }
-      __pyx_L15:;
-
-      /* "reconstruct.pyx":50
- *                 count+=invdst
- *                 sum+=invdst*data[start0,i]
- *             if mask[stop0,i]==0:             # <<<<<<<<<<<<<<
- *                 invdst=invert_distance(stop0,i,p0,p1)
- *                 count+=invdst
- */
-      __pyx_t_16 = __pyx_v_stop0;
-      __pyx_t_17 = __pyx_v_i;
-      __pyx_t_1 = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mask.data + __pyx_t_16 * __pyx_v_mask.strides[0]) ) + __pyx_t_17 * __pyx_v_mask.strides[1]) ))) == 0);
-      if (__pyx_t_1) {
-
-        /* "reconstruct.pyx":51
- *                 sum+=invdst*data[start0,i]
- *             if mask[stop0,i]==0:
- *                 invdst=invert_distance(stop0,i,p0,p1)             # <<<<<<<<<<<<<<
- *                 count+=invdst
- *                 sum+=invdst*data[stop0,i]
- */
-        __pyx_v_invdst = __pyx_f_11reconstruct_invert_distance(__pyx_v_stop0, __pyx_v_i, __pyx_v_p0, __pyx_v_p1);
-
-        /* "reconstruct.pyx":52
- *             if mask[stop0,i]==0:
- *                 invdst=invert_distance(stop0,i,p0,p1)
- *                 count+=invdst             # <<<<<<<<<<<<<<
- *                 sum+=invdst*data[stop0,i]
- *         if count>0:
- */
-        __pyx_v_count = (__pyx_v_count + __pyx_v_invdst);
-
-        /* "reconstruct.pyx":53
- *                 invdst=invert_distance(stop0,i,p0,p1)
- *                 count+=invdst
- *                 sum+=invdst*data[stop0,i]             # <<<<<<<<<<<<<<
- *         if count>0:
- *             found=1
- */
-        __pyx_t_18 = __pyx_v_stop0;
-        __pyx_t_19 = __pyx_v_i;
-        __pyx_v_sum = (__pyx_v_sum + (__pyx_v_invdst * (*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_data.data + __pyx_t_18 * __pyx_v_data.strides[0]) ) + __pyx_t_19 * __pyx_v_data.strides[1]) )))));
-        goto __pyx_L16;
-      }
-      __pyx_L16:;
-    }
-
-    /* "reconstruct.pyx":54
- *                 count+=invdst
- *                 sum+=invdst*data[stop0,i]
- *         if count>0:             # <<<<<<<<<<<<<<
- *             found=1
- *     return sum/count
- */
-    __pyx_t_1 = (__pyx_v_count > 0.0);
-    if (__pyx_t_1) {
-
-      /* "reconstruct.pyx":55
- *                 sum+=invdst*data[stop0,i]
- *         if count>0:
- *             found=1             # <<<<<<<<<<<<<<
- *     return sum/count
- * 
- */
-      __pyx_v_found = 1;
-      goto __pyx_L17;
-    }
-    __pyx_L17:;
-  }
-
-  /* "reconstruct.pyx":56
- *         if count>0:
- *             found=1
- *     return sum/count             # <<<<<<<<<<<<<<
- * 
- * @cython.boundscheck(False)
- */
-  __pyx_r = (__pyx_v_sum / __pyx_v_count);
-  goto __pyx_L0;
-
-  __pyx_r = 0;
-  __pyx_L0:;
-  return __pyx_r;
-}
-
-/* Python wrapper */
-static PyObject *__pyx_pw_11reconstruct_1reconstruct(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_11reconstruct_1reconstruct = {__Pyx_NAMESTR("reconstruct"), (PyCFunction)__pyx_pw_11reconstruct_1reconstruct, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pw_11reconstruct_1reconstruct(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
-  PyArrayObject *__pyx_v_data = 0;
-  PyArrayObject *__pyx_v_mask = 0;
-  PyObject *__pyx_v_dummy = 0;
-  PyObject *__pyx_v_delta_dummy = 0;
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("reconstruct (wrapper)", 0);
-  {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__data,&__pyx_n_s__mask,&__pyx_n_s__dummy,&__pyx_n_s__delta_dummy,0};
-    PyObject* values[4] = {0,0,0,0};
-
-    /* "reconstruct.pyx":60
- * @cython.boundscheck(False)
- * @cython.wraparound(False)
- * def reconstruct(numpy.ndarray data not None, numpy.ndarray mask=None, dummy=None,  delta_dummy=None):             # <<<<<<<<<<<<<<
- *     assert data.ndim==2
- *     cdef ssize_t d0=data.shape[0]
- */
-    values[1] = (PyObject *)((PyArrayObject *)Py_None);
-    values[2] = ((PyObject *)Py_None);
-    values[3] = ((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  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__data)) != 0)) kw_args--;
-        else goto __pyx_L5_argtuple_error;
-        case  1:
-        if (kw_args > 0) {
-          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mask);
-          if (value) { values[1] = value; kw_args--; }
-        }
-        case  2:
-        if (kw_args > 0) {
-          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dummy);
-          if (value) { values[2] = value; kw_args--; }
-        }
-        case  3:
-        if (kw_args > 0) {
-          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__delta_dummy);
-          if (value) { values[3] = value; kw_args--; }
-        }
-      }
-      if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "reconstruct") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-      }
-    } else {
-      switch (PyTuple_GET_SIZE(__pyx_args)) {
-        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
-        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
-        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
-        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
-        break;
-        default: goto __pyx_L5_argtuple_error;
-      }
-    }
-    __pyx_v_data = ((PyArrayObject *)values[0]);
-    __pyx_v_mask = ((PyArrayObject *)values[1]);
-    __pyx_v_dummy = values[2];
-    __pyx_v_delta_dummy = values[3];
-  }
-  goto __pyx_L4_argument_unpacking_done;
-  __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("reconstruct", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-  __pyx_L3_error:;
-  __Pyx_AddTraceback("reconstruct.reconstruct", __pyx_clineno, __pyx_lineno, __pyx_filename);
-  __Pyx_RefNannyFinishContext();
-  return NULL;
-  __pyx_L4_argument_unpacking_done:;
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), __pyx_ptype_5numpy_ndarray, 0, "data", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mask), __pyx_ptype_5numpy_ndarray, 1, "mask", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_r = __pyx_pf_11reconstruct_reconstruct(__pyx_self, __pyx_v_data, __pyx_v_mask, __pyx_v_dummy, __pyx_v_delta_dummy);
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __pyx_r = NULL;
-  __pyx_L0:;
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-static PyObject *__pyx_pf_11reconstruct_reconstruct(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_data, PyArrayObject *__pyx_v_mask, PyObject *__pyx_v_dummy, PyObject *__pyx_v_delta_dummy) {
-  Py_ssize_t __pyx_v_d0;
-  Py_ssize_t __pyx_v_d1;
-  __Pyx_memviewslice __pyx_v_cdata = { 0, 0, { 0 }, { 0 }, { 0 } };
-  __Pyx_memviewslice __pyx_v_cmask = { 0, 0, { 0 }, { 0 }, { 0 } };
-  PyArrayObject *__pyx_v_out = 0;
-  Py_ssize_t __pyx_v_p0;
-  Py_ssize_t __pyx_v_p1;
-  __Pyx_LocalBuf_ND __pyx_pybuffernd_out;
-  __Pyx_Buffer __pyx_pybuffer_out;
-  PyObject *__pyx_r = NULL;
-  __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
-  PyObject *__pyx_t_2 = NULL;
-  PyObject *__pyx_t_3 = NULL;
-  PyObject *__pyx_t_4 = NULL;
-  PyObject *__pyx_t_5 = NULL;
-  __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
-  int __pyx_t_7;
-  __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
-  PyArrayObject *__pyx_t_9 = NULL;
-  int __pyx_t_10;
-  PyObject *__pyx_t_11 = NULL;
-  PyObject *__pyx_t_12 = NULL;
-  PyObject *__pyx_t_13 = NULL;
-  Py_ssize_t __pyx_t_14;
-  Py_ssize_t __pyx_t_15;
-  Py_ssize_t __pyx_t_16;
-  Py_ssize_t __pyx_t_17;
-  Py_ssize_t __pyx_t_18;
-  Py_ssize_t __pyx_t_19;
-  Py_ssize_t __pyx_t_20;
-  Py_ssize_t __pyx_t_21;
-  Py_ssize_t __pyx_t_22;
-  int __pyx_lineno = 0;
-  const char *__pyx_filename = NULL;
-  int __pyx_clineno = 0;
-  __Pyx_RefNannySetupContext("reconstruct", 0);
-  __Pyx_INCREF((PyObject *)__pyx_v_data);
-  __Pyx_INCREF((PyObject *)__pyx_v_mask);
-  __pyx_pybuffer_out.pybuffer.buf = NULL;
-  __pyx_pybuffer_out.refcount = 0;
-  __pyx_pybuffernd_out.data = NULL;
-  __pyx_pybuffernd_out.rcbuffer = &__pyx_pybuffer_out;
-
-  /* "reconstruct.pyx":61
- * @cython.wraparound(False)
- * def reconstruct(numpy.ndarray data not None, numpy.ndarray mask=None, dummy=None,  delta_dummy=None):
- *     assert data.ndim==2             # <<<<<<<<<<<<<<
- *     cdef ssize_t d0=data.shape[0]
- *     cdef ssize_t d1=data.shape[1]
- */
-  #ifndef CYTHON_WITHOUT_ASSERTIONS
-  if (unlikely(!(__pyx_v_data->nd == 2))) {
-    PyErr_SetNone(PyExc_AssertionError);
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  }
-  #endif
-
-  /* "reconstruct.pyx":62
- * def reconstruct(numpy.ndarray data not None, numpy.ndarray mask=None, dummy=None,  delta_dummy=None):
- *     assert data.ndim==2
- *     cdef ssize_t d0=data.shape[0]             # <<<<<<<<<<<<<<
- *     cdef ssize_t d1=data.shape[1]
- *     data=numpy.ascontiguousarray(data, dtype=numpy.float32)
- */
-  __pyx_v_d0 = (__pyx_v_data->dimensions[0]);
-
-  /* "reconstruct.pyx":63
- *     assert data.ndim==2
- *     cdef ssize_t d0=data.shape[0]
- *     cdef ssize_t d1=data.shape[1]             # <<<<<<<<<<<<<<
- *     data=numpy.ascontiguousarray(data, dtype=numpy.float32)
- *     cdef float[:,:] cdata =data
- */
-  __pyx_v_d1 = (__pyx_v_data->dimensions[1]);
-
-  /* "reconstruct.pyx":64
- *     cdef ssize_t d0=data.shape[0]
- *     cdef ssize_t d1=data.shape[1]
- *     data=numpy.ascontiguousarray(data, dtype=numpy.float32)             # <<<<<<<<<<<<<<
- *     cdef float[:,:] cdata =data
- *     if mask is not None:
- */
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__ascontiguousarray); 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_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyInt_to_py_npy_uint32((__pyx_v_nrow * __pyx_v_ncol)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_INCREF(((PyObject *)__pyx_v_data));
-  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_data));
-  __Pyx_GIVEREF(((PyObject *)__pyx_v_data));
-  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__float32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
+  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_6);
+  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s__float32); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_7);
+  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __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);
+  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_7);
+  __Pyx_GIVEREF(__pyx_t_7);
+  __pyx_t_1 = 0;
+  __pyx_t_7 = 0;
+  __pyx_t_7 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_7);
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(((PyObject *)__pyx_v_data));
-  __pyx_v_data = ((PyArrayObject *)__pyx_t_5);
-  __pyx_t_5 = 0;
-
-  /* "reconstruct.pyx":65
- *     cdef ssize_t d1=data.shape[1]
- *     data=numpy.ascontiguousarray(data, dtype=numpy.float32)
- *     cdef float[:,:] cdata =data             # <<<<<<<<<<<<<<
- *     if mask is not None:
- *         mask = numpy.ascontiguousarray(mask, dtype=numpy.int8)
- */
-  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(((PyObject *)__pyx_v_data));
-  if (unlikely(!__pyx_t_6.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_cdata = __pyx_t_6;
-  __pyx_t_6.memview = NULL;
-  __pyx_t_6.data = NULL;
-
-  /* "reconstruct.pyx":66
- *     data=numpy.ascontiguousarray(data, dtype=numpy.float32)
- *     cdef float[:,:] cdata =data
- *     if mask is not None:             # <<<<<<<<<<<<<<
- *         mask = numpy.ascontiguousarray(mask, dtype=numpy.int8)
- *     else:
- */
-  __pyx_t_7 = (((PyObject *)__pyx_v_mask) != Py_None);
-  if (__pyx_t_7) {
-
-    /* "reconstruct.pyx":67
- *     cdef float[:,:] cdata =data
- *     if mask is not None:
- *         mask = numpy.ascontiguousarray(mask, dtype=numpy.int8)             # <<<<<<<<<<<<<<
- *     else:
- *         mask = numpy.zeros((d0,d1),dtype=numpy.int8)
- */
-    __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__ascontiguousarray); 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_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_INCREF(((PyObject *)__pyx_v_mask));
-    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_mask));
-    __Pyx_GIVEREF(((PyObject *)__pyx_v_mask));
-    __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_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); 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_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__int8); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __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_5)); __pyx_t_5 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(((PyObject *)__pyx_v_mask));
-    __pyx_v_mask = ((PyArrayObject *)__pyx_t_4);
-    __pyx_t_4 = 0;
-    goto __pyx_L3;
-  }
-  /*else*/ {
-
-    /* "reconstruct.pyx":69
- *         mask = numpy.ascontiguousarray(mask, dtype=numpy.int8)
- *     else:
- *         mask = numpy.zeros((d0,d1),dtype=numpy.int8)             # <<<<<<<<<<<<<<
- *     if dummy is not None:
- *         if delta_dummy is None:
- */
-    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_d0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_d1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_3 = PyTuple_New(2); 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);
-    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
-    __Pyx_GIVEREF(__pyx_t_4);
-    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5);
-    __Pyx_GIVEREF(__pyx_t_5);
-    __pyx_t_4 = 0;
-    __pyx_t_5 = 0;
-    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_3));
-    __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
-    __pyx_t_3 = 0;
-    __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(((PyObject *)__pyx_v_mask));
-    __pyx_v_mask = ((PyArrayObject *)__pyx_t_2);
-    __pyx_t_2 = 0;
-  }
-  __pyx_L3:;
-
-  /* "reconstruct.pyx":70
- *     else:
- *         mask = numpy.zeros((d0,d1),dtype=numpy.int8)
- *     if dummy is not None:             # <<<<<<<<<<<<<<
- *         if delta_dummy is None:
- *             mask+=(data==dummy)
- */
-  __pyx_t_7 = (__pyx_v_dummy != Py_None);
-  if (__pyx_t_7) {
-
-    /* "reconstruct.pyx":71
- *         mask = numpy.zeros((d0,d1),dtype=numpy.int8)
- *     if dummy is not None:
- *         if delta_dummy is None:             # <<<<<<<<<<<<<<
- *             mask+=(data==dummy)
- *         else:
- */
-    __pyx_t_7 = (__pyx_v_delta_dummy == Py_None);
-    if (__pyx_t_7) {
-
-      /* "reconstruct.pyx":72
- *     if dummy is not None:
- *         if delta_dummy is None:
- *             mask+=(data==dummy)             # <<<<<<<<<<<<<<
- *         else:
- *             mask+=(abs(data-dummy)<=delta_dummy)
- */
-      __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_data), __pyx_v_dummy, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_t_3 = PyNumber_InPlaceAdd(((PyObject *)__pyx_v_mask), __pyx_t_2); 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_2); __pyx_t_2 = 0;
-      if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(((PyObject *)__pyx_v_mask));
-      __pyx_v_mask = ((PyArrayObject *)__pyx_t_3);
-      __pyx_t_3 = 0;
-      goto __pyx_L5;
-    }
-    /*else*/ {
-
-      /* "reconstruct.pyx":74
- *             mask+=(data==dummy)
- *         else:
- *             mask+=(abs(data-dummy)<=delta_dummy)             # <<<<<<<<<<<<<<
- *     cdef bint[:,:] cmask = mask.astype("int32")
- *     assert d0==mask.shape[0]
- */
-      __pyx_t_3 = PyNumber_Subtract(((PyObject *)__pyx_v_data), __pyx_v_dummy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_2 = PyNumber_Absolute(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_v_delta_dummy, Py_LE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __pyx_t_2 = PyNumber_InPlaceAdd(((PyObject *)__pyx_v_mask), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(((PyObject *)__pyx_v_mask));
-      __pyx_v_mask = ((PyArrayObject *)__pyx_t_2);
-      __pyx_t_2 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+  if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_8 = ((PyArrayObject *)__pyx_t_7);
+  {
+    __Pyx_BufFmt_StackElem __pyx_stack[1];
+    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_data.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
+      __pyx_v_data = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_data.rcbuffer->pybuffer.buf = NULL;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    } else {__pyx_pybuffernd_data.diminfo[0].strides = __pyx_pybuffernd_data.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_data.diminfo[0].shape = __pyx_pybuffernd_data.rcbuffer->pybuffer.shape[0];
     }
-    __pyx_L5:;
-    goto __pyx_L4;
   }
-  __pyx_L4:;
-
-  /* "reconstruct.pyx":75
- *         else:
- *             mask+=(abs(data-dummy)<=delta_dummy)
- *     cdef bint[:,:] cmask = mask.astype("int32")             # <<<<<<<<<<<<<<
- *     assert d0==mask.shape[0]
- *     assert d1==mask.shape[1]
- */
-  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_mask), __pyx_n_s__astype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(__pyx_t_3);
-  if (unlikely(!__pyx_t_8.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_v_cmask = __pyx_t_8;
-  __pyx_t_8.memview = NULL;
-  __pyx_t_8.data = NULL;
-
-  /* "reconstruct.pyx":76
- *             mask+=(abs(data-dummy)<=delta_dummy)
- *     cdef bint[:,:] cmask = mask.astype("int32")
- *     assert d0==mask.shape[0]             # <<<<<<<<<<<<<<
- *     assert d1==mask.shape[1]
- *     cdef numpy.ndarray[numpy.float32_t, ndim = 2]out =numpy.zeros_like(data)
- */
-  #ifndef CYTHON_WITHOUT_ASSERTIONS
-  if (unlikely(!(__pyx_v_d0 == (__pyx_v_mask->dimensions[0])))) {
-    PyErr_SetNone(PyExc_AssertionError);
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  }
-  #endif
-
-  /* "reconstruct.pyx":77
- *     cdef bint[:,:] cmask = mask.astype("int32")
- *     assert d0==mask.shape[0]
- *     assert d1==mask.shape[1]             # <<<<<<<<<<<<<<
- *     cdef numpy.ndarray[numpy.float32_t, ndim = 2]out =numpy.zeros_like(data)
- *     out+=data
- */
-  #ifndef CYTHON_WITHOUT_ASSERTIONS
-  if (unlikely(!(__pyx_v_d1 == (__pyx_v_mask->dimensions[1])))) {
-    PyErr_SetNone(PyExc_AssertionError);
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  }
-  #endif
-
-  /* "reconstruct.pyx":78
- *     assert d0==mask.shape[0]
- *     assert d1==mask.shape[1]
- *     cdef numpy.ndarray[numpy.float32_t, ndim = 2]out =numpy.zeros_like(data)             # <<<<<<<<<<<<<<
- *     out+=data
- *     out[mask.astype(bool)]=0
- */
-  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__zeros_like); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_INCREF(((PyObject *)__pyx_v_data));
-  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_data));
-  __Pyx_GIVEREF(((PyObject *)__pyx_v_data));
-  __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_9 = ((PyArrayObject *)__pyx_t_5);
+  __pyx_t_8 = 0;
+  __pyx_v_data = ((PyArrayObject *)__pyx_t_7);
+  __pyx_t_7 = 0;
+
+  /* "sparse_csr.pyx":38
+ *     nrow = lut.shape[0]
+ *     cdef numpy.ndarray[numpy.float32_t, ndim=1] data = numpy.zeros(nrow*ncol,numpy.float32)
+ *     cdef numpy.ndarray[numpy.uint32_t, ndim=1]  indices= numpy.zeros(nrow*ncol,numpy.uint32)             # <<<<<<<<<<<<<<
+ *     cdef numpy.ndarray[numpy.uint32_t, ndim=1] indptr = numpy.zeros(nrow+1,numpy.uint32)
+ *     cdef numpy.uint32_t i, j
+ */
+  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_7);
+  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s__zeros); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_6);
+  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+  __pyx_t_7 = __Pyx_PyInt_to_py_npy_uint32((__pyx_v_nrow * __pyx_v_ncol)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_7);
+  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__uint32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
+  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7);
+  __Pyx_GIVEREF(__pyx_t_7);
+  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
+  __Pyx_GIVEREF(__pyx_t_1);
+  __pyx_t_7 = 0;
+  __pyx_t_1 = 0;
+  __pyx_t_1 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_9 = ((PyArrayObject *)__pyx_t_1);
   {
     __Pyx_BufFmt_StackElem __pyx_stack[1];
-    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
-      __pyx_v_out = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_out.rcbuffer->pybuffer.buf = NULL;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    } else {__pyx_pybuffernd_out.diminfo[0].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_out.diminfo[0].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_out.diminfo[1].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_out.diminfo[1].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[1];
+    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indices.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
+      __pyx_v_indices = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_indices.rcbuffer->pybuffer.buf = NULL;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    } else {__pyx_pybuffernd_indices.diminfo[0].strides = __pyx_pybuffernd_indices.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indices.diminfo[0].shape = __pyx_pybuffernd_indices.rcbuffer->pybuffer.shape[0];
     }
   }
   __pyx_t_9 = 0;
-  __pyx_v_out = ((PyArrayObject *)__pyx_t_5);
-  __pyx_t_5 = 0;
+  __pyx_v_indices = ((PyArrayObject *)__pyx_t_1);
+  __pyx_t_1 = 0;
 
-  /* "reconstruct.pyx":79
- *     assert d1==mask.shape[1]
- *     cdef numpy.ndarray[numpy.float32_t, ndim = 2]out =numpy.zeros_like(data)
- *     out+=data             # <<<<<<<<<<<<<<
- *     out[mask.astype(bool)]=0
- * 
+  /* "sparse_csr.pyx":39
+ *     cdef numpy.ndarray[numpy.float32_t, ndim=1] data = numpy.zeros(nrow*ncol,numpy.float32)
+ *     cdef numpy.ndarray[numpy.uint32_t, ndim=1]  indices= numpy.zeros(nrow*ncol,numpy.uint32)
+ *     cdef numpy.ndarray[numpy.uint32_t, ndim=1] indptr = numpy.zeros(nrow+1,numpy.uint32)             # <<<<<<<<<<<<<<
+ *     cdef numpy.uint32_t i, j
+ *     for i in range(nrow):
  */
-  __pyx_t_5 = PyNumber_InPlaceAdd(((PyObject *)__pyx_v_out), ((PyObject *)__pyx_v_data)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_9 = ((PyArrayObject *)__pyx_t_5);
+  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); 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_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__zeros); 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_t_1 = PyInt_FromLong((__pyx_v_nrow + 1)); 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_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_6);
+  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s__uint32); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_7);
+  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __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);
+  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_7);
+  __Pyx_GIVEREF(__pyx_t_7);
+  __pyx_t_1 = 0;
+  __pyx_t_7 = 0;
+  __pyx_t_7 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_7);
+  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+  if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_10 = ((PyArrayObject *)__pyx_t_7);
   {
     __Pyx_BufFmt_StackElem __pyx_stack[1];
-    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
-    __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
-    if (unlikely(__pyx_t_10 < 0)) {
-      PyErr_Fetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
-      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)__pyx_v_out, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
-        Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13);
-        __Pyx_RaiseBufferFallbackError();
-      } else {
-        PyErr_Restore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
-      }
+    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indptr.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
+      __pyx_v_indptr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_indptr.rcbuffer->pybuffer.buf = NULL;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    } else {__pyx_pybuffernd_indptr.diminfo[0].strides = __pyx_pybuffernd_indptr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indptr.diminfo[0].shape = __pyx_pybuffernd_indptr.rcbuffer->pybuffer.shape[0];
     }
-    __pyx_pybuffernd_out.diminfo[0].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_out.diminfo[0].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_out.diminfo[1].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_out.diminfo[1].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[1];
-    if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
-  __pyx_t_9 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_v_out));
-  __pyx_v_out = ((PyArrayObject *)__pyx_t_5);
-  __pyx_t_5 = 0;
+  __pyx_t_10 = 0;
+  __pyx_v_indptr = ((PyArrayObject *)__pyx_t_7);
+  __pyx_t_7 = 0;
+
+  /* "sparse_csr.pyx":41
+ *     cdef numpy.ndarray[numpy.uint32_t, ndim=1] indptr = numpy.zeros(nrow+1,numpy.uint32)
+ *     cdef numpy.uint32_t i, j
+ *     for i in range(nrow):             # <<<<<<<<<<<<<<
+ *         indptr[i] = nelt
+ *         for j in range(ncol):
+ */
+  __pyx_t_5 = __pyx_v_nrow;
+  for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_5; __pyx_t_11+=1) {
+    __pyx_v_i = __pyx_t_11;
+
+    /* "sparse_csr.pyx":42
+ *     cdef numpy.uint32_t i, j
+ *     for i in range(nrow):
+ *         indptr[i] = nelt             # <<<<<<<<<<<<<<
+ *         for j in range(ncol):
+ *             if coef[i,j]<=0.0:
+ */
+    __pyx_t_12 = __pyx_v_i;
+    __pyx_t_13 = -1;
+    if (unlikely(__pyx_t_12 >= (size_t)__pyx_pybuffernd_indptr.diminfo[0].shape)) __pyx_t_13 = 0;
+    if (unlikely(__pyx_t_13 != -1)) {
+      __Pyx_RaiseBufferIndexError(__pyx_t_13);
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    }
+    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint32_t *, __pyx_pybuffernd_indptr.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_indptr.diminfo[0].strides) = __pyx_v_nelt;
+
+    /* "sparse_csr.pyx":43
+ *     for i in range(nrow):
+ *         indptr[i] = nelt
+ *         for j in range(ncol):             # <<<<<<<<<<<<<<
+ *             if coef[i,j]<=0.0:
+ *                 break
+ */
+    __pyx_t_14 = __pyx_v_ncol;
+    for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
+      __pyx_v_j = __pyx_t_15;
+
+      /* "sparse_csr.pyx":44
+ *         indptr[i] = nelt
+ *         for j in range(ncol):
+ *             if coef[i,j]<=0.0:             # <<<<<<<<<<<<<<
+ *                 break
+ *             else:
+ */
+      __pyx_t_16 = __pyx_v_i;
+      __pyx_t_17 = __pyx_v_j;
+      __pyx_t_13 = -1;
+      if (unlikely(__pyx_t_16 >= (size_t)__pyx_v_coef.shape[0])) __pyx_t_13 = 0;
+      if (unlikely(__pyx_t_17 >= (size_t)__pyx_v_coef.shape[1])) __pyx_t_13 = 1;
+      if (unlikely(__pyx_t_13 != -1)) {
+        __Pyx_RaiseBufferIndexError(__pyx_t_13);
+        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      }
+      __pyx_t_18 = ((*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coef.data + __pyx_t_16 * __pyx_v_coef.strides[0]) ) + __pyx_t_17 * __pyx_v_coef.strides[1]) ))) <= 0.0);
+      if (__pyx_t_18) {
 
-  /* "reconstruct.pyx":80
- *     cdef numpy.ndarray[numpy.float32_t, ndim = 2]out =numpy.zeros_like(data)
- *     out+=data
- *     out[mask.astype(bool)]=0             # <<<<<<<<<<<<<<
- * 
- *     cdef ssize_t p0,p1,i,l
+        /* "sparse_csr.pyx":45
+ *         for j in range(ncol):
+ *             if coef[i,j]<=0.0:
+ *                 break             # <<<<<<<<<<<<<<
+ *             else:
+ *                 data[nelt] = coef[i,j]
  */
-  __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_mask), __pyx_n_s__astype); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_INCREF(((PyObject*)&PyBool_Type));
-  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject*)&PyBool_Type));
-  __Pyx_GIVEREF(((PyObject*)&PyBool_Type));
-  __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-  if (PyObject_SetItem(((PyObject *)__pyx_v_out), __pyx_t_2, __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+        goto __pyx_L6_break;
+        goto __pyx_L7;
+      }
+      /*else*/ {
 
-  /* "reconstruct.pyx":83
- * 
- *     cdef ssize_t p0,p1,i,l
- *     for p0 in prange(d0,nogil=True, schedule="guided"):             # <<<<<<<<<<<<<<
- *         for p1 in range(d1):
- *             if cmask[p0,p1]:
+        /* "sparse_csr.pyx":47
+ *                 break
+ *             else:
+ *                 data[nelt] = coef[i,j]             # <<<<<<<<<<<<<<
+ *                 indices[nelt] = idx[i,j]
+ *                 nelt+=1
  */
-  {
-      #ifdef WITH_THREAD
-      PyThreadState *_save = NULL;
-      #endif
-      Py_UNBLOCK_THREADS
-      /*try:*/ {
-        __pyx_t_14 = __pyx_v_d0;
-        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_16 = (__pyx_t_14 - 0) / 1;
-            if (__pyx_t_16 > 0)
-            {
-                #ifdef _OPENMP
-                #pragma omp parallel private(__pyx_t_18, __pyx_t_17, __pyx_t_20, __pyx_t_7, __pyx_t_21, __pyx_t_19, __pyx_t_22)
-                #endif /* _OPENMP */
-                {
-                    #ifdef _OPENMP
-                    #pragma omp for lastprivate(__pyx_v_p1) firstprivate(__pyx_v_p0) lastprivate(__pyx_v_p0) schedule(guided)
-                    #endif /* _OPENMP */
-                    for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_16; __pyx_t_15++){
-                        {
-                            __pyx_v_p0 = 0 + 1 * __pyx_t_15;
-                            /* Initialize private variables to invalid values */
-                            __pyx_v_p1 = ((Py_ssize_t)0xbad0bad0);
-
-                            /* "reconstruct.pyx":84
- *     cdef ssize_t p0,p1,i,l
- *     for p0 in prange(d0,nogil=True, schedule="guided"):
- *         for p1 in range(d1):             # <<<<<<<<<<<<<<
- *             if cmask[p0,p1]:
- *                 out[p0,p1] += processPoint(cdata,cmask,p0,p1,d0,d1)
- */
-                            __pyx_t_17 = __pyx_v_d1;
-                            for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
-                              __pyx_v_p1 = __pyx_t_18;
-
-                              /* "reconstruct.pyx":85
- *     for p0 in prange(d0,nogil=True, schedule="guided"):
- *         for p1 in range(d1):
- *             if cmask[p0,p1]:             # <<<<<<<<<<<<<<
- *                 out[p0,p1] += processPoint(cdata,cmask,p0,p1,d0,d1)
- *     return out
- */
-                              __pyx_t_19 = __pyx_v_p0;
-                              __pyx_t_20 = __pyx_v_p1;
-                              __pyx_t_7 = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_cmask.data + __pyx_t_19 * __pyx_v_cmask.strides[0]) ) + __pyx_t_20 * __pyx_v_cmask.strides[1]) )));
-                              if (__pyx_t_7) {
-
-                                /* "reconstruct.pyx":86
- *         for p1 in range(d1):
- *             if cmask[p0,p1]:
- *                 out[p0,p1] += processPoint(cdata,cmask,p0,p1,d0,d1)             # <<<<<<<<<<<<<<
- *     return out
- * 
- */
-                                __pyx_t_21 = __pyx_v_p0;
-                                __pyx_t_22 = __pyx_v_p1;
-                                *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_out.diminfo[1].strides) += __pyx_f_11reconstruct_processPoint(__pyx_v_cdata, __pyx_v_cmask, __pyx_v_p0, __pyx_v_p1, __pyx_v_d0, __pyx_v_d1);
-                                goto __pyx_L15;
-                              }
-                              __pyx_L15:;
-                            }
-                        }
-                    }
-                }
-            }
+        __pyx_t_19 = __pyx_v_i;
+        __pyx_t_20 = __pyx_v_j;
+        __pyx_t_13 = -1;
+        if (unlikely(__pyx_t_19 >= (size_t)__pyx_v_coef.shape[0])) __pyx_t_13 = 0;
+        if (unlikely(__pyx_t_20 >= (size_t)__pyx_v_coef.shape[1])) __pyx_t_13 = 1;
+        if (unlikely(__pyx_t_13 != -1)) {
+          __Pyx_RaiseBufferIndexError(__pyx_t_13);
+          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         }
-        #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
-      }
+        __pyx_t_21 = __pyx_v_nelt;
+        __pyx_t_13 = -1;
+        if (unlikely(__pyx_t_21 >= (size_t)__pyx_pybuffernd_data.diminfo[0].shape)) __pyx_t_13 = 0;
+        if (unlikely(__pyx_t_13 != -1)) {
+          __Pyx_RaiseBufferIndexError(__pyx_t_13);
+          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        }
+        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_data.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_data.diminfo[0].strides) = (*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coef.data + __pyx_t_19 * __pyx_v_coef.strides[0]) ) + __pyx_t_20 * __pyx_v_coef.strides[1]) )));
 
-      /* "reconstruct.pyx":83
- * 
- *     cdef ssize_t p0,p1,i,l
- *     for p0 in prange(d0,nogil=True, schedule="guided"):             # <<<<<<<<<<<<<<
- *         for p1 in range(d1):
- *             if cmask[p0,p1]:
+        /* "sparse_csr.pyx":48
+ *             else:
+ *                 data[nelt] = coef[i,j]
+ *                 indices[nelt] = idx[i,j]             # <<<<<<<<<<<<<<
+ *                 nelt+=1
+ *     indptr[nrow] = nelt
+ */
+        __pyx_t_22 = __pyx_v_i;
+        __pyx_t_23 = __pyx_v_j;
+        __pyx_t_13 = -1;
+        if (unlikely(__pyx_t_22 >= (size_t)__pyx_v_idx.shape[0])) __pyx_t_13 = 0;
+        if (unlikely(__pyx_t_23 >= (size_t)__pyx_v_idx.shape[1])) __pyx_t_13 = 1;
+        if (unlikely(__pyx_t_13 != -1)) {
+          __Pyx_RaiseBufferIndexError(__pyx_t_13);
+          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        }
+        __pyx_t_24 = __pyx_v_nelt;
+        __pyx_t_13 = -1;
+        if (unlikely(__pyx_t_24 >= (size_t)__pyx_pybuffernd_indices.diminfo[0].shape)) __pyx_t_13 = 0;
+        if (unlikely(__pyx_t_13 != -1)) {
+          __Pyx_RaiseBufferIndexError(__pyx_t_13);
+          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        }
+        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint32_t *, __pyx_pybuffernd_indices.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_indices.diminfo[0].strides) = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_idx.data + __pyx_t_22 * __pyx_v_idx.strides[0]) ) + __pyx_t_23 * __pyx_v_idx.strides[1]) )));
+
+        /* "sparse_csr.pyx":49
+ *                 data[nelt] = coef[i,j]
+ *                 indices[nelt] = idx[i,j]
+ *                 nelt+=1             # <<<<<<<<<<<<<<
+ *     indptr[nrow] = nelt
+ *     return data[:nelt], indices[:nelt], indptr
  */
-      /*finally:*/ {
-        Py_BLOCK_THREADS
+        __pyx_v_nelt = (__pyx_v_nelt + 1);
       }
+      __pyx_L7:;
+    }
+    __pyx_L6_break:;
   }
 
-  /* "reconstruct.pyx":87
- *             if cmask[p0,p1]:
- *                 out[p0,p1] += processPoint(cdata,cmask,p0,p1,d0,d1)
- *     return out             # <<<<<<<<<<<<<<
- * 
+  /* "sparse_csr.pyx":50
+ *                 indices[nelt] = idx[i,j]
+ *                 nelt+=1
+ *     indptr[nrow] = nelt             # <<<<<<<<<<<<<<
+ *     return data[:nelt], indices[:nelt], indptr
+ */
+  __pyx_t_5 = __pyx_v_nrow;
+  __pyx_t_13 = -1;
+  if (unlikely(__pyx_t_5 >= (size_t)__pyx_pybuffernd_indptr.diminfo[0].shape)) __pyx_t_13 = 0;
+  if (unlikely(__pyx_t_13 != -1)) {
+    __Pyx_RaiseBufferIndexError(__pyx_t_13);
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  }
+  *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint32_t *, __pyx_pybuffernd_indptr.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_indptr.diminfo[0].strides) = __pyx_v_nelt;
+
+  /* "sparse_csr.pyx":51
+ *                 nelt+=1
+ *     indptr[nrow] = nelt
+ *     return data[:nelt], indices[:nelt], indptr             # <<<<<<<<<<<<<<
  */
   __Pyx_XDECREF(__pyx_r);
-  __Pyx_INCREF(((PyObject *)__pyx_v_out));
-  __pyx_r = ((PyObject *)__pyx_v_out);
+  __pyx_t_7 = __Pyx_PyObject_GetSlice(((PyObject *)__pyx_v_data), 0, __pyx_v_nelt, NULL, NULL, NULL, 0, 1, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_7);
+  __pyx_t_6 = __Pyx_PyObject_GetSlice(((PyObject *)__pyx_v_indices), 0, __pyx_v_nelt, NULL, NULL, NULL, 0, 1, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_6);
+  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
+  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7);
+  __Pyx_GIVEREF(__pyx_t_7);
+  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_6);
+  __Pyx_GIVEREF(__pyx_t_6);
+  __Pyx_INCREF(((PyObject *)__pyx_v_indptr));
+  PyTuple_SET_ITEM(__pyx_t_4, 2, ((PyObject *)__pyx_v_indptr));
+  __Pyx_GIVEREF(((PyObject *)__pyx_v_indptr));
+  __pyx_t_7 = 0;
+  __pyx_t_6 = 0;
+  __pyx_r = ((PyObject *)__pyx_t_4);
+  __pyx_t_4 = 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_XDEC_MEMVIEW(&__pyx_t_2, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1);
   __Pyx_XDECREF(__pyx_t_4);
-  __Pyx_XDECREF(__pyx_t_5);
-  __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
-  __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
+  __Pyx_XDECREF(__pyx_t_6);
+  __Pyx_XDECREF(__pyx_t_7);
   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
-    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
+    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_data.rcbuffer->pybuffer);
+    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indices.rcbuffer->pybuffer);
+    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indptr.rcbuffer->pybuffer);
   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
-  __Pyx_AddTraceback("reconstruct.reconstruct", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("sparse_csr.LUT_to_CSR", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   goto __pyx_L2;
   __pyx_L0:;
-  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
+  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_data.rcbuffer->pybuffer);
+  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indices.rcbuffer->pybuffer);
+  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indptr.rcbuffer->pybuffer);
   __pyx_L2:;
-  __PYX_XDEC_MEMVIEW(&__pyx_v_cdata, 1);
-  __PYX_XDEC_MEMVIEW(&__pyx_v_cmask, 1);
-  __Pyx_XDECREF((PyObject *)__pyx_v_out);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_idx, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_coef, 1);
   __Pyx_XDECREF((PyObject *)__pyx_v_data);
-  __Pyx_XDECREF((PyObject *)__pyx_v_mask);
+  __Pyx_XDECREF((PyObject *)__pyx_v_indices);
+  __Pyx_XDECREF((PyObject *)__pyx_v_indptr);
   __Pyx_XGIVEREF(__pyx_r);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
 /* Python wrapper */
-static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
-static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
+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);
@@ -2995,7 +2435,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  * 
  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
  */
-    __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __Pyx_Raise(__pyx_t_4, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
@@ -3035,7 +2475,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  * 
  *             info.buf = PyArray_DATA(self)
  */
-    __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __Pyx_Raise(__pyx_t_4, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
@@ -3185,33 +2625,42 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *             cdef list stack
  *             cdef int offset
  */
-  __Pyx_INCREF(((PyObject *)__pyx_v_self->descr));
-  __pyx_v_descr = __pyx_v_self->descr;
+  __pyx_t_4 = ((PyObject *)__pyx_v_self->descr);
+  __Pyx_INCREF(__pyx_t_4);
+  __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4);
+  __pyx_t_4 = 0;
 
   /* "numpy.pxd":244
  *             cdef int offset
  * 
- *             cdef bint hasfields = PyDataType_HASFIELDS(descr)             # <<<<<<<<<<<<<<
+ *             cdef bint hasfields = PyDataType_HASFIELDS(descr) or descr.type_num == NPY_VOID             # <<<<<<<<<<<<<<
  * 
  *             if not hasfields and not copy_shape:
  */
-  __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr);
+  __pyx_t_2 = PyDataType_HASFIELDS(__pyx_v_descr);
+  if (!__pyx_t_2) {
+    __pyx_t_3 = (__pyx_v_descr->type_num == NPY_VOID);
+    __pyx_t_1 = __pyx_t_3;
+  } else {
+    __pyx_t_1 = __pyx_t_2;
+  }
+  __pyx_v_hasfields = __pyx_t_1;
 
   /* "numpy.pxd":246
- *             cdef bint hasfields = PyDataType_HASFIELDS(descr)
+ *             cdef bint hasfields = PyDataType_HASFIELDS(descr) or descr.type_num == NPY_VOID
  * 
  *             if not hasfields and not copy_shape:             # <<<<<<<<<<<<<<
  *                 # do not call releasebuffer
  *                 info.obj = None
  */
-  __pyx_t_2 = (!__pyx_v_hasfields);
-  if (__pyx_t_2) {
-    __pyx_t_3 = (!__pyx_v_copy_shape);
-    __pyx_t_1 = __pyx_t_3;
+  __pyx_t_1 = (!__pyx_v_hasfields);
+  if (__pyx_t_1) {
+    __pyx_t_2 = (!__pyx_v_copy_shape);
+    __pyx_t_3 = __pyx_t_2;
   } else {
-    __pyx_t_1 = __pyx_t_2;
+    __pyx_t_3 = __pyx_t_1;
   }
-  if (__pyx_t_1) {
+  if (__pyx_t_3) {
 
     /* "numpy.pxd":248
  *             if not hasfields and not copy_shape:
@@ -3251,8 +2700,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 t = descr.type_num
  *                 if ((descr.byteorder == c'>' and little_endian) or
  */
-  __pyx_t_1 = (!__pyx_v_hasfields);
-  if (__pyx_t_1) {
+  __pyx_t_3 = (!__pyx_v_hasfields);
+  if (__pyx_t_3) {
 
     /* "numpy.pxd":254
  * 
@@ -3261,7 +2710,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 if ((descr.byteorder == c'>' and little_endian) or
  *                     (descr.byteorder == c'<' and not little_endian)):
  */
-    __pyx_v_t = __pyx_v_descr->type_num;
+    __pyx_t_5 = __pyx_v_descr->type_num;
+    __pyx_v_t = __pyx_t_5;
 
     /* "numpy.pxd":255
  *             if not hasfields:
@@ -3270,13 +2720,13 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                     (descr.byteorder == c'<' and not little_endian)):
  *                     raise ValueError(u"Non-native byte order not supported")
  */
-    __pyx_t_1 = (__pyx_v_descr->byteorder == '>');
-    if (__pyx_t_1) {
-      __pyx_t_2 = __pyx_v_little_endian;
+    __pyx_t_3 = (__pyx_v_descr->byteorder == '>');
+    if (__pyx_t_3) {
+      __pyx_t_1 = __pyx_v_little_endian;
     } else {
-      __pyx_t_2 = __pyx_t_1;
+      __pyx_t_1 = __pyx_t_3;
     }
-    if (!__pyx_t_2) {
+    if (!__pyx_t_1) {
 
       /* "numpy.pxd":256
  *                 t = descr.type_num
@@ -3285,18 +2735,18 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                     raise ValueError(u"Non-native byte order not supported")
  *                 if   t == NPY_BYTE:        f = "b"
  */
-      __pyx_t_1 = (__pyx_v_descr->byteorder == '<');
-      if (__pyx_t_1) {
-        __pyx_t_3 = (!__pyx_v_little_endian);
-        __pyx_t_7 = __pyx_t_3;
+      __pyx_t_3 = (__pyx_v_descr->byteorder == '<');
+      if (__pyx_t_3) {
+        __pyx_t_2 = (!__pyx_v_little_endian);
+        __pyx_t_7 = __pyx_t_2;
       } else {
-        __pyx_t_7 = __pyx_t_1;
+        __pyx_t_7 = __pyx_t_3;
       }
-      __pyx_t_1 = __pyx_t_7;
+      __pyx_t_3 = __pyx_t_7;
     } else {
-      __pyx_t_1 = __pyx_t_2;
+      __pyx_t_3 = __pyx_t_1;
     }
-    if (__pyx_t_1) {
+    if (__pyx_t_3) {
 
       /* "numpy.pxd":257
  *                 if ((descr.byteorder == c'>' and little_endian) or
@@ -3305,7 +2755,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 if   t == NPY_BYTE:        f = "b"
  *                 elif t == NPY_UBYTE:       f = "B"
  */
-      __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_7), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_4);
       __Pyx_Raise(__pyx_t_4, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
@@ -3314,227 +2764,202 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
     }
     __pyx_L12:;
 
-    /* "numpy.pxd":258
+    /* "numpy.pxd":274
+ *                 elif t == NPY_CDOUBLE:     f = "Zd"
+ *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
+ *                 elif t == NPY_OBJECT:      f = "O"             # <<<<<<<<<<<<<<
+ *                 else:
+ *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
+ */
+    switch (__pyx_v_t) {
+
+      /* "numpy.pxd":258
  *                     (descr.byteorder == c'<' and not little_endian)):
  *                     raise ValueError(u"Non-native byte order not supported")
  *                 if   t == NPY_BYTE:        f = "b"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_UBYTE:       f = "B"
  *                 elif t == NPY_SHORT:       f = "h"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_BYTE);
-    if (__pyx_t_1) {
+      case NPY_BYTE:
       __pyx_v_f = __pyx_k__b;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":259
+      /* "numpy.pxd":259
  *                     raise ValueError(u"Non-native byte order not supported")
  *                 if   t == NPY_BYTE:        f = "b"
  *                 elif t == NPY_UBYTE:       f = "B"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_SHORT:       f = "h"
  *                 elif t == NPY_USHORT:      f = "H"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_UBYTE);
-    if (__pyx_t_1) {
+      case NPY_UBYTE:
       __pyx_v_f = __pyx_k__B;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":260
+      /* "numpy.pxd":260
  *                 if   t == NPY_BYTE:        f = "b"
  *                 elif t == NPY_UBYTE:       f = "B"
  *                 elif t == NPY_SHORT:       f = "h"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_USHORT:      f = "H"
  *                 elif t == NPY_INT:         f = "i"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_SHORT);
-    if (__pyx_t_1) {
+      case NPY_SHORT:
       __pyx_v_f = __pyx_k__h;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":261
+      /* "numpy.pxd":261
  *                 elif t == NPY_UBYTE:       f = "B"
  *                 elif t == NPY_SHORT:       f = "h"
  *                 elif t == NPY_USHORT:      f = "H"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_INT:         f = "i"
  *                 elif t == NPY_UINT:        f = "I"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_USHORT);
-    if (__pyx_t_1) {
+      case NPY_USHORT:
       __pyx_v_f = __pyx_k__H;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":262
+      /* "numpy.pxd":262
  *                 elif t == NPY_SHORT:       f = "h"
  *                 elif t == NPY_USHORT:      f = "H"
  *                 elif t == NPY_INT:         f = "i"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_UINT:        f = "I"
  *                 elif t == NPY_LONG:        f = "l"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_INT);
-    if (__pyx_t_1) {
+      case NPY_INT:
       __pyx_v_f = __pyx_k__i;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":263
+      /* "numpy.pxd":263
  *                 elif t == NPY_USHORT:      f = "H"
  *                 elif t == NPY_INT:         f = "i"
  *                 elif t == NPY_UINT:        f = "I"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_LONG:        f = "l"
  *                 elif t == NPY_ULONG:       f = "L"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_UINT);
-    if (__pyx_t_1) {
+      case NPY_UINT:
       __pyx_v_f = __pyx_k__I;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":264
+      /* "numpy.pxd":264
  *                 elif t == NPY_INT:         f = "i"
  *                 elif t == NPY_UINT:        f = "I"
  *                 elif t == NPY_LONG:        f = "l"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_ULONG:       f = "L"
  *                 elif t == NPY_LONGLONG:    f = "q"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_LONG);
-    if (__pyx_t_1) {
+      case NPY_LONG:
       __pyx_v_f = __pyx_k__l;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":265
+      /* "numpy.pxd":265
  *                 elif t == NPY_UINT:        f = "I"
  *                 elif t == NPY_LONG:        f = "l"
  *                 elif t == NPY_ULONG:       f = "L"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_LONGLONG:    f = "q"
  *                 elif t == NPY_ULONGLONG:   f = "Q"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_ULONG);
-    if (__pyx_t_1) {
+      case NPY_ULONG:
       __pyx_v_f = __pyx_k__L;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":266
+      /* "numpy.pxd":266
  *                 elif t == NPY_LONG:        f = "l"
  *                 elif t == NPY_ULONG:       f = "L"
  *                 elif t == NPY_LONGLONG:    f = "q"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_ULONGLONG:   f = "Q"
  *                 elif t == NPY_FLOAT:       f = "f"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG);
-    if (__pyx_t_1) {
+      case NPY_LONGLONG:
       __pyx_v_f = __pyx_k__q;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":267
+      /* "numpy.pxd":267
  *                 elif t == NPY_ULONG:       f = "L"
  *                 elif t == NPY_LONGLONG:    f = "q"
  *                 elif t == NPY_ULONGLONG:   f = "Q"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_FLOAT:       f = "f"
  *                 elif t == NPY_DOUBLE:      f = "d"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG);
-    if (__pyx_t_1) {
+      case NPY_ULONGLONG:
       __pyx_v_f = __pyx_k__Q;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":268
+      /* "numpy.pxd":268
  *                 elif t == NPY_LONGLONG:    f = "q"
  *                 elif t == NPY_ULONGLONG:   f = "Q"
  *                 elif t == NPY_FLOAT:       f = "f"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_DOUBLE:      f = "d"
  *                 elif t == NPY_LONGDOUBLE:  f = "g"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_FLOAT);
-    if (__pyx_t_1) {
+      case NPY_FLOAT:
       __pyx_v_f = __pyx_k__f;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":269
+      /* "numpy.pxd":269
  *                 elif t == NPY_ULONGLONG:   f = "Q"
  *                 elif t == NPY_FLOAT:       f = "f"
  *                 elif t == NPY_DOUBLE:      f = "d"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_LONGDOUBLE:  f = "g"
  *                 elif t == NPY_CFLOAT:      f = "Zf"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE);
-    if (__pyx_t_1) {
+      case NPY_DOUBLE:
       __pyx_v_f = __pyx_k__d;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":270
+      /* "numpy.pxd":270
  *                 elif t == NPY_FLOAT:       f = "f"
  *                 elif t == NPY_DOUBLE:      f = "d"
  *                 elif t == NPY_LONGDOUBLE:  f = "g"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_CFLOAT:      f = "Zf"
  *                 elif t == NPY_CDOUBLE:     f = "Zd"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE);
-    if (__pyx_t_1) {
+      case NPY_LONGDOUBLE:
       __pyx_v_f = __pyx_k__g;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":271
+      /* "numpy.pxd":271
  *                 elif t == NPY_DOUBLE:      f = "d"
  *                 elif t == NPY_LONGDOUBLE:  f = "g"
  *                 elif t == NPY_CFLOAT:      f = "Zf"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_CDOUBLE:     f = "Zd"
  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT);
-    if (__pyx_t_1) {
+      case NPY_CFLOAT:
       __pyx_v_f = __pyx_k__Zf;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":272
+      /* "numpy.pxd":272
  *                 elif t == NPY_LONGDOUBLE:  f = "g"
  *                 elif t == NPY_CFLOAT:      f = "Zf"
  *                 elif t == NPY_CDOUBLE:     f = "Zd"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
  *                 elif t == NPY_OBJECT:      f = "O"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE);
-    if (__pyx_t_1) {
+      case NPY_CDOUBLE:
       __pyx_v_f = __pyx_k__Zd;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":273
+      /* "numpy.pxd":273
  *                 elif t == NPY_CFLOAT:      f = "Zf"
  *                 elif t == NPY_CDOUBLE:     f = "Zd"
  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_OBJECT:      f = "O"
  *                 else:
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE);
-    if (__pyx_t_1) {
+      case NPY_CLONGDOUBLE:
       __pyx_v_f = __pyx_k__Zg;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":274
+      /* "numpy.pxd":274
  *                 elif t == NPY_CDOUBLE:     f = "Zd"
  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
  *                 elif t == NPY_OBJECT:      f = "O"             # <<<<<<<<<<<<<<
  *                 else:
  *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_OBJECT);
-    if (__pyx_t_1) {
+      case NPY_OBJECT:
       __pyx_v_f = __pyx_k__O;
-      goto __pyx_L13;
-    }
-    /*else*/ {
+      break;
+      default:
 
       /* "numpy.pxd":276
  *                 elif t == NPY_OBJECT:      f = "O"
@@ -3545,7 +2970,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  */
       __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_8), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_7), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_8));
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
       __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -3559,8 +2984,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
       {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      break;
     }
-    __pyx_L13:;
 
     /* "numpy.pxd":277
  *                 else:
@@ -3656,8 +3081,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
 }
 
 /* Python wrapper */
-static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
-static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
+static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
+static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
   __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));
@@ -3949,12 +3374,16 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__
 
 static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) {
   PyArray_Descr *__pyx_v_child = 0;
+  int __pyx_v_size;
+  int __pyx_v_idx;
   int __pyx_v_endian_detector;
   int __pyx_v_little_endian;
   PyObject *__pyx_v_fields = 0;
   PyObject *__pyx_v_childname = NULL;
   PyObject *__pyx_v_new_offset = NULL;
   PyObject *__pyx_v_t = NULL;
+  PyObject *__pyx_v_shape = NULL;
+  long __pyx_v_val;
   char *__pyx_r;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -3968,14 +3397,18 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
   int __pyx_t_9;
   int __pyx_t_10;
   long __pyx_t_11;
-  char *__pyx_t_12;
+  Py_ssize_t __pyx_t_12;
+  PyObject *(*__pyx_t_13)(PyObject *);
+  int __pyx_t_14;
+  int __pyx_t_15;
+  char *__pyx_t_16;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("_util_dtypestring", 0);
 
   /* "numpy.pxd":790
- *     cdef int delta_offset
+ *     cdef int delta_offset, size, idx
  *     cdef tuple i
  *     cdef int endian_detector = 1             # <<<<<<<<<<<<<<
  *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
@@ -4055,7 +3488,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
       __Pyx_INCREF(__pyx_t_4);
       #else
       __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
       __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_4);
       #endif
     } else if (1) {
       __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -4119,7 +3554,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  * 
  *         if ((child.byteorder == c'>' and little_endian) or
  */
-      __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_9), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
       __Pyx_Raise(__pyx_t_5, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
@@ -4170,7 +3605,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  *             # One could encode it in the format string and have Cython
  *             # complain instead, BUT: < and > in format strings also imply
  */
-      __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_11), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
       __Pyx_Raise(__pyx_t_5, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
@@ -4274,7 +3709,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  * 
  *             # Until ticket #99 is fixed, use integers to avoid warnings
  */
-        __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_13), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_3);
         __Pyx_Raise(__pyx_t_3, 0, 0, 0);
         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
@@ -4562,7 +3997,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
  *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg             # <<<<<<<<<<<<<<
  *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
- *             else:
+ *             elif t == NPY_VOID:
  */
       __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
@@ -4581,8 +4016,8 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
  *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
  *             elif t == NPY_OBJECT:      f[0] = 79 #"O"             # <<<<<<<<<<<<<<
- *             else:
- *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
+ *             elif t == NPY_VOID:
+ *                 shape =  child.shape
  */
       __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
@@ -4594,32 +4029,441 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
         (__pyx_v_f[0]) = 79;
         goto __pyx_L13;
       }
-      /*else*/ {
+
+      /* "numpy.pxd":843
+ *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
+ *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
+ *             elif t == NPY_VOID:             # <<<<<<<<<<<<<<
+ *                 shape =  child.shape
+ *                 size = 1
+ */
+      __pyx_t_5 = PyInt_FromLong(NPY_VOID); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      if (__pyx_t_7) {
 
         /* "numpy.pxd":844
  *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
+ *             elif t == NPY_VOID:
+ *                 shape =  child.shape             # <<<<<<<<<<<<<<
+ *                 size = 1
+ *                 for idx in shape: size*=idx
+ */
+        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_child), __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_3);
+        __Pyx_XDECREF(__pyx_v_shape);
+        __pyx_v_shape = __pyx_t_3;
+        __pyx_t_3 = 0;
+
+        /* "numpy.pxd":845
+ *             elif t == NPY_VOID:
+ *                 shape =  child.shape
+ *                 size = 1             # <<<<<<<<<<<<<<
+ *                 for idx in shape: size*=idx
+ *                 t = child.base.num
+ */
+        __pyx_v_size = 1;
+
+        /* "numpy.pxd":846
+ *                 shape =  child.shape
+ *                 size = 1
+ *                 for idx in shape: size*=idx             # <<<<<<<<<<<<<<
+ *                 t = child.base.num
+ *                 if   t == NPY_BYTE:        val =  98 #"b"
+ */
+        if (PyList_CheckExact(__pyx_v_shape) || PyTuple_CheckExact(__pyx_v_shape)) {
+          __pyx_t_3 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_3); __pyx_t_12 = 0;
+          __pyx_t_13 = NULL;
+        } else {
+          __pyx_t_12 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_3);
+          __pyx_t_13 = Py_TYPE(__pyx_t_3)->tp_iternext;
+        }
+        for (;;) {
+          if (!__pyx_t_13 && PyList_CheckExact(__pyx_t_3)) {
+            if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_3)) break;
+            #if CYTHON_COMPILING_IN_CPYTHON
+            __pyx_t_5 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_12); __Pyx_INCREF(__pyx_t_5); __pyx_t_12++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+            #else
+            __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+            #endif
+          } else if (!__pyx_t_13 && PyTuple_CheckExact(__pyx_t_3)) {
+            if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
+            #if CYTHON_COMPILING_IN_CPYTHON
+            __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_12); __Pyx_INCREF(__pyx_t_5); __pyx_t_12++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+            #else
+            __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+            #endif
+          } else {
+            __pyx_t_5 = __pyx_t_13(__pyx_t_3);
+            if (unlikely(!__pyx_t_5)) {
+              if (PyErr_Occurred()) {
+                if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
+                else {__pyx_filename = __pyx_f[1]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+              }
+              break;
+            }
+            __Pyx_GOTREF(__pyx_t_5);
+          }
+          __pyx_t_14 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+          __pyx_v_idx = __pyx_t_14;
+          __pyx_v_size = (__pyx_v_size * __pyx_v_idx);
+        }
+        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+
+        /* "numpy.pxd":847
+ *                 size = 1
+ *                 for idx in shape: size*=idx
+ *                 t = child.base.num             # <<<<<<<<<<<<<<
+ *                 if   t == NPY_BYTE:        val =  98 #"b"
+ *                 elif t == NPY_UBYTE:       val =  66 #"B"
+ */
+        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_child), __pyx_n_s__base); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_3);
+        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__num); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_5);
+        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+        __Pyx_DECREF(__pyx_v_t);
+        __pyx_v_t = __pyx_t_5;
+        __pyx_t_5 = 0;
+
+        /* "numpy.pxd":848
+ *                 for idx in shape: size*=idx
+ *                 t = child.base.num
+ *                 if   t == NPY_BYTE:        val =  98 #"b"             # <<<<<<<<<<<<<<
+ *                 elif t == NPY_UBYTE:       val =  66 #"B"
+ *                 elif t == NPY_SHORT:       val = 104 #"h"
+ */
+        __pyx_t_5 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_5);
+        __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+        if (__pyx_t_7) {
+          __pyx_v_val = 98;
+          goto __pyx_L16;
+        }
+
+        /* "numpy.pxd":849
+ *                 t = child.base.num
+ *                 if   t == NPY_BYTE:        val =  98 #"b"
+ *                 elif t == NPY_UBYTE:       val =  66 #"B"             # <<<<<<<<<<<<<<
+ *                 elif t == NPY_SHORT:       val = 104 #"h"
+ *                 elif t == NPY_USHORT:      val =  72 #"H"
+ */
+        __pyx_t_3 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_3);
+        __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+        if (__pyx_t_7) {
+          __pyx_v_val = 66;
+          goto __pyx_L16;
+        }
+
+        /* "numpy.pxd":850
+ *                 if   t == NPY_BYTE:        val =  98 #"b"
+ *                 elif t == NPY_UBYTE:       val =  66 #"B"
+ *                 elif t == NPY_SHORT:       val = 104 #"h"             # <<<<<<<<<<<<<<
+ *                 elif t == NPY_USHORT:      val =  72 #"H"
+ *                 elif t == NPY_INT:         val = 105 #"i"
+ */
+        __pyx_t_5 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_5);
+        __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+        if (__pyx_t_7) {
+          __pyx_v_val = 104;
+          goto __pyx_L16;
+        }
+
+        /* "numpy.pxd":851
+ *                 elif t == NPY_UBYTE:       val =  66 #"B"
+ *                 elif t == NPY_SHORT:       val = 104 #"h"
+ *                 elif t == NPY_USHORT:      val =  72 #"H"             # <<<<<<<<<<<<<<
+ *                 elif t == NPY_INT:         val = 105 #"i"
+ *                 elif t == NPY_UINT:        val =  73 #"I"
+ */
+        __pyx_t_3 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_3);
+        __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+        if (__pyx_t_7) {
+          __pyx_v_val = 72;
+          goto __pyx_L16;
+        }
+
+        /* "numpy.pxd":852
+ *                 elif t == NPY_SHORT:       val = 104 #"h"
+ *                 elif t == NPY_USHORT:      val =  72 #"H"
+ *                 elif t == NPY_INT:         val = 105 #"i"             # <<<<<<<<<<<<<<
+ *                 elif t == NPY_UINT:        val =  73 #"I"
+ *                 elif t == NPY_LONG:        val = 108 #"l"
+ */
+        __pyx_t_5 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_5);
+        __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+        if (__pyx_t_7) {
+          __pyx_v_val = 105;
+          goto __pyx_L16;
+        }
+
+        /* "numpy.pxd":853
+ *                 elif t == NPY_USHORT:      val =  72 #"H"
+ *                 elif t == NPY_INT:         val = 105 #"i"
+ *                 elif t == NPY_UINT:        val =  73 #"I"             # <<<<<<<<<<<<<<
+ *                 elif t == NPY_LONG:        val = 108 #"l"
+ *                 elif t == NPY_ULONG:       val = 76  #"L"
+ */
+        __pyx_t_3 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_3);
+        __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+        if (__pyx_t_7) {
+          __pyx_v_val = 73;
+          goto __pyx_L16;
+        }
+
+        /* "numpy.pxd":854
+ *                 elif t == NPY_INT:         val = 105 #"i"
+ *                 elif t == NPY_UINT:        val =  73 #"I"
+ *                 elif t == NPY_LONG:        val = 108 #"l"             # <<<<<<<<<<<<<<
+ *                 elif t == NPY_ULONG:       val = 76  #"L"
+ *                 elif t == NPY_LONGLONG:    val = 113 #"q"
+ */
+        __pyx_t_5 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_5);
+        __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+        if (__pyx_t_7) {
+          __pyx_v_val = 108;
+          goto __pyx_L16;
+        }
+
+        /* "numpy.pxd":855
+ *                 elif t == NPY_UINT:        val =  73 #"I"
+ *                 elif t == NPY_LONG:        val = 108 #"l"
+ *                 elif t == NPY_ULONG:       val = 76  #"L"             # <<<<<<<<<<<<<<
+ *                 elif t == NPY_LONGLONG:    val = 113 #"q"
+ *                 elif t == NPY_ULONGLONG:   val = 81  #"Q"
+ */
+        __pyx_t_3 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_3);
+        __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+        if (__pyx_t_7) {
+          __pyx_v_val = 76;
+          goto __pyx_L16;
+        }
+
+        /* "numpy.pxd":856
+ *                 elif t == NPY_LONG:        val = 108 #"l"
+ *                 elif t == NPY_ULONG:       val = 76  #"L"
+ *                 elif t == NPY_LONGLONG:    val = 113 #"q"             # <<<<<<<<<<<<<<
+ *                 elif t == NPY_ULONGLONG:   val = 81  #"Q"
+ *                 elif t == NPY_FLOAT:       val = 102 #"f"
+ */
+        __pyx_t_5 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_5);
+        __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+        if (__pyx_t_7) {
+          __pyx_v_val = 113;
+          goto __pyx_L16;
+        }
+
+        /* "numpy.pxd":857
+ *                 elif t == NPY_ULONG:       val = 76  #"L"
+ *                 elif t == NPY_LONGLONG:    val = 113 #"q"
+ *                 elif t == NPY_ULONGLONG:   val = 81  #"Q"             # <<<<<<<<<<<<<<
+ *                 elif t == NPY_FLOAT:       val = 102 #"f"
+ *                 elif t == NPY_DOUBLE:      val = 100 #"d"
+ */
+        __pyx_t_3 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_3);
+        __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+        if (__pyx_t_7) {
+          __pyx_v_val = 81;
+          goto __pyx_L16;
+        }
+
+        /* "numpy.pxd":858
+ *                 elif t == NPY_LONGLONG:    val = 113 #"q"
+ *                 elif t == NPY_ULONGLONG:   val = 81  #"Q"
+ *                 elif t == NPY_FLOAT:       val = 102 #"f"             # <<<<<<<<<<<<<<
+ *                 elif t == NPY_DOUBLE:      val = 100 #"d"
+ *                 elif t == NPY_LONGDOUBLE:  val = 103 #"g"
+ */
+        __pyx_t_5 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_5);
+        __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+        if (__pyx_t_7) {
+          __pyx_v_val = 102;
+          goto __pyx_L16;
+        }
+
+        /* "numpy.pxd":859
+ *                 elif t == NPY_ULONGLONG:   val = 81  #"Q"
+ *                 elif t == NPY_FLOAT:       val = 102 #"f"
+ *                 elif t == NPY_DOUBLE:      val = 100 #"d"             # <<<<<<<<<<<<<<
+ *                 elif t == NPY_LONGDOUBLE:  val = 103 #"g"
+ *                 elif t == NPY_OBJECT:      val = 79 #"O"
+ */
+        __pyx_t_3 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_3);
+        __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+        if (__pyx_t_7) {
+          __pyx_v_val = 100;
+          goto __pyx_L16;
+        }
+
+        /* "numpy.pxd":860
+ *                 elif t == NPY_FLOAT:       val = 102 #"f"
+ *                 elif t == NPY_DOUBLE:      val = 100 #"d"
+ *                 elif t == NPY_LONGDOUBLE:  val = 103 #"g"             # <<<<<<<<<<<<<<
+ *                 elif t == NPY_OBJECT:      val = 79 #"O"
+ *                 else:
+ */
+        __pyx_t_5 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_5);
+        __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+        if (__pyx_t_7) {
+          __pyx_v_val = 103;
+          goto __pyx_L16;
+        }
+
+        /* "numpy.pxd":861
+ *                 elif t == NPY_DOUBLE:      val = 100 #"d"
+ *                 elif t == NPY_LONGDOUBLE:  val = 103 #"g"
+ *                 elif t == NPY_OBJECT:      val = 79 #"O"             # <<<<<<<<<<<<<<
+ *                 else:
+ *                     raise ValueError(u"unknown dtype code substructure in numpy.pxd (%d)" % t)
+ */
+        __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_3);
+        __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+        if (__pyx_t_7) {
+          __pyx_v_val = 79;
+          goto __pyx_L16;
+        }
+        /*else*/ {
+
+          /* "numpy.pxd":863
+ *                 elif t == NPY_OBJECT:      val = 79 #"O"
+ *                 else:
+ *                     raise ValueError(u"unknown dtype code substructure in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
+ *                 for idx in range(size):
+ *                     f[idx] = val
+ */
+          __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_13), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+          __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_3);
+          PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5));
+          __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
+          __pyx_t_5 = 0;
+          __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __Pyx_GOTREF(__pyx_t_5);
+          __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+          __Pyx_Raise(__pyx_t_5, 0, 0, 0);
+          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+          {__pyx_filename = __pyx_f[1]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        }
+        __pyx_L16:;
+
+        /* "numpy.pxd":864
+ *                 else:
+ *                     raise ValueError(u"unknown dtype code substructure in numpy.pxd (%d)" % t)
+ *                 for idx in range(size):             # <<<<<<<<<<<<<<
+ *                     f[idx] = val
+ *                 f+=size-1
+ */
+        __pyx_t_14 = __pyx_v_size;
+        for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
+          __pyx_v_idx = __pyx_t_15;
+
+          /* "numpy.pxd":865
+ *                     raise ValueError(u"unknown dtype code substructure in numpy.pxd (%d)" % t)
+ *                 for idx in range(size):
+ *                     f[idx] = val             # <<<<<<<<<<<<<<
+ *                 f+=size-1
+ *             else:
+ */
+          (__pyx_v_f[__pyx_v_idx]) = __pyx_v_val;
+        }
+
+        /* "numpy.pxd":866
+ *                 for idx in range(size):
+ *                     f[idx] = val
+ *                 f+=size-1             # <<<<<<<<<<<<<<
+ *             else:
+ *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
+ */
+        __pyx_v_f = (__pyx_v_f + (__pyx_v_size - 1));
+        goto __pyx_L13;
+      }
+      /*else*/ {
+
+        /* "numpy.pxd":868
+ *                 f+=size-1
  *             else:
  *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
  *             f += 1
  *         else:
  */
-        __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_8), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_7), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(((PyObject *)__pyx_t_5));
-        __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_3);
         PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5));
         __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
         __pyx_t_5 = 0;
-        __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_5);
         __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
         __Pyx_Raise(__pyx_t_5, 0, 0, 0);
         __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-        {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        {__pyx_filename = __pyx_f[1]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       }
       __pyx_L13:;
 
-      /* "numpy.pxd":845
+      /* "numpy.pxd":869
  *             else:
  *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
  *             f += 1             # <<<<<<<<<<<<<<
@@ -4631,21 +4475,21 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
     }
     /*else*/ {
 
-      /* "numpy.pxd":849
+      /* "numpy.pxd":873
  *             # Cython ignores struct boundary information ("T{...}"),
  *             # so don't output it
  *             f = _util_dtypestring(child, f, end, offset)             # <<<<<<<<<<<<<<
  *     return f
  * 
  */
-      __pyx_t_12 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_v_f = __pyx_t_12;
+      __pyx_t_16 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_16 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_v_f = __pyx_t_16;
     }
     __pyx_L11:;
   }
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "numpy.pxd":850
+  /* "numpy.pxd":874
  *             # so don't output it
  *             f = _util_dtypestring(child, f, end, offset)
  *     return f             # <<<<<<<<<<<<<<
@@ -4670,11 +4514,12 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
   __Pyx_XDECREF(__pyx_v_childname);
   __Pyx_XDECREF(__pyx_v_new_offset);
   __Pyx_XDECREF(__pyx_v_t);
+  __Pyx_XDECREF(__pyx_v_shape);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "numpy.pxd":965
+/* "numpy.pxd":989
  * 
  * 
  * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
@@ -4688,7 +4533,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a
   int __pyx_t_1;
   __Pyx_RefNannySetupContext("set_array_base", 0);
 
-  /* "numpy.pxd":967
+  /* "numpy.pxd":991
  * cdef inline void set_array_base(ndarray arr, object base):
  *      cdef PyObject* baseptr
  *      if base is None:             # <<<<<<<<<<<<<<
@@ -4698,7 +4543,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a
   __pyx_t_1 = (__pyx_v_base == Py_None);
   if (__pyx_t_1) {
 
-    /* "numpy.pxd":968
+    /* "numpy.pxd":992
  *      cdef PyObject* baseptr
  *      if base is None:
  *          baseptr = NULL             # <<<<<<<<<<<<<<
@@ -4710,7 +4555,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a
   }
   /*else*/ {
 
-    /* "numpy.pxd":970
+    /* "numpy.pxd":994
  *          baseptr = NULL
  *      else:
  *          Py_INCREF(base) # important to do this before decref below!             # <<<<<<<<<<<<<<
@@ -4719,7 +4564,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a
  */
     Py_INCREF(__pyx_v_base);
 
-    /* "numpy.pxd":971
+    /* "numpy.pxd":995
  *      else:
  *          Py_INCREF(base) # important to do this before decref below!
  *          baseptr = <PyObject*>base             # <<<<<<<<<<<<<<
@@ -4730,7 +4575,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a
   }
   __pyx_L3:;
 
-  /* "numpy.pxd":972
+  /* "numpy.pxd":996
  *          Py_INCREF(base) # important to do this before decref below!
  *          baseptr = <PyObject*>base
  *      Py_XDECREF(arr.base)             # <<<<<<<<<<<<<<
@@ -4739,7 +4584,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a
  */
   Py_XDECREF(__pyx_v_arr->base);
 
-  /* "numpy.pxd":973
+  /* "numpy.pxd":997
  *          baseptr = <PyObject*>base
  *      Py_XDECREF(arr.base)
  *      arr.base = baseptr             # <<<<<<<<<<<<<<
@@ -4751,7 +4596,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a
   __Pyx_RefNannyFinishContext();
 }
 
-/* "numpy.pxd":975
+/* "numpy.pxd":999
  *      arr.base = baseptr
  * 
  * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
@@ -4765,7 +4610,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py
   int __pyx_t_1;
   __Pyx_RefNannySetupContext("get_array_base", 0);
 
-  /* "numpy.pxd":976
+  /* "numpy.pxd":1000
  * 
  * cdef inline object get_array_base(ndarray arr):
  *     if arr.base is NULL:             # <<<<<<<<<<<<<<
@@ -4775,7 +4620,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py
   __pyx_t_1 = (__pyx_v_arr->base == NULL);
   if (__pyx_t_1) {
 
-    /* "numpy.pxd":977
+    /* "numpy.pxd":1001
  * cdef inline object get_array_base(ndarray arr):
  *     if arr.base is NULL:
  *         return None             # <<<<<<<<<<<<<<
@@ -4790,7 +4635,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py
   }
   /*else*/ {
 
-    /* "numpy.pxd":979
+    /* "numpy.pxd":1003
  *         return None
  *     else:
  *         return <object>arr.base             # <<<<<<<<<<<<<<
@@ -4817,6 +4662,9 @@ static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, P
   PyObject *__pyx_v_format = 0;
   PyObject *__pyx_v_mode = 0;
   int __pyx_v_allocate_buffer;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
@@ -4936,12 +4784,12 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
   Py_ssize_t __pyx_t_1;
   int __pyx_t_2;
   PyObject *__pyx_t_3 = NULL;
-  PyObject *__pyx_t_4 = NULL;
-  PyObject *__pyx_t_5 = NULL;
-  char *__pyx_t_6;
+  char *__pyx_t_4;
+  int __pyx_t_5;
+  int __pyx_t_6;
   int __pyx_t_7;
-  int __pyx_t_8;
-  int __pyx_t_9;
+  PyObject *__pyx_t_8 = NULL;
+  PyObject *__pyx_t_9 = NULL;
   Py_ssize_t __pyx_t_10;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
@@ -5032,16 +4880,10 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *         if encode:
  *             format = encode('ASCII')
  */
-  __pyx_t_3 = ((PyObject *)__pyx_n_s__encode);
-  __Pyx_INCREF(__pyx_t_3);
-  __pyx_t_4 = Py_None;
-  __Pyx_INCREF(__pyx_t_4);
-  __pyx_t_5 = __Pyx_GetAttr3(__pyx_v_format, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_v_encode = __pyx_t_5;
-  __pyx_t_5 = 0;
+  __pyx_t_3 = __Pyx_GetAttr3(__pyx_v_format, ((PyObject *)__pyx_n_s__encode), Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_v_encode = __pyx_t_3;
+  __pyx_t_3 = 0;
 
   /* "View.MemoryView":130
  * 
@@ -5060,11 +4902,11 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *         self._format = format
  *         self.format = self._format
  */
-    __pyx_t_5 = PyObject_Call(__pyx_v_encode, ((PyObject *)__pyx_k_tuple_18), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
+    __pyx_t_3 = PyObject_Call(__pyx_v_encode, ((PyObject *)__pyx_k_tuple_18), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
     __Pyx_DECREF(__pyx_v_format);
-    __pyx_v_format = __pyx_t_5;
-    __pyx_t_5 = 0;
+    __pyx_v_format = __pyx_t_3;
+    __pyx_t_3 = 0;
     goto __pyx_L5;
   }
   __pyx_L5:;
@@ -5090,8 +4932,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  *         self._shape = <Py_ssize_t *> malloc(sizeof(Py_ssize_t)*self.ndim)
  */
-  __pyx_t_6 = PyBytes_AsString(((PyObject *)__pyx_v_self->_format)); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_self->format = __pyx_t_6;
+  __pyx_t_4 = __Pyx_PyObject_AsString(((PyObject *)__pyx_v_self->_format)); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_v_self->format = __pyx_t_4;
 
   /* "View.MemoryView":135
  *         self.format = self._format
@@ -5120,12 +4962,12 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  */
   __pyx_t_2 = (!(__pyx_v_self->_shape != 0));
   if (!__pyx_t_2) {
-    __pyx_t_7 = (!(__pyx_v_self->_strides != 0));
-    __pyx_t_8 = __pyx_t_7;
+    __pyx_t_5 = (!(__pyx_v_self->_strides != 0));
+    __pyx_t_6 = __pyx_t_5;
   } else {
-    __pyx_t_8 = __pyx_t_2;
+    __pyx_t_6 = __pyx_t_2;
   }
-  if (__pyx_t_8) {
+  if (__pyx_t_6) {
 
     /* "View.MemoryView":139
  * 
@@ -5152,10 +4994,10 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  * 
  */
-    __pyx_t_5 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_20), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_20), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L6;
   }
@@ -5177,20 +5019,20 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             if dim <= 0:
  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
  */
-  __pyx_t_9 = 0;
-  __pyx_t_5 = ((PyObject *)__pyx_v_shape); __Pyx_INCREF(__pyx_t_5); __pyx_t_1 = 0;
+  __pyx_t_7 = 0;
+  __pyx_t_3 = ((PyObject *)__pyx_v_shape); __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
   for (;;) {
-    if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
+    if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
     #if CYTHON_COMPILING_IN_CPYTHON
-    __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_1); __Pyx_INCREF(__pyx_t_4); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_8); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     #else
-    __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_8 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     #endif
     __Pyx_XDECREF(__pyx_v_dim);
-    __pyx_v_dim = __pyx_t_4;
-    __pyx_t_4 = 0;
-    __pyx_v_idx = __pyx_t_9;
-    __pyx_t_9 = (__pyx_t_9 + 1);
+    __pyx_v_dim = __pyx_t_8;
+    __pyx_t_8 = 0;
+    __pyx_v_idx = __pyx_t_7;
+    __pyx_t_7 = (__pyx_t_7 + 1);
 
     /* "View.MemoryView":146
  *         idx = 0
@@ -5199,10 +5041,10 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
  * 
  */
-    __pyx_t_4 = PyObject_RichCompare(__pyx_v_dim, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    if (__pyx_t_8) {
+    __pyx_t_8 = PyObject_RichCompare(__pyx_v_dim, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    if (__pyx_t_6) {
 
       /* "View.MemoryView":147
  *         for idx, dim in enumerate(shape):
@@ -5211,29 +5053,29 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  *             self._shape[idx] = dim
  */
-      __pyx_t_4 = PyInt_FromLong(__pyx_v_idx); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
-      __Pyx_GIVEREF(__pyx_t_4);
+      __pyx_t_8 = PyInt_FromLong(__pyx_v_idx); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_8);
+      __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
+      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8);
+      __Pyx_GIVEREF(__pyx_t_8);
       __Pyx_INCREF(__pyx_v_dim);
-      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_dim);
+      PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_dim);
       __Pyx_GIVEREF(__pyx_v_dim);
-      __pyx_t_4 = 0;
-      __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_21), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
-      __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
-      __pyx_t_4 = 0;
-      __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+      __pyx_t_8 = 0;
+      __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_21), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_8));
+      __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
+      __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
+      PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_t_8));
+      __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
+      __pyx_t_8 = 0;
+      __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_8);
+      __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
+      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
+      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
       {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L9;
     }
@@ -5258,7 +5100,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  */
     __pyx_v_idx = (__pyx_v_idx + 1);
   }
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
   /* "View.MemoryView":152
  *             idx += 1
@@ -5267,22 +5109,22 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)
  * 
  */
-  __Pyx_INCREF(__pyx_v_mode);
-  __pyx_t_5 = __pyx_v_mode;
-  __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, ((PyObject *)__pyx_n_s__fortran), Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (((int)__pyx_t_8)) {
-    __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, ((PyObject *)__pyx_n_s__c), Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_7 = ((int)__pyx_t_2);
+  __Pyx_INCREF(__pyx_v_mode);
+  __pyx_t_3 = __pyx_v_mode;
+  __pyx_t_8 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__fortran), Py_NE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+  if (((int)__pyx_t_6)) {
+    __pyx_t_8 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__c), Py_NE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    __pyx_t_5 = ((int)__pyx_t_2);
   } else {
-    __pyx_t_7 = ((int)__pyx_t_8);
+    __pyx_t_5 = ((int)__pyx_t_6);
   }
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __pyx_t_8 = __pyx_t_7;
-  if (__pyx_t_8) {
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_6 = __pyx_t_5;
+  if (__pyx_t_6) {
 
     /* "View.MemoryView":153
  * 
@@ -5291,18 +5133,18 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  *         cdef char order
  */
-    __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_22), __pyx_v_mode); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
-    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_5));
-    __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
-    __pyx_t_5 = 0;
-    __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_22), __pyx_v_mode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+    __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_8);
+    PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_3));
+    __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
+    __pyx_t_3 = 0;
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
+    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L10;
   }
@@ -5315,10 +5157,10 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             order = 'F'
  *         else:
  */
-  __pyx_t_5 = PyObject_RichCompare(__pyx_v_mode, ((PyObject *)__pyx_n_s__fortran), Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  if (__pyx_t_8) {
+  __pyx_t_3 = PyObject_RichCompare(__pyx_v_mode, ((PyObject *)__pyx_n_s__fortran), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  if (__pyx_t_6) {
 
     /* "View.MemoryView":157
  *         cdef char order
@@ -5359,14 +5201,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *         if decode:
  *             mode = decode('ASCII')
  */
-  __pyx_t_5 = ((PyObject *)__pyx_n_s__decode);
-  __Pyx_INCREF(__pyx_t_5);
-  __pyx_t_4 = Py_None;
-  __Pyx_INCREF(__pyx_t_4);
-  __pyx_t_3 = __Pyx_GetAttr3(__pyx_v_mode, __pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_GetAttr3(__pyx_v_mode, ((PyObject *)__pyx_n_s__decode), Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   __pyx_v_decode = __pyx_t_3;
   __pyx_t_3 = 0;
 
@@ -5377,8 +5213,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             mode = decode('ASCII')
  *         self.mode = mode
  */
-  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_decode); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__pyx_t_8) {
+  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_decode); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__pyx_t_6) {
 
     /* "View.MemoryView":166
  *         decode = getattr(mode, 'decode', None)
@@ -5427,9 +5263,9 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             self.data = <char *>malloc(self.len)
  */
   __pyx_t_3 = PyObject_RichCompare(__pyx_v_format, ((PyObject *)__pyx_n_b__O), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_v_self->dtype_is_object = __pyx_t_8;
+  __pyx_v_self->dtype_is_object = __pyx_t_6;
 
   /* "View.MemoryView":171
  *         self.free_data = allocate_buffer
@@ -5456,8 +5292,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *                 raise MemoryError("unable to allocate array data.")
  * 
  */
-    __pyx_t_8 = (!(__pyx_v_self->data != 0));
-    if (__pyx_t_8) {
+    __pyx_t_6 = (!(__pyx_v_self->data != 0));
+    if (__pyx_t_6) {
 
       /* "View.MemoryView":174
  *             self.data = <char *>malloc(self.len)
@@ -5501,11 +5337,23 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *                     Py_INCREF(Py_None)
  */
       if (unlikely(__pyx_v_itemsize == 0)) {
+        #ifdef WITH_THREAD
+        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+        #endif
         PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero");
+        #ifdef WITH_THREAD
+        PyGILState_Release(__pyx_gilstate_save);
+        #endif
         {__pyx_filename = __pyx_f[2]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       }
       else if (sizeof(Py_ssize_t) == sizeof(long) && unlikely(__pyx_v_itemsize == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) {
+        #ifdef WITH_THREAD
+        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+        #endif
         PyErr_Format(PyExc_OverflowError, "value too large to perform division");
+        #ifdef WITH_THREAD
+        PyGILState_Release(__pyx_gilstate_save);
+        #endif
         {__pyx_filename = __pyx_f[2]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       }
       __pyx_t_1 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_itemsize);
@@ -5541,8 +5389,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_XDECREF(__pyx_t_4);
-  __Pyx_XDECREF(__pyx_t_5);
+  __Pyx_XDECREF(__pyx_t_8);
+  __Pyx_XDECREF(__pyx_t_9);
   __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
@@ -5556,8 +5404,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
 }
 
 /* Python wrapper */
-static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
-static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
+static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
+static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
@@ -5580,7 +5428,10 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
   PyObject *__pyx_t_2 = NULL;
-  int __pyx_t_3;
+  char *__pyx_t_3;
+  Py_ssize_t __pyx_t_4;
+  int __pyx_t_5;
+  Py_ssize_t *__pyx_t_6;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -5675,7 +5526,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.len = self.len
  *         info.ndim = self.ndim
  */
-  __pyx_v_info->buf = __pyx_v_self->data;
+  __pyx_t_3 = __pyx_v_self->data;
+  __pyx_v_info->buf = __pyx_t_3;
 
   /* "View.MemoryView":192
  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
@@ -5684,7 +5536,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.ndim = self.ndim
  *         info.shape = self._shape
  */
-  __pyx_v_info->len = __pyx_v_self->len;
+  __pyx_t_4 = __pyx_v_self->len;
+  __pyx_v_info->len = __pyx_t_4;
 
   /* "View.MemoryView":193
  *         info.buf = self.data
@@ -5693,7 +5546,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.shape = self._shape
  *         info.strides = self._strides
  */
-  __pyx_v_info->ndim = __pyx_v_self->ndim;
+  __pyx_t_5 = __pyx_v_self->ndim;
+  __pyx_v_info->ndim = __pyx_t_5;
 
   /* "View.MemoryView":194
  *         info.len = self.len
@@ -5702,7 +5556,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.strides = self._strides
  *         info.suboffsets = NULL
  */
-  __pyx_v_info->shape = __pyx_v_self->_shape;
+  __pyx_t_6 = __pyx_v_self->_shape;
+  __pyx_v_info->shape = __pyx_t_6;
 
   /* "View.MemoryView":195
  *         info.ndim = self.ndim
@@ -5711,7 +5566,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.suboffsets = NULL
  *         info.itemsize = self.itemsize
  */
-  __pyx_v_info->strides = __pyx_v_self->_strides;
+  __pyx_t_6 = __pyx_v_self->_strides;
+  __pyx_v_info->strides = __pyx_t_6;
 
   /* "View.MemoryView":196
  *         info.shape = self._shape
@@ -5729,7 +5585,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.readonly = 0
  * 
  */
-  __pyx_v_info->itemsize = __pyx_v_self->itemsize;
+  __pyx_t_4 = __pyx_v_self->itemsize;
+  __pyx_v_info->itemsize = __pyx_t_4;
 
   /* "View.MemoryView":198
  *         info.suboffsets = NULL
@@ -5747,8 +5604,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *             info.format = self.format
  *         else:
  */
-  __pyx_t_3 = (__pyx_v_flags & PyBUF_FORMAT);
-  if (__pyx_t_3) {
+  __pyx_t_5 = (__pyx_v_flags & PyBUF_FORMAT);
+  if (__pyx_t_5) {
 
     /* "View.MemoryView":201
  * 
@@ -5757,7 +5614,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         else:
  *             info.format = NULL
  */
-    __pyx_v_info->format = __pyx_v_self->format;
+    __pyx_t_3 = __pyx_v_self->format;
+    __pyx_v_info->format = __pyx_t_3;
     goto __pyx_L5;
   }
   /*else*/ {
@@ -6034,9 +5892,9 @@ static PyObject *__pyx_array_MemoryView_5array_6__getattr__(struct __pyx_array_o
  *     def __getitem__(self, item):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __pyx_r = __pyx_t_2;
@@ -6093,7 +5951,7 @@ static PyObject *__pyx_array_MemoryView_5array_8__getitem__(struct __pyx_array_o
  *     def __setitem__(self, item, value):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (!__pyx_t_2) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
@@ -6150,7 +6008,7 @@ static int __pyx_array_MemoryView_5array_10__setitem__(struct __pyx_array_obj *_
  * 
  * 
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   if (PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -6207,7 +6065,7 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize
  */
     __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_3 = PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_3));
     __pyx_t_4 = ((PyObject *)__Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_4));
@@ -6243,7 +6101,7 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize
  */
     __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_5 = PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_5));
     __pyx_t_3 = ((PyObject *)__Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_3));
@@ -6325,6 +6183,9 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize
 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_name = 0;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
@@ -6517,6 +6378,9 @@ static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_ar
   PyObject *__pyx_v_obj = 0;
   int __pyx_v_flags;
   int __pyx_v_dtype_is_object;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
@@ -6733,7 +6597,7 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor
  *         else:
  *             self.dtype_is_object = dtype_is_object
  */
-    __pyx_t_5 = PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_5));
     __pyx_t_6 = PyObject_RichCompare(((PyObject *)__pyx_t_5), ((PyObject *)__pyx_n_b__O), Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
@@ -7063,7 +6927,9 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
     __Pyx_INCREF(__pyx_t_4);
     #else
     __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
     __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
     #endif
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   } else if (1) {
@@ -7229,7 +7095,9 @@ static int __pyx_memoryview_MemoryView_10memoryview_6__setitem__(struct __pyx_me
     __Pyx_INCREF(__pyx_t_3);
     #else
     __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
     __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
     #endif
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   } else if (1) {
@@ -7372,9 +7240,9 @@ static int __pyx_memoryview_MemoryView_10memoryview_6__setitem__(struct __pyx_me
 static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
+  int __pyx_t_1;
   int __pyx_t_2;
-  int __pyx_t_3;
+  PyObject *__pyx_t_3 = NULL;
   PyObject *__pyx_t_4 = NULL;
   PyObject *__pyx_t_5 = NULL;
   PyObject *__pyx_t_6 = NULL;
@@ -7394,12 +7262,9 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
  *             try:
  *                 obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS,
  */
-  __pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryview_type));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = (!__pyx_t_2);
-  if (__pyx_t_3) {
+  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, ((PyObject *)__pyx_memoryview_type)); 
+  __pyx_t_2 = (!__pyx_t_1);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":389
  *     cdef is_slice(self, obj):
@@ -7409,10 +7274,10 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
  *                                  self.dtype_is_object)
  */
     {
-      __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
+      __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
+      __Pyx_XGOTREF(__pyx_t_3);
       __Pyx_XGOTREF(__pyx_t_4);
       __Pyx_XGOTREF(__pyx_t_5);
-      __Pyx_XGOTREF(__pyx_t_6);
       /*try:*/ {
 
         /* "View.MemoryView":390
@@ -7422,8 +7287,8 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
  *                                  self.dtype_is_object)
  *             except TypeError:
  */
-        __pyx_t_1 = PyInt_FromLong((__pyx_v_self->flags | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
-        __Pyx_GOTREF(__pyx_t_1);
+        __pyx_t_6 = PyInt_FromLong((__pyx_v_self->flags | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+        __Pyx_GOTREF(__pyx_t_6);
 
         /* "View.MemoryView":391
  *             try:
@@ -7439,11 +7304,11 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
         __Pyx_INCREF(__pyx_v_obj);
         PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj);
         __Pyx_GIVEREF(__pyx_v_obj);
-        PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_1);
-        __Pyx_GIVEREF(__pyx_t_1);
+        PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
+        __Pyx_GIVEREF(__pyx_t_6);
         PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
         __Pyx_GIVEREF(__pyx_t_7);
-        __pyx_t_1 = 0;
+        __pyx_t_6 = 0;
         __pyx_t_7 = 0;
         __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject *)__pyx_memoryview_type)), ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
         __Pyx_GOTREF(__pyx_t_7);
@@ -7452,12 +7317,12 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
         __pyx_v_obj = __pyx_t_7;
         __pyx_t_7 = 0;
       }
+      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
       goto __pyx_L11_try_end;
       __pyx_L4_error:;
-      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
       __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
 
@@ -7471,10 +7336,10 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
       __pyx_t_9 = PyErr_ExceptionMatches(__pyx_builtin_TypeError);
       if (__pyx_t_9) {
         __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
-        if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
+        if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
         __Pyx_GOTREF(__pyx_t_7);
         __Pyx_GOTREF(__pyx_t_8);
-        __Pyx_GOTREF(__pyx_t_1);
+        __Pyx_GOTREF(__pyx_t_6);
 
         /* "View.MemoryView":393
  *                                  self.dtype_is_object)
@@ -7486,32 +7351,32 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
         __Pyx_XDECREF(__pyx_r);
         __Pyx_INCREF(Py_None);
         __pyx_r = Py_None;
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
         goto __pyx_L7_except_return;
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
         goto __pyx_L5_exception_handled;
       }
       __pyx_L6_except_error:;
+      __Pyx_XGIVEREF(__pyx_t_3);
       __Pyx_XGIVEREF(__pyx_t_4);
       __Pyx_XGIVEREF(__pyx_t_5);
-      __Pyx_XGIVEREF(__pyx_t_6);
-      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
+      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
       goto __pyx_L1_error;
       __pyx_L7_except_return:;
+      __Pyx_XGIVEREF(__pyx_t_3);
       __Pyx_XGIVEREF(__pyx_t_4);
       __Pyx_XGIVEREF(__pyx_t_5);
-      __Pyx_XGIVEREF(__pyx_t_6);
-      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
+      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
       goto __pyx_L0;
       __pyx_L5_exception_handled:;
+      __Pyx_XGIVEREF(__pyx_t_3);
       __Pyx_XGIVEREF(__pyx_t_4);
       __Pyx_XGIVEREF(__pyx_t_5);
-      __Pyx_XGIVEREF(__pyx_t_6);
-      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
+      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
       __pyx_L11_try_end:;
     }
     goto __pyx_L3;
@@ -7533,7 +7398,7 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_XDECREF(__pyx_t_6);
   __Pyx_XDECREF(__pyx_t_7);
   __Pyx_XDECREF(__pyx_t_8);
   __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -7559,11 +7424,9 @@ static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryvi
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
-  PyObject *__pyx_t_2 = NULL;
-  PyObject *__pyx_t_3 = NULL;
+  int __pyx_t_2;
+  int __pyx_t_3;
   int __pyx_t_4;
-  int __pyx_t_5;
-  int __pyx_t_6;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -7577,8 +7440,6 @@ static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryvi
  *                                  src.ndim, dst.ndim, self.dtype_is_object)
  */
   if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_1 = __pyx_v_src;
-  __Pyx_INCREF(__pyx_t_1);
 
   /* "View.MemoryView":402
  * 
@@ -7588,8 +7449,6 @@ static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryvi
  * 
  */
   if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_2 = __pyx_v_dst;
-  __Pyx_INCREF(__pyx_t_2);
 
   /* "View.MemoryView":403
  *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
@@ -7598,24 +7457,20 @@ static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryvi
  * 
  *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):
  */
-  __pyx_t_3 = PyObject_GetAttr(__pyx_v_src, __pyx_n_s__ndim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = PyObject_GetAttr(__pyx_v_dst, __pyx_n_s__ndim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_6 = __pyx_memoryview_copy_contents((__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_t_1), (&__pyx_v_src_slice))[0]), (__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_t_2), (&__pyx_v_dst_slice))[0]), __pyx_t_4, __pyx_t_5, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s__ndim); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __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_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s__ndim); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_4 = __pyx_memoryview_copy_contents((__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice))[0]), (__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice))[0]), __pyx_t_2, __pyx_t_3, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_XDECREF(__pyx_t_3);
   __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
@@ -8000,9 +7855,9 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview
  *         try:
  *             result = struct.unpack(self.view.format, bytesitem)
  */
-  __pyx_t_1 = PyBytes_FromStringAndSize(((const char*)__pyx_v_itemp) + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  __pyx_v_bytesitem = __pyx_t_1;
+  __pyx_v_bytesitem = ((PyObject*)__pyx_t_1);
   __pyx_t_1 = 0;
 
   /* "View.MemoryView":449
@@ -8026,9 +7881,9 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview
  *         except struct.error:
  *             raise ValueError("Unable to convert item to object")
  */
-      __pyx_t_1 = PyObject_GetAttr(__pyx_v_struct, __pyx_n_s__unpack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s__unpack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_5 = PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_5));
       __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       __Pyx_GOTREF(__pyx_t_6);
@@ -8066,7 +7921,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview
  * 
  */
         __Pyx_XDECREF(__pyx_r);
-        __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_result, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
+        __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_result, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_5) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
         __Pyx_GOTREF(__pyx_t_5);
         __pyx_r = __pyx_t_5;
         __pyx_t_5 = 0;
@@ -8103,7 +7958,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview
  *             raise ValueError("Unable to convert item to object")
  *         else:
  */
-    __pyx_t_5 = PyObject_GetAttr(__pyx_v_struct, __pyx_n_s__error); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
+    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s__error); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __pyx_t_9 = PyErr_ExceptionMatches(__pyx_t_5);
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
@@ -8219,10 +8074,7 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  *             bytesvalue = struct.pack(self.view.format, *value)
  *         else:
  */
-  __pyx_t_1 = ((PyObject *)((PyObject*)(&PyTuple_Type)));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_value, __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_2 = PyTuple_Check(__pyx_v_value); 
   if (__pyx_t_2) {
 
     /* "View.MemoryView":467
@@ -8232,9 +8084,9 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  *         else:
  *             bytesvalue = struct.pack(self.view.format, value)
  */
-    __pyx_t_1 = PyObject_GetAttr(__pyx_v_struct, __pyx_n_s__pack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s__pack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_3 = PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_3));
     __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
@@ -8265,9 +8117,9 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  * 
  *         for i, c in enumerate(bytesvalue):
  */
-    __pyx_t_3 = PyObject_GetAttr(__pyx_v_struct, __pyx_n_s__pack); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s__pack); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_5 = PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_5));
     __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
@@ -8355,8 +8207,8 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
 }
 
 /* Python wrapper */
-static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
-static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
+static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
+static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
@@ -8377,6 +8229,10 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
+  Py_ssize_t *__pyx_t_2;
+  char *__pyx_t_3;
+  void *__pyx_t_4;
+  Py_ssize_t __pyx_t_5;
   __Pyx_RefNannySetupContext("__getbuffer__", 0);
   if (__pyx_v_info != NULL) {
     __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
@@ -8400,7 +8256,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         else:
  *             info.shape = NULL
  */
-    __pyx_v_info->shape = __pyx_v_self->view.shape;
+    __pyx_t_2 = __pyx_v_self->view.shape;
+    __pyx_v_info->shape = __pyx_t_2;
     goto __pyx_L3;
   }
   /*else*/ {
@@ -8433,7 +8290,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         else:
  *             info.strides = NULL
  */
-    __pyx_v_info->strides = __pyx_v_self->view.strides;
+    __pyx_t_2 = __pyx_v_self->view.strides;
+    __pyx_v_info->strides = __pyx_t_2;
     goto __pyx_L4;
   }
   /*else*/ {
@@ -8466,7 +8324,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         else:
  *             info.suboffsets = NULL
  */
-    __pyx_v_info->suboffsets = __pyx_v_self->view.suboffsets;
+    __pyx_t_2 = __pyx_v_self->view.suboffsets;
+    __pyx_v_info->suboffsets = __pyx_t_2;
     goto __pyx_L5;
   }
   /*else*/ {
@@ -8499,7 +8358,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         else:
  *             info.format = NULL
  */
-    __pyx_v_info->format = __pyx_v_self->view.format;
+    __pyx_t_3 = __pyx_v_self->view.format;
+    __pyx_v_info->format = __pyx_t_3;
     goto __pyx_L6;
   }
   /*else*/ {
@@ -8522,7 +8382,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         info.ndim = self.view.ndim
  *         info.itemsize = self.view.itemsize
  */
-  __pyx_v_info->buf = __pyx_v_self->view.buf;
+  __pyx_t_4 = __pyx_v_self->view.buf;
+  __pyx_v_info->buf = __pyx_t_4;
 
   /* "View.MemoryView":497
  * 
@@ -8531,7 +8392,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         info.itemsize = self.view.itemsize
  *         info.len = self.view.len
  */
-  __pyx_v_info->ndim = __pyx_v_self->view.ndim;
+  __pyx_t_1 = __pyx_v_self->view.ndim;
+  __pyx_v_info->ndim = __pyx_t_1;
 
   /* "View.MemoryView":498
  *         info.buf = self.view.buf
@@ -8540,7 +8402,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         info.len = self.view.len
  *         info.readonly = 0
  */
-  __pyx_v_info->itemsize = __pyx_v_self->view.itemsize;
+  __pyx_t_5 = __pyx_v_self->view.itemsize;
+  __pyx_v_info->itemsize = __pyx_t_5;
 
   /* "View.MemoryView":499
  *         info.ndim = self.view.ndim
@@ -8549,7 +8412,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         info.readonly = 0
  *         info.obj = self
  */
-  __pyx_v_info->len = __pyx_v_self->view.len;
+  __pyx_t_5 = __pyx_v_self->view.len;
+  __pyx_v_info->len = __pyx_t_5;
 
   /* "View.MemoryView":500
  *         info.itemsize = self.view.itemsize
@@ -8749,10 +8613,10 @@ static PyObject *__pyx_memoryview_get_shape_MemoryView_10memoryview_5shape___get
     __pyx_v_i = __pyx_t_3;
     __pyx_t_4 = PyInt_FromSsize_t((__pyx_v_self->view.shape[__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    if (unlikely(__Pyx_PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   }
-  __pyx_t_4 = ((PyObject *)PyList_AsTuple(__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = ((PyObject *)PyList_AsTuple(((PyObject*)__pyx_t_1))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_4));
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   __pyx_r = ((PyObject *)__pyx_t_4);
@@ -8846,10 +8710,10 @@ static PyObject *__pyx_memoryview_get_strides_MemoryView_10memoryview_7strides__
     __pyx_v_i = __pyx_t_4;
     __pyx_t_5 = PyInt_FromSsize_t((__pyx_v_self->view.strides[__pyx_v_i])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    if (unlikely(__Pyx_PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
   }
-  __pyx_t_5 = ((PyObject *)PyList_AsTuple(__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = ((PyObject *)PyList_AsTuple(((PyObject*)__pyx_t_2))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_5));
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __pyx_r = ((PyObject *)__pyx_t_5);
@@ -8951,10 +8815,10 @@ static PyObject *__pyx_memoryview_get_suboffsets_MemoryView_10memoryview_10subof
     __pyx_v_i = __pyx_t_4;
     __pyx_t_5 = PyInt_FromSsize_t((__pyx_v_self->view.suboffsets[__pyx_v_i])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    if (unlikely(__Pyx_PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
   }
-  __pyx_t_5 = ((PyObject *)PyList_AsTuple(__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = ((PyObject *)PyList_AsTuple(((PyObject*)__pyx_t_2))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_5));
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __pyx_r = ((PyObject *)__pyx_t_5);
@@ -9120,7 +8984,7 @@ static PyObject *__pyx_memoryview_get_nbytes_MemoryView_10memoryview_6nbytes___g
  *     property size:
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
@@ -9207,7 +9071,7 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__
  *                     result *= length
  * 
  */
-    __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
       __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
@@ -9408,12 +9272,12 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_12__repr__(struct __py
  * 
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__base); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__base); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____name__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s____name__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
@@ -9498,12 +9362,12 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_14__str__(struct __pyx
  * 
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__base); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__base); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____name__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s____name__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -9919,30 +9783,26 @@ static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, in
 /* "View.MemoryView":624
  * 
  * @cname('__pyx_memoryview_check')
- * cdef bint memoryview_check(object o):             # <<<<<<<<<<<<<<
+ * cdef inline bint memoryview_check(object o):             # <<<<<<<<<<<<<<
  *     return isinstance(o, memoryview)
  * 
  */
 
-static int __pyx_memoryview_check(PyObject *__pyx_v_o) {
+static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
-  int __pyx_t_2;
+  int __pyx_t_1;
   __Pyx_RefNannySetupContext("memoryview_check", 0);
 
   /* "View.MemoryView":625
  * @cname('__pyx_memoryview_check')
- * cdef bint memoryview_check(object o):
+ * cdef inline bint memoryview_check(object o):
  *     return isinstance(o, memoryview)             # <<<<<<<<<<<<<<
  * 
  * cdef tuple _unellipsify(object index, int ndim):
  */
-  __pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryview_type));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_o, __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_r = __pyx_t_2;
+  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, ((PyObject *)__pyx_memoryview_type)); 
+  __pyx_r = __pyx_t_1;
   goto __pyx_L0;
 
   __pyx_r = 0;
@@ -9969,9 +9829,9 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
   PyObject *__pyx_v_nslices = NULL;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
+  int __pyx_t_1;
   int __pyx_t_2;
-  int __pyx_t_3;
+  PyObject *__pyx_t_3 = NULL;
   PyObject *__pyx_t_4 = NULL;
   Py_ssize_t __pyx_t_5;
   PyObject *(*__pyx_t_6)(PyObject *);
@@ -9993,12 +9853,9 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *         tup = (index,)
  *     else:
  */
-  __pyx_t_1 = ((PyObject *)((PyObject*)(&PyTuple_Type)));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_index, __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = (!__pyx_t_2);
-  if (__pyx_t_3) {
+  __pyx_t_1 = PyTuple_Check(__pyx_v_index); 
+  __pyx_t_2 = (!__pyx_t_1);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":633
  *     """
@@ -10007,13 +9864,13 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *     else:
  *         tup = index
  */
-    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
     __Pyx_INCREF(__pyx_v_index);
-    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_index);
+    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index);
     __Pyx_GIVEREF(__pyx_v_index);
-    __pyx_v_tup = ((PyObject *)__pyx_t_1);
-    __pyx_t_1 = 0;
+    __pyx_v_tup = ((PyObject *)__pyx_t_3);
+    __pyx_t_3 = 0;
     goto __pyx_L3;
   }
   /*else*/ {
@@ -10037,10 +9894,10 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *     have_slices = False
  *     seen_ellipsis = False
  */
-  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_v_result = __pyx_t_1;
-  __pyx_t_1 = 0;
+  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_v_result = ((PyObject*)__pyx_t_3);
+  __pyx_t_3 = 0;
 
   /* "View.MemoryView":638
  * 
@@ -10049,10 +9906,10 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *     seen_ellipsis = False
  *     for idx, item in enumerate(tup):
  */
-  __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_v_have_slices = __pyx_t_1;
-  __pyx_t_1 = 0;
+  __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_v_have_slices = __pyx_t_3;
+  __pyx_t_3 = 0;
 
   /* "View.MemoryView":639
  *     result = []
@@ -10071,7 +9928,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *             if not seen_ellipsis:
  */
   __Pyx_INCREF(__pyx_int_0);
-  __pyx_t_1 = __pyx_int_0;
+  __pyx_t_3 = __pyx_int_0;
   if (PyList_CheckExact(__pyx_v_tup) || PyTuple_CheckExact(__pyx_v_tup)) {
     __pyx_t_4 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
     __pyx_t_6 = NULL;
@@ -10109,13 +9966,13 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
     __Pyx_XDECREF(__pyx_v_item);
     __pyx_v_item = __pyx_t_7;
     __pyx_t_7 = 0;
-    __Pyx_INCREF(__pyx_t_1);
+    __Pyx_INCREF(__pyx_t_3);
     __Pyx_XDECREF(__pyx_v_idx);
-    __pyx_v_idx = __pyx_t_1;
-    __pyx_t_7 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_v_idx = __pyx_t_3;
+    __pyx_t_7 = PyNumber_Add(__pyx_t_3, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
-    __Pyx_DECREF(__pyx_t_1);
-    __pyx_t_1 = __pyx_t_7;
+    __Pyx_DECREF(__pyx_t_3);
+    __pyx_t_3 = __pyx_t_7;
     __pyx_t_7 = 0;
 
     /* "View.MemoryView":641
@@ -10125,8 +9982,8 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *             if not seen_ellipsis:
  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
  */
-    __pyx_t_3 = (__pyx_v_item == __pyx_builtin_Ellipsis);
-    if (__pyx_t_3) {
+    __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":642
  *     for idx, item in enumerate(tup):
@@ -10135,8 +9992,8 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
  *                 seen_ellipsis = True
  */
-      __pyx_t_3 = (!__pyx_v_seen_ellipsis);
-      if (__pyx_t_3) {
+      __pyx_t_2 = (!__pyx_v_seen_ellipsis);
+      if (__pyx_t_2) {
 
         /* "View.MemoryView":643
  *         if item is Ellipsis:
@@ -10145,7 +10002,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *                 seen_ellipsis = True
  *             else:
  */
-        __pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_v_result), __pyx_n_s__extend); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_result), __pyx_n_s__extend); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_7);
         __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_34), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_8);
@@ -10192,7 +10049,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  */
         __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_35), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_10);
-        __pyx_t_11 = PyList_Append(__pyx_v_result, __pyx_t_10); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_10); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
       }
       __pyx_L7:;
@@ -10220,16 +10077,13 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *                 raise TypeError("Cannot index with type '%s'" % type(item))
  * 
  */
-      __pyx_t_10 = ((PyObject *)((PyObject*)(&PySlice_Type)));
-      __Pyx_INCREF(__pyx_t_10);
-      __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_item, __pyx_t_10); 
-      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-      __pyx_t_2 = (!__pyx_t_3);
-      if (__pyx_t_2) {
-        __pyx_t_3 = (!PyIndex_Check(__pyx_v_item));
-        __pyx_t_12 = __pyx_t_3;
-      } else {
+      __pyx_t_2 = PySlice_Check(__pyx_v_item); 
+      __pyx_t_1 = (!__pyx_t_2);
+      if (__pyx_t_1) {
+        __pyx_t_2 = (!__Pyx_PyIndex_Check(__pyx_v_item));
         __pyx_t_12 = __pyx_t_2;
+      } else {
+        __pyx_t_12 = __pyx_t_1;
       }
       if (__pyx_t_12) {
 
@@ -10266,10 +10120,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  */
       __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       if (!__pyx_t_12) {
-        __pyx_t_10 = ((PyObject *)((PyObject*)(&PySlice_Type)));
-        __Pyx_INCREF(__pyx_t_10);
-        __pyx_t_12 = __Pyx_TypeCheck(__pyx_v_item, __pyx_t_10); 
-        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+        __pyx_t_12 = PySlice_Check(__pyx_v_item); 
         __pyx_t_10 = __Pyx_PyBool_FromLong(__pyx_t_12); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_10);
         __pyx_t_8 = __pyx_t_10;
@@ -10289,12 +10140,12 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  * 
  *     nslices = ndim - len(result)
  */
-      __pyx_t_11 = PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     __pyx_L6:;
   }
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
   /* "View.MemoryView":655
  *             result.append(item)
@@ -10304,10 +10155,10 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *         result.extend([slice(None)] * nslices)
  */
   __pyx_t_5 = PyList_GET_SIZE(((PyObject *)__pyx_v_result)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_1 = PyInt_FromSsize_t((__pyx_v_ndim - __pyx_t_5)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_v_nslices = __pyx_t_1;
-  __pyx_t_1 = 0;
+  __pyx_t_3 = PyInt_FromSsize_t((__pyx_v_ndim - __pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_v_nslices = __pyx_t_3;
+  __pyx_t_3 = 0;
 
   /* "View.MemoryView":656
  * 
@@ -10326,8 +10177,8 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  * 
  *     return have_slices or nslices, tuple(result)
  */
-    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_result), __pyx_n_s__extend); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_result), __pyx_n_s__extend); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
     __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_37), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -10345,9 +10196,9 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
     PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
     __pyx_t_8 = 0;
-    __pyx_t_8 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_8 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_8);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
     goto __pyx_L9;
@@ -10372,22 +10223,22 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
   }
   __pyx_t_4 = ((PyObject *)PyList_AsTuple(__pyx_v_result)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8);
+  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_8);
   __Pyx_GIVEREF(__pyx_t_8);
-  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_t_4));
+  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_t_4));
   __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
   __pyx_t_8 = 0;
   __pyx_t_4 = 0;
-  __pyx_r = __pyx_t_1;
-  __pyx_t_1 = 0;
+  __pyx_r = ((PyObject*)__pyx_t_3);
+  __pyx_t_3 = 0;
   goto __pyx_L0;
 
   __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_7);
   __Pyx_XDECREF(__pyx_t_8);
@@ -10504,15 +10355,17 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
   PyObject *__pyx_v_index = NULL;
   struct __pyx_memoryview_obj *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
-  int __pyx_t_2;
-  int __pyx_t_3;
-  Py_ssize_t __pyx_t_4;
-  PyObject *(*__pyx_t_5)(PyObject *);
-  PyObject *__pyx_t_6 = NULL;
-  int __pyx_t_7;
-  Py_ssize_t __pyx_t_8;
-  PyObject *__pyx_t_9 = NULL;
+  int __pyx_t_1;
+  struct __pyx_memoryview_obj *__pyx_t_2;
+  char *__pyx_t_3;
+  int __pyx_t_4;
+  PyObject *__pyx_t_5 = NULL;
+  Py_ssize_t __pyx_t_6;
+  PyObject *(*__pyx_t_7)(PyObject *);
+  PyObject *__pyx_t_8 = NULL;
+  int __pyx_t_9;
+  Py_ssize_t __pyx_t_10;
+  PyObject *__pyx_t_11 = NULL;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -10558,11 +10411,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *         memviewsliceobj = memview
  *         p_src = &memviewsliceobj.from_slice
  */
-  __pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryviewslice_type));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (__pyx_t_2) {
+  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), ((PyObject *)__pyx_memoryviewslice_type)); 
+  if (__pyx_t_1) {
 
     /* "View.MemoryView":687
  * 
@@ -10614,7 +10464,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *     dst.data = p_src.data
  * 
  */
-  __pyx_v_dst.memview = __pyx_v_p_src->memview;
+  __pyx_t_2 = __pyx_v_p_src->memview;
+  __pyx_v_dst.memview = __pyx_t_2;
 
   /* "View.MemoryView":698
  * 
@@ -10623,7 +10474,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  * 
  * 
  */
-  __pyx_v_dst.data = __pyx_v_p_src->data;
+  __pyx_t_3 = __pyx_v_p_src->data;
+  __pyx_v_dst.data = __pyx_t_3;
 
   /* "View.MemoryView":703
  * 
@@ -10650,46 +10502,46 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *         if PyIndex_Check(index):
  *             slice_memviewslice(
  */
-  __pyx_t_3 = 0;
+  __pyx_t_4 = 0;
   if (PyList_CheckExact(__pyx_v_indices) || PyTuple_CheckExact(__pyx_v_indices)) {
-    __pyx_t_1 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0;
-    __pyx_t_5 = NULL;
+    __pyx_t_5 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_5); __pyx_t_6 = 0;
+    __pyx_t_7 = NULL;
   } else {
-    __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext;
+    __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext;
   }
   for (;;) {
-    if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_1)) {
-      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
+    if (!__pyx_t_7 && PyList_CheckExact(__pyx_t_5)) {
+      if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break;
       #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_8 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       #else
-      __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_8 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       #endif
-    } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_1)) {
-      if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+    } else if (!__pyx_t_7 && PyTuple_CheckExact(__pyx_t_5)) {
+      if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
       #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       #else
-      __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_8 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       #endif
     } else {
-      __pyx_t_6 = __pyx_t_5(__pyx_t_1);
-      if (unlikely(!__pyx_t_6)) {
+      __pyx_t_8 = __pyx_t_7(__pyx_t_5);
+      if (unlikely(!__pyx_t_8)) {
         if (PyErr_Occurred()) {
           if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
           else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         }
         break;
       }
-      __Pyx_GOTREF(__pyx_t_6);
+      __Pyx_GOTREF(__pyx_t_8);
     }
     __Pyx_XDECREF(__pyx_v_index);
-    __pyx_v_index = __pyx_t_6;
-    __pyx_t_6 = 0;
-    __pyx_v_dim = __pyx_t_3;
-    __pyx_t_3 = (__pyx_t_3 + 1);
+    __pyx_v_index = __pyx_t_8;
+    __pyx_t_8 = 0;
+    __pyx_v_dim = __pyx_t_4;
+    __pyx_t_4 = (__pyx_t_4 + 1);
 
     /* "View.MemoryView":709
  * 
@@ -10698,8 +10550,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             slice_memviewslice(
  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
  */
-    __pyx_t_7 = PyIndex_Check(__pyx_v_index);
-    if (__pyx_t_7) {
+    __pyx_t_9 = __Pyx_PyIndex_Check(__pyx_v_index);
+    if (__pyx_t_9) {
 
       /* "View.MemoryView":713
  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
@@ -10708,7 +10560,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *                 0, 0, 0, # have_{start,stop,step}
  *                 False)
  */
-      __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
       /* "View.MemoryView":715
  *                 index, 0, 0, # start, stop, step
@@ -10717,7 +10569,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *         elif index is None:
  *             p_dst.shape[new_ndim] = 1
  */
-      __pyx_t_7 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_8, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_10, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L6;
     }
 
@@ -10728,8 +10580,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             p_dst.shape[new_ndim] = 1
  *             p_dst.strides[new_ndim] = 0
  */
-    __pyx_t_2 = (__pyx_v_index == Py_None);
-    if (__pyx_t_2) {
+    __pyx_t_1 = (__pyx_v_index == Py_None);
+    if (__pyx_t_1) {
 
       /* "View.MemoryView":717
  *                 False)
@@ -10777,20 +10629,20 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             stop = index.stop or 0
  *             step = index.step or 0
  */
-      __pyx_t_6 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_6);
-      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      if (!__pyx_t_2) {
-        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_8);
+      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      if (!__pyx_t_1) {
+        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
         __Pyx_INCREF(__pyx_int_0);
-        __pyx_t_9 = __pyx_int_0;
+        __pyx_t_11 = __pyx_int_0;
       } else {
-        __pyx_t_9 = __pyx_t_6;
-        __pyx_t_6 = 0;
+        __pyx_t_11 = __pyx_t_8;
+        __pyx_t_8 = 0;
       }
-      __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_v_start = __pyx_t_8;
+      __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_11); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+      __pyx_v_start = __pyx_t_10;
 
       /* "View.MemoryView":723
  *         else:
@@ -10799,20 +10651,20 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             step = index.step or 0
  * 
  */
-      __pyx_t_9 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__stop); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      if (!__pyx_t_2) {
-        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__stop); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_11);
+      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      if (!__pyx_t_1) {
+        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
         __Pyx_INCREF(__pyx_int_0);
-        __pyx_t_6 = __pyx_int_0;
+        __pyx_t_8 = __pyx_int_0;
       } else {
-        __pyx_t_6 = __pyx_t_9;
-        __pyx_t_9 = 0;
+        __pyx_t_8 = __pyx_t_11;
+        __pyx_t_11 = 0;
       }
-      __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-      __pyx_v_stop = __pyx_t_8;
+      __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+      __pyx_v_stop = __pyx_t_10;
 
       /* "View.MemoryView":724
  *             start = index.start or 0
@@ -10821,20 +10673,20 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  * 
  *             have_start = index.start is not None
  */
-      __pyx_t_6 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_6);
-      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      if (!__pyx_t_2) {
-        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_8);
+      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      if (!__pyx_t_1) {
+        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
         __Pyx_INCREF(__pyx_int_0);
-        __pyx_t_9 = __pyx_int_0;
+        __pyx_t_11 = __pyx_int_0;
       } else {
-        __pyx_t_9 = __pyx_t_6;
-        __pyx_t_6 = 0;
+        __pyx_t_11 = __pyx_t_8;
+        __pyx_t_8 = 0;
       }
-      __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_v_step = __pyx_t_8;
+      __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_11); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+      __pyx_v_step = __pyx_t_10;
 
       /* "View.MemoryView":726
  *             step = index.step or 0
@@ -10843,11 +10695,11 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             have_stop = index.stop is not None
  *             have_step = index.step is not None
  */
-      __pyx_t_9 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_2 = (__pyx_t_9 != Py_None);
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_v_have_start = __pyx_t_2;
+      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_11);
+      __pyx_t_1 = (__pyx_t_11 != Py_None);
+      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+      __pyx_v_have_start = __pyx_t_1;
 
       /* "View.MemoryView":727
  * 
@@ -10856,11 +10708,11 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             have_step = index.step is not None
  * 
  */
-      __pyx_t_9 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__stop); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_2 = (__pyx_t_9 != Py_None);
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_v_have_stop = __pyx_t_2;
+      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__stop); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_11);
+      __pyx_t_1 = (__pyx_t_11 != Py_None);
+      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+      __pyx_v_have_stop = __pyx_t_1;
 
       /* "View.MemoryView":728
  *             have_start = index.start is not None
@@ -10869,11 +10721,11 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  * 
  *             slice_memviewslice(
  */
-      __pyx_t_9 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_2 = (__pyx_t_9 != Py_None);
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_v_have_step = __pyx_t_2;
+      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_11);
+      __pyx_t_1 = (__pyx_t_11 != Py_None);
+      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+      __pyx_v_have_step = __pyx_t_1;
 
       /* "View.MemoryView":735
  *                 start, stop, step,
@@ -10882,7 +10734,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             new_ndim += 1
  * 
  */
-      __pyx_t_7 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
       /* "View.MemoryView":736
  *                 have_start, have_stop, have_step,
@@ -10895,7 +10747,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
     }
     __pyx_L6:;
   }
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
   /* "View.MemoryView":738
  *             new_ndim += 1
@@ -10904,11 +10756,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *         return memoryview_fromslice(dst, new_ndim,
  *                                     memviewsliceobj.to_object_func,
  */
-  __pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryviewslice_type));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (__pyx_t_2) {
+  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), ((PyObject *)__pyx_memoryviewslice_type)); 
+  if (__pyx_t_1) {
 
     /* "View.MemoryView":739
  * 
@@ -10935,11 +10784,11 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *     else:
  *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,
  */
-    __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_1);
-    __pyx_t_1 = 0;
+    __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_5);
+    __pyx_t_5 = 0;
     goto __pyx_L0;
     goto __pyx_L7;
   }
@@ -10961,11 +10810,11 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  * 
  * 
  */
-    __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_1);
-    __pyx_t_1 = 0;
+    __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_5);
+    __pyx_t_5 = 0;
     goto __pyx_L0;
   }
   __pyx_L7:;
@@ -10973,9 +10822,9 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
   __pyx_r = ((struct __pyx_memoryview_obj *)Py_None); __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_6);
-  __Pyx_XDECREF(__pyx_t_9);
+  __Pyx_XDECREF(__pyx_t_5);
+  __Pyx_XDECREF(__pyx_t_8);
+  __Pyx_XDECREF(__pyx_t_11);
   __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
@@ -11383,23 +11232,23 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *         with cython.cdivision(True):
  *             new_shape = (stop - start) // step             # <<<<<<<<<<<<<<
  * 
- *             if (stop - start) % step:
+ *             if (stop - start) - step * new_shape:
  */
     __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step);
 
     /* "View.MemoryView":839
  *             new_shape = (stop - start) // step
  * 
- *             if (stop - start) % step:             # <<<<<<<<<<<<<<
+ *             if (stop - start) - step * new_shape:             # <<<<<<<<<<<<<<
  *                 new_shape += 1
  * 
  */
-    __pyx_t_5 = ((__pyx_v_stop - __pyx_v_start) % __pyx_v_step);
+    __pyx_t_5 = ((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape));
     if (__pyx_t_5) {
 
       /* "View.MemoryView":840
  * 
- *             if (stop - start) % step:
+ *             if (stop - start) - step * new_shape:
  *                 new_shape += 1             # <<<<<<<<<<<<<<
  * 
  *         if new_shape < 0:
@@ -11607,9 +11456,10 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
   char *__pyx_v_resultp;
   char *__pyx_r;
   __Pyx_RefNannyDeclarations
-  int __pyx_t_1;
-  PyObject *__pyx_t_2 = NULL;
+  Py_ssize_t __pyx_t_1;
+  int __pyx_t_2;
   PyObject *__pyx_t_3 = NULL;
+  PyObject *__pyx_t_4 = NULL;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -11631,7 +11481,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *     cdef char *resultp
  * 
  */
-  __pyx_v_itemsize = __pyx_v_view->itemsize;
+  __pyx_t_1 = __pyx_v_view->itemsize;
+  __pyx_v_itemsize = __pyx_t_1;
 
   /* "View.MemoryView":878
  *     cdef char *resultp
@@ -11640,8 +11491,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *         shape = view.len / itemsize
  *         stride = itemsize
  */
-  __pyx_t_1 = (__pyx_v_view->ndim == 0);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_v_view->ndim == 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":879
  * 
@@ -11651,11 +11502,23 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *     else:
  */
     if (unlikely(__pyx_v_itemsize == 0)) {
+      #ifdef WITH_THREAD
+      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+      #endif
       PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero");
+      #ifdef WITH_THREAD
+      PyGILState_Release(__pyx_gilstate_save);
+      #endif
       {__pyx_filename = __pyx_f[2]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     else if (sizeof(Py_ssize_t) == sizeof(long) && unlikely(__pyx_v_itemsize == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) {
+      #ifdef WITH_THREAD
+      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+      #endif
       PyErr_Format(PyExc_OverflowError, "value too large to perform division");
+      #ifdef WITH_THREAD
+      PyGILState_Release(__pyx_gilstate_save);
+      #endif
       {__pyx_filename = __pyx_f[2]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize);
@@ -11697,8 +11560,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *             suboffset = view.suboffsets[dim]
  * 
  */
-    __pyx_t_1 = (__pyx_v_view->suboffsets != NULL);
-    if (__pyx_t_1) {
+    __pyx_t_2 = (__pyx_v_view->suboffsets != NULL);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":885
  *         stride = view.strides[dim]
@@ -11721,8 +11584,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *         index += view.shape[dim]
  *         if index < 0:
  */
-  __pyx_t_1 = (__pyx_v_index < 0);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_v_index < 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":888
  * 
@@ -11740,8 +11603,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
  * 
  */
-    __pyx_t_1 = (__pyx_v_index < 0);
-    if (__pyx_t_1) {
+    __pyx_t_2 = (__pyx_v_index < 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":890
  *         index += view.shape[dim]
@@ -11750,21 +11613,21 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  * 
  *     if index >= shape:
  */
-      __pyx_t_2 = PyInt_FromLong(__pyx_v_dim); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_43), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3));
-      __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
-      __pyx_t_3 = 0;
-      __pyx_t_3 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyInt_FromLong(__pyx_v_dim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
-      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+      __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_43), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
+      __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
+      __pyx_t_4 = 0;
+      __pyx_t_4 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_4);
+      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
+      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
       {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L6;
     }
@@ -11780,8 +11643,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
  * 
  */
-  __pyx_t_1 = (__pyx_v_index >= __pyx_v_shape);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_v_index >= __pyx_v_shape);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":893
  * 
@@ -11790,21 +11653,21 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  * 
  *     resultp = bufp + index * stride
  */
-    __pyx_t_3 = PyInt_FromLong(__pyx_v_dim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyInt_FromLong(__pyx_v_dim); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_43), __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
+    __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
+    __pyx_t_3 = 0;
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_43), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
-    __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
-    __pyx_t_2 = 0;
-    __pyx_t_2 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L7;
   }
@@ -11826,8 +11689,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *         resultp = (<char **> resultp)[0] + suboffset
  * 
  */
-  __pyx_t_1 = (__pyx_v_suboffset >= 0);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_v_suboffset >= 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":897
  *     resultp = bufp + index * stride
@@ -11854,8 +11717,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
   __pyx_r = 0;
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
+  __Pyx_XDECREF(__pyx_t_4);
   __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
@@ -11878,14 +11741,15 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
   int __pyx_v_i;
   int __pyx_v_j;
   int __pyx_r;
-  long __pyx_t_1;
-  int __pyx_t_2;
-  Py_ssize_t __pyx_t_3;
+  int __pyx_t_1;
+  Py_ssize_t *__pyx_t_2;
+  long __pyx_t_3;
   Py_ssize_t __pyx_t_4;
-  int __pyx_t_5;
+  Py_ssize_t __pyx_t_5;
   int __pyx_t_6;
   int __pyx_t_7;
   int __pyx_t_8;
+  int __pyx_t_9;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -11897,7 +11761,8 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  * 
  *     cdef Py_ssize_t *shape = memslice.shape
  */
-  __pyx_v_ndim = __pyx_v_memslice->memview->view.ndim;
+  __pyx_t_1 = __pyx_v_memslice->memview->view.ndim;
+  __pyx_v_ndim = __pyx_t_1;
 
   /* "View.MemoryView":908
  *     cdef int ndim = memslice.memview.view.ndim
@@ -11906,7 +11771,8 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  *     cdef Py_ssize_t *strides = memslice.strides
  * 
  */
-  __pyx_v_shape = __pyx_v_memslice->shape;
+  __pyx_t_2 = __pyx_v_memslice->shape;
+  __pyx_v_shape = __pyx_t_2;
 
   /* "View.MemoryView":909
  * 
@@ -11915,7 +11781,8 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  * 
  * 
  */
-  __pyx_v_strides = __pyx_v_memslice->strides;
+  __pyx_t_2 = __pyx_v_memslice->strides;
+  __pyx_v_strides = __pyx_t_2;
 
   /* "View.MemoryView":913
  * 
@@ -11924,9 +11791,9 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  *         j = ndim - 1 - i
  *         strides[i], strides[j] = strides[j], strides[i]
  */
-  __pyx_t_1 = __Pyx_div_long(__pyx_v_ndim, 2);
-  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
-    __pyx_v_i = __pyx_t_2;
+  __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2);
+  for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_3; __pyx_t_1+=1) {
+    __pyx_v_i = __pyx_t_1;
 
     /* "View.MemoryView":914
  *     cdef int i, j
@@ -11944,10 +11811,10 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  *         shape[i], shape[j] = shape[j], shape[i]
  * 
  */
-    __pyx_t_3 = (__pyx_v_strides[__pyx_v_j]);
-    __pyx_t_4 = (__pyx_v_strides[__pyx_v_i]);
-    (__pyx_v_strides[__pyx_v_i]) = __pyx_t_3;
-    (__pyx_v_strides[__pyx_v_j]) = __pyx_t_4;
+    __pyx_t_4 = (__pyx_v_strides[__pyx_v_j]);
+    __pyx_t_5 = (__pyx_v_strides[__pyx_v_i]);
+    (__pyx_v_strides[__pyx_v_i]) = __pyx_t_4;
+    (__pyx_v_strides[__pyx_v_j]) = __pyx_t_5;
 
     /* "View.MemoryView":916
  *         j = ndim - 1 - i
@@ -11956,10 +11823,10 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  * 
  *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
  */
-    __pyx_t_4 = (__pyx_v_shape[__pyx_v_j]);
-    __pyx_t_3 = (__pyx_v_shape[__pyx_v_i]);
-    (__pyx_v_shape[__pyx_v_i]) = __pyx_t_4;
-    (__pyx_v_shape[__pyx_v_j]) = __pyx_t_3;
+    __pyx_t_5 = (__pyx_v_shape[__pyx_v_j]);
+    __pyx_t_4 = (__pyx_v_shape[__pyx_v_i]);
+    (__pyx_v_shape[__pyx_v_i]) = __pyx_t_5;
+    (__pyx_v_shape[__pyx_v_j]) = __pyx_t_4;
 
     /* "View.MemoryView":918
  *         shape[i], shape[j] = shape[j], shape[i]
@@ -11968,14 +11835,14 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
  * 
  */
-    __pyx_t_5 = ((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0);
-    if (!__pyx_t_5) {
-      __pyx_t_6 = ((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0);
-      __pyx_t_7 = __pyx_t_6;
+    __pyx_t_6 = ((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0);
+    if (!__pyx_t_6) {
+      __pyx_t_7 = ((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0);
+      __pyx_t_8 = __pyx_t_7;
     } else {
-      __pyx_t_7 = __pyx_t_5;
+      __pyx_t_8 = __pyx_t_6;
     }
-    if (__pyx_t_7) {
+    if (__pyx_t_8) {
 
       /* "View.MemoryView":919
  * 
@@ -11984,7 +11851,7 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  * 
  *     return 1
  */
-      __pyx_t_8 = __pyx_memoryview_err(__pyx_builtin_ValueError, __pyx_k_44); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = __pyx_memoryview_err(__pyx_builtin_ValueError, __pyx_k_44); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L5;
     }
     __pyx_L5:;
@@ -12248,8 +12115,11 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
   int __pyx_t_1;
   PyObject *__pyx_t_2 = NULL;
   PyObject *__pyx_t_3 = NULL;
-  int __pyx_t_4;
-  int __pyx_t_5;
+  __Pyx_TypeInfo *__pyx_t_4;
+  Py_buffer __pyx_t_5;
+  Py_ssize_t __pyx_t_6;
+  int __pyx_t_7;
+  int __pyx_t_8;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -12331,7 +12201,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
  *     result.typeinfo = memviewslice.memview.typeinfo
  * 
  */
-  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s__base); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s__base); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_GIVEREF(__pyx_t_2);
   __Pyx_GOTREF(__pyx_v_result->from_object);
@@ -12346,7 +12216,8 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
  * 
  *     result.view = memviewslice.memview.view
  */
-  __pyx_v_result->__pyx_base.typeinfo = __pyx_v_memviewslice.memview->typeinfo;
+  __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo;
+  __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4;
 
   /* "View.MemoryView":985
  *     result.typeinfo = memviewslice.memview.typeinfo
@@ -12355,7 +12226,8 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
  *     result.view.buf = <void *> memviewslice.data
  *     result.view.ndim = ndim
  */
-  __pyx_v_result->__pyx_base.view = __pyx_v_memviewslice.memview->view;
+  __pyx_t_5 = __pyx_v_memviewslice.memview->view;
+  __pyx_v_result->__pyx_base.view = __pyx_t_5;
 
   /* "View.MemoryView":986
  * 
@@ -12436,7 +12308,8 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
  *     for i in range(ndim):
  *         result.view.len *= result.view.shape[i]
  */
-  __pyx_v_result->__pyx_base.view.len = __pyx_v_result->__pyx_base.view.itemsize;
+  __pyx_t_6 = __pyx_v_result->__pyx_base.view.itemsize;
+  __pyx_v_result->__pyx_base.view.len = __pyx_t_6;
 
   /* "View.MemoryView":998
  * 
@@ -12445,9 +12318,9 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
  *         result.view.len *= result.view.shape[i]
  * 
  */
-  __pyx_t_4 = __pyx_v_ndim;
-  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
-    __pyx_v_i = __pyx_t_5;
+  __pyx_t_7 = __pyx_v_ndim;
+  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
+    __pyx_v_i = __pyx_t_8;
 
     /* "View.MemoryView":999
  *     result.view.len = result.view.itemsize
@@ -12515,8 +12388,7 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p
   struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0;
   __Pyx_memviewslice *__pyx_r;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
-  int __pyx_t_2;
+  int __pyx_t_1;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -12529,11 +12401,8 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p
  *         obj = memview
  *         return &obj.from_slice
  */
-  __pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryviewslice_type));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (__pyx_t_2) {
+  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), ((PyObject *)__pyx_memoryviewslice_type)); 
+  if (__pyx_t_1) {
 
     /* "View.MemoryView":1011
  *     cdef _memoryviewslice obj
@@ -12583,7 +12452,6 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p
   __pyx_r = 0;
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
   __Pyx_WriteUnraisable("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
@@ -12606,9 +12474,10 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem
   Py_ssize_t *__pyx_v_strides;
   Py_ssize_t *__pyx_v_suboffsets;
   __Pyx_RefNannyDeclarations
-  int __pyx_t_1;
+  Py_ssize_t *__pyx_t_1;
   int __pyx_t_2;
   int __pyx_t_3;
+  int __pyx_t_4;
   __Pyx_RefNannySetupContext("slice_copy", 0);
 
   /* "View.MemoryView":1022
@@ -12618,7 +12487,8 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem
  *     strides = memview.view.strides
  *     suboffsets = memview.view.suboffsets
  */
-  __pyx_v_shape = __pyx_v_memview->view.shape;
+  __pyx_t_1 = __pyx_v_memview->view.shape;
+  __pyx_v_shape = __pyx_t_1;
 
   /* "View.MemoryView":1023
  * 
@@ -12627,7 +12497,8 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem
  *     suboffsets = memview.view.suboffsets
  * 
  */
-  __pyx_v_strides = __pyx_v_memview->view.strides;
+  __pyx_t_1 = __pyx_v_memview->view.strides;
+  __pyx_v_strides = __pyx_t_1;
 
   /* "View.MemoryView":1024
  *     shape = memview.view.shape
@@ -12636,7 +12507,8 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem
  * 
  *     dst.memview = <__pyx_memoryview *> memview
  */
-  __pyx_v_suboffsets = __pyx_v_memview->view.suboffsets;
+  __pyx_t_1 = __pyx_v_memview->view.suboffsets;
+  __pyx_v_suboffsets = __pyx_t_1;
 
   /* "View.MemoryView":1026
  *     suboffsets = memview.view.suboffsets
@@ -12663,9 +12535,9 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem
  *         dst.shape[dim] = shape[dim]
  *         dst.strides[dim] = strides[dim]
  */
-  __pyx_t_1 = __pyx_v_memview->view.ndim;
-  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
-    __pyx_v_dim = __pyx_t_2;
+  __pyx_t_2 = __pyx_v_memview->view.ndim;
+  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
+    __pyx_v_dim = __pyx_t_3;
 
     /* "View.MemoryView":1030
  * 
@@ -12692,8 +12564,8 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem
  *             dst.suboffsets[dim] = -1
  *         else:
  */
-    __pyx_t_3 = (__pyx_v_suboffsets == NULL);
-    if (__pyx_t_3) {
+    __pyx_t_4 = (__pyx_v_suboffsets == NULL);
+    if (__pyx_t_4) {
 
       /* "View.MemoryView":1033
  *         dst.strides[dim] = strides[dim]
@@ -12788,8 +12660,10 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview
   int (*__pyx_v_to_dtype_func)(char *, PyObject *);
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
-  int __pyx_t_2;
+  int __pyx_t_1;
+  PyObject *(*__pyx_t_2)(char *);
+  int (*__pyx_t_3)(char *, PyObject *);
+  PyObject *__pyx_t_4 = NULL;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -12802,11 +12676,8 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview
  *         to_object_func = (<_memoryviewslice> memview).to_object_func
  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
  */
-  __pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryviewslice_type));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (__pyx_t_2) {
+  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), ((PyObject *)__pyx_memoryviewslice_type)); 
+  if (__pyx_t_1) {
 
     /* "View.MemoryView":1053
  * 
@@ -12815,7 +12686,8 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview
  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
  *     else:
  */
-    __pyx_v_to_object_func = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
+    __pyx_t_2 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
+    __pyx_v_to_object_func = __pyx_t_2;
 
     /* "View.MemoryView":1054
  *     if isinstance(memview, _memoryviewslice):
@@ -12824,7 +12696,8 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview
  *     else:
  *         to_object_func = NULL
  */
-    __pyx_v_to_dtype_func = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
+    __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
+    __pyx_v_to_dtype_func = __pyx_t_3;
     goto __pyx_L3;
   }
   /*else*/ {
@@ -12865,16 +12738,16 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview
  * 
  * 
  */
-  __pyx_t_1 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_r = __pyx_t_1;
-  __pyx_t_1 = 0;
+  __pyx_t_4 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
+  __pyx_r = __pyx_t_4;
+  __pyx_t_4 = 0;
   goto __pyx_L0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_XDECREF(__pyx_t_4);
   __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
@@ -13329,8 +13202,9 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_sr
   int __pyx_v_i;
   Py_ssize_t __pyx_v_size;
   Py_ssize_t __pyx_r;
-  int __pyx_t_1;
+  Py_ssize_t __pyx_t_1;
   int __pyx_t_2;
+  int __pyx_t_3;
 
   /* "View.MemoryView":1138
  *     "Return the size of the memory occupied by the slice in number of bytes"
@@ -13339,7 +13213,8 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_sr
  * 
  *     for i in range(ndim):
  */
-  __pyx_v_size = __pyx_v_src->memview->view.itemsize;
+  __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
+  __pyx_v_size = __pyx_t_1;
 
   /* "View.MemoryView":1140
  *     cdef Py_ssize_t size = src.memview.view.itemsize
@@ -13348,9 +13223,9 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_sr
  *         size *= src.shape[i]
  * 
  */
-  __pyx_t_1 = __pyx_v_ndim;
-  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
-    __pyx_v_i = __pyx_t_2;
+  __pyx_t_2 = __pyx_v_ndim;
+  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
+    __pyx_v_i = __pyx_t_3;
 
     /* "View.MemoryView":1141
  * 
@@ -13495,9 +13370,11 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
   size_t __pyx_v_itemsize;
   size_t __pyx_v_size;
   void *__pyx_r;
-  int __pyx_t_1;
+  Py_ssize_t __pyx_t_1;
   int __pyx_t_2;
   int __pyx_t_3;
+  struct __pyx_memoryview_obj *__pyx_t_4;
+  int __pyx_t_5;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -13509,7 +13386,8 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *     cdef size_t size = slice_get_size(src, ndim)
  * 
  */
-  __pyx_v_itemsize = __pyx_v_src->memview->view.itemsize;
+  __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
+  __pyx_v_itemsize = __pyx_t_1;
 
   /* "View.MemoryView":1179
  * 
@@ -13536,8 +13414,8 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *         _err(MemoryError, NULL)
  * 
  */
-  __pyx_t_1 = (!(__pyx_v_result != 0));
-  if (__pyx_t_1) {
+  __pyx_t_2 = (!(__pyx_v_result != 0));
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":1183
  *     result = malloc(size)
@@ -13546,7 +13424,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  * 
  * 
  */
-    __pyx_t_2 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L3;
   }
   __pyx_L3:;
@@ -13567,7 +13445,8 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *     for i in range(ndim):
  *         tmpslice.shape[i] = src.shape[i]
  */
-  __pyx_v_tmpslice->memview = __pyx_v_src->memview;
+  __pyx_t_4 = __pyx_v_src->memview;
+  __pyx_v_tmpslice->memview = __pyx_t_4;
 
   /* "View.MemoryView":1188
  *     tmpslice.data = <char *> result
@@ -13576,9 +13455,9 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *         tmpslice.shape[i] = src.shape[i]
  *         tmpslice.suboffsets[i] = -1
  */
-  __pyx_t_2 = __pyx_v_ndim;
-  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
-    __pyx_v_i = __pyx_t_3;
+  __pyx_t_3 = __pyx_v_ndim;
+  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_3; __pyx_t_5+=1) {
+    __pyx_v_i = __pyx_t_5;
 
     /* "View.MemoryView":1189
  *     tmpslice.memview = src.memview
@@ -13615,9 +13494,9 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *         if tmpslice.shape[i] == 1:
  *             tmpslice.strides[i] = 0
  */
-  __pyx_t_2 = __pyx_v_ndim;
-  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
-    __pyx_v_i = __pyx_t_3;
+  __pyx_t_3 = __pyx_v_ndim;
+  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_3; __pyx_t_5+=1) {
+    __pyx_v_i = __pyx_t_5;
 
     /* "View.MemoryView":1197
  * 
@@ -13626,8 +13505,8 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *             tmpslice.strides[i] = 0
  * 
  */
-    __pyx_t_1 = ((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1);
-    if (__pyx_t_1) {
+    __pyx_t_2 = ((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1198
  *     for i in range(ndim):
@@ -13649,8 +13528,8 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *         memcpy(result, src.data, size)
  *     else:
  */
-  __pyx_t_1 = __pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim);
-  if (__pyx_t_1) {
+  __pyx_t_2 = __pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":1201
  * 
@@ -13951,11 +13830,12 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
   __Pyx_memviewslice __pyx_v_tmp;
   int __pyx_v_ndim;
   int __pyx_r;
-  int __pyx_t_1;
+  Py_ssize_t __pyx_t_1;
   int __pyx_t_2;
   int __pyx_t_3;
   int __pyx_t_4;
-  void *__pyx_t_5;
+  int __pyx_t_5;
+  void *__pyx_t_6;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -13976,7 +13856,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *     cdef int i
  *     cdef char order = get_best_order(&src, src_ndim)
  */
-  __pyx_v_itemsize = __pyx_v_src.memview->view.itemsize;
+  __pyx_t_1 = __pyx_v_src.memview->view.itemsize;
+  __pyx_v_itemsize = __pyx_t_1;
 
   /* "View.MemoryView":1238
  *     cdef size_t itemsize = src.memview.view.itemsize
@@ -14012,8 +13893,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *         broadcast_leading(&src, src_ndim, dst_ndim)
  *     elif dst_ndim < src_ndim:
  */
-  __pyx_t_1 = (__pyx_v_src_ndim < __pyx_v_dst_ndim);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_v_src_ndim < __pyx_v_dst_ndim);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":1244
  * 
@@ -14033,8 +13914,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *         broadcast_leading(&dst, dst_ndim, src_ndim)
  * 
  */
-  __pyx_t_1 = (__pyx_v_dst_ndim < __pyx_v_src_ndim);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_v_dst_ndim < __pyx_v_src_ndim);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":1246
  *         broadcast_leading(&src, src_ndim, dst_ndim)
@@ -14055,14 +13936,14 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  *     for i in range(ndim):
  */
-  __pyx_t_2 = __pyx_v_dst_ndim;
-  __pyx_t_3 = __pyx_v_src_ndim;
-  if ((__pyx_t_2 > __pyx_t_3)) {
-    __pyx_t_4 = __pyx_t_2;
+  __pyx_t_3 = __pyx_v_dst_ndim;
+  __pyx_t_4 = __pyx_v_src_ndim;
+  if ((__pyx_t_3 > __pyx_t_4)) {
+    __pyx_t_5 = __pyx_t_3;
   } else {
-    __pyx_t_4 = __pyx_t_3;
+    __pyx_t_5 = __pyx_t_4;
   }
-  __pyx_v_ndim = __pyx_t_4;
+  __pyx_v_ndim = __pyx_t_5;
 
   /* "View.MemoryView":1250
  *     cdef int ndim = max(src_ndim, dst_ndim)
@@ -14071,9 +13952,9 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *         if src.shape[i] != dst.shape[i]:
  *             if src.shape[i] == 1:
  */
-  __pyx_t_4 = __pyx_v_ndim;
-  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_4; __pyx_t_2+=1) {
-    __pyx_v_i = __pyx_t_2;
+  __pyx_t_5 = __pyx_v_ndim;
+  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_5; __pyx_t_3+=1) {
+    __pyx_v_i = __pyx_t_3;
 
     /* "View.MemoryView":1251
  * 
@@ -14082,8 +13963,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *             if src.shape[i] == 1:
  *                 broadcasting = True
  */
-    __pyx_t_1 = ((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i]));
-    if (__pyx_t_1) {
+    __pyx_t_2 = ((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i]));
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1252
  *     for i in range(ndim):
@@ -14092,8 +13973,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *                 broadcasting = True
  *                 src.strides[i] = 0
  */
-      __pyx_t_1 = ((__pyx_v_src.shape[__pyx_v_i]) == 1);
-      if (__pyx_t_1) {
+      __pyx_t_2 = ((__pyx_v_src.shape[__pyx_v_i]) == 1);
+      if (__pyx_t_2) {
 
         /* "View.MemoryView":1253
  *         if src.shape[i] != dst.shape[i]:
@@ -14123,7 +14004,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  *         if src.suboffsets[i] >= 0:
  */
-        __pyx_t_3 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_4 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       }
       __pyx_L7:;
       goto __pyx_L6;
@@ -14137,8 +14018,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *             _err_dim(ValueError, "Dimension %d is not direct", i)
  * 
  */
-    __pyx_t_1 = ((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0);
-    if (__pyx_t_1) {
+    __pyx_t_2 = ((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1259
  * 
@@ -14147,7 +14028,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  *     if slices_overlap(&src, &dst, ndim, itemsize):
  */
-      __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, __pyx_k_46, __pyx_v_i); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, __pyx_k_46, __pyx_v_i); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L8;
     }
     __pyx_L8:;
@@ -14160,8 +14041,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  *         if not slice_is_contig(&src, order, ndim):
  */
-  __pyx_t_1 = __pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize);
-  if (__pyx_t_1) {
+  __pyx_t_2 = __pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":1263
  *     if slices_overlap(&src, &dst, ndim, itemsize):
@@ -14170,8 +14051,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *             order = get_best_order(&dst, ndim)
  * 
  */
-    __pyx_t_1 = (!__pyx_memviewslice_is_contig((&__pyx_v_src), __pyx_v_order, __pyx_v_ndim));
-    if (__pyx_t_1) {
+    __pyx_t_2 = (!__pyx_memviewslice_is_contig((&__pyx_v_src), __pyx_v_order, __pyx_v_ndim));
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1264
  * 
@@ -14192,8 +14073,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *         src = tmp
  * 
  */
-    __pyx_t_5 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_v_tmpdata = __pyx_t_5;
+    __pyx_t_6 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_v_tmpdata = __pyx_t_6;
 
     /* "View.MemoryView":1267
  * 
@@ -14214,8 +14095,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  * 
  */
-  __pyx_t_1 = (!__pyx_v_broadcasting);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (!__pyx_v_broadcasting);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":1272
  * 
@@ -14224,8 +14105,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *             direct_copy = slice_is_contig(&dst, 'C', ndim)
  *         elif slice_is_contig(&src, 'F', ndim):
  */
-    __pyx_t_1 = __pyx_memviewslice_is_contig((&__pyx_v_src), 'C', __pyx_v_ndim);
-    if (__pyx_t_1) {
+    __pyx_t_2 = __pyx_memviewslice_is_contig((&__pyx_v_src), 'C', __pyx_v_ndim);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1273
  * 
@@ -14245,8 +14126,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *             direct_copy = slice_is_contig(&dst, 'F', ndim)
  * 
  */
-    __pyx_t_1 = __pyx_memviewslice_is_contig((&__pyx_v_src), 'F', __pyx_v_ndim);
-    if (__pyx_t_1) {
+    __pyx_t_2 = __pyx_memviewslice_is_contig((&__pyx_v_src), 'F', __pyx_v_ndim);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1275
  *             direct_copy = slice_is_contig(&dst, 'C', ndim)
@@ -14319,11 +14200,11 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  * 
  */
-  __pyx_t_1 = (__pyx_v_order == 'F');
-  if (__pyx_t_1) {
-    __pyx_t_1 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
+  __pyx_t_2 = (__pyx_v_order == 'F');
+  if (__pyx_t_2) {
+    __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
   }
-  if (__pyx_t_1) {
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":1287
  * 
@@ -14332,7 +14213,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *         transpose_memslice(&dst)
  * 
  */
-    __pyx_t_4 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_4 == 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
     /* "View.MemoryView":1288
  * 
@@ -14341,7 +14222,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  *     refcount_copying(&dst, dtype_is_object, ndim, False)
  */
-    __pyx_t_4 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_4 == 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L14;
   }
   __pyx_L14:;
@@ -14822,12 +14703,13 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t
 
 static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
   struct __pyx_array_obj *p;
-  PyObject *o = (*t->tp_alloc)(t, 0);
-  if (!o) return 0;
+  PyObject *o;
+  o = (*t->tp_alloc)(t, 0);
+  if (unlikely(!o)) return 0;
   p = ((struct __pyx_array_obj *)o);
   p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
   p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
-  if (__pyx_array___cinit__(o, a, k) < 0) {
+  if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) {
     Py_DECREF(o); o = 0;
   }
   return o;
@@ -14835,6 +14717,7 @@ static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
 
 static void __pyx_tp_dealloc_array(PyObject *o) {
   struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
+  PyObject_GC_UnTrack(o);
   {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
@@ -15014,7 +14897,7 @@ static PyBufferProcs __pyx_tp_as_buffer_array = {
 
 static PyTypeObject __pyx_type___pyx_array = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("reconstruct.array"), /*tp_name*/
+  __Pyx_NAMESTR("sparse_csr.array"), /*tp_name*/
   sizeof(struct __pyx_array_obj), /*tp_basicsize*/
   0, /*tp_itemsize*/
   __pyx_tp_dealloc_array, /*tp_dealloc*/
@@ -15036,7 +14919,7 @@ static PyTypeObject __pyx_type___pyx_array = {
   __pyx_tp_getattro_array, /*tp_getattro*/
   0, /*tp_setattro*/
   &__pyx_tp_as_buffer_array, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
   0, /*tp_doc*/
   __pyx_tp_traverse_array, /*tp_traverse*/
   __pyx_tp_clear_array, /*tp_clear*/
@@ -15070,8 +14953,9 @@ static PyTypeObject __pyx_type___pyx_array = {
 
 static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
   struct __pyx_MemviewEnum_obj *p;
-  PyObject *o = (*t->tp_alloc)(t, 0);
-  if (!o) return 0;
+  PyObject *o;
+  o = (*t->tp_alloc)(t, 0);
+  if (unlikely(!o)) return 0;
   p = ((struct __pyx_MemviewEnum_obj *)o);
   p->name = Py_None; Py_INCREF(Py_None);
   return o;
@@ -15079,6 +14963,7 @@ static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, C
 
 static void __pyx_tp_dealloc_Enum(PyObject *o) {
   struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
+  PyObject_GC_UnTrack(o);
   Py_CLEAR(p->name);
   (*Py_TYPE(o)->tp_free)(o);
 }
@@ -15205,7 +15090,7 @@ static PyBufferProcs __pyx_tp_as_buffer_Enum = {
 
 static PyTypeObject __pyx_type___pyx_MemviewEnum = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("reconstruct.Enum"), /*tp_name*/
+  __Pyx_NAMESTR("sparse_csr.Enum"), /*tp_name*/
   sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/
   0, /*tp_itemsize*/
   __pyx_tp_dealloc_Enum, /*tp_dealloc*/
@@ -15227,7 +15112,7 @@ static PyTypeObject __pyx_type___pyx_MemviewEnum = {
   0, /*tp_getattro*/
   0, /*tp_setattro*/
   &__pyx_tp_as_buffer_Enum, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
   0, /*tp_doc*/
   __pyx_tp_traverse_Enum, /*tp_traverse*/
   __pyx_tp_clear_Enum, /*tp_clear*/
@@ -15262,15 +15147,16 @@ static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;
 
 static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
   struct __pyx_memoryview_obj *p;
-  PyObject *o = (*t->tp_alloc)(t, 0);
-  if (!o) return 0;
+  PyObject *o;
+  o = (*t->tp_alloc)(t, 0);
+  if (unlikely(!o)) return 0;
   p = ((struct __pyx_memoryview_obj *)o);
   p->__pyx_vtab = __pyx_vtabptr_memoryview;
   p->obj = Py_None; Py_INCREF(Py_None);
   p->_size = Py_None; Py_INCREF(Py_None);
   p->_array_interface = Py_None; Py_INCREF(Py_None);
   p->view.obj = NULL;
-  if (__pyx_memoryview___cinit__(o, a, k) < 0) {
+  if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) {
     Py_DECREF(o); o = 0;
   }
   return o;
@@ -15278,6 +15164,7 @@ static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject
 
 static void __pyx_tp_dealloc_memoryview(PyObject *o) {
   struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
+  PyObject_GC_UnTrack(o);
   {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
@@ -15502,7 +15389,7 @@ static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
 
 static PyTypeObject __pyx_type___pyx_memoryview = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("reconstruct.memoryview"), /*tp_name*/
+  __Pyx_NAMESTR("sparse_csr.memoryview"), /*tp_name*/
   sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/
   0, /*tp_itemsize*/
   __pyx_tp_dealloc_memoryview, /*tp_dealloc*/
@@ -15524,7 +15411,7 @@ static PyTypeObject __pyx_type___pyx_memoryview = {
   0, /*tp_getattro*/
   0, /*tp_setattro*/
   &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
   0, /*tp_doc*/
   __pyx_tp_traverse_memoryview, /*tp_traverse*/
   __pyx_tp_clear_memoryview, /*tp_clear*/
@@ -15560,7 +15447,7 @@ static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice;
 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) {
   struct __pyx_memoryviewslice_obj *p;
   PyObject *o = __pyx_tp_new_memoryview(t, a, k);
-  if (!o) return 0;
+  if (unlikely(!o)) return 0;
   p = ((struct __pyx_memoryviewslice_obj *)o);
   p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice;
   p->from_object = Py_None; Py_INCREF(Py_None);
@@ -15570,6 +15457,7 @@ static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyO
 
 static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) {
   struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
+  PyObject_GC_UnTrack(o);
   {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
@@ -15580,6 +15468,7 @@ static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) {
     PyErr_Restore(etype, eval, etb);
   }
   Py_CLEAR(p->from_object);
+  PyObject_GC_Track(o);
   __pyx_tp_dealloc_memoryview(o);
 }
 
@@ -15733,7 +15622,7 @@ static PyBufferProcs __pyx_tp_as_buffer__memoryviewslice = {
 
 static PyTypeObject __pyx_type___pyx_memoryviewslice = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("reconstruct._memoryviewslice"), /*tp_name*/
+  __Pyx_NAMESTR("sparse_csr._memoryviewslice"), /*tp_name*/
   sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/
   0, /*tp_itemsize*/
   __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/
@@ -15763,7 +15652,7 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = {
   0, /*tp_getattro*/
   0, /*tp_setattro*/
   &__pyx_tp_as_buffer__memoryviewslice, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
   __Pyx_DOCSTR("Internal class for passing memoryview slices to Python"), /*tp_doc*/
   __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/
   __pyx_tp_clear__memoryviewslice, /*tp_clear*/
@@ -15801,8 +15690,12 @@ static PyMethodDef __pyx_methods[] = {
 
 #if PY_MAJOR_VERSION >= 3
 static struct PyModuleDef __pyx_moduledef = {
+  #if PY_VERSION_HEX < 0x03020000
+    { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
+  #else
     PyModuleDef_HEAD_INIT,
-    __Pyx_NAMESTR("reconstruct"),
+  #endif
+    __Pyx_NAMESTR("sparse_csr"),
     0, /* m_doc */
     -1, /* m_size */
     __pyx_methods /* m_methods */,
@@ -15814,63 +15707,59 @@ static struct PyModuleDef __pyx_moduledef = {
 #endif
 
 static __Pyx_StringTabEntry __pyx_string_tab[] = {
-  {&__pyx_kp_u_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 1, 0, 0},
+  {&__pyx_kp_u_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 1, 0, 0},
+  {&__pyx_kp_u_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 1, 0, 0},
+  {&__pyx_kp_u_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 1, 0, 0},
   {&__pyx_kp_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 0},
   {&__pyx_kp_s_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 0, 1, 0},
   {&__pyx_kp_s_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 0, 1, 0},
-  {&__pyx_kp_u_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 1, 0, 0},
   {&__pyx_kp_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 0},
   {&__pyx_kp_s_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 0, 1, 0},
   {&__pyx_kp_s_24, __pyx_k_24, sizeof(__pyx_k_24), 0, 0, 1, 0},
   {&__pyx_kp_s_26, __pyx_k_26, sizeof(__pyx_k_26), 0, 0, 1, 0},
   {&__pyx_kp_s_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 0, 1, 0},
+  {&__pyx_kp_u_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 1, 0, 0},
   {&__pyx_kp_s_30, __pyx_k_30, sizeof(__pyx_k_30), 0, 0, 1, 0},
   {&__pyx_kp_s_32, __pyx_k_32, sizeof(__pyx_k_32), 0, 0, 1, 0},
   {&__pyx_kp_s_33, __pyx_k_33, sizeof(__pyx_k_33), 0, 0, 1, 0},
   {&__pyx_kp_s_36, __pyx_k_36, sizeof(__pyx_k_36), 0, 0, 1, 0},
   {&__pyx_kp_s_38, __pyx_k_38, sizeof(__pyx_k_38), 0, 0, 1, 0},
-  {&__pyx_kp_u_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 1, 0, 0},
   {&__pyx_kp_s_43, __pyx_k_43, sizeof(__pyx_k_43), 0, 0, 1, 0},
   {&__pyx_kp_s_45, __pyx_k_45, sizeof(__pyx_k_45), 0, 0, 1, 0},
   {&__pyx_kp_s_49, __pyx_k_49, sizeof(__pyx_k_49), 0, 0, 1, 0},
+  {&__pyx_kp_u_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 1, 0, 0},
   {&__pyx_kp_s_51, __pyx_k_51, sizeof(__pyx_k_51), 0, 0, 1, 0},
   {&__pyx_kp_s_53, __pyx_k_53, sizeof(__pyx_k_53), 0, 0, 1, 0},
   {&__pyx_kp_s_55, __pyx_k_55, sizeof(__pyx_k_55), 0, 0, 1, 0},
   {&__pyx_kp_s_57, __pyx_k_57, sizeof(__pyx_k_57), 0, 0, 1, 0},
   {&__pyx_kp_s_59, __pyx_k_59, sizeof(__pyx_k_59), 0, 0, 1, 0},
-  {&__pyx_kp_u_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 1, 0, 0},
+  {&__pyx_kp_u_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 1, 0, 0},
   {&__pyx_kp_u_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 1, 0, 0},
-  {&__pyx_kp_u_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 1, 0, 0},
   {&__pyx_n_s__ASCII, __pyx_k__ASCII, sizeof(__pyx_k__ASCII), 0, 0, 1, 1},
   {&__pyx_n_s__Ellipsis, __pyx_k__Ellipsis, sizeof(__pyx_k__Ellipsis), 0, 0, 1, 1},
   {&__pyx_n_s__IndexError, __pyx_k__IndexError, sizeof(__pyx_k__IndexError), 0, 0, 1, 1},
+  {&__pyx_n_s__LUT_to_CSR, __pyx_k__LUT_to_CSR, sizeof(__pyx_k__LUT_to_CSR), 0, 0, 1, 1},
   {&__pyx_n_s__MemoryError, __pyx_k__MemoryError, sizeof(__pyx_k__MemoryError), 0, 0, 1, 1},
   {&__pyx_n_b__O, __pyx_k__O, sizeof(__pyx_k__O), 0, 0, 0, 1},
   {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1},
   {&__pyx_n_s__TypeError, __pyx_k__TypeError, sizeof(__pyx_k__TypeError), 0, 0, 1, 1},
   {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1},
   {&__pyx_n_s____class__, __pyx_k____class__, sizeof(__pyx_k____class__), 0, 0, 1, 1},
+  {&__pyx_n_s____import__, __pyx_k____import__, sizeof(__pyx_k____import__), 0, 0, 1, 1},
   {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
   {&__pyx_n_s____name__, __pyx_k____name__, sizeof(__pyx_k____name__), 0, 0, 1, 1},
   {&__pyx_n_s____pyx_getbuffer, __pyx_k____pyx_getbuffer, sizeof(__pyx_k____pyx_getbuffer), 0, 0, 1, 1},
+  {&__pyx_n_s____pyx_releasebuffer, __pyx_k____pyx_releasebuffer, sizeof(__pyx_k____pyx_releasebuffer), 0, 0, 1, 1},
   {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
   {&__pyx_n_s__allocate_buffer, __pyx_k__allocate_buffer, sizeof(__pyx_k__allocate_buffer), 0, 0, 1, 1},
-  {&__pyx_n_s__ascontiguousarray, __pyx_k__ascontiguousarray, sizeof(__pyx_k__ascontiguousarray), 0, 0, 1, 1},
-  {&__pyx_n_s__astype, __pyx_k__astype, sizeof(__pyx_k__astype), 0, 0, 1, 1},
   {&__pyx_n_s__base, __pyx_k__base, sizeof(__pyx_k__base), 0, 0, 1, 1},
   {&__pyx_n_b__c, __pyx_k__c, sizeof(__pyx_k__c), 0, 0, 0, 1},
   {&__pyx_n_s__c, __pyx_k__c, sizeof(__pyx_k__c), 0, 0, 1, 1},
   {&__pyx_n_u__c, __pyx_k__c, sizeof(__pyx_k__c), 0, 1, 0, 1},
-  {&__pyx_n_s__cdata, __pyx_k__cdata, sizeof(__pyx_k__cdata), 0, 0, 1, 1},
-  {&__pyx_n_s__cmask, __pyx_k__cmask, sizeof(__pyx_k__cmask), 0, 0, 1, 1},
-  {&__pyx_n_s__d0, __pyx_k__d0, sizeof(__pyx_k__d0), 0, 0, 1, 1},
-  {&__pyx_n_s__d1, __pyx_k__d1, sizeof(__pyx_k__d1), 0, 0, 1, 1},
+  {&__pyx_n_s__coef, __pyx_k__coef, sizeof(__pyx_k__coef), 0, 0, 1, 1},
   {&__pyx_n_s__data, __pyx_k__data, sizeof(__pyx_k__data), 0, 0, 1, 1},
   {&__pyx_n_s__decode, __pyx_k__decode, sizeof(__pyx_k__decode), 0, 0, 1, 1},
-  {&__pyx_n_s__delta_dummy, __pyx_k__delta_dummy, sizeof(__pyx_k__delta_dummy), 0, 0, 1, 1},
-  {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1},
   {&__pyx_n_s__dtype_is_object, __pyx_k__dtype_is_object, sizeof(__pyx_k__dtype_is_object), 0, 0, 1, 1},
-  {&__pyx_n_s__dummy, __pyx_k__dummy, sizeof(__pyx_k__dummy), 0, 0, 1, 1},
   {&__pyx_n_s__encode, __pyx_k__encode, sizeof(__pyx_k__encode), 0, 0, 1, 1},
   {&__pyx_n_s__enumerate, __pyx_k__enumerate, sizeof(__pyx_k__enumerate), 0, 0, 1, 1},
   {&__pyx_n_s__error, __pyx_k__error, sizeof(__pyx_k__error), 0, 0, 1, 1},
@@ -15882,50 +15771,52 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s__fortran, __pyx_k__fortran, sizeof(__pyx_k__fortran), 0, 0, 1, 1},
   {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1},
   {&__pyx_n_s__id, __pyx_k__id, sizeof(__pyx_k__id), 0, 0, 1, 1},
-  {&__pyx_n_s__int32, __pyx_k__int32, sizeof(__pyx_k__int32), 0, 0, 1, 1},
-  {&__pyx_n_s__int8, __pyx_k__int8, sizeof(__pyx_k__int8), 0, 0, 1, 1},
+  {&__pyx_n_s__idx, __pyx_k__idx, sizeof(__pyx_k__idx), 0, 0, 1, 1},
+  {&__pyx_n_s__indices, __pyx_k__indices, sizeof(__pyx_k__indices), 0, 0, 1, 1},
+  {&__pyx_n_s__indptr, __pyx_k__indptr, sizeof(__pyx_k__indptr), 0, 0, 1, 1},
   {&__pyx_n_s__itemsize, __pyx_k__itemsize, sizeof(__pyx_k__itemsize), 0, 0, 1, 1},
-  {&__pyx_n_s__l, __pyx_k__l, sizeof(__pyx_k__l), 0, 0, 1, 1},
-  {&__pyx_n_s__mask, __pyx_k__mask, sizeof(__pyx_k__mask), 0, 0, 1, 1},
+  {&__pyx_n_s__j, __pyx_k__j, sizeof(__pyx_k__j), 0, 0, 1, 1},
+  {&__pyx_n_s__lut, __pyx_k__lut, sizeof(__pyx_k__lut), 0, 0, 1, 1},
   {&__pyx_n_s__memview, __pyx_k__memview, sizeof(__pyx_k__memview), 0, 0, 1, 1},
   {&__pyx_n_s__mode, __pyx_k__mode, sizeof(__pyx_k__mode), 0, 0, 1, 1},
   {&__pyx_n_s__name, __pyx_k__name, sizeof(__pyx_k__name), 0, 0, 1, 1},
+  {&__pyx_n_s__ncol, __pyx_k__ncol, sizeof(__pyx_k__ncol), 0, 0, 1, 1},
   {&__pyx_n_s__ndim, __pyx_k__ndim, sizeof(__pyx_k__ndim), 0, 0, 1, 1},
+  {&__pyx_n_s__nelt, __pyx_k__nelt, sizeof(__pyx_k__nelt), 0, 0, 1, 1},
+  {&__pyx_n_s__nrow, __pyx_k__nrow, sizeof(__pyx_k__nrow), 0, 0, 1, 1},
+  {&__pyx_n_s__num, __pyx_k__num, sizeof(__pyx_k__num), 0, 0, 1, 1},
   {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1},
   {&__pyx_n_s__obj, __pyx_k__obj, sizeof(__pyx_k__obj), 0, 0, 1, 1},
-  {&__pyx_n_s__out, __pyx_k__out, sizeof(__pyx_k__out), 0, 0, 1, 1},
-  {&__pyx_n_s__p0, __pyx_k__p0, sizeof(__pyx_k__p0), 0, 0, 1, 1},
-  {&__pyx_n_s__p1, __pyx_k__p1, sizeof(__pyx_k__p1), 0, 0, 1, 1},
   {&__pyx_n_s__pack, __pyx_k__pack, sizeof(__pyx_k__pack), 0, 0, 1, 1},
   {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1},
-  {&__pyx_n_s__reconstruct, __pyx_k__reconstruct, sizeof(__pyx_k__reconstruct), 0, 0, 1, 1},
   {&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1},
   {&__pyx_n_s__size, __pyx_k__size, sizeof(__pyx_k__size), 0, 0, 1, 1},
+  {&__pyx_n_s__sparse_csr, __pyx_k__sparse_csr, sizeof(__pyx_k__sparse_csr), 0, 0, 1, 1},
   {&__pyx_n_s__start, __pyx_k__start, sizeof(__pyx_k__start), 0, 0, 1, 1},
   {&__pyx_n_s__step, __pyx_k__step, sizeof(__pyx_k__step), 0, 0, 1, 1},
   {&__pyx_n_s__stop, __pyx_k__stop, sizeof(__pyx_k__stop), 0, 0, 1, 1},
   {&__pyx_n_s__struct, __pyx_k__struct, sizeof(__pyx_k__struct), 0, 0, 1, 1},
+  {&__pyx_n_s__uint32, __pyx_k__uint32, sizeof(__pyx_k__uint32), 0, 0, 1, 1},
   {&__pyx_n_s__unpack, __pyx_k__unpack, sizeof(__pyx_k__unpack), 0, 0, 1, 1},
   {&__pyx_n_s__xrange, __pyx_k__xrange, sizeof(__pyx_k__xrange), 0, 0, 1, 1},
   {&__pyx_n_s__zeros, __pyx_k__zeros, sizeof(__pyx_k__zeros), 0, 0, 1, 1},
-  {&__pyx_n_s__zeros_like, __pyx_k__zeros_like, sizeof(__pyx_k__zeros_like), 0, 0, 1, 1},
   {0, 0, 0, 0, 0, 0, 0}
 };
 static int __Pyx_InitCachedBuiltins(void) {
-  __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_MemoryError = __Pyx_GetName(__pyx_b, __pyx_n_s__MemoryError); if (!__pyx_builtin_MemoryError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_enumerate = __Pyx_GetName(__pyx_b, __pyx_n_s__enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_Ellipsis = __Pyx_GetName(__pyx_b, __pyx_n_s__Ellipsis); if (!__pyx_builtin_Ellipsis) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s__MemoryError); if (!__pyx_builtin_MemoryError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s__enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s__Ellipsis); if (!__pyx_builtin_Ellipsis) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   #if PY_MAJOR_VERSION >= 3
-  __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   #else
-  __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__xrange); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s__xrange); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   #endif
-  __pyx_builtin_id = __Pyx_GetName(__pyx_b, __pyx_n_s__id); if (!__pyx_builtin_id) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_IndexError = __Pyx_GetName(__pyx_b, __pyx_n_s__IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s__id); if (!__pyx_builtin_id) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s__IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   return 0;
   __pyx_L1_error:;
   return -1;
@@ -15935,20 +15826,6 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
 
-  /* "reconstruct.pyx":75
- *         else:
- *             mask+=(abs(data-dummy)<=delta_dummy)
- *     cdef bint[:,:] cmask = mask.astype("int32")             # <<<<<<<<<<<<<<
- *     assert d0==mask.shape[0]
- *     assert d1==mask.shape[1]
- */
-  __pyx_k_tuple_1 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_1);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__int32));
-  PyTuple_SET_ITEM(__pyx_k_tuple_1, 0, ((PyObject *)__pyx_n_s__int32));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__int32));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_1));
-
   /* "numpy.pxd":215
  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
  *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
@@ -15956,12 +15833,9 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
  */
-  __pyx_k_tuple_3 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_3);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_2));
-  PyTuple_SET_ITEM(__pyx_k_tuple_3, 0, ((PyObject *)__pyx_kp_u_2));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_2));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_3));
+  __pyx_k_tuple_2 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_1)); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_2);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2));
 
   /* "numpy.pxd":219
  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
@@ -15970,12 +15844,9 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *             info.buf = PyArray_DATA(self)
  */
-  __pyx_k_tuple_5 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_5);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_4));
-  PyTuple_SET_ITEM(__pyx_k_tuple_5, 0, ((PyObject *)__pyx_kp_u_4));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_4));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5));
+  __pyx_k_tuple_4 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_3)); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_4);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4));
 
   /* "numpy.pxd":257
  *                 if ((descr.byteorder == c'>' and little_endian) or
@@ -15984,12 +15855,9 @@ static int __Pyx_InitCachedConstants(void) {
  *                 if   t == NPY_BYTE:        f = "b"
  *                 elif t == NPY_UBYTE:       f = "B"
  */
-  __pyx_k_tuple_7 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_7);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_6));
-  PyTuple_SET_ITEM(__pyx_k_tuple_7, 0, ((PyObject *)__pyx_kp_u_6));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_6));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_7));
+  __pyx_k_tuple_6 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_5)); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_6);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6));
 
   /* "numpy.pxd":799
  * 
@@ -15998,12 +15866,9 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *         if ((child.byteorder == c'>' and little_endian) or
  */
-  __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_10);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_9));
-  PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_kp_u_9));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_9));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10));
+  __pyx_k_tuple_9 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_8)); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_9);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9));
 
   /* "numpy.pxd":803
  *         if ((child.byteorder == c'>' and little_endian) or
@@ -16012,12 +15877,9 @@ static int __Pyx_InitCachedConstants(void) {
  *             # One could encode it in the format string and have Cython
  *             # complain instead, BUT: < and > in format strings also imply
  */
-  __pyx_k_tuple_11 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_11);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_6));
-  PyTuple_SET_ITEM(__pyx_k_tuple_11, 0, ((PyObject *)__pyx_kp_u_6));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_6));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11));
+  __pyx_k_tuple_10 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_5)); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_10);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10));
 
   /* "numpy.pxd":823
  *             t = child.type_num
@@ -16026,12 +15888,9 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *             # Until ticket #99 is fixed, use integers to avoid warnings
  */
-  __pyx_k_tuple_13 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_13);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_12));
-  PyTuple_SET_ITEM(__pyx_k_tuple_13, 0, ((PyObject *)__pyx_kp_u_12));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_12));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_13));
+  __pyx_k_tuple_12 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_11)); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_12);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12));
 
   /* "View.MemoryView":124
  * 
@@ -16040,11 +15899,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *         if self.itemsize <= 0:
  */
-  __pyx_k_tuple_15 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_15 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_14)); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_15);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_14));
-  PyTuple_SET_ITEM(__pyx_k_tuple_15, 0, ((PyObject *)__pyx_kp_s_14));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15));
 
   /* "View.MemoryView":127
@@ -16054,11 +15910,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *         encode = getattr(format, 'encode', None)
  */
-  __pyx_k_tuple_17 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_17 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_17);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_16));
-  PyTuple_SET_ITEM(__pyx_k_tuple_17, 0, ((PyObject *)__pyx_kp_s_16));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_16));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17));
 
   /* "View.MemoryView":131
@@ -16068,11 +15921,8 @@ static int __Pyx_InitCachedConstants(void) {
  *         self._format = format
  *         self.format = self._format
  */
-  __pyx_k_tuple_18 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_18 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__ASCII)); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_18);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__ASCII));
-  PyTuple_SET_ITEM(__pyx_k_tuple_18, 0, ((PyObject *)__pyx_n_s__ASCII));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ASCII));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18));
 
   /* "View.MemoryView":141
@@ -16082,11 +15932,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  * 
  */
-  __pyx_k_tuple_20 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_20)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_20 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_19)); if (unlikely(!__pyx_k_tuple_20)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_20);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_19));
-  PyTuple_SET_ITEM(__pyx_k_tuple_20, 0, ((PyObject *)__pyx_kp_s_19));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_19));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_20));
 
   /* "View.MemoryView":166
@@ -16096,11 +15943,8 @@ static int __Pyx_InitCachedConstants(void) {
  *         self.mode = mode
  * 
  */
-  __pyx_k_tuple_23 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_23)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_23 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__ASCII)); if (unlikely(!__pyx_k_tuple_23)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_23);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__ASCII));
-  PyTuple_SET_ITEM(__pyx_k_tuple_23, 0, ((PyObject *)__pyx_n_s__ASCII));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ASCII));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_23));
 
   /* "View.MemoryView":174
@@ -16110,11 +15954,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *             if self.dtype_is_object:
  */
-  __pyx_k_tuple_25 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_25)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_25 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_24)); if (unlikely(!__pyx_k_tuple_25)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_25);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_24));
-  PyTuple_SET_ITEM(__pyx_k_tuple_25, 0, ((PyObject *)__pyx_kp_s_24));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_24));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_25));
 
   /* "View.MemoryView":190
@@ -16124,11 +15965,8 @@ static int __Pyx_InitCachedConstants(void) {
  *         info.buf = self.data
  *         info.len = self.len
  */
-  __pyx_k_tuple_27 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_27)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_27 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_26)); if (unlikely(!__pyx_k_tuple_27)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_27);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_26));
-  PyTuple_SET_ITEM(__pyx_k_tuple_27, 0, ((PyObject *)__pyx_kp_s_26));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_26));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_27));
 
   /* "View.MemoryView":452
@@ -16138,11 +15976,8 @@ static int __Pyx_InitCachedConstants(void) {
  *         else:
  *             if len(self.view.format) == 1:
  */
-  __pyx_k_tuple_29 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_29)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_29 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_28)); if (unlikely(!__pyx_k_tuple_29)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_29);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_28));
-  PyTuple_SET_ITEM(__pyx_k_tuple_29, 0, ((PyObject *)__pyx_kp_s_28));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_28));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_29));
 
   /* "View.MemoryView":528
@@ -16152,11 +15987,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *             return tuple([self.view.strides[i] for i in xrange(self.view.ndim)])
  */
-  __pyx_k_tuple_31 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_31)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_31 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_30)); if (unlikely(!__pyx_k_tuple_31)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_31);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_30));
-  PyTuple_SET_ITEM(__pyx_k_tuple_31, 0, ((PyObject *)__pyx_kp_s_30));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_30));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_31));
 
   /* "View.MemoryView":643
@@ -16166,11 +15998,8 @@ static int __Pyx_InitCachedConstants(void) {
  *                 seen_ellipsis = True
  *             else:
  */
-  __pyx_k_tuple_34 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_34)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_34 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_k_tuple_34)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_34);
-  __Pyx_INCREF(Py_None);
-  PyTuple_SET_ITEM(__pyx_k_tuple_34, 0, Py_None);
-  __Pyx_GIVEREF(Py_None);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_34));
 
   /* "View.MemoryView":646
@@ -16180,11 +16009,8 @@ static int __Pyx_InitCachedConstants(void) {
  *             have_slices = True
  *         else:
  */
-  __pyx_k_tuple_35 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_35)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_35 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_k_tuple_35)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_35);
-  __Pyx_INCREF(Py_None);
-  PyTuple_SET_ITEM(__pyx_k_tuple_35, 0, Py_None);
-  __Pyx_GIVEREF(Py_None);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_35));
 
   /* "View.MemoryView":657
@@ -16194,11 +16020,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *     return have_slices or nslices, tuple(result)
  */
-  __pyx_k_tuple_37 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_37)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_37 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_k_tuple_37)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_37);
-  __Pyx_INCREF(Py_None);
-  PyTuple_SET_ITEM(__pyx_k_tuple_37, 0, Py_None);
-  __Pyx_GIVEREF(Py_None);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_37));
 
   /* "View.MemoryView":665
@@ -16208,63 +16031,21 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  * 
  */
-  __pyx_k_tuple_39 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_39)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_39 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_38)); if (unlikely(!__pyx_k_tuple_39)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_39);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_38));
-  PyTuple_SET_ITEM(__pyx_k_tuple_39, 0, ((PyObject *)__pyx_kp_s_38));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_38));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_39));
 
-  /* "reconstruct.pyx":60
- * @cython.boundscheck(False)
- * @cython.wraparound(False)
- * def reconstruct(numpy.ndarray data not None, numpy.ndarray mask=None, dummy=None,  delta_dummy=None):             # <<<<<<<<<<<<<<
- *     assert data.ndim==2
- *     cdef ssize_t d0=data.shape[0]
+  /* "sparse_csr.pyx":31
+ * import numpy
+ * 
+ * def LUT_to_CSR(lut):             # <<<<<<<<<<<<<<
+ *     cdef int[:,:] idx = lut.idx
+ *     cdef float[:,:] coef = lut.coef
  */
-  __pyx_k_tuple_47 = PyTuple_New(13); if (unlikely(!__pyx_k_tuple_47)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_47 = PyTuple_Pack(11, ((PyObject *)__pyx_n_s__lut), ((PyObject *)__pyx_n_s__idx), ((PyObject *)__pyx_n_s__coef), ((PyObject *)__pyx_n_s__nrow), ((PyObject *)__pyx_n_s__ncol), ((PyObject *)__pyx_n_s__nelt), ((PyObject *)__pyx_n_s__data), ((PyObject *)__pyx_n_s__indices), ((PyObject *)__pyx_n_s__indptr), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__j)); if (unlikely(!__pyx_k_tuple_47)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __ [...]
   __Pyx_GOTREF(__pyx_k_tuple_47);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__data));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 0, ((PyObject *)__pyx_n_s__data));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__data));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__mask));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 1, ((PyObject *)__pyx_n_s__mask));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mask));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__dummy));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 2, ((PyObject *)__pyx_n_s__dummy));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dummy));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__delta_dummy));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 3, ((PyObject *)__pyx_n_s__delta_dummy));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__delta_dummy));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__d0));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 4, ((PyObject *)__pyx_n_s__d0));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__d0));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__d1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 5, ((PyObject *)__pyx_n_s__d1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__d1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cdata));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 6, ((PyObject *)__pyx_n_s__cdata));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cdata));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cmask));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 7, ((PyObject *)__pyx_n_s__cmask));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cmask));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 8, ((PyObject *)__pyx_n_s__out));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__p0));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 9, ((PyObject *)__pyx_n_s__p0));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__p0));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__p1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 10, ((PyObject *)__pyx_n_s__p1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__p1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 11, ((PyObject *)__pyx_n_s__i));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__l));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 12, ((PyObject *)__pyx_n_s__l));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__l));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_47));
-  __pyx_k_codeobj_48 = (PyObject*)__Pyx_PyCode_New(4, 0, 13, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_47, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_49, __pyx_n_s__reconstruct, 60, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_48)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_codeobj_48 = (PyObject*)__Pyx_PyCode_New(1, 0, 11, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_47, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_49, __pyx_n_s__LUT_to_CSR, 31, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_48)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   /* "View.MemoryView":282
  *         return self.name
@@ -16273,11 +16054,8 @@ static int __Pyx_InitCachedConstants(void) {
  * cdef strided = Enum("<strided and direct>") # default
  * cdef indirect = Enum("<strided and indirect>")
  */
-  __pyx_k_tuple_52 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_52)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_52 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_51)); if (unlikely(!__pyx_k_tuple_52)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_52);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_51));
-  PyTuple_SET_ITEM(__pyx_k_tuple_52, 0, ((PyObject *)__pyx_kp_s_51));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_51));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_52));
 
   /* "View.MemoryView":283
@@ -16287,11 +16065,8 @@ static int __Pyx_InitCachedConstants(void) {
  * cdef indirect = Enum("<strided and indirect>")
  * 
  */
-  __pyx_k_tuple_54 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_54)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_54 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_53)); if (unlikely(!__pyx_k_tuple_54)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_54);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_53));
-  PyTuple_SET_ITEM(__pyx_k_tuple_54, 0, ((PyObject *)__pyx_kp_s_53));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_53));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_54));
 
   /* "View.MemoryView":284
@@ -16301,11 +16076,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  * 
  */
-  __pyx_k_tuple_56 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_56)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_56 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_55)); if (unlikely(!__pyx_k_tuple_56)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_56);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_55));
-  PyTuple_SET_ITEM(__pyx_k_tuple_56, 0, ((PyObject *)__pyx_kp_s_55));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_55));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_56));
 
   /* "View.MemoryView":287
@@ -16315,11 +16087,8 @@ static int __Pyx_InitCachedConstants(void) {
  * cdef indirect_contiguous = Enum("<contiguous and indirect>")
  * 
  */
-  __pyx_k_tuple_58 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_58)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_58 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_57)); if (unlikely(!__pyx_k_tuple_58)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_58);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_57));
-  PyTuple_SET_ITEM(__pyx_k_tuple_58, 0, ((PyObject *)__pyx_kp_s_57));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_57));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_58));
 
   /* "View.MemoryView":288
@@ -16329,11 +16098,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  * 
  */
-  __pyx_k_tuple_60 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_60)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_60 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_59)); if (unlikely(!__pyx_k_tuple_60)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_60);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_59));
-  PyTuple_SET_ITEM(__pyx_k_tuple_60, 0, ((PyObject *)__pyx_kp_s_59));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_59));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_60));
   __Pyx_RefNannyFinishContext();
   return 0;
@@ -16343,16 +16109,7 @@ static int __Pyx_InitCachedConstants(void) {
 }
 
 static int __Pyx_InitGlobals(void) {
-  /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and
-   a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is
-   a quiet NaN. */
-    memset(&__PYX_NAN, 0xFF, sizeof(__PYX_NAN));
-
-#ifdef WITH_THREAD
-PyEval_InitThreads();
-#endif
-
-if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
   __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
   __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
   __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
@@ -16363,14 +16120,17 @@ if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx
 }
 
 #if PY_MAJOR_VERSION < 3
-PyMODINIT_FUNC initreconstruct(void); /*proto*/
-PyMODINIT_FUNC initreconstruct(void)
+PyMODINIT_FUNC initsparse_csr(void); /*proto*/
+PyMODINIT_FUNC initsparse_csr(void)
 #else
-PyMODINIT_FUNC PyInit_reconstruct(void); /*proto*/
-PyMODINIT_FUNC PyInit_reconstruct(void)
+PyMODINIT_FUNC PyInit_sparse_csr(void); /*proto*/
+PyMODINIT_FUNC PyInit_sparse_csr(void)
 #endif
 {
   PyObject *__pyx_t_1 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannyDeclarations
   #if CYTHON_REFNANNY
   __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
@@ -16381,7 +16141,7 @@ PyMODINIT_FUNC PyInit_reconstruct(void)
           Py_FatalError("failed to import 'refnanny' module");
   }
   #endif
-  __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_reconstruct(void)", 0);
+  __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_sparse_csr(void)", 0);
   if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -16403,11 +16163,21 @@ PyMODINIT_FUNC PyInit_reconstruct(void)
   #endif
   /*--- Module creation code ---*/
   #if PY_MAJOR_VERSION < 3
-  __pyx_m = Py_InitModule4(__Pyx_NAMESTR("reconstruct"), __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
+  __pyx_m = Py_InitModule4(__Pyx_NAMESTR("sparse_csr"), __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
   #else
   __pyx_m = PyModule_Create(&__pyx_moduledef);
   #endif
   if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  Py_INCREF(__pyx_d);
+  #if PY_MAJOR_VERSION >= 3
+  {
+    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (!PyDict_GetItemString(modules, "sparse_csr")) {
+      if (unlikely(PyDict_SetItemString(modules, "sparse_csr", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    }
+  }
+  #endif
   __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   #if CYTHON_COMPILING_IN_PYPY
   Py_INCREF(__pyx_b);
@@ -16415,7 +16185,10 @@ PyMODINIT_FUNC PyInit_reconstruct(void)
   if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
   /*--- Initialize various global constants etc. ---*/
   if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__pyx_module_is_main_reconstruct) {
+  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
+  if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  #endif
+  if (__pyx_module_is_main_sparse_csr) {
     if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
   }
   /*--- Builtin init code ---*/
@@ -16470,43 +16243,43 @@ PyMODINIT_FUNC PyInit_reconstruct(void)
   __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 885; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   /*--- Variable import code ---*/
   /*--- Function import code ---*/
   /*--- Execution code ---*/
 
-  /* "reconstruct.pyx":3
- * #Cython module to reconstruct the masked values of an image
+  /* "sparse_csr.pyx":29
  * import cython
- * import numpy             # <<<<<<<<<<<<<<
  * cimport numpy
- * from libc.math cimport sqrt
+ * import numpy             # <<<<<<<<<<<<<<
+ * 
+ * def LUT_to_CSR(lut):
  */
-  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__numpy, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s__numpy, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "reconstruct.pyx":60
- * @cython.boundscheck(False)
- * @cython.wraparound(False)
- * def reconstruct(numpy.ndarray data not None, numpy.ndarray mask=None, dummy=None,  delta_dummy=None):             # <<<<<<<<<<<<<<
- *     assert data.ndim==2
- *     cdef ssize_t d0=data.shape[0]
+  /* "sparse_csr.pyx":31
+ * import numpy
+ * 
+ * def LUT_to_CSR(lut):             # <<<<<<<<<<<<<<
+ *     cdef int[:,:] idx = lut.idx
+ *     cdef float[:,:] coef = lut.coef
  */
-  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11reconstruct_1reconstruct, NULL, __pyx_n_s__reconstruct); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10sparse_csr_1LUT_to_CSR, NULL, __pyx_n_s__sparse_csr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__reconstruct, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s__LUT_to_CSR, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "reconstruct.pyx":1
- * #Cython module to reconstruct the masked values of an image             # <<<<<<<<<<<<<<
- * import cython
- * import numpy
+  /* "sparse_csr.pyx":1
+ * #!/usr/bin/env python             # <<<<<<<<<<<<<<
+ * # -*- coding: utf-8 -*-
+ * #
  */
   __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
   /* "View.MemoryView":207
@@ -16634,10 +16407,10 @@ PyMODINIT_FUNC PyInit_reconstruct(void)
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   if (__pyx_m) {
-    __Pyx_AddTraceback("init reconstruct", __pyx_clineno, __pyx_lineno, __pyx_filename);
+    __Pyx_AddTraceback("init sparse_csr", __pyx_clineno, __pyx_lineno, __pyx_filename);
     Py_DECREF(__pyx_m); __pyx_m = 0;
   } else if (!PyErr_Occurred()) {
-    PyErr_SetString(PyExc_ImportError, "init reconstruct");
+    PyErr_SetString(PyExc_ImportError, "init sparse_csr");
   }
   __pyx_L0:;
   __Pyx_RefNannyFinishContext();
@@ -16664,179 +16437,113 @@ end:
     return (__Pyx_RefNannyAPIStruct *)r;
 }
 #endif /* CYTHON_REFNANNY */
-
-static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
-    PyObject *result;
-    result = PyObject_GetAttr(dict, name);
-    if (!result) {
-        if (dict != __pyx_b) {
-            PyErr_Clear();
-            result = PyObject_GetAttr(__pyx_b, name);
-        }
-        if (!result) {
-            PyErr_SetObject(PyExc_NameError, name);
-        }
-    }
-    return result;
-}
-
-static void __Pyx_RaiseDoubleKeywordsError(
-    const char* func_name,
-    PyObject* kw_name)
-{
-    PyErr_Format(PyExc_TypeError,
-        #if PY_MAJOR_VERSION >= 3
-        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
-        #else
-        "%s() got multiple values for keyword argument '%s'", func_name,
-        PyString_AsString(kw_name));
-        #endif
-}
-
-static int __Pyx_ParseOptionalKeywords(
-    PyObject *kwds,
-    PyObject **argnames[],
-    PyObject *kwds2,
-    PyObject *values[],
-    Py_ssize_t num_pos_args,
-    const char* function_name)
-{
-    PyObject *key = 0, *value = 0;
-    Py_ssize_t pos = 0;
-    PyObject*** name;
-    PyObject*** first_kw_arg = argnames + num_pos_args;
-    while (PyDict_Next(kwds, &pos, &key, &value)) {
-        name = first_kw_arg;
-        while (*name && (**name != key)) name++;
-        if (*name) {
-            values[name-argnames] = value;
-            continue;
-        }
-        name = first_kw_arg;
-        #if PY_MAJOR_VERSION < 3
-        if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
-            while (*name) {
-                if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
-                        && _PyString_Eq(**name, key)) {
-                    values[name-argnames] = value;
-                    break;
-                }
-                name++;
-            }
-            if (*name) continue;
-            else {
-                PyObject*** argname = argnames;
-                while (argname != first_kw_arg) {
-                    if ((**argname == key) || (
-                            (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
-                             && _PyString_Eq(**argname, key))) {
-                        goto arg_passed_twice;
-                    }
-                    argname++;
-                }
-            }
-        } else
-        #endif
-        if (likely(PyUnicode_Check(key))) {
-            while (*name) {
-                int cmp = (**name == key) ? 0 :
-                #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
-                    (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
-                #endif
-                    PyUnicode_Compare(**name, key);
-                if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
-                if (cmp == 0) {
-                    values[name-argnames] = value;
-                    break;
-                }
-                name++;
-            }
-            if (*name) continue;
-            else {
-                PyObject*** argname = argnames;
-                while (argname != first_kw_arg) {
-                    int cmp = (**argname == key) ? 0 :
-                    #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
-                        (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
-                    #endif
-                        PyUnicode_Compare(**argname, key);
-                    if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
-                    if (cmp == 0) goto arg_passed_twice;
-                    argname++;
-                }
-            }
-        } else
-            goto invalid_keyword_type;
-        if (kwds2) {
-            if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
-        } else {
-            goto invalid_keyword;
-        }
+
+static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
+    PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
+    if (unlikely(!result)) {
+        PyErr_Format(PyExc_NameError,
+#if PY_MAJOR_VERSION >= 3
+            "name '%U' is not defined", name);
+#else
+            "name '%s' is not defined", PyString_AS_STRING(name));
+#endif
     }
-    return 0;
-arg_passed_twice:
-    __Pyx_RaiseDoubleKeywordsError(function_name, key);
-    goto bad;
-invalid_keyword_type:
-    PyErr_Format(PyExc_TypeError,
-        "%s() keywords must be strings", function_name);
-    goto bad;
-invalid_keyword:
-    PyErr_Format(PyExc_TypeError,
-    #if PY_MAJOR_VERSION < 3
-        "%s() got an unexpected keyword argument '%s'",
-        function_name, PyString_AsString(key));
-    #else
-        "%s() got an unexpected keyword argument '%U'",
-        function_name, key);
-    #endif
-bad:
-    return -1;
+    return result;
 }
 
-static void __Pyx_RaiseArgtupleInvalid(
-    const char* func_name,
-    int exact,
-    Py_ssize_t num_min,
-    Py_ssize_t num_max,
-    Py_ssize_t num_found)
-{
-    Py_ssize_t num_expected;
-    const char *more_or_less;
-    if (num_found < num_min) {
-        num_expected = num_min;
-        more_or_less = "at least";
-    } else {
-        num_expected = num_max;
-        more_or_less = "at most";
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
+    PyObject *r;
+    if (!j) return NULL;
+    r = PyObject_GetItem(o, j);
+    Py_DECREF(j);
+    return r;
+}
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
+                                                              int wraparound, int boundscheck) {
+#if CYTHON_COMPILING_IN_CPYTHON
+    if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o);
+    if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
+        PyObject *r = PyList_GET_ITEM(o, i);
+        Py_INCREF(r);
+        return r;
     }
-    if (exact) {
-        more_or_less = "exactly";
+    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+#else
+    return PySequence_GetItem(o, i);
+#endif
+}
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
+                                                              int wraparound, int boundscheck) {
+#if CYTHON_COMPILING_IN_CPYTHON
+    if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o);
+    if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
+        PyObject *r = PyTuple_GET_ITEM(o, i);
+        Py_INCREF(r);
+        return r;
     }
-    PyErr_Format(PyExc_TypeError,
-                 "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)",
-                 func_name, more_or_less, num_expected,
-                 (num_expected == 1) ? "" : "s", num_found);
+    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+#else
+    return PySequence_GetItem(o, i);
+#endif
 }
-
-static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
-    const char *name, int exact)
-{
-    if (!type) {
-        PyErr_Format(PyExc_SystemError, "Missing type object");
-        return 0;
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
+                                                     int is_list, int wraparound, int boundscheck) {
+#if CYTHON_COMPILING_IN_CPYTHON
+    if (is_list || PyList_CheckExact(o)) {
+        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
+        if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) {
+            PyObject *r = PyList_GET_ITEM(o, n);
+            Py_INCREF(r);
+            return r;
+        }
     }
-    if (none_allowed && obj == Py_None) return 1;
-    else if (exact) {
-        if (Py_TYPE(obj) == type) return 1;
+    else if (PyTuple_CheckExact(o)) {
+        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
+        if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
+            PyObject *r = PyTuple_GET_ITEM(o, n);
+            Py_INCREF(r);
+            return r;
+        }
+    } else {
+        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
+        if (likely(m && m->sq_item)) {
+            if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
+                Py_ssize_t l = m->sq_length(o);
+                if (likely(l >= 0)) {
+                    i += l;
+                } else {
+                    if (PyErr_ExceptionMatches(PyExc_OverflowError))
+                        PyErr_Clear();
+                    else
+                        return NULL;
+                }
+            }
+            return m->sq_item(o, i);
+        }
     }
-    else {
-        if (PyObject_TypeCheck(obj, type)) return 1;
+#else
+    if (is_list || PySequence_Check(o)) {
+        return PySequence_GetItem(o, i);
     }
-    PyErr_Format(PyExc_TypeError,
-        "Argument '%s' has incorrect type (expected %s, got %s)",
-        name, type->tp_name, Py_TYPE(obj)->tp_name);
-    return 0;
+#endif
+    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+}
+
+static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
+    PyObject *result;
+#if CYTHON_COMPILING_IN_CPYTHON
+    result = PyDict_GetItem(__pyx_d, name);
+    if (result) {
+        Py_INCREF(result);
+    } else {
+#else
+    result = PyObject_GetItem(__pyx_d, name);
+    if (!result) {
+        PyErr_Clear();
+#endif
+        result = __Pyx_GetBuiltinName(name);
+    }
+    return result;
 }
 
 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
@@ -17394,197 +17101,108 @@ static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
   __Pyx_ReleaseBuffer(info);
 }
 
-static void __Pyx_RaiseBufferFallbackError(void) {
-  PyErr_Format(PyExc_ValueError,
-     "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!");
+static void __Pyx_RaiseBufferIndexError(int axis) {
+  PyErr_Format(PyExc_IndexError,
+     "Out of bounds on buffer access (axis %d)", axis);
 }
 
-static int
-__pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b)
-{
-    int i;
-    if (!a || !b)
-        return 0;
-    if (a == b)
-        return 1;
-    if (a->size != b->size || a->typegroup != b->typegroup ||
-            a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) {
-        if (a->typegroup == 'H' || b->typegroup == 'H') {
-            return a->size == b->size;
-        } else {
-            return 0;
+static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(
+        PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop,
+        PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
+        int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
+#if CYTHON_COMPILING_IN_CPYTHON
+    PyMappingMethods* mp;
+#if PY_MAJOR_VERSION < 3
+    PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
+    if (likely(ms && ms->sq_slice)) {
+        if (!has_cstart) {
+            if (_py_start && (*_py_start != Py_None)) {
+                cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
+                if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
+            } else
+                cstart = 0;
         }
-    }
-    if (a->ndim) {
-        for (i = 0; i < a->ndim; i++)
-            if (a->arraysize[i] != b->arraysize[i])
-                return 0;
-    }
-    if (a->typegroup == 'S') {
-        if (a->flags != b->flags)
-            return 0;
-        if (a->fields || b->fields) {
-            if (!(a->fields && b->fields))
-                return 0;
-            for (i = 0; a->fields[i].type && b->fields[i].type; i++) {
-                __Pyx_StructField *field_a = a->fields + i;
-                __Pyx_StructField *field_b = b->fields + i;
-                if (field_a->offset != field_b->offset ||
-                    !__pyx_typeinfo_cmp(field_a->type, field_b->type))
-                    return 0;
-            }
-            return !a->fields[i].type && !b->fields[i].type;
+        if (!has_cstop) {
+            if (_py_stop && (*_py_stop != Py_None)) {
+                cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
+                if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
+            } else
+                cstop = PY_SSIZE_T_MAX;
         }
-    }
-    return 1;
-}
-
-static int __Pyx_ValidateAndInit_memviewslice(
-                int *axes_specs,
-                int c_or_f_flag,
-                int buf_flags,
-                int ndim,
-                __Pyx_TypeInfo *dtype,
-                __Pyx_BufFmt_StackElem stack[],
-                __Pyx_memviewslice *memviewslice,
-                PyObject *original_obj)
-{
-    struct __pyx_memoryview_obj *memview, *new_memview;
-    __Pyx_RefNannyDeclarations
-    Py_buffer *buf;
-    int i, spec = 0, retval = -1;
-    __Pyx_BufFmt_Context ctx;
-    int from_memoryview = __pyx_memoryview_check(original_obj);
-    __Pyx_RefNannySetupContext("ValidateAndInit_memviewslice", 0);
-    if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((struct __pyx_memoryview_obj *)
-                                                            original_obj)->typeinfo)) {
-        memview = (struct __pyx_memoryview_obj *) original_obj;
-        new_memview = NULL;
-    } else {
-        memview = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
-                                            original_obj, buf_flags, 0, dtype);
-        new_memview = memview;
-        if (unlikely(!memview))
-            goto fail;
-    }
-    buf = &memview->view;
-    if (buf->ndim != ndim) {
-        PyErr_Format(PyExc_ValueError,
-                "Buffer has wrong number of dimensions (expected %d, got %d)",
-                ndim, buf->ndim);
-        goto fail;
-    }
-    if (new_memview) {
-        __Pyx_BufFmt_Init(&ctx, stack, dtype);
-        if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
-    }
-    if ((unsigned)buf->itemsize != dtype->size) {
-        PyErr_Format(PyExc_ValueError,
-                     "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "u byte%s) "
-                     "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "u byte%s)",
-                     buf->itemsize,
-                     (buf->itemsize > 1) ? "s" : "",
-                     dtype->name,
-                     dtype->size,
-                     (dtype->size > 1) ? "s" : "");
-        goto fail;
-    }
-    for (i = 0; i < ndim; i++) {
-        spec = axes_specs[i];
-        if (buf->strides) {
-            if (spec & __Pyx_MEMVIEW_CONTIG) {
-                if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) {
-                    if (buf->strides[i] != sizeof(void *)) {
-                        PyErr_Format(PyExc_ValueError,
-                            "Buffer is not indirectly contiguous in dimension %d.", i);
-                        goto fail;
-                    }
-                } else if (buf->strides[i] != buf->itemsize) {
-                    PyErr_SetString(PyExc_ValueError,
-                        "Buffer and memoryview are not contiguous in the same dimension.");
-                    goto fail;
+        if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
+            Py_ssize_t l = ms->sq_length(obj);
+            if (likely(l >= 0)) {
+                if (cstop < 0) {
+                    cstop += l;
+                    if (cstop < 0) cstop = 0;
                 }
-            }
-            if (spec & __Pyx_MEMVIEW_FOLLOW) {
-                Py_ssize_t stride = buf->strides[i];
-                if (stride < 0)
-                    stride = -stride;
-                if (stride < buf->itemsize) {
-                    PyErr_SetString(PyExc_ValueError,
-                        "Buffer and memoryview are not contiguous in the same dimension.");
-                    goto fail;
+                if (cstart < 0) {
+                    cstart += l;
+                    if (cstart < 0) cstart = 0;
                 }
-            }
-        } else {
-            if (spec & __Pyx_MEMVIEW_CONTIG && i != ndim - 1) {
-                PyErr_Format(PyExc_ValueError,
-                             "C-contiguous buffer is not contiguous in "
-                             "dimension %d", i);
-                goto fail;
-            } else if (spec & (__Pyx_MEMVIEW_PTR)) {
-                PyErr_Format(PyExc_ValueError,
-                             "C-contiguous buffer is not indirect in "
-                             "dimension %d", i);
-                goto fail;
-            } else if (buf->suboffsets) {
-                PyErr_SetString(PyExc_ValueError,
-                                "Buffer exposes suboffsets but no strides");
-                goto fail;
-            }
-        }
-        /* Todo: without PyBUF_INDIRECT we may not have suboffset information, i.e., the
-           ptr may not be set to NULL but may be uninitialized? */
-        if (spec & __Pyx_MEMVIEW_DIRECT) {
-            if (buf->suboffsets && buf->suboffsets[i] >= 0) {
-                PyErr_Format(PyExc_ValueError,
-                    "Buffer not compatible with direct access in dimension %d.", i);
-                goto fail;
-            }
-        }
-        if (spec & __Pyx_MEMVIEW_PTR) {
-            if (!buf->suboffsets || (buf->suboffsets && buf->suboffsets[i] < 0)) {
-                PyErr_Format(PyExc_ValueError,
-                    "Buffer is not indirectly accessisble in dimension %d.", i);
-                goto fail;
+            } else {
+                if (PyErr_ExceptionMatches(PyExc_OverflowError))
+                    PyErr_Clear();
+                else
+                    goto bad;
             }
         }
+        return ms->sq_slice(obj, cstart, cstop);
     }
-    if (buf->strides) {
-        if (c_or_f_flag & __Pyx_IS_F_CONTIG) {
-            Py_ssize_t stride = 1;
-            for (i=0; i<ndim; i++) {
-                if (stride * buf->itemsize != buf->strides[i]) {
-                    PyErr_SetString(PyExc_ValueError,
-                        "Buffer not fortran contiguous.");
-                    goto fail;
-                }
-                stride = stride * buf->shape[i];
+#endif
+    mp = Py_TYPE(obj)->tp_as_mapping;
+    if (likely(mp && mp->mp_subscript))
+#endif
+    {
+        PyObject* result;
+        PyObject *py_slice, *py_start, *py_stop;
+        if (_py_slice) {
+            py_slice = *_py_slice;
+        } else {
+            PyObject* owned_start = NULL;
+            PyObject* owned_stop = NULL;
+            if (_py_start) {
+                py_start = *_py_start;
+            } else {
+                if (has_cstart) {
+                    owned_start = py_start = PyInt_FromSsize_t(cstart);
+                    if (unlikely(!py_start)) goto bad;
+                } else
+                    py_start = Py_None;
             }
-        } else if (c_or_f_flag & __Pyx_IS_C_CONTIG) {
-            Py_ssize_t stride = 1;
-            for (i = ndim-1; i>-1; i--) {
-                if(stride * buf->itemsize != buf->strides[i]) {
-                    PyErr_SetString(PyExc_ValueError,
-                        "Buffer not C contiguous.");
-                    goto fail;
-                }
-                stride = stride * buf->shape[i];
+            if (_py_stop) {
+                py_stop = *_py_stop;
+            } else {
+                if (has_cstop) {
+                    owned_stop = py_stop = PyInt_FromSsize_t(cstop);
+                    if (unlikely(!py_stop)) {
+                        Py_XDECREF(owned_start);
+                        goto bad;
+                    }
+                } else
+                    py_stop = Py_None;
             }
+            py_slice = PySlice_New(py_start, py_stop, Py_None);
+            Py_XDECREF(owned_start);
+            Py_XDECREF(owned_stop);
+            if (unlikely(!py_slice)) goto bad;
         }
-    }
-    if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice,
-                                         new_memview != NULL) == -1)) {
-        goto fail;
-    }
-    retval = 0;
-    goto no_fail;
-fail:
-    Py_XDECREF(new_memview);
-    retval = -1;
-no_fail:
-    __Pyx_RefNannyFinishContext();
-    return retval;
+#if CYTHON_COMPILING_IN_CPYTHON
+        result = mp->mp_subscript(obj, py_slice);
+#else
+        result = PyObject_GetItem(obj, py_slice);
+#endif
+        if (!_py_slice) {
+            Py_DECREF(py_slice);
+        }
+        return result;
+    }
+    PyErr_Format(PyExc_TypeError,
+        "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name);
+bad:
+    return NULL;
 }
+
 static int
 __Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview,
                         int ndim,
@@ -17789,24 +17407,23 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
         }
         value = type;
         #if PY_VERSION_HEX < 0x02050000
-            if (PyInstance_Check(type)) {
-                type = (PyObject*) ((PyInstanceObject*)type)->in_class;
-                Py_INCREF(type);
-            }
-            else {
-                type = 0;
-                PyErr_SetString(PyExc_TypeError,
-                    "raise: exception must be an old-style class or instance");
-                goto raise_error;
-            }
-        #else
-            type = (PyObject*) Py_TYPE(type);
+        if (PyInstance_Check(type)) {
+            type = (PyObject*) ((PyInstanceObject*)type)->in_class;
             Py_INCREF(type);
-            if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
-                PyErr_SetString(PyExc_TypeError,
-                    "raise: exception class must be a subclass of BaseException");
-                goto raise_error;
-            }
+        } else {
+            type = 0;
+            PyErr_SetString(PyExc_TypeError,
+                "raise: exception must be an old-style class or instance");
+            goto raise_error;
+        }
+        #else
+        type = (PyObject*) Py_TYPE(type);
+        Py_INCREF(type);
+        if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
+            PyErr_SetString(PyExc_TypeError,
+                "raise: exception class must be a subclass of BaseException");
+            goto raise_error;
+        }
         #endif
     }
     __Pyx_ErrRestore(type, value, tb);
@@ -17844,8 +17461,7 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject
         else if (PyTuple_Check(value)) {
             Py_INCREF(value);
             args = value;
-        }
-        else
+        } else
             args = PyTuple_Pack(1, value);
         if (!args)
             goto bad;
@@ -17866,18 +17482,22 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject
             "raise: exception class must be a subclass of BaseException");
         goto bad;
     }
+#if PY_VERSION_HEX >= 0x03030000
+    if (cause) {
+#else
     if (cause && cause != Py_None) {
+#endif
         PyObject *fixed_cause;
-        if (PyExceptionClass_Check(cause)) {
+        if (cause == Py_None) {
+            fixed_cause = NULL;
+        } else if (PyExceptionClass_Check(cause)) {
             fixed_cause = PyObject_CallObject(cause, NULL);
             if (fixed_cause == NULL)
                 goto bad;
-        }
-        else if (PyExceptionInstance_Check(cause)) {
+        } else if (PyExceptionInstance_Check(cause)) {
             fixed_cause = cause;
             Py_INCREF(fixed_cause);
-        }
-        else {
+        } else {
             PyErr_SetString(PyExc_TypeError,
                             "exception causes must derive from "
                             "BaseException");
@@ -17961,8 +17581,179 @@ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
     return 0;
 }
 
+static void __Pyx_RaiseArgtupleInvalid(
+    const char* func_name,
+    int exact,
+    Py_ssize_t num_min,
+    Py_ssize_t num_max,
+    Py_ssize_t num_found)
+{
+    Py_ssize_t num_expected;
+    const char *more_or_less;
+    if (num_found < num_min) {
+        num_expected = num_min;
+        more_or_less = "at least";
+    } else {
+        num_expected = num_max;
+        more_or_less = "at most";
+    }
+    if (exact) {
+        more_or_less = "exactly";
+    }
+    PyErr_Format(PyExc_TypeError,
+                 "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)",
+                 func_name, more_or_less, num_expected,
+                 (num_expected == 1) ? "" : "s", num_found);
+}
+
+static void __Pyx_RaiseDoubleKeywordsError(
+    const char* func_name,
+    PyObject* kw_name)
+{
+    PyErr_Format(PyExc_TypeError,
+        #if PY_MAJOR_VERSION >= 3
+        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
+        #else
+        "%s() got multiple values for keyword argument '%s'", func_name,
+        PyString_AsString(kw_name));
+        #endif
+}
+
+static int __Pyx_ParseOptionalKeywords(
+    PyObject *kwds,
+    PyObject **argnames[],
+    PyObject *kwds2,
+    PyObject *values[],
+    Py_ssize_t num_pos_args,
+    const char* function_name)
+{
+    PyObject *key = 0, *value = 0;
+    Py_ssize_t pos = 0;
+    PyObject*** name;
+    PyObject*** first_kw_arg = argnames + num_pos_args;
+    while (PyDict_Next(kwds, &pos, &key, &value)) {
+        name = first_kw_arg;
+        while (*name && (**name != key)) name++;
+        if (*name) {
+            values[name-argnames] = value;
+            continue;
+        }
+        name = first_kw_arg;
+        #if PY_MAJOR_VERSION < 3
+        if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
+            while (*name) {
+                if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
+                        && _PyString_Eq(**name, key)) {
+                    values[name-argnames] = value;
+                    break;
+                }
+                name++;
+            }
+            if (*name) continue;
+            else {
+                PyObject*** argname = argnames;
+                while (argname != first_kw_arg) {
+                    if ((**argname == key) || (
+                            (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
+                             && _PyString_Eq(**argname, key))) {
+                        goto arg_passed_twice;
+                    }
+                    argname++;
+                }
+            }
+        } else
+        #endif
+        if (likely(PyUnicode_Check(key))) {
+            while (*name) {
+                int cmp = (**name == key) ? 0 :
+                #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
+                    (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
+                #endif
+                    PyUnicode_Compare(**name, key);
+                if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
+                if (cmp == 0) {
+                    values[name-argnames] = value;
+                    break;
+                }
+                name++;
+            }
+            if (*name) continue;
+            else {
+                PyObject*** argname = argnames;
+                while (argname != first_kw_arg) {
+                    int cmp = (**argname == key) ? 0 :
+                    #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
+                        (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
+                    #endif
+                        PyUnicode_Compare(**argname, key);
+                    if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
+                    if (cmp == 0) goto arg_passed_twice;
+                    argname++;
+                }
+            }
+        } else
+            goto invalid_keyword_type;
+        if (kwds2) {
+            if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
+        } else {
+            goto invalid_keyword;
+        }
+    }
+    return 0;
+arg_passed_twice:
+    __Pyx_RaiseDoubleKeywordsError(function_name, key);
+    goto bad;
+invalid_keyword_type:
+    PyErr_Format(PyExc_TypeError,
+        "%s() keywords must be strings", function_name);
+    goto bad;
+invalid_keyword:
+    PyErr_Format(PyExc_TypeError,
+    #if PY_MAJOR_VERSION < 3
+        "%s() got an unexpected keyword argument '%s'",
+        function_name, PyString_AsString(key));
+    #else
+        "%s() got an unexpected keyword argument '%U'",
+        function_name, key);
+    #endif
+bad:
+    return -1;
+}
+
+static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
+    const char *name, int exact)
+{
+    if (!type) {
+        PyErr_Format(PyExc_SystemError, "Missing type object");
+        return 0;
+    }
+    if (none_allowed && obj == Py_None) return 1;
+    else if (exact) {
+        if (Py_TYPE(obj) == type) return 1;
+    }
+    else {
+        if (PyObject_TypeCheck(obj, type)) return 1;
+    }
+    PyErr_Format(PyExc_TypeError,
+        "Argument '%s' has incorrect type (expected %s, got %s)",
+        name, type->tp_name, Py_TYPE(obj)->tp_name);
+    return 0;
+}
+
+static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
+#if CYTHON_COMPILING_IN_CPYTHON
+#if PY_MAJOR_VERSION >= 3
+    if (likely(PyUnicode_Check(n)))
+#else
+    if (likely(PyString_Check(n)))
+#endif
+        return __Pyx_PyObject_GetAttrStr(o, n);
+#endif
+    return PyObject_GetAttr(o, n);
+}
+
 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
-    PyObject *r = PyObject_GetAttr(o, n);
+    PyObject *r = __Pyx_GetAttr(o, n);
     if (!r) {
         if (!PyErr_ExceptionMatches(PyExc_AttributeError))
             goto bad;
@@ -18124,7 +17915,6 @@ static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
 
 #if PY_MAJOR_VERSION < 3
 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
-    CYTHON_UNUSED PyObject *getbuffer_cobj;
   #if PY_VERSION_HEX >= 0x02060000
     if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
   #endif
@@ -18132,21 +17922,18 @@ static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
         if (PyObject_TypeCheck(obj, __pyx_array_type)) return __pyx_array_getbuffer(obj, view, flags);
         if (PyObject_TypeCheck(obj, __pyx_memoryview_type)) return __pyx_memoryview_getbuffer(obj, view, flags);
   #if PY_VERSION_HEX < 0x02060000
-    if (obj->ob_type->tp_dict &&
-        (getbuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict,
-                                             "__pyx_getbuffer"))) {
-        getbufferproc func;
-      #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0)
-        func = (getbufferproc) PyCapsule_GetPointer(getbuffer_cobj, "getbuffer(obj, view, flags)");
-      #else
-        func = (getbufferproc) PyCObject_AsVoidPtr(getbuffer_cobj);
-      #endif
-        Py_DECREF(getbuffer_cobj);
-        if (!func)
-            goto fail;
-        return func(obj, view, flags);
-    } else {
-        PyErr_Clear();
+    if (obj->ob_type->tp_dict) {
+        PyObject *getbuffer_cobj = PyObject_GetItem(
+            obj->ob_type->tp_dict, __pyx_n_s____pyx_getbuffer);
+        if (getbuffer_cobj) {
+            getbufferproc func = (getbufferproc) PyCObject_AsVoidPtr(getbuffer_cobj);
+            Py_DECREF(getbuffer_cobj);
+            if (!func)
+                goto fail;
+            return func(obj, view, flags);
+        } else {
+            PyErr_Clear();
+        }
     }
   #endif
     PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
@@ -18157,7 +17944,6 @@ fail:
 }
 static void __Pyx_ReleaseBuffer(Py_buffer *view) {
     PyObject *obj = view->obj;
-    CYTHON_UNUSED PyObject *releasebuffer_cobj;
     if (!obj) return;
   #if PY_VERSION_HEX >= 0x02060000
     if (PyObject_CheckBuffer(obj)) {
@@ -18167,22 +17953,19 @@ static void __Pyx_ReleaseBuffer(Py_buffer *view) {
   #endif
         if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) { __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view); return; }
   #if PY_VERSION_HEX < 0x02060000
-    if (obj->ob_type->tp_dict &&
-        (releasebuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict,
-                                                      "__pyx_releasebuffer"))) {
-        releasebufferproc func;
-      #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0)
-        func = (releasebufferproc) PyCapsule_GetPointer(releasebuffer_cobj, "releasebuffer(obj, view)");
-      #else
-        func = (releasebufferproc) PyCObject_AsVoidPtr(releasebuffer_cobj);
-      #endif
-        Py_DECREF(releasebuffer_cobj);
-        if (!func)
-            goto fail;
-        func(obj, view);
-        return;
-    } else {
-        PyErr_Clear();
+    if (obj->ob_type->tp_dict) {
+        PyObject *releasebuffer_cobj = PyObject_GetItem(
+            obj->ob_type->tp_dict, __pyx_n_s____pyx_releasebuffer);
+        if (releasebuffer_cobj) {
+            releasebufferproc func = (releasebufferproc) PyCObject_AsVoidPtr(releasebuffer_cobj);
+            Py_DECREF(releasebuffer_cobj);
+            if (!func)
+                goto fail;
+            func(obj, view);
+            return;
+        } else {
+            PyErr_Clear();
+        }
     }
   #endif
     goto nofail;
@@ -18197,16 +17980,18 @@ nofail:
 #endif /*  PY_MAJOR_VERSION < 3 */
 
 
-      static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) {
-    PyObject *py_import = 0;
+          static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
     PyObject *empty_list = 0;
     PyObject *module = 0;
     PyObject *global_dict = 0;
     PyObject *empty_dict = 0;
     PyObject *list;
-    py_import = __Pyx_GetAttrString(__pyx_b, "__import__");
+    #if PY_VERSION_HEX < 0x03030000
+    PyObject *py_import;
+    py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s____import__);
     if (!py_import)
         goto bad;
+    #endif
     if (from_list)
         list = from_list;
     else {
@@ -18226,13 +18011,17 @@ nofail:
         #if PY_MAJOR_VERSION >= 3
         if (level == -1) {
             if (strchr(__Pyx_MODULE_NAME, '.')) {
-                /* try package relative import first */
+                #if PY_VERSION_HEX < 0x03030000
                 PyObject *py_level = PyInt_FromLong(1);
                 if (!py_level)
                     goto bad;
                 module = PyObject_CallFunctionObjArgs(py_import,
                     name, global_dict, empty_dict, list, py_level, NULL);
                 Py_DECREF(py_level);
+                #else
+                module = PyImport_ImportModuleLevelObject(
+                    name, global_dict, empty_dict, list, 1);
+                #endif
                 if (!module) {
                     if (!PyErr_ExceptionMatches(PyExc_ImportError))
                         goto bad;
@@ -18243,12 +18032,17 @@ nofail:
         }
         #endif
         if (!module) {
+            #if PY_VERSION_HEX < 0x03030000
             PyObject *py_level = PyInt_FromLong(level);
             if (!py_level)
                 goto bad;
             module = PyObject_CallFunctionObjArgs(py_import,
                 name, global_dict, empty_dict, list, py_level, NULL);
             Py_DECREF(py_level);
+            #else
+            module = PyImport_ImportModuleLevelObject(
+                name, global_dict, empty_dict, list, level);
+            #endif
         }
     }
     #else
@@ -18260,32 +18054,94 @@ nofail:
         name, global_dict, empty_dict, list, NULL);
     #endif
 bad:
-    Py_XDECREF(empty_list);
+    #if PY_VERSION_HEX < 0x03030000
     Py_XDECREF(py_import);
+    #endif
+    Py_XDECREF(empty_list);
     Py_XDECREF(empty_dict);
     return module;
 }
 
-static CYTHON_INLINE size_t __Pyx_pow_size_t(size_t b, size_t e) {
-    size_t t = b;
-    switch (e) {
-        case 3:
-            t *= b;
-        case 2:
-            t *= b;
-        case 1:
-            return t;
-        case 0:
-            return 1;
+static CYTHON_INLINE npy_uint32 __Pyx_PyInt_from_py_npy_uint32(PyObject* x) {
+    const npy_uint32 neg_one = (npy_uint32)-1, const_zero = (npy_uint32)0;
+    const int is_unsigned = const_zero < neg_one;
+    if (sizeof(npy_uint32) == sizeof(char)) {
+        if (is_unsigned)
+            return (npy_uint32)__Pyx_PyInt_AsUnsignedChar(x);
+        else
+            return (npy_uint32)__Pyx_PyInt_AsSignedChar(x);
+    } else if (sizeof(npy_uint32) == sizeof(short)) {
+        if (is_unsigned)
+            return (npy_uint32)__Pyx_PyInt_AsUnsignedShort(x);
+        else
+            return (npy_uint32)__Pyx_PyInt_AsSignedShort(x);
+    } else if (sizeof(npy_uint32) == sizeof(int)) {
+        if (is_unsigned)
+            return (npy_uint32)__Pyx_PyInt_AsUnsignedInt(x);
+        else
+            return (npy_uint32)__Pyx_PyInt_AsSignedInt(x);
+    } else if (sizeof(npy_uint32) == sizeof(long)) {
+        if (is_unsigned)
+            return (npy_uint32)__Pyx_PyInt_AsUnsignedLong(x);
+        else
+            return (npy_uint32)__Pyx_PyInt_AsSignedLong(x);
+    } else if (sizeof(npy_uint32) == sizeof(PY_LONG_LONG)) {
+        if (is_unsigned)
+            return (npy_uint32)__Pyx_PyInt_AsUnsignedLongLong(x);
+        else
+            return (npy_uint32)__Pyx_PyInt_AsSignedLongLong(x);
+    }  else {
+        #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
+        PyErr_SetString(PyExc_RuntimeError,
+                        "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
+        #else
+        npy_uint32 val;
+        PyObject *v = __Pyx_PyNumber_Int(x);
+        #if PY_MAJOR_VERSION < 3
+        if (likely(v) && !PyLong_Check(v)) {
+            PyObject *tmp = v;
+            v = PyNumber_Long(tmp);
+            Py_DECREF(tmp);
+        }
+        #endif
+        if (likely(v)) {
+            int one = 1; int is_little = (int)*(unsigned char *)&one;
+            unsigned char *bytes = (unsigned char *)&val;
+            int ret = _PyLong_AsByteArray((PyLongObject *)v,
+                                          bytes, sizeof(val),
+                                          is_little, !is_unsigned);
+            Py_DECREF(v);
+            if (likely(!ret))
+                return val;
+        }
+        #endif
+        return (npy_uint32)-1;
     }
-    if (unlikely(e<0)) return 0;
-    t = 1;
-    while (likely(e)) {
-        t *= (b * (e&1)) | ((~e)&1);    /* 1 or b */
-        b *= b;
-        e >>= 1;
+}
+
+static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_uint32(npy_uint32 val) {
+    const npy_uint32 neg_one = (npy_uint32)-1, const_zero = (npy_uint32)0;
+    const int is_unsigned = const_zero < neg_one;
+    if ((sizeof(npy_uint32) == sizeof(char))  ||
+        (sizeof(npy_uint32) == sizeof(short))) {
+        return PyInt_FromLong((long)val);
+    } else if ((sizeof(npy_uint32) == sizeof(int)) ||
+               (sizeof(npy_uint32) == sizeof(long))) {
+        if (is_unsigned)
+            return PyLong_FromUnsignedLong((unsigned long)val);
+        else
+            return PyInt_FromLong((long)val);
+    } else if (sizeof(npy_uint32) == sizeof(PY_LONG_LONG)) {
+        if (is_unsigned)
+            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val);
+        else
+            return PyLong_FromLongLong((PY_LONG_LONG)val);
+    } else {
+        int one = 1; int little = (int)*(unsigned char *)&one;
+        unsigned char *bytes = (unsigned char *)&val;
+        return _PyLong_FromByteArray(bytes, sizeof(npy_uint32),
+                                     little, !is_unsigned);
     }
-    return t;
 }
 
 #if CYTHON_CCOMPLEX
@@ -18652,7 +18508,7 @@ no_fail:
 }
 
 static CYTHON_INLINE PyObject *
-__pyx_capsule_create(void *p, const char *sig)
+__pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig)
 {
     PyObject *cobj;
 #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0)
@@ -18884,10 +18740,15 @@ static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) {
     return (int)__Pyx_PyInt_AsLong(x);
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
     const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -18900,6 +18761,16 @@ static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(unsigned long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (unsigned long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to unsigned long");
@@ -18907,6 +18778,17 @@ static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
             }
             return (unsigned long)PyLong_AsUnsignedLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(unsigned long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(unsigned long) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(unsigned long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (unsigned long)PyLong_AsLong(x);
         }
     } else {
@@ -18919,10 +18801,15 @@ static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
     }
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
     const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -18935,6 +18822,16 @@ static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObje
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to unsigned PY_LONG_LONG");
@@ -18942,6 +18839,17 @@ static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObje
             }
             return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x);
         }
     } else {
@@ -18954,10 +18862,15 @@ static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObje
     }
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
     const long neg_one = (long)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -18970,6 +18883,16 @@ static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to long");
@@ -18977,6 +18900,17 @@ static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
             }
             return (long)PyLong_AsUnsignedLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(long) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (long)PyLong_AsLong(x);
         }
     } else {
@@ -18989,10 +18923,15 @@ static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
     }
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
     const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -19005,6 +18944,16 @@ static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to PY_LONG_LONG");
@@ -19012,6 +18961,17 @@ static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
             }
             return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (PY_LONG_LONG)PyLong_AsLongLong(x);
         }
     } else {
@@ -19024,10 +18984,15 @@ static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
     }
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
     const signed long neg_one = (signed long)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -19040,6 +19005,16 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(signed long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (signed long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to signed long");
@@ -19047,6 +19022,17 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
             }
             return (signed long)PyLong_AsUnsignedLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(signed long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(signed long) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(signed long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (signed long)PyLong_AsLong(x);
         }
     } else {
@@ -19059,10 +19045,15 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
     }
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
     const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -19075,6 +19066,16 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject*
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to signed PY_LONG_LONG");
@@ -19082,6 +19083,17 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject*
             }
             return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (signed PY_LONG_LONG)PyLong_AsLongLong(x);
         }
     } else {
@@ -19094,7 +19106,228 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject*
     }
 }
 
-static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_float(PyObject *obj) {
+static int
+__pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b)
+{
+    int i;
+    if (!a || !b)
+        return 0;
+    if (a == b)
+        return 1;
+    if (a->size != b->size || a->typegroup != b->typegroup ||
+            a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) {
+        if (a->typegroup == 'H' || b->typegroup == 'H') {
+            return a->size == b->size;
+        } else {
+            return 0;
+        }
+    }
+    if (a->ndim) {
+        for (i = 0; i < a->ndim; i++)
+            if (a->arraysize[i] != b->arraysize[i])
+                return 0;
+    }
+    if (a->typegroup == 'S') {
+        if (a->flags != b->flags)
+            return 0;
+        if (a->fields || b->fields) {
+            if (!(a->fields && b->fields))
+                return 0;
+            for (i = 0; a->fields[i].type && b->fields[i].type; i++) {
+                __Pyx_StructField *field_a = a->fields + i;
+                __Pyx_StructField *field_b = b->fields + i;
+                if (field_a->offset != field_b->offset ||
+                    !__pyx_typeinfo_cmp(field_a->type, field_b->type))
+                    return 0;
+            }
+            return !a->fields[i].type && !b->fields[i].type;
+        }
+    }
+    return 1;
+}
+
+static int
+__pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec)
+{
+    if (buf->shape[dim] <= 1)
+        return 1;
+    if (buf->strides) {
+        if (spec & __Pyx_MEMVIEW_CONTIG) {
+            if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) {
+                if (buf->strides[dim] != sizeof(void *)) {
+                    PyErr_Format(PyExc_ValueError,
+                                 "Buffer is not indirectly contiguous "
+                                 "in dimension %d.", dim);
+                    goto fail;
+                }
+            } else if (buf->strides[dim] != buf->itemsize) {
+                PyErr_SetString(PyExc_ValueError,
+                                "Buffer and memoryview are not contiguous "
+                                "in the same dimension.");
+                goto fail;
+            }
+        }
+        if (spec & __Pyx_MEMVIEW_FOLLOW) {
+            Py_ssize_t stride = buf->strides[dim];
+            if (stride < 0)
+                stride = -stride;
+            if (stride < buf->itemsize) {
+                PyErr_SetString(PyExc_ValueError,
+                                "Buffer and memoryview are not contiguous "
+                                "in the same dimension.");
+                goto fail;
+            }
+        }
+    } else {
+        if (spec & __Pyx_MEMVIEW_CONTIG && dim != ndim - 1) {
+            PyErr_Format(PyExc_ValueError,
+                         "C-contiguous buffer is not contiguous in "
+                         "dimension %d", dim);
+            goto fail;
+        } else if (spec & (__Pyx_MEMVIEW_PTR)) {
+            PyErr_Format(PyExc_ValueError,
+                         "C-contiguous buffer is not indirect in "
+                         "dimension %d", dim);
+            goto fail;
+        } else if (buf->suboffsets) {
+            PyErr_SetString(PyExc_ValueError,
+                            "Buffer exposes suboffsets but no strides");
+            goto fail;
+        }
+    }
+    return 1;
+fail:
+    return 0;
+}
+static int
+__pyx_check_suboffsets(Py_buffer *buf, int dim, CYTHON_UNUSED int ndim, int spec)
+{
+    if (spec & __Pyx_MEMVIEW_DIRECT) {
+        if (buf->suboffsets && buf->suboffsets[dim] >= 0) {
+            PyErr_Format(PyExc_ValueError,
+                         "Buffer not compatible with direct access "
+                         "in dimension %d.", dim);
+            goto fail;
+        }
+    }
+    if (spec & __Pyx_MEMVIEW_PTR) {
+        if (!buf->suboffsets || (buf->suboffsets && buf->suboffsets[dim] < 0)) {
+            PyErr_Format(PyExc_ValueError,
+                         "Buffer is not indirectly accessisble "
+                         "in dimension %d.", dim);
+            goto fail;
+        }
+    }
+    return 1;
+fail:
+    return 0;
+}
+static int
+__pyx_verify_contig(Py_buffer *buf, int ndim, int c_or_f_flag)
+{
+    int i;
+    if (c_or_f_flag & __Pyx_IS_F_CONTIG) {
+        Py_ssize_t stride = 1;
+        for (i = 0; i < ndim; i++) {
+            if (stride * buf->itemsize != buf->strides[i] &&
+                    buf->shape[i] > 1)
+            {
+                PyErr_SetString(PyExc_ValueError,
+                    "Buffer not fortran contiguous.");
+                goto fail;
+            }
+            stride = stride * buf->shape[i];
+        }
+    } else if (c_or_f_flag & __Pyx_IS_C_CONTIG) {
+        Py_ssize_t stride = 1;
+        for (i = ndim - 1; i >- 1; i--) {
+            if (stride * buf->itemsize != buf->strides[i] &&
+                    buf->shape[i] > 1) {
+                PyErr_SetString(PyExc_ValueError,
+                    "Buffer not C contiguous.");
+                goto fail;
+            }
+            stride = stride * buf->shape[i];
+        }
+    }
+    return 1;
+fail:
+    return 0;
+}
+static int __Pyx_ValidateAndInit_memviewslice(
+                int *axes_specs,
+                int c_or_f_flag,
+                int buf_flags,
+                int ndim,
+                __Pyx_TypeInfo *dtype,
+                __Pyx_BufFmt_StackElem stack[],
+                __Pyx_memviewslice *memviewslice,
+                PyObject *original_obj)
+{
+    struct __pyx_memoryview_obj *memview, *new_memview;
+    __Pyx_RefNannyDeclarations
+    Py_buffer *buf;
+    int i, spec = 0, retval = -1;
+    __Pyx_BufFmt_Context ctx;
+    int from_memoryview = __pyx_memoryview_check(original_obj);
+    __Pyx_RefNannySetupContext("ValidateAndInit_memviewslice", 0);
+    if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((struct __pyx_memoryview_obj *)
+                                                            original_obj)->typeinfo)) {
+        memview = (struct __pyx_memoryview_obj *) original_obj;
+        new_memview = NULL;
+    } else {
+        memview = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
+                                            original_obj, buf_flags, 0, dtype);
+        new_memview = memview;
+        if (unlikely(!memview))
+            goto fail;
+    }
+    buf = &memview->view;
+    if (buf->ndim != ndim) {
+        PyErr_Format(PyExc_ValueError,
+                "Buffer has wrong number of dimensions (expected %d, got %d)",
+                ndim, buf->ndim);
+        goto fail;
+    }
+    if (new_memview) {
+        __Pyx_BufFmt_Init(&ctx, stack, dtype);
+        if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
+    }
+    if ((unsigned) buf->itemsize != dtype->size) {
+        PyErr_Format(PyExc_ValueError,
+                     "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "u byte%s) "
+                     "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "u byte%s)",
+                     buf->itemsize,
+                     (buf->itemsize > 1) ? "s" : "",
+                     dtype->name,
+                     dtype->size,
+                     (dtype->size > 1) ? "s" : "");
+        goto fail;
+    }
+    for (i = 0; i < ndim; i++) {
+        spec = axes_specs[i];
+        if (!__pyx_check_strides(buf, i, ndim, spec))
+            goto fail;
+        if (!__pyx_check_suboffsets(buf, i, ndim, spec))
+            goto fail;
+    }
+    if (buf->strides && !__pyx_verify_contig(buf, ndim, c_or_f_flag))
+        goto fail;
+    if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice,
+                                         new_memview != NULL) == -1)) {
+        goto fail;
+    }
+    retval = 0;
+    goto no_fail;
+fail:
+    Py_XDECREF(new_memview);
+    retval = -1;
+no_fail:
+    __Pyx_RefNannyFinishContext();
+    return retval;
+}
+
+static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_int(PyObject *obj) {
     __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
     __Pyx_BufFmt_StackElem stack[1];
     int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
@@ -19105,7 +19338,7 @@ static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_f
     }
     retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
                                                  PyBUF_RECORDS, 2,
-                                                 &__Pyx_TypeInfo_float, stack,
+                                                 &__Pyx_TypeInfo_int, stack,
                                                  &result, obj);
     if (unlikely(retcode == -1))
         goto __pyx_fail;
@@ -19116,7 +19349,7 @@ __pyx_fail:
     return result;
 }
 
-static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_int(PyObject *obj) {
+static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_float(PyObject *obj) {
     __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
     __Pyx_BufFmt_StackElem stack[1];
     int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
@@ -19127,7 +19360,7 @@ static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_i
     }
     retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
                                                  PyBUF_RECORDS, 2,
-                                                 &__Pyx_TypeInfo_int, stack,
+                                                 &__Pyx_TypeInfo_float, stack,
                                                  &result, obj);
     if (unlikely(retcode == -1))
         goto __pyx_fail;
@@ -19219,6 +19452,10 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class
     PyObject *result = 0;
     PyObject *py_name = 0;
     char warning[200];
+    Py_ssize_t basicsize;
+#ifdef Py_LIMITED_API
+    PyObject *py_basicsize;
+#endif
     py_module = __Pyx_ImportModule(module_name);
     if (!py_module)
         goto bad;
@@ -19238,7 +19475,19 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class
             module_name, class_name);
         goto bad;
     }
-    if (!strict && (size_t)((PyTypeObject *)result)->tp_basicsize > size) {
+#ifndef Py_LIMITED_API
+    basicsize = ((PyTypeObject *)result)->tp_basicsize;
+#else
+    py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
+    if (!py_basicsize)
+        goto bad;
+    basicsize = PyLong_AsSsize_t(py_basicsize);
+    Py_DECREF(py_basicsize);
+    py_basicsize = 0;
+    if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
+        goto bad;
+#endif
+    if (!strict && (size_t)basicsize > size) {
         PyOS_snprintf(warning, sizeof(warning),
             "%s.%s size changed, may indicate binary incompatibility",
             module_name, class_name);
@@ -19248,7 +19497,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class
         if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
         #endif
     }
-    else if ((size_t)((PyTypeObject *)result)->tp_basicsize != size) {
+    else if ((size_t)basicsize != size) {
         PyErr_Format(PyExc_ValueError,
             "%s.%s has the wrong size, try recompiling",
             module_name, class_name);
@@ -19454,27 +19703,82 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
     return 0;
 }
 
-
-/* Type Conversion Functions */
-
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char* c_str) {
+    return __Pyx_PyUnicode_FromStringAndSize(c_str, strlen(c_str));
+}
+static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
+    Py_ssize_t ignore;
+    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
+}
+static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
+    if (
+#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+            __Pyx_sys_getdefaultencoding_not_ascii &&
+#endif
+            PyUnicode_Check(o)) {
+#if PY_VERSION_HEX < 0x03030000
+        char* defenc_c;
+        PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
+        if (!defenc) return NULL;
+        defenc_c = PyBytes_AS_STRING(defenc);
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+        {
+            char* end = defenc_c + PyBytes_GET_SIZE(defenc);
+            char* c;
+            for (c = defenc_c; c < end; c++) {
+                if ((unsigned char) (*c) >= 128) {
+                    PyUnicode_AsASCIIString(o);
+                    return NULL;
+                }
+            }
+        }
+#endif /*__PYX_DEFAULT_STRING_ENCODING_IS_ASCII*/
+        *length = PyBytes_GET_SIZE(defenc);
+        return defenc_c;
+#else /* PY_VERSION_HEX < 0x03030000 */
+        if (PyUnicode_READY(o) == -1) return NULL;
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+        if (PyUnicode_IS_ASCII(o)) {
+            *length = PyUnicode_GET_DATA_SIZE(o);
+            return PyUnicode_AsUTF8(o);
+        } else {
+            PyUnicode_AsASCIIString(o);
+            return NULL;
+        }
+#else /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
+        return PyUnicode_AsUTF8AndSize(o, length);
+#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
+#endif /* PY_VERSION_HEX < 0x03030000 */
+    } else
+#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII  || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT */
+    {
+        char* result;
+        int r = PyBytes_AsStringAndSize(o, &result, length);
+        if (r < 0) {
+            return NULL;
+        } else {
+            return result;
+        }
+    }
+}
 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
    int is_true = x == Py_True;
    if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
    else return PyObject_IsTrue(x);
 }
-
 static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
   PyNumberMethods *m;
   const char *name = NULL;
   PyObject *res = NULL;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
   if (PyInt_Check(x) || PyLong_Check(x))
 #else
   if (PyLong_Check(x))
 #endif
     return Py_INCREF(x), x;
   m = Py_TYPE(x)->tp_as_number;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
   if (m && m->nb_int) {
     name = "int";
     res = PyNumber_Int(x);
@@ -19490,7 +19794,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
   }
 #endif
   if (res) {
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (!PyInt_Check(res) && !PyLong_Check(res)) {
 #else
     if (!PyLong_Check(res)) {
@@ -19508,7 +19812,6 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
   }
   return res;
 }
-
 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
   Py_ssize_t ival;
   PyObject* x = PyNumber_Index(b);
@@ -19517,7 +19820,6 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
   Py_DECREF(x);
   return ival;
 }
-
 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
 #if PY_VERSION_HEX < 0x02050000
    if (ival <= LONG_MAX)
@@ -19531,14 +19833,12 @@ static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
    return PyInt_FromSize_t(ival);
 #endif
 }
-
 static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
    unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
-   if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) {
-       return (size_t)-1;
-   } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
-       PyErr_SetString(PyExc_OverflowError,
-                       "value too large to convert to size_t");
+   if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
+       if ((val != (unsigned PY_LONG_LONG)-1) || !PyErr_Occurred())
+           PyErr_SetString(PyExc_OverflowError,
+                           "value too large to convert to size_t");
        return (size_t)-1;
    }
    return (size_t)val;
diff --git a/src/sparse_csr.pyx b/src/sparse_csr.pyx
new file mode 100644
index 0000000..7be9190
--- /dev/null
+++ b/src/sparse_csr.pyx
@@ -0,0 +1,51 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+#    Project: Fast Azimuthal integration
+#             https://github.com/kif/pyFAI
+#
+#
+#    Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
+#
+#    Principal author:       Jérôme Kieffer (Jerome.Kieffer at ESRF.eu)
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+
+
+import cython
+cimport numpy
+import numpy
+
+def LUT_to_CSR(lut):
+    cdef int[:,:] idx = lut.idx
+    cdef float[:,:] coef = lut.coef
+    cdef numpy.uint32_t nrow, ncol,nelt =0
+    ncol = lut.shape[-1]
+    nrow = lut.shape[0]
+    cdef numpy.ndarray[numpy.float32_t, ndim=1] data = numpy.zeros(nrow*ncol,numpy.float32)
+    cdef numpy.ndarray[numpy.uint32_t, ndim=1]  indices= numpy.zeros(nrow*ncol,numpy.uint32)
+    cdef numpy.ndarray[numpy.uint32_t, ndim=1] indptr = numpy.zeros(nrow+1,numpy.uint32)
+    cdef numpy.uint32_t i, j
+    for i in range(nrow):
+        indptr[i] = nelt
+        for j in range(ncol):
+            if coef[i,j]<=0.0:
+                break
+            else:
+                data[nelt] = coef[i,j]
+                indices[nelt] = idx[i,j]
+                nelt+=1
+    indptr[nrow] = nelt
+    return data[:nelt], indices[:nelt], indptr
\ No newline at end of file
diff --git a/src/splitBBox.c b/src/splitBBox.c
index f60d804..d8148c6 100644
--- a/src/splitBBox.c
+++ b/src/splitBBox.c
@@ -1,6 +1,18 @@
-/* Generated by Cython 0.17 on Wed Dec 19 21:04:29 2012 */
+/* Generated by Cython 0.19.2 on Mon Jan  6 15:25:40 2014 */
 
 #define PY_SSIZE_T_CLEAN
+#ifndef CYTHON_USE_PYLONG_INTERNALS
+#ifdef PYLONG_BITS_IN_DIGIT
+#define CYTHON_USE_PYLONG_INTERNALS 0
+#else
+#include "pyconfig.h"
+#ifdef PYLONG_BITS_IN_DIGIT
+#define CYTHON_USE_PYLONG_INTERNALS 1
+#else
+#define CYTHON_USE_PYLONG_INTERNALS 0
+#endif
+#endif
+#endif
 #include "Python.h"
 #ifndef Py_PYTHON_H
     #error Python headers needed to compile C extensions, please install development version of Python.
@@ -53,12 +65,15 @@
                                 (PyErr_Format(PyExc_TypeError, \
                                               "expected index value, got %.200s", Py_TYPE(o)->tp_name), \
                                  (PyObject*)0))
-  #define PyIndex_Check(o)     (PyNumber_Check(o) && !PyFloat_Check(o) && !PyComplex_Check(o))
+  #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \
+                                  !PyComplex_Check(o))
+  #define PyIndex_Check __Pyx_PyIndex_Check
   #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
   #define __PYX_BUILD_PY_SSIZE_T "i"
 #else
   #define __PYX_BUILD_PY_SSIZE_T "n"
   #define CYTHON_FORMAT_SSIZE_T "z"
+  #define __Pyx_PyIndex_Check PyIndex_Check
 #endif
 #if PY_VERSION_HEX < 0x02060000
   #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
@@ -113,6 +128,9 @@
 #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
   #define Py_TPFLAGS_HAVE_NEWBUFFER 0
 #endif
+#if PY_VERSION_HEX < 0x02060000
+  #define Py_TPFLAGS_HAVE_VERSION_TAG 0
+#endif
 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
   #define CYTHON_PEP393_ENABLED 1
   #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ? \
@@ -152,6 +170,14 @@
   #define PyBytes_Concat               PyString_Concat
   #define PyBytes_ConcatAndDel         PyString_ConcatAndDel
 #endif
+#if PY_MAJOR_VERSION >= 3
+  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
+  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
+#else
+  #define __Pyx_PyBaseString_Check(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj) || \
+                                         PyString_Check(obj) || PyUnicode_Check(obj))
+  #define __Pyx_PyBaseString_CheckExact(obj) (Py_TYPE(obj) == &PyBaseString_Type)
+#endif
 #if PY_VERSION_HEX < 0x02060000
   #define PySet_Check(obj)             PyObject_TypeCheck(obj, &PySet_Type)
   #define PyFrozenSet_Check(obj)       PyObject_TypeCheck(obj, &PyFrozenSet_Type)
@@ -224,6 +250,40 @@
   #define __Pyx_NAMESTR(n) (n)
   #define __Pyx_DOCSTR(n)  (n)
 #endif
+#ifndef CYTHON_INLINE
+  #if defined(__GNUC__)
+    #define CYTHON_INLINE __inline__
+  #elif defined(_MSC_VER)
+    #define CYTHON_INLINE __inline
+  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+    #define CYTHON_INLINE inline
+  #else
+    #define CYTHON_INLINE
+  #endif
+#endif
+#ifndef CYTHON_RESTRICT
+  #if defined(__GNUC__)
+    #define CYTHON_RESTRICT __restrict__
+  #elif defined(_MSC_VER) && _MSC_VER >= 1400
+    #define CYTHON_RESTRICT __restrict
+  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+    #define CYTHON_RESTRICT restrict
+  #else
+    #define CYTHON_RESTRICT
+  #endif
+#endif
+#ifdef NAN
+#define __PYX_NAN() ((float) NAN)
+#else
+static CYTHON_INLINE float __PYX_NAN() {
+  /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and
+   a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is
+   a quiet NaN. */
+  float value;
+  memset(&value, 0xFF, sizeof(value));
+  return value;
+}
+#endif
 
 
 #if PY_MAJOR_VERSION >= 3
@@ -248,13 +308,13 @@
 #include <math.h>
 #define __PYX_HAVE__splitBBox
 #define __PYX_HAVE_API__splitBBox
+#include "string.h"
 #include "stdio.h"
 #include "stdlib.h"
 #include "numpy/arrayobject.h"
 #include "numpy/ufuncobject.h"
 #include "math.h"
 #include "pythread.h"
-#include "string.h"
 #include "pystate.h"
 #ifdef _OPENMP
 #include <omp.h>
@@ -264,21 +324,6 @@
 #define CYTHON_WITHOUT_ASSERTIONS
 #endif
 
-
-/* inline attribute */
-#ifndef CYTHON_INLINE
-  #if defined(__GNUC__)
-    #define CYTHON_INLINE __inline__
-  #elif defined(_MSC_VER)
-    #define CYTHON_INLINE __inline
-  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
-    #define CYTHON_INLINE inline
-  #else
-    #define CYTHON_INLINE
-  #endif
-#endif
-
-/* unused attribute */
 #ifndef CYTHON_UNUSED
 # if defined(__GNUC__)
 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
@@ -292,30 +337,130 @@
 #   define CYTHON_UNUSED
 # endif
 #endif
-
-typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/
-
-
-/* Type Conversion Predeclarations */
-
-#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
-#define __Pyx_PyBytes_AsUString(s)   ((unsigned char*) PyBytes_AsString(s))
-
+typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding;
+                const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/
+
+#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
+#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
+#define __PYX_DEFAULT_STRING_ENCODING ""
+#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
+#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
+static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
+static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
+#define __Pyx_PyBytes_FromString        PyBytes_FromString
+#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char*);
+#if PY_MAJOR_VERSION < 3
+    #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
+    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
+#else
+    #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
+    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
+#endif
+#define __Pyx_PyObject_AsUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
+#define __Pyx_PyObject_FromUString(s)  __Pyx_PyObject_FromString((char*)s)
+#define __Pyx_PyBytes_FromUString(s)   __Pyx_PyBytes_FromString((char*)s)
+#define __Pyx_PyStr_FromUString(s)     __Pyx_PyStr_FromString((char*)s)
+#define __Pyx_PyUnicode_FromUString(s) __Pyx_PyUnicode_FromString((char*)s)
+#if PY_MAJOR_VERSION < 3
+static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
+{
+    const Py_UNICODE *u_end = u;
+    while (*u_end++) ;
+    return u_end - u - 1;
+}
+#else
+#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
+#endif
+#define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
+#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
+#define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
 #define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
 #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
 static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
-
 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
 static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
-
 #if CYTHON_COMPILING_IN_CPYTHON
 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
 #else
 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
 #endif
 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
+#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+static int __Pyx_sys_getdefaultencoding_not_ascii;
+static int __Pyx_init_sys_getdefaultencoding_params() {
+    PyObject* sys = NULL;
+    PyObject* default_encoding = NULL;
+    PyObject* ascii_chars_u = NULL;
+    PyObject* ascii_chars_b = NULL;
+    sys = PyImport_ImportModule("sys");
+    if (sys == NULL) goto bad;
+    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
+    if (default_encoding == NULL) goto bad;
+    if (strcmp(PyBytes_AsString(default_encoding), "ascii") == 0) {
+        __Pyx_sys_getdefaultencoding_not_ascii = 0;
+    } else {
+        const char* default_encoding_c = PyBytes_AS_STRING(default_encoding);
+        char ascii_chars[128];
+        int c;
+        for (c = 0; c < 128; c++) {
+            ascii_chars[c] = c;
+        }
+        __Pyx_sys_getdefaultencoding_not_ascii = 1;
+        ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
+        if (ascii_chars_u == NULL) goto bad;
+        ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
+        if (ascii_chars_b == NULL || strncmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
+            PyErr_Format(
+                PyExc_ValueError,
+                "This module compiled with c_string_encoding=ascii, but default encoding '%s' is not a superset of ascii.",
+                default_encoding_c);
+            goto bad;
+        }
+    }
+    Py_XDECREF(sys);
+    Py_XDECREF(default_encoding);
+    Py_XDECREF(ascii_chars_u);
+    Py_XDECREF(ascii_chars_b);
+    return 0;
+bad:
+    Py_XDECREF(sys);
+    Py_XDECREF(default_encoding);
+    Py_XDECREF(ascii_chars_u);
+    Py_XDECREF(ascii_chars_b);
+    return -1;
+}
+#endif
+#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
+#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
+#else
+#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
+#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
+static char* __PYX_DEFAULT_STRING_ENCODING;
+static int __Pyx_init_sys_getdefaultencoding_params() {
+    PyObject* sys = NULL;
+    PyObject* default_encoding = NULL;
+    char* default_encoding_c;
+    sys = PyImport_ImportModule("sys");
+    if (sys == NULL) goto bad;
+    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
+    if (default_encoding == NULL) goto bad;
+    default_encoding_c = PyBytes_AS_STRING(default_encoding);
+    __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
+    strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
+    Py_DECREF(sys);
+    Py_DECREF(default_encoding);
+    return 0;
+bad:
+    Py_XDECREF(sys);
+    Py_XDECREF(default_encoding);
+    return -1;
+}
+#endif
+#endif
+
 
 #ifdef __GNUC__
   /* Test for GCC > 2.95 */
@@ -330,8 +475,9 @@ static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
   #define likely(x)   (x)
   #define unlikely(x) (x)
 #endif /* __GNUC__ */
-    
+
 static PyObject *__pyx_m;
+static PyObject *__pyx_d;
 static PyObject *__pyx_b;
 static PyObject *__pyx_empty_tuple;
 static PyObject *__pyx_empty_bytes;
@@ -417,10 +563,9 @@ typedef struct {
     #define CYTHON_ATOMICS 1
 #endif
 #define __pyx_atomic_int_type int
-/* todo: Portland pgcc, maybe OS X's OSAtomicIncrement32,
-   libatomic + autotools-like distutils support? Such a pain... */
-#if CYTHON_ATOMICS && __GNUC__ >= 4 && (__GNUC_MINOR__ > 1 || \
-                    (__GNUC_MINOR__ == 1 && __GNUC_PATHLEVEL >= 2))
+#if CYTHON_ATOMICS && __GNUC__ >= 4 && (__GNUC_MINOR__ > 1 ||           \
+                    (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL >= 2)) && \
+                    !defined(__i386__)
     #define __pyx_atomic_incr_aligned(value, lock) __sync_fetch_and_add(value, 1)
     #define __pyx_atomic_decr_aligned(value, lock) __sync_fetch_and_sub(value, 1)
     #ifdef __PYX_DEBUG_ATOMICS
@@ -873,10 +1018,33 @@ static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice;
   #define __Pyx_XGOTREF(r)
   #define __Pyx_XGIVEREF(r)
 #endif /* CYTHON_REFNANNY */
+#define __Pyx_XDECREF_SET(r, v) do {                            \
+        PyObject *tmp = (PyObject *) r;                         \
+        r = v; __Pyx_XDECREF(tmp);                              \
+    } while (0)
+#define __Pyx_DECREF_SET(r, v) do {                             \
+        PyObject *tmp = (PyObject *) r;                         \
+        r = v; __Pyx_DECREF(tmp);                               \
+    } while (0)
 #define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
 #define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
 
-static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
+    PyTypeObject* tp = Py_TYPE(obj);
+    if (likely(tp->tp_getattro))
+        return tp->tp_getattro(obj, attr_name);
+#if PY_MAJOR_VERSION < 3
+    if (likely(tp->tp_getattr))
+        return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
+#endif
+    return PyObject_GetAttr(obj, attr_name);
+}
+#else
+#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
+#endif
+
+static PyObject *__Pyx_GetBuiltinName(PyObject *name); /*proto*/
 
 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
     Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/
@@ -890,6 +1058,8 @@ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \
 static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
     const char *name, int exact); /*proto*/
 
+static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); /*proto*/
+
 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/
 
 static CYTHON_INLINE int  __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj,
@@ -915,8 +1085,6 @@ static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
 
 static void __Pyx_RaiseUnboundMemoryviewSliceNogil(const char *varname);
 
-static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
-
 #define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d
 #define __Pyx_MEMVIEW_DIRECT   1
 #define __Pyx_MEMVIEW_PTR      2
@@ -926,24 +1094,15 @@ static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
 #define __Pyx_MEMVIEW_FOLLOW   32
 #define __Pyx_IS_C_CONTIG 1
 #define __Pyx_IS_F_CONTIG 2
-static int __Pyx_ValidateAndInit_memviewslice(
-                int *axes_specs,
-                int c_or_f_flag,
-                int buf_flags,
-                int ndim,
-                __Pyx_TypeInfo *dtype,
-                __Pyx_BufFmt_StackElem stack[],
-                __Pyx_memviewslice *memviewslice,
-                PyObject *original_obj);
 static int __Pyx_init_memviewslice(
                 struct __pyx_memoryview_obj *memview,
                 int ndim,
                 __Pyx_memviewslice *memviewslice,
                 int memview_is_new_reference);
-static CYTHON_INLINE int __pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
-                                                            PyThread_type_lock lock);
-static CYTHON_INLINE int __pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
-                                                            PyThread_type_lock lock);
+static CYTHON_INLINE int __pyx_add_acquisition_count_locked(
+    __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
+static CYTHON_INLINE int __pyx_sub_acquisition_count_locked(
+    __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
 #define __pyx_get_slice_count_pointer(memview) (memview->acquisition_count_aligned_p)
 #define __pyx_get_slice_count(memview) (*__pyx_get_slice_count_pointer(memview))
 #define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__)
@@ -969,13 +1128,19 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
 #define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1)
 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/
 
+static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); /*proto*/
+
 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); /*proto*/
 
 static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t); /* proto */
 
+#ifndef __PYX_FORCE_INIT_THREADS
+  #define __PYX_FORCE_INIT_THREADS 0
+#endif
+
 #define UNARY_NEG_WOULD_OVERFLOW(x)            (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))
 
-static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
+static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/
 
 static PyObject *get_memview(PyObject *__pyx_v_self); /*proto*/
@@ -986,98 +1151,32 @@ static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
 
 #include <string.h>
 
-static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
-    PyObject *r;
-    if (!j) return NULL;
-    r = PyObject_GetItem(o, j);
-    Py_DECREF(j);
-    return r;
-}
-#define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
-                                                    __Pyx_GetItemInt_List_Fast(o, i) : \
-                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
-static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) {
-#if CYTHON_COMPILING_IN_CPYTHON
-    if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
-        PyObject *r = PyList_GET_ITEM(o, i);
-        Py_INCREF(r);
-        return r;
-    }
-    else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
-        PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
-        Py_INCREF(r);
-        return r;
-    }
-    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
-#else
-    return PySequence_GetItem(o, i);
-#endif
-}
-#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
-                                                    __Pyx_GetItemInt_Tuple_Fast(o, i) : \
-                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
-static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) {
-#if CYTHON_COMPILING_IN_CPYTHON
-    if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
-        PyObject *r = PyTuple_GET_ITEM(o, i);
-        Py_INCREF(r);
-        return r;
-    }
-    else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
-        PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
-        Py_INCREF(r);
-        return r;
-    }
-    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
-#else
-    return PySequence_GetItem(o, i);
-#endif
-}
-#define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
-                                                    __Pyx_GetItemInt_Fast(o, i) : \
-                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
-static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) {
-#if CYTHON_COMPILING_IN_CPYTHON
-    if (PyList_CheckExact(o)) {
-        Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
-        if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) {
-            PyObject *r = PyList_GET_ITEM(o, n);
-            Py_INCREF(r);
-            return r;
-        }
-    }
-    else if (PyTuple_CheckExact(o)) {
-        Py_ssize_t n = (likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
-        if (likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
-            PyObject *r = PyTuple_GET_ITEM(o, n);
-            Py_INCREF(r);
-            return r;
-        }
-    } else {  /* inlined PySequence_GetItem() */
-        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
-        if (likely(m && m->sq_item)) {
-            if (unlikely(i < 0) && likely(m->sq_length)) {
-                Py_ssize_t l = m->sq_length(o);
-                if (unlikely(l < 0)) return NULL;
-                i += l;
-            }
-            return m->sq_item(o, i);
-        }
-    }
-#else
-    if (PySequence_Check(o)) {
-        return PySequence_GetItem(o, i);
-    }
-#endif
-    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
-}
-
-static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
+#define __Pyx_GetItemInt(o, i, size, to_py_func, is_list, wraparound, boundscheck) \
+    (((size) <= sizeof(Py_ssize_t)) ? \
+    __Pyx_GetItemInt_Fast(o, i, is_list, wraparound, boundscheck) : \
+    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
+#define __Pyx_GetItemInt_List(o, i, size, to_py_func, is_list, wraparound, boundscheck) \
+    (((size) <= sizeof(Py_ssize_t)) ? \
+    __Pyx_GetItemInt_List_Fast(o, i, wraparound, boundscheck) : \
+    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
+                                                              int wraparound, int boundscheck);
+#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func, is_list, wraparound, boundscheck) \
+    (((size) <= sizeof(Py_ssize_t)) ? \
+    __Pyx_GetItemInt_Tuple_Fast(o, i, wraparound, boundscheck) : \
+    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
+                                                              int wraparound, int boundscheck);
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
+                                                     int is_list, int wraparound, int boundscheck);
+
+static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
 static PyObject *__pyx_memoryview_transpose(PyObject *__pyx_v_self); /*proto*/
 static PyObject *__pyx_memoryview__get__base(PyObject *__pyx_v_self); /*proto*/
 static PyObject *__pyx_memoryview_get_shape(PyObject *__pyx_v_self); /*proto*/
 #if CYTHON_COMPILING_IN_CPYTHON
-static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
+static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
     PyListObject* L = (PyListObject*) list;
     Py_ssize_t len = Py_SIZE(list);
     if (likely(L->allocated > len)) {
@@ -1089,7 +1188,7 @@ static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
     return PyList_Append(list, x);
 }
 #else
-#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
+#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
 #endif
 
 static PyObject *__pyx_memoryview_get_strides(PyObject *__pyx_v_self); /*proto*/
@@ -1098,13 +1197,30 @@ static PyObject *__pyx_memoryview_get_ndim(PyObject *__pyx_v_self); /*proto*/
 static PyObject *__pyx_memoryview_get_itemsize(PyObject *__pyx_v_self); /*proto*/
 static PyObject *__pyx_memoryview_get_nbytes(PyObject *__pyx_v_self); /*proto*/
 static PyObject *__pyx_memoryview_get_size(PyObject *__pyx_v_self); /*proto*/
-#ifndef __PYX_FORCE_INIT_THREADS
-  #define __PYX_FORCE_INIT_THREADS 0
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
+    PyListObject* L = (PyListObject*) list;
+    Py_ssize_t len = Py_SIZE(list);
+    if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
+        Py_INCREF(x);
+        PyList_SET_ITEM(list, len, x);
+        Py_SIZE(list) = len+1;
+        return 0;
+    }
+    return PyList_Append(list, x);
+}
+#else
+#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
 #endif
 
 static CYTHON_INLINE long __Pyx_div_long(long, long); /* proto */
 
 static PyObject *__pyx_memoryviewslice__get__base(PyObject *__pyx_v_self); /*proto*/
+static void __Pyx_WriteUnraisable(const char *name, int clineno,
+                                  int lineno, const char *filename); /*proto*/
+
+static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
+
 static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
 static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
 
@@ -1133,7 +1249,7 @@ typedef struct {
 static Py_ssize_t __Pyx_zeros[] = {0, 0, 0, 0, 0, 0, 0, 0};
 static Py_ssize_t __Pyx_minusones[] = {-1, -1, -1, -1, -1, -1, -1, -1};
 
-static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/
+static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /*proto*/
 
 static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_int8(npy_int8);
 
@@ -1282,17 +1398,24 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);
 
 static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);
 
+static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
+
+static int __Pyx_ValidateAndInit_memviewslice(
+                int *axes_specs,
+                int c_or_f_flag,
+                int buf_flags,
+                int ndim,
+                __Pyx_TypeInfo *dtype,
+                __Pyx_BufFmt_StackElem stack[],
+                __Pyx_memviewslice *memviewslice,
+                PyObject *original_obj);
+
 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int8_t(PyObject *);
 
 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_float(PyObject *);
 
-static void __Pyx_WriteUnraisable(const char *name, int clineno,
-                                  int lineno, const char *filename); /*proto*/
-
 static int __Pyx_check_binary_version(void);
 
-static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
-
 #if !defined(__Pyx_PyIdentifier_FromString)
 #if PY_MAJOR_VERSION < 3
   #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
@@ -1333,6 +1456,8 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
 
 /* Module declarations from 'cpython.ref' */
 
+/* Module declarations from 'libc.string' */
+
 /* Module declarations from 'libc.stdio' */
 
 /* Module declarations from 'cpython.object' */
@@ -1357,10 +1482,11 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, cha
 /* Module declarations from 'libc.math' */
 
 /* Module declarations from 'splitBBox' */
+static PyTypeObject *__pyx_memoryview_type = 0;
 static PyTypeObject *__pyx_array_type = 0;
 static PyTypeObject *__pyx_MemviewEnum_type = 0;
-static PyTypeObject *__pyx_memoryview_type = 0;
 static PyTypeObject *__pyx_memoryviewslice_type = 0;
+static float __pyx_v_9splitBBox_pi;
 static PyObject *generic = 0;
 static PyObject *strided = 0;
 static PyObject *indirect = 0;
@@ -1370,12 +1496,12 @@ static float __pyx_f_9splitBBox_getBinNr(float, float, float); /*proto*/
 static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/
 static void *__pyx_align_pointer(void *, size_t); /*proto*/
 static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo *); /*proto*/
-static int __pyx_memoryview_check(PyObject *); /*proto*/
+static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/
 static PyObject *_unellipsify(PyObject *, int); /*proto*/
 static PyObject *assert_direct_dimensions(Py_ssize_t *, int); /*proto*/
 static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/
 static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int, int); /*proto*/
-static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, int); /*proto*/
+static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/
 static int __pyx_memslice_transpose(__Pyx_memviewslice *); /*proto*/
 static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice, int, PyObject *(*)(char *), int (*)(char *, PyObject *), int); /*proto*/
 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
@@ -1420,7 +1546,7 @@ static PyObject *__pyx_builtin_xrange;
 static PyObject *__pyx_builtin_id;
 static PyObject *__pyx_builtin_IndexError;
 static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_weights, PyArrayObject *__pyx_v_pos0, PyArrayObject *__pyx_v_delta_pos0, PyObject *__pyx_v_pos1, PyObject *__pyx_v_delta_pos1, size_t __pyx_v_bins, PyObject *__pyx_v_pos0Range, PyObject *__pyx_v_pos1Range, PyObject *__pyx_v_dummy, PyObject *__pyx_v_delta_dummy, PyObject *__pyx_v_mask, PyObject *__pyx_v_dark, PyObject *__pyx_v_flat, PyObject *__pyx_v_solidangle, PyObject *__pyx_v_po [...]
-static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_weights, PyArrayObject *__pyx_v_pos0, PyArrayObject *__pyx_v_delta_pos0, PyArrayObject *__pyx_v_pos1, PyArrayObject *__pyx_v_delta_pos1, PyObject *__pyx_v_bins, PyObject *__pyx_v_pos0Range, PyObject *__pyx_v_pos1Range, PyObject *__pyx_v_dummy, PyObject *__pyx_v_delta_dummy, PyObject *__pyx_v_mask, PyObject *__pyx_v_dark, PyObject *__pyx_v_flat, PyObject *__pyx_v_solidangle, PyObje [...]
+static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_weights, PyArrayObject *__pyx_v_pos0, PyArrayObject *__pyx_v_delta_pos0, PyArrayObject *__pyx_v_pos1, PyArrayObject *__pyx_v_delta_pos1, PyObject *__pyx_v_bins, PyObject *__pyx_v_pos0Range, PyObject *__pyx_v_pos1Range, PyObject *__pyx_v_dummy, PyObject *__pyx_v_delta_dummy, PyObject *__pyx_v_mask, PyObject *__pyx_v_dark, PyObject *__pyx_v_flat, PyObject *__pyx_v_solidangle, PyObje [...]
 static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
 static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */
 static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer); /* proto */
@@ -1455,6 +1581,10 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_20copy(struct __pyx_me
 static PyObject *__pyx_memoryview_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
 static void __pyx_memoryviewslice_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
 static PyObject *__pyx_memoryviewslice__get__base_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
+static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
 static char __pyx_k_2[] = "ndarray is not C contiguous";
 static char __pyx_k_4[] = "ndarray is not Fortran contiguous";
 static char __pyx_k_6[] = "Non-native byte order not supported";
@@ -1481,7 +1611,7 @@ static char __pyx_k_43[] = "Out of bounds on buffer access (axis %d)";
 static char __pyx_k_44[] = "Cannot transpose memoryview with indirect dimensions";
 static char __pyx_k_45[] = "got differing extents in dimension %d (got %d and %d)";
 static char __pyx_k_46[] = "Dimension %d is not direct";
-static char __pyx_k_49[] = "/home/jerome/workspace/pyFAI/src/splitBBox.pyx";
+static char __pyx_k_49[] = "/users/kieffer/workspace-ssd/pyFAI/src/splitBBox.pyx";
 static char __pyx_k_52[] = "getbuffer(obj, view, flags)";
 static char __pyx_k_53[] = "<strided and direct or indirect>";
 static char __pyx_k_55[] = "<strided and direct>";
@@ -1508,6 +1638,10 @@ static char __pyx_k__q[] = "q";
 static char __pyx_k__Zd[] = "Zd";
 static char __pyx_k__Zf[] = "Zf";
 static char __pyx_k__Zg[] = "Zg";
+static char __pyx_k__c0[] = "c0";
+static char __pyx_k__c1[] = "c1";
+static char __pyx_k__d0[] = "d0";
+static char __pyx_k__d1[] = "d1";
 static char __pyx_k__id[] = "id";
 static char __pyx_k__p1[] = "p1";
 static char __pyx_k__bin[] = "bin";
@@ -1577,6 +1711,7 @@ static char __pyx_k__edges1[] = "edges1";
 static char __pyx_k__encode[] = "encode";
 static char __pyx_k__extend[] = "extend";
 static char __pyx_k__format[] = "format";
+static char __pyx_k__lower0[] = "lower0";
 static char __pyx_k__outPos[] = "outPos";
 static char __pyx_k__struct[] = "struct";
 static char __pyx_k__unpack[] = "unpack";
@@ -1618,6 +1753,7 @@ static char __pyx_k__pos1Range[] = "pos1Range";
 static char __pyx_k__splitBBox[] = "splitBBox";
 static char __pyx_k__IndexError[] = "IndexError";
 static char __pyx_k__ValueError[] = "ValueError";
+static char __pyx_k____import__[] = "__import__";
 static char __pyx_k__check_mask[] = "check_mask";
 static char __pyx_k__check_pos1[] = "check_pos1";
 static char __pyx_k__delta_pos0[] = "delta_pos0";
@@ -1627,8 +1763,11 @@ static char __pyx_k__pos1_maxin[] = "pos1_maxin";
 static char __pyx_k__solidangle[] = "solidangle";
 static char __pyx_k__MemoryError[] = "MemoryError";
 static char __pyx_k__check_dummy[] = "check_dummy";
+static char __pyx_k__chiDiscAtPi[] = "chiDiscAtPi";
 static char __pyx_k__cpos0_lower[] = "cpos0_lower";
 static char __pyx_k__cpos0_upper[] = "cpos0_upper";
+static char __pyx_k__cpos1_lower[] = "cpos1_lower";
+static char __pyx_k__cpos1_upper[] = "cpos1_upper";
 static char __pyx_k__csolidangle[] = "csolidangle";
 static char __pyx_k__delta_dummy[] = "delta_dummy";
 static char __pyx_k__histoBBox1d[] = "histoBBox1d";
@@ -1637,11 +1776,14 @@ static char __pyx_k__RuntimeError[] = "RuntimeError";
 static char __pyx_k__polarization[] = "polarization";
 static char __pyx_k__cpolarization[] = "cpolarization";
 static char __pyx_k__do_solidangle[] = "do_solidangle";
+static char __pyx_k____pyx_vtable__[] = "__pyx_vtable__";
+static char __pyx_k__allow_pos0_neg[] = "allow_pos0_neg";
 static char __pyx_k____pyx_getbuffer[] = "__pyx_getbuffer";
 static char __pyx_k__allocate_buffer[] = "allocate_buffer";
 static char __pyx_k__do_polarization[] = "do_polarization";
 static char __pyx_k__dtype_is_object[] = "dtype_is_object";
 static char __pyx_k__ascontiguousarray[] = "ascontiguousarray";
+static char __pyx_k____pyx_releasebuffer[] = "__pyx_releasebuffer";
 static PyObject *__pyx_kp_u_12;
 static PyObject *__pyx_kp_s_14;
 static PyObject *__pyx_kp_s_16;
@@ -1680,11 +1822,15 @@ static PyObject *__pyx_n_s__T;
 static PyObject *__pyx_n_s__TypeError;
 static PyObject *__pyx_n_s__ValueError;
 static PyObject *__pyx_n_s____class__;
+static PyObject *__pyx_n_s____import__;
 static PyObject *__pyx_n_s____main__;
 static PyObject *__pyx_n_s____name__;
 static PyObject *__pyx_n_s____pyx_getbuffer;
+static PyObject *__pyx_n_s____pyx_releasebuffer;
+static PyObject *__pyx_n_s____pyx_vtable__;
 static PyObject *__pyx_n_s____test__;
 static PyObject *__pyx_n_s__allocate_buffer;
+static PyObject *__pyx_n_s__allow_pos0_neg;
 static PyObject *__pyx_n_s__ascontiguousarray;
 static PyObject *__pyx_n_s__base;
 static PyObject *__pyx_n_s__bin;
@@ -1698,6 +1844,8 @@ static PyObject *__pyx_n_s__bins1;
 static PyObject *__pyx_n_b__c;
 static PyObject *__pyx_n_s__c;
 static PyObject *__pyx_n_u__c;
+static PyObject *__pyx_n_s__c0;
+static PyObject *__pyx_n_s__c1;
 static PyObject *__pyx_n_s__cdark;
 static PyObject *__pyx_n_s__cdata;
 static PyObject *__pyx_n_s__cdummy;
@@ -1705,13 +1853,18 @@ static PyObject *__pyx_n_s__cflat;
 static PyObject *__pyx_n_s__check_dummy;
 static PyObject *__pyx_n_s__check_mask;
 static PyObject *__pyx_n_s__check_pos1;
+static PyObject *__pyx_n_s__chiDiscAtPi;
 static PyObject *__pyx_n_s__cmask;
 static PyObject *__pyx_n_s__cpolarization;
 static PyObject *__pyx_n_s__cpos0;
 static PyObject *__pyx_n_s__cpos0_lower;
 static PyObject *__pyx_n_s__cpos0_upper;
 static PyObject *__pyx_n_s__cpos1;
+static PyObject *__pyx_n_s__cpos1_lower;
+static PyObject *__pyx_n_s__cpos1_upper;
 static PyObject *__pyx_n_s__csolidangle;
+static PyObject *__pyx_n_s__d0;
+static PyObject *__pyx_n_s__d1;
 static PyObject *__pyx_n_s__dark;
 static PyObject *__pyx_n_s__data;
 static PyObject *__pyx_n_s__ddummy;
@@ -1766,6 +1919,7 @@ static PyObject *__pyx_n_s__int8;
 static PyObject *__pyx_n_s__itemsize;
 static PyObject *__pyx_n_s__j;
 static PyObject *__pyx_n_s__linspace;
+static PyObject *__pyx_n_s__lower0;
 static PyObject *__pyx_n_s__mask;
 static PyObject *__pyx_n_s__max;
 static PyObject *__pyx_n_s__max0;
@@ -1847,7 +2001,7 @@ static PyObject *__pyx_k_tuple_62;
 static PyObject *__pyx_k_codeobj_48;
 static PyObject *__pyx_k_codeobj_51;
 
-/* "splitBBox.pyx":36
+/* "splitBBox.pyx":37
  * 
  * @cython.cdivision(True)
  * cdef float  getBinNr(float x0, float pos0_min, float delta) nogil:             # <<<<<<<<<<<<<<
@@ -1858,7 +2012,7 @@ static PyObject *__pyx_k_codeobj_51;
 static float __pyx_f_9splitBBox_getBinNr(float __pyx_v_x0, float __pyx_v_pos0_min, float __pyx_v_delta) {
   float __pyx_r;
 
-  /* "splitBBox.pyx":43
+  /* "splitBBox.pyx":44
  *     param delta: bin width
  *     """
  *     return (x0 - pos0_min) / delta             # <<<<<<<<<<<<<<
@@ -1893,6 +2047,9 @@ static PyObject *__pyx_pw_9splitBBox_1histoBBox1d(PyObject *__pyx_self, PyObject
   PyObject *__pyx_v_flat = 0;
   PyObject *__pyx_v_solidangle = 0;
   PyObject *__pyx_v_polarization = 0;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("histoBBox1d (wrapper)", 0);
@@ -1900,7 +2057,7 @@ static PyObject *__pyx_pw_9splitBBox_1histoBBox1d(PyObject *__pyx_self, PyObject
     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__weights,&__pyx_n_s__pos0,&__pyx_n_s__delta_pos0,&__pyx_n_s__pos1,&__pyx_n_s__delta_pos1,&__pyx_n_s__bins,&__pyx_n_s__pos0Range,&__pyx_n_s__pos1Range,&__pyx_n_s__dummy,&__pyx_n_s__delta_dummy,&__pyx_n_s__mask,&__pyx_n_s__dark,&__pyx_n_s__flat,&__pyx_n_s__solidangle,&__pyx_n_s__polarization,0};
     PyObject* values[15] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
 
-    /* "splitBBox.pyx":52
+    /* "splitBBox.pyx":53
  *                 numpy.ndarray pos0 not None,
  *                 numpy.ndarray delta_pos0 not None,
  *                 pos1=None,             # <<<<<<<<<<<<<<
@@ -1909,7 +2066,7 @@ static PyObject *__pyx_pw_9splitBBox_1histoBBox1d(PyObject *__pyx_self, PyObject
  */
     values[3] = ((PyObject *)Py_None);
 
-    /* "splitBBox.pyx":53
+    /* "splitBBox.pyx":54
  *                 numpy.ndarray delta_pos0 not None,
  *                 pos1=None,
  *                 delta_pos1=None,             # <<<<<<<<<<<<<<
@@ -1918,7 +2075,7 @@ static PyObject *__pyx_pw_9splitBBox_1histoBBox1d(PyObject *__pyx_self, PyObject
  */
     values[4] = ((PyObject *)Py_None);
 
-    /* "splitBBox.pyx":55
+    /* "splitBBox.pyx":56
  *                 delta_pos1=None,
  *                 size_t bins=100,
  *                 pos0Range=None,             # <<<<<<<<<<<<<<
@@ -1927,7 +2084,7 @@ static PyObject *__pyx_pw_9splitBBox_1histoBBox1d(PyObject *__pyx_self, PyObject
  */
     values[6] = ((PyObject *)Py_None);
 
-    /* "splitBBox.pyx":56
+    /* "splitBBox.pyx":57
  *                 size_t bins=100,
  *                 pos0Range=None,
  *                 pos1Range=None,             # <<<<<<<<<<<<<<
@@ -1936,7 +2093,7 @@ static PyObject *__pyx_pw_9splitBBox_1histoBBox1d(PyObject *__pyx_self, PyObject
  */
     values[7] = ((PyObject *)Py_None);
 
-    /* "splitBBox.pyx":57
+    /* "splitBBox.pyx":58
  *                 pos0Range=None,
  *                 pos1Range=None,
  *                 dummy=None,             # <<<<<<<<<<<<<<
@@ -1945,7 +2102,7 @@ static PyObject *__pyx_pw_9splitBBox_1histoBBox1d(PyObject *__pyx_self, PyObject
  */
     values[8] = ((PyObject *)Py_None);
 
-    /* "splitBBox.pyx":58
+    /* "splitBBox.pyx":59
  *                 pos1Range=None,
  *                 dummy=None,
  *                 delta_dummy=None,             # <<<<<<<<<<<<<<
@@ -1954,7 +2111,7 @@ static PyObject *__pyx_pw_9splitBBox_1histoBBox1d(PyObject *__pyx_self, PyObject
  */
     values[9] = ((PyObject *)Py_None);
 
-    /* "splitBBox.pyx":59
+    /* "splitBBox.pyx":60
  *                 dummy=None,
  *                 delta_dummy=None,
  *                 mask=None,             # <<<<<<<<<<<<<<
@@ -1963,7 +2120,7 @@ static PyObject *__pyx_pw_9splitBBox_1histoBBox1d(PyObject *__pyx_self, PyObject
  */
     values[10] = ((PyObject *)Py_None);
 
-    /* "splitBBox.pyx":60
+    /* "splitBBox.pyx":61
  *                 delta_dummy=None,
  *                 mask=None,
  *                 dark=None,             # <<<<<<<<<<<<<<
@@ -1972,7 +2129,7 @@ static PyObject *__pyx_pw_9splitBBox_1histoBBox1d(PyObject *__pyx_self, PyObject
  */
     values[11] = ((PyObject *)Py_None);
 
-    /* "splitBBox.pyx":61
+    /* "splitBBox.pyx":62
  *                 mask=None,
  *                 dark=None,
  *                 flat=None,             # <<<<<<<<<<<<<<
@@ -1981,7 +2138,7 @@ static PyObject *__pyx_pw_9splitBBox_1histoBBox1d(PyObject *__pyx_self, PyObject
  */
     values[12] = ((PyObject *)Py_None);
 
-    /* "splitBBox.pyx":62
+    /* "splitBBox.pyx":63
  *                 dark=None,
  *                 flat=None,
  *                 solidangle=None,             # <<<<<<<<<<<<<<
@@ -1990,7 +2147,7 @@ static PyObject *__pyx_pw_9splitBBox_1histoBBox1d(PyObject *__pyx_self, PyObject
  */
     values[13] = ((PyObject *)Py_None);
 
-    /* "splitBBox.pyx":63
+    /* "splitBBox.pyx":64
  *                 flat=None,
  *                 solidangle=None,
  *                 polarization=None):             # <<<<<<<<<<<<<<
@@ -2028,12 +2185,12 @@ static PyObject *__pyx_pw_9splitBBox_1histoBBox1d(PyObject *__pyx_self, PyObject
         case  1:
         if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos0)) != 0)) kw_args--;
         else {
-          __Pyx_RaiseArgtupleInvalid("histoBBox1d", 0, 3, 15, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+          __Pyx_RaiseArgtupleInvalid("histoBBox1d", 0, 3, 15, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  2:
         if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__delta_pos0)) != 0)) kw_args--;
         else {
-          __Pyx_RaiseArgtupleInvalid("histoBBox1d", 0, 3, 15, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+          __Pyx_RaiseArgtupleInvalid("histoBBox1d", 0, 3, 15, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  3:
         if (kw_args > 0) {
@@ -2097,7 +2254,7 @@ static PyObject *__pyx_pw_9splitBBox_1histoBBox1d(PyObject *__pyx_self, PyObject
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "histoBBox1d") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "histoBBox1d") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     } else {
       switch (PyTuple_GET_SIZE(__pyx_args)) {
@@ -2126,7 +2283,7 @@ static PyObject *__pyx_pw_9splitBBox_1histoBBox1d(PyObject *__pyx_self, PyObject
     __pyx_v_pos1 = values[3];
     __pyx_v_delta_pos1 = values[4];
     if (values[5]) {
-      __pyx_v_bins = __Pyx_PyInt_AsSize_t(values[5]); if (unlikely((__pyx_v_bins == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      __pyx_v_bins = __Pyx_PyInt_AsSize_t(values[5]); if (unlikely((__pyx_v_bins == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     } else {
       __pyx_v_bins = ((size_t)100);
     }
@@ -2142,15 +2299,15 @@ static PyObject *__pyx_pw_9splitBBox_1histoBBox1d(PyObject *__pyx_self, PyObject
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("histoBBox1d", 0, 3, 15, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __Pyx_RaiseArgtupleInvalid("histoBBox1d", 0, 3, 15, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_AddTraceback("splitBBox.histoBBox1d", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weights), __pyx_ptype_5numpy_ndarray, 0, "weights", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos0), __pyx_ptype_5numpy_ndarray, 0, "pos0", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_delta_pos0), __pyx_ptype_5numpy_ndarray, 0, "delta_pos0", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __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 = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos0), __pyx_ptype_5numpy_ndarray, 0, "pos0", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_delta_pos0), __pyx_ptype_5numpy_ndarray, 0, "delta_pos0", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_r = __pyx_pf_9splitBBox_histoBBox1d(__pyx_self, __pyx_v_weights, __pyx_v_pos0, __pyx_v_delta_pos0, __pyx_v_pos1, __pyx_v_delta_pos1, __pyx_v_bins, __pyx_v_pos0Range, __pyx_v_pos1Range, __pyx_v_dummy, __pyx_v_delta_dummy, __pyx_v_mask, __pyx_v_dark, __pyx_v_flat, __pyx_v_solidangle, __pyx_v_polarization);
   goto __pyx_L0;
   __pyx_L1_error:;
@@ -2160,7 +2317,7 @@ static PyObject *__pyx_pw_9splitBBox_1histoBBox1d(PyObject *__pyx_self, PyObject
   return __pyx_r;
 }
 
-/* "splitBBox.pyx":49
+/* "splitBBox.pyx":50
  * @cython.boundscheck(False)
  * @cython.wraparound(False)
  * def histoBBox1d(numpy.ndarray weights not None,             # <<<<<<<<<<<<<<
@@ -2254,8 +2411,8 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
   PyArrayObject *__pyx_t_14 = NULL;
   PyArrayObject *__pyx_t_15 = NULL;
   PyArrayObject *__pyx_t_16 = NULL;
-  __Pyx_memviewslice __pyx_t_17 = { 0, 0, { 0 }, { 0 }, { 0 } };
-  int __pyx_t_18;
+  int __pyx_t_17;
+  __Pyx_memviewslice __pyx_t_18 = { 0, 0, { 0 }, { 0 }, { 0 } };
   int __pyx_t_19;
   double __pyx_t_20;
   __Pyx_memviewslice __pyx_t_21 = { 0, 0, { 0 }, { 0 }, { 0 } };
@@ -2268,9 +2425,9 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
   size_t __pyx_t_28;
   size_t __pyx_t_29;
   size_t __pyx_t_30;
-  Py_ssize_t __pyx_t_31;
-  float __pyx_t_32;
-  size_t __pyx_t_33;
+  size_t __pyx_t_31;
+  Py_ssize_t __pyx_t_32;
+  float __pyx_t_33;
   size_t __pyx_t_34;
   size_t __pyx_t_35;
   size_t __pyx_t_36;
@@ -2282,20 +2439,21 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
   size_t __pyx_t_42;
   size_t __pyx_t_43;
   size_t __pyx_t_44;
-  Py_ssize_t __pyx_t_45;
+  size_t __pyx_t_45;
   Py_ssize_t __pyx_t_46;
   Py_ssize_t __pyx_t_47;
   Py_ssize_t __pyx_t_48;
   Py_ssize_t __pyx_t_49;
   Py_ssize_t __pyx_t_50;
   Py_ssize_t __pyx_t_51;
-  size_t __pyx_t_52;
+  Py_ssize_t __pyx_t_52;
   size_t __pyx_t_53;
   size_t __pyx_t_54;
   size_t __pyx_t_55;
   size_t __pyx_t_56;
   size_t __pyx_t_57;
   size_t __pyx_t_58;
+  size_t __pyx_t_59;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -2341,20 +2499,20 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
   __pyx_pybuffernd_outMerge.data = NULL;
   __pyx_pybuffernd_outMerge.rcbuffer = &__pyx_pybuffer_outMerge;
 
-  /* "splitBBox.pyx":88
+  /* "splitBBox.pyx":89
  *     @return 2theta, I, weighted histogram, unweighted histogram
  *     """
  *     cdef size_t  size = weights.size             # <<<<<<<<<<<<<<
  *     assert pos0.size == size
  *     assert delta_pos0.size == size
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_weights), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_weights), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_PyInt_AsSize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyInt_AsSize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __pyx_v_size = __pyx_t_2;
 
-  /* "splitBBox.pyx":89
+  /* "splitBBox.pyx":90
  *     """
  *     cdef size_t  size = weights.size
  *     assert pos0.size == size             # <<<<<<<<<<<<<<
@@ -2362,22 +2520,22 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
  *     assert  bins > 1
  */
   #ifndef CYTHON_WITHOUT_ASSERTIONS
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_pos0), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __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 = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   if (unlikely(!__pyx_t_5)) {
     PyErr_SetNone(PyExc_AssertionError);
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   #endif
 
-  /* "splitBBox.pyx":90
+  /* "splitBBox.pyx":91
  *     cdef size_t  size = weights.size
  *     assert pos0.size == size
  *     assert delta_pos0.size == size             # <<<<<<<<<<<<<<
@@ -2385,22 +2543,22 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
  *     cdef ssize_t   bin0_max, bin0_min, bin = 0
  */
   #ifndef CYTHON_WITHOUT_ASSERTIONS
-  __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_delta_pos0), __pyx_n_s__size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_delta_pos0), __pyx_n_s__size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (unlikely(!__pyx_t_5)) {
     PyErr_SetNone(PyExc_AssertionError);
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   #endif
 
-  /* "splitBBox.pyx":91
+  /* "splitBBox.pyx":92
  *     assert pos0.size == size
  *     assert delta_pos0.size == size
  *     assert  bins > 1             # <<<<<<<<<<<<<<
@@ -2408,13 +2566,13 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
  *     cdef float data, deltaR, deltaL, deltaA,p1, epsilon = 1e-10, cdummy = 0, ddummy = 0
  */
   #ifndef CYTHON_WITHOUT_ASSERTIONS
-  if (unlikely(!(__pyx_v_bins > 1))) {
+  if (unlikely(!((__pyx_v_bins > 1) != 0))) {
     PyErr_SetNone(PyExc_AssertionError);
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   #endif
 
-  /* "splitBBox.pyx":92
+  /* "splitBBox.pyx":93
  *     assert delta_pos0.size == size
  *     assert  bins > 1
  *     cdef ssize_t   bin0_max, bin0_min, bin = 0             # <<<<<<<<<<<<<<
@@ -2423,7 +2581,7 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
  */
   __pyx_v_bin = 0;
 
-  /* "splitBBox.pyx":93
+  /* "splitBBox.pyx":94
  *     assert  bins > 1
  *     cdef ssize_t   bin0_max, bin0_min, bin = 0
  *     cdef float data, deltaR, deltaL, deltaA,p1, epsilon = 1e-10, cdummy = 0, ddummy = 0             # <<<<<<<<<<<<<<
@@ -2434,7 +2592,7 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
   __pyx_v_cdummy = 0.0;
   __pyx_v_ddummy = 0.0;
 
-  /* "splitBBox.pyx":94
+  /* "splitBBox.pyx":95
  *     cdef ssize_t   bin0_max, bin0_min, bin = 0
  *     cdef float data, deltaR, deltaL, deltaA,p1, epsilon = 1e-10, cdummy = 0, ddummy = 0
  *     cdef float pos0_min=0, pos0_max=0, pos0_maxin=0, pos1_min=0, pos1_max=0, pos1_maxin=0, min0=0, max0=0, fbin0_min=0, fbin0_max=0             # <<<<<<<<<<<<<<
@@ -2452,7 +2610,7 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
   __pyx_v_fbin0_min = 0.0;
   __pyx_v_fbin0_max = 0.0;
 
-  /* "splitBBox.pyx":95
+  /* "splitBBox.pyx":96
  *     cdef float data, deltaR, deltaL, deltaA,p1, epsilon = 1e-10, cdummy = 0, ddummy = 0
  *     cdef float pos0_min=0, pos0_max=0, pos0_maxin=0, pos1_min=0, pos1_max=0, pos1_maxin=0, min0=0, max0=0, fbin0_min=0, fbin0_max=0
  *     cdef bint check_pos1=False, check_mask=False, check_dummy=False, do_dark=False, do_flat=False, do_polarization=False, do_solidangle=False             # <<<<<<<<<<<<<<
@@ -2467,49 +2625,49 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
   __pyx_v_do_polarization = 0;
   __pyx_v_do_solidangle = 0;
 
-  /* "splitBBox.pyx":97
+  /* "splitBBox.pyx":98
  *     cdef bint check_pos1=False, check_mask=False, check_dummy=False, do_dark=False, do_flat=False, do_polarization=False, do_solidangle=False
  * 
  *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cdata = numpy.ascontiguousarray(weights.ravel(),dtype=numpy.float32)             # <<<<<<<<<<<<<<
  *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos0, dpos0, cpos1, dpos1,cpos0_lower, cpos0_upper
  *     cdef numpy.int8_t[:] cmask
  */
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __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 = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_weights), __pyx_n_s__ravel); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_weights), __pyx_n_s__ravel); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
   __Pyx_GIVEREF(__pyx_t_4);
   __pyx_t_4 = 0;
-  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-  __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
-  __pyx_t_7 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__float32); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s__float32); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __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_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-  __pyx_t_7 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_7);
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-  if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_t_8 = ((PyArrayObject *)__pyx_t_7);
   {
     __Pyx_BufFmt_StackElem __pyx_stack[1];
     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cdata.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
       __pyx_v_cdata = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_cdata.rcbuffer->pybuffer.buf = NULL;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     } else {__pyx_pybuffernd_cdata.diminfo[0].strides = __pyx_pybuffernd_cdata.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cdata.diminfo[0].shape = __pyx_pybuffernd_cdata.rcbuffer->pybuffer.shape[0];
     }
   }
@@ -2517,43 +2675,43 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
   __pyx_v_cdata = ((PyArrayObject *)__pyx_t_7);
   __pyx_t_7 = 0;
 
-  /* "splitBBox.pyx":102
+  /* "splitBBox.pyx":103
  *     cdef float[:] cflat, cdark, cpolarization, csolidangle
  * 
  *     cpos0 = numpy.ascontiguousarray(pos0.ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
  *     dpos0 = numpy.ascontiguousarray(delta_pos0.ravel(), dtype=numpy.float32)
  * 
  */
-  __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_7);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-  __pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_v_pos0), __pyx_n_s__ravel); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_pos0), __pyx_n_s__ravel); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_7);
-  __pyx_t_1 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-  __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __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 = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_6 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__float32); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__float32); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-  __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_t_9 = ((PyArrayObject *)__pyx_t_6);
   {
     __Pyx_BufFmt_StackElem __pyx_stack[1];
@@ -2569,49 +2727,49 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
       }
     }
     __pyx_pybuffernd_cpos0.diminfo[0].strides = __pyx_pybuffernd_cpos0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cpos0.diminfo[0].shape = __pyx_pybuffernd_cpos0.rcbuffer->pybuffer.shape[0];
-    if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   __pyx_t_9 = 0;
   __pyx_v_cpos0 = ((PyArrayObject *)__pyx_t_6);
   __pyx_t_6 = 0;
 
-  /* "splitBBox.pyx":103
+  /* "splitBBox.pyx":104
  * 
  *     cpos0 = numpy.ascontiguousarray(pos0.ravel(), dtype=numpy.float32)
  *     dpos0 = numpy.ascontiguousarray(delta_pos0.ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
  * 
  *     cdef numpy.ndarray[numpy.float64_t, ndim = 1] outData = numpy.zeros(bins, dtype=numpy.float64)
  */
-  __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-  __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_delta_pos0), __pyx_n_s__ravel); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_delta_pos0), __pyx_n_s__ravel); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __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 = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __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 = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_7);
   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
   PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7);
   __Pyx_GIVEREF(__pyx_t_7);
   __pyx_t_7 = 0;
-  __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_7));
-  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__float32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__float32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __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_6), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 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 = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_t_9 = ((PyArrayObject *)__pyx_t_3);
   {
     __Pyx_BufFmt_StackElem __pyx_stack[1];
@@ -2627,52 +2785,52 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
       }
     }
     __pyx_pybuffernd_dpos0.diminfo[0].strides = __pyx_pybuffernd_dpos0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dpos0.diminfo[0].shape = __pyx_pybuffernd_dpos0.rcbuffer->pybuffer.shape[0];
-    if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   __pyx_t_9 = 0;
   __pyx_v_dpos0 = ((PyArrayObject *)__pyx_t_3);
   __pyx_t_3 = 0;
 
-  /* "splitBBox.pyx":105
+  /* "splitBBox.pyx":106
  *     dpos0 = numpy.ascontiguousarray(delta_pos0.ravel(), dtype=numpy.float32)
  * 
  *     cdef numpy.ndarray[numpy.float64_t, ndim = 1] outData = numpy.zeros(bins, dtype=numpy.float64)             # <<<<<<<<<<<<<<
  *     cdef numpy.ndarray[numpy.float64_t, ndim = 1] outCount = numpy.zeros(bins, dtype=numpy.float64)
  *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] outMerge = numpy.zeros(bins, dtype=numpy.float32)
  */
-  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_7 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__zeros); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__zeros); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_7);
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_bins); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_bins); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
   PyTuple_SET_ITEM(__pyx_t_6, 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 = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__float64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_t_4 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_t_14 = ((PyArrayObject *)__pyx_t_4);
   {
     __Pyx_BufFmt_StackElem __pyx_stack[1];
     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outData.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__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 = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __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];
     }
   }
@@ -2680,46 +2838,46 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
   __pyx_v_outData = ((PyArrayObject *)__pyx_t_4);
   __pyx_t_4 = 0;
 
-  /* "splitBBox.pyx":106
+  /* "splitBBox.pyx":107
  * 
  *     cdef numpy.ndarray[numpy.float64_t, ndim = 1] outData = numpy.zeros(bins, dtype=numpy.float64)
  *     cdef numpy.ndarray[numpy.float64_t, ndim = 1] outCount = numpy.zeros(bins, dtype=numpy.float64)             # <<<<<<<<<<<<<<
  *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] outMerge = numpy.zeros(bins, dtype=numpy.float32)
  * 
  */
-  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_v_bins); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_v_bins); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
   PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
   __Pyx_GIVEREF(__pyx_t_4);
   __pyx_t_4 = 0;
-  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-  __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_7);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__float64); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s__float64); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __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_6)); __pyx_t_6 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_t_15 = ((PyArrayObject *)__pyx_t_1);
   {
     __Pyx_BufFmt_StackElem __pyx_stack[1];
     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outCount.rcbuffer->pybuffer, (PyObject*)__pyx_t_15, &__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 = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __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];
     }
   }
@@ -2727,46 +2885,46 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
   __pyx_v_outCount = ((PyArrayObject *)__pyx_t_1);
   __pyx_t_1 = 0;
 
-  /* "splitBBox.pyx":107
+  /* "splitBBox.pyx":108
  *     cdef numpy.ndarray[numpy.float64_t, ndim = 1] outData = numpy.zeros(bins, dtype=numpy.float64)
  *     cdef numpy.ndarray[numpy.float64_t, ndim = 1] outCount = numpy.zeros(bins, dtype=numpy.float64)
  *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] outMerge = numpy.zeros(bins, dtype=numpy.float32)             # <<<<<<<<<<<<<<
  * 
  *     if  mask is not None:
  */
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_bins); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_bins); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __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 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_7 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__float32); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__float32); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_7);
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-  __pyx_t_7 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_7);
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-  if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_t_16 = ((PyArrayObject *)__pyx_t_7);
   {
     __Pyx_BufFmt_StackElem __pyx_stack[1];
     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outMerge.rcbuffer->pybuffer, (PyObject*)__pyx_t_16, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
       __pyx_v_outMerge = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.buf = NULL;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __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];
     }
   }
@@ -2774,7 +2932,7 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
   __pyx_v_outMerge = ((PyArrayObject *)__pyx_t_7);
   __pyx_t_7 = 0;
 
-  /* "splitBBox.pyx":109
+  /* "splitBBox.pyx":110
  *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] outMerge = numpy.zeros(bins, dtype=numpy.float32)
  * 
  *     if  mask is not None:             # <<<<<<<<<<<<<<
@@ -2782,9 +2940,10 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
  *         check_mask = True
  */
   __pyx_t_5 = (__pyx_v_mask != Py_None);
-  if (__pyx_t_5) {
+  __pyx_t_17 = (__pyx_t_5 != 0);
+  if (__pyx_t_17) {
 
-    /* "splitBBox.pyx":110
+    /* "splitBBox.pyx":111
  * 
  *     if  mask is not None:
  *         assert mask.size == size             # <<<<<<<<<<<<<<
@@ -2792,22 +2951,22 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
  *         cmask = numpy.ascontiguousarray(mask.ravel(),dtype=numpy.int8)
  */
     #ifndef CYTHON_WITHOUT_ASSERTIONS
-    __pyx_t_7 = PyObject_GetAttr(__pyx_v_mask, __pyx_n_s__size); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_mask, __pyx_n_s__size); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
-    __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_6 = PyObject_RichCompare(__pyx_t_7, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyObject_RichCompare(__pyx_t_7, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_17 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    if (unlikely(!__pyx_t_5)) {
+    if (unlikely(!__pyx_t_17)) {
       PyErr_SetNone(PyExc_AssertionError);
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     #endif
 
-    /* "splitBBox.pyx":111
+    /* "splitBBox.pyx":112
  *     if  mask is not None:
  *         assert mask.size == size
  *         check_mask = True             # <<<<<<<<<<<<<<
@@ -2816,69 +2975,69 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
  */
     __pyx_v_check_mask = 1;
 
-    /* "splitBBox.pyx":112
+    /* "splitBBox.pyx":113
  *         assert mask.size == size
  *         check_mask = True
  *         cmask = numpy.ascontiguousarray(mask.ravel(),dtype=numpy.int8)             # <<<<<<<<<<<<<<
  * 
  *     if (dummy is not None) and (delta_dummy is not None):
  */
-    __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_1 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_t_6 = PyObject_GetAttr(__pyx_v_mask, __pyx_n_s__ravel); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_mask, __pyx_n_s__ravel); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __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 = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __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 = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
     PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7);
     __Pyx_GIVEREF(__pyx_t_7);
     __pyx_t_7 = 0;
-    __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_7));
-    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__int8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __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_6), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __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_6)); __pyx_t_6 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
-    __pyx_t_17 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int8_t(__pyx_t_3);
-    if (unlikely(!__pyx_t_17.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_18 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int8_t(__pyx_t_3);
+    if (unlikely(!__pyx_t_18.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_v_cmask = __pyx_t_17;
-    __pyx_t_17.memview = NULL;
-    __pyx_t_17.data = NULL;
+    __pyx_v_cmask = __pyx_t_18;
+    __pyx_t_18.memview = NULL;
+    __pyx_t_18.data = NULL;
     goto __pyx_L3;
   }
   __pyx_L3:;
 
-  /* "splitBBox.pyx":114
+  /* "splitBBox.pyx":115
  *         cmask = numpy.ascontiguousarray(mask.ravel(),dtype=numpy.int8)
  * 
  *     if (dummy is not None) and (delta_dummy is not None):             # <<<<<<<<<<<<<<
  *         check_dummy = True
  *         cdummy =  float(dummy)
  */
-  __pyx_t_5 = (__pyx_v_dummy != Py_None);
-  if (__pyx_t_5) {
-    __pyx_t_18 = (__pyx_v_delta_dummy != Py_None);
-    __pyx_t_19 = __pyx_t_18;
+  __pyx_t_17 = (__pyx_v_dummy != Py_None);
+  if ((__pyx_t_17 != 0)) {
+    __pyx_t_5 = (__pyx_v_delta_dummy != Py_None);
+    __pyx_t_19 = (__pyx_t_5 != 0);
   } else {
-    __pyx_t_19 = __pyx_t_5;
+    __pyx_t_19 = (__pyx_t_17 != 0);
   }
   if (__pyx_t_19) {
 
-    /* "splitBBox.pyx":115
+    /* "splitBBox.pyx":116
  * 
  *     if (dummy is not None) and (delta_dummy is not None):
  *         check_dummy = True             # <<<<<<<<<<<<<<
@@ -2887,29 +3046,29 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
  */
     __pyx_v_check_dummy = 1;
 
-    /* "splitBBox.pyx":116
+    /* "splitBBox.pyx":117
  *     if (dummy is not None) and (delta_dummy is not None):
  *         check_dummy = True
  *         cdummy =  float(dummy)             # <<<<<<<<<<<<<<
  *         ddummy =  float(delta_dummy)
  *     elif (dummy is not None):
  */
-    __pyx_t_20 = __Pyx_PyObject_AsDouble(__pyx_v_dummy); if (unlikely(__pyx_t_20 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_20 = __Pyx_PyObject_AsDouble(__pyx_v_dummy); if (unlikely(__pyx_t_20 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_v_cdummy = __pyx_t_20;
 
-    /* "splitBBox.pyx":117
+    /* "splitBBox.pyx":118
  *         check_dummy = True
  *         cdummy =  float(dummy)
  *         ddummy =  float(delta_dummy)             # <<<<<<<<<<<<<<
  *     elif (dummy is not None):
  *         check_dummy = True
  */
-    __pyx_t_20 = __Pyx_PyObject_AsDouble(__pyx_v_delta_dummy); if (unlikely(__pyx_t_20 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_20 = __Pyx_PyObject_AsDouble(__pyx_v_delta_dummy); if (unlikely(__pyx_t_20 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_v_ddummy = __pyx_t_20;
     goto __pyx_L4;
   }
 
-  /* "splitBBox.pyx":118
+  /* "splitBBox.pyx":119
  *         cdummy =  float(dummy)
  *         ddummy =  float(delta_dummy)
  *     elif (dummy is not None):             # <<<<<<<<<<<<<<
@@ -2917,9 +3076,10 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
  *         cdummy = float(dummy)
  */
   __pyx_t_19 = (__pyx_v_dummy != Py_None);
-  if (__pyx_t_19) {
+  __pyx_t_17 = (__pyx_t_19 != 0);
+  if (__pyx_t_17) {
 
-    /* "splitBBox.pyx":119
+    /* "splitBBox.pyx":120
  *         ddummy =  float(delta_dummy)
  *     elif (dummy is not None):
  *         check_dummy = True             # <<<<<<<<<<<<<<
@@ -2928,17 +3088,17 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
  */
     __pyx_v_check_dummy = 1;
 
-    /* "splitBBox.pyx":120
+    /* "splitBBox.pyx":121
  *     elif (dummy is not None):
  *         check_dummy = True
  *         cdummy = float(dummy)             # <<<<<<<<<<<<<<
  *         ddummy = 0.0
  *     else:
  */
-    __pyx_t_20 = __Pyx_PyObject_AsDouble(__pyx_v_dummy); if (unlikely(__pyx_t_20 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_20 = __Pyx_PyObject_AsDouble(__pyx_v_dummy); if (unlikely(__pyx_t_20 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_v_cdummy = __pyx_t_20;
 
-    /* "splitBBox.pyx":121
+    /* "splitBBox.pyx":122
  *         check_dummy = True
  *         cdummy = float(dummy)
  *         ddummy = 0.0             # <<<<<<<<<<<<<<
@@ -2950,7 +3110,7 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
   }
   /*else*/ {
 
-    /* "splitBBox.pyx":123
+    /* "splitBBox.pyx":124
  *         ddummy = 0.0
  *     else:
  *         check_dummy = False             # <<<<<<<<<<<<<<
@@ -2959,7 +3119,7 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
  */
     __pyx_v_check_dummy = 0;
 
-    /* "splitBBox.pyx":124
+    /* "splitBBox.pyx":125
  *     else:
  *         check_dummy = False
  *         cdummy = 0.0             # <<<<<<<<<<<<<<
@@ -2968,7 +3128,7 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
  */
     __pyx_v_cdummy = 0.0;
 
-    /* "splitBBox.pyx":125
+    /* "splitBBox.pyx":126
  *         check_dummy = False
  *         cdummy = 0.0
  *         ddummy = 0.0             # <<<<<<<<<<<<<<
@@ -2979,17 +3139,18 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
   }
   __pyx_L4:;
 
-  /* "splitBBox.pyx":126
+  /* "splitBBox.pyx":127
  *         cdummy = 0.0
  *         ddummy = 0.0
  *     if dark is not None:             # <<<<<<<<<<<<<<
  *         assert dark.size == size
  *         do_dark = True
  */
-  __pyx_t_19 = (__pyx_v_dark != Py_None);
+  __pyx_t_17 = (__pyx_v_dark != Py_None);
+  __pyx_t_19 = (__pyx_t_17 != 0);
   if (__pyx_t_19) {
 
-    /* "splitBBox.pyx":127
+    /* "splitBBox.pyx":128
  *         ddummy = 0.0
  *     if dark is not None:
  *         assert dark.size == size             # <<<<<<<<<<<<<<
@@ -2997,22 +3158,22 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
  *         cdark = numpy.ascontiguousarray(dark.ravel(),dtype=numpy.float32)
  */
     #ifndef CYTHON_WITHOUT_ASSERTIONS
-    __pyx_t_3 = PyObject_GetAttr(__pyx_v_dark, __pyx_n_s__size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_dark, __pyx_n_s__size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_7 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
-    __pyx_t_6 = PyObject_RichCompare(__pyx_t_3, __pyx_t_7, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyObject_RichCompare(__pyx_t_3, __pyx_t_7, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-    __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
     if (unlikely(!__pyx_t_19)) {
       PyErr_SetNone(PyExc_AssertionError);
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     #endif
 
-    /* "splitBBox.pyx":128
+    /* "splitBBox.pyx":129
  *     if dark is not None:
  *         assert dark.size == size
  *         do_dark = True             # <<<<<<<<<<<<<<
@@ -3021,44 +3182,44 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
  */
     __pyx_v_do_dark = 1;
 
-    /* "splitBBox.pyx":129
+    /* "splitBBox.pyx":130
  *         assert dark.size == size
  *         do_dark = True
  *         cdark = numpy.ascontiguousarray(dark.ravel(),dtype=numpy.float32)             # <<<<<<<<<<<<<<
  *     if flat is not None:
  *         assert flat.size == size
  */
-    __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_7 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_t_6 = PyObject_GetAttr(__pyx_v_dark, __pyx_n_s__ravel); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_dark, __pyx_n_s__ravel); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_3 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
     PyTuple_SET_ITEM(__pyx_t_6, 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 = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__float32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_4 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
     __pyx_t_21 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_4);
-    if (unlikely(!__pyx_t_21.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(!__pyx_t_21.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     __pyx_v_cdark = __pyx_t_21;
     __pyx_t_21.memview = NULL;
@@ -3067,7 +3228,7 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
   }
   __pyx_L5:;
 
-  /* "splitBBox.pyx":130
+  /* "splitBBox.pyx":131
  *         do_dark = True
  *         cdark = numpy.ascontiguousarray(dark.ravel(),dtype=numpy.float32)
  *     if flat is not None:             # <<<<<<<<<<<<<<
@@ -3075,9 +3236,10 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
  *         do_flat = True
  */
   __pyx_t_19 = (__pyx_v_flat != Py_None);
-  if (__pyx_t_19) {
+  __pyx_t_17 = (__pyx_t_19 != 0);
+  if (__pyx_t_17) {
 
-    /* "splitBBox.pyx":131
+    /* "splitBBox.pyx":132
  *         cdark = numpy.ascontiguousarray(dark.ravel(),dtype=numpy.float32)
  *     if flat is not None:
  *         assert flat.size == size             # <<<<<<<<<<<<<<
@@ -3085,22 +3247,22 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
  *         cflat = numpy.ascontiguousarray(flat.ravel(),dtype=numpy.float32)
  */
     #ifndef CYTHON_WITHOUT_ASSERTIONS
-    __pyx_t_4 = PyObject_GetAttr(__pyx_v_flat, __pyx_n_s__size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_flat, __pyx_n_s__size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_17 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    if (unlikely(!__pyx_t_19)) {
+    if (unlikely(!__pyx_t_17)) {
       PyErr_SetNone(PyExc_AssertionError);
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     #endif
 
-    /* "splitBBox.pyx":132
+    /* "splitBBox.pyx":133
  *     if flat is not None:
  *         assert flat.size == size
  *         do_flat = True             # <<<<<<<<<<<<<<
@@ -3109,44 +3271,44 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
  */
     __pyx_v_do_flat = 1;
 
-    /* "splitBBox.pyx":133
+    /* "splitBBox.pyx":134
  *         assert flat.size == size
  *         do_flat = True
  *         cflat = numpy.ascontiguousarray(flat.ravel(),dtype=numpy.float32)             # <<<<<<<<<<<<<<
  *     if polarization is not None:
  *         do_polarization = True
  */
-    __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_3 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_t_6 = PyObject_GetAttr(__pyx_v_flat, __pyx_n_s__ravel); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_flat, __pyx_n_s__ravel); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_4 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
     PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
     __Pyx_GIVEREF(__pyx_t_4);
     __pyx_t_4 = 0;
-    __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-    __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
-    __pyx_t_1 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__float32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s__float32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-    if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __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_6)); __pyx_t_6 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
     __pyx_t_21 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_1);
-    if (unlikely(!__pyx_t_21.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(!__pyx_t_21.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __pyx_v_cflat = __pyx_t_21;
     __pyx_t_21.memview = NULL;
@@ -3155,17 +3317,18 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
   }
   __pyx_L6:;
 
-  /* "splitBBox.pyx":134
+  /* "splitBBox.pyx":135
  *         do_flat = True
  *         cflat = numpy.ascontiguousarray(flat.ravel(),dtype=numpy.float32)
  *     if polarization is not None:             # <<<<<<<<<<<<<<
  *         do_polarization = True
  *         assert polarization.size == size
  */
-  __pyx_t_19 = (__pyx_v_polarization != Py_None);
+  __pyx_t_17 = (__pyx_v_polarization != Py_None);
+  __pyx_t_19 = (__pyx_t_17 != 0);
   if (__pyx_t_19) {
 
-    /* "splitBBox.pyx":135
+    /* "splitBBox.pyx":136
  *         cflat = numpy.ascontiguousarray(flat.ravel(),dtype=numpy.float32)
  *     if polarization is not None:
  *         do_polarization = True             # <<<<<<<<<<<<<<
@@ -3174,7 +3337,7 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
  */
     __pyx_v_do_polarization = 1;
 
-    /* "splitBBox.pyx":136
+    /* "splitBBox.pyx":137
  *     if polarization is not None:
  *         do_polarization = True
  *         assert polarization.size == size             # <<<<<<<<<<<<<<
@@ -3182,59 +3345,59 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
  *     if solidangle is not None:
  */
     #ifndef CYTHON_WITHOUT_ASSERTIONS
-    __pyx_t_1 = PyObject_GetAttr(__pyx_v_polarization, __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_polarization, __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_6 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
     if (unlikely(!__pyx_t_19)) {
       PyErr_SetNone(PyExc_AssertionError);
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     #endif
 
-    /* "splitBBox.pyx":137
+    /* "splitBBox.pyx":138
  *         do_polarization = True
  *         assert polarization.size == size
  *         cpolarization = numpy.ascontiguousarray(polarization.ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
  *     if solidangle is not None:
  *         do_solidangle = True
  */
-    __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_4 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_t_6 = PyObject_GetAttr(__pyx_v_polarization, __pyx_n_s__ravel); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_polarization, __pyx_n_s__ravel); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_1 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __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 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_7 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__float32); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__float32); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-    __pyx_t_7 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
     __pyx_t_21 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_7);
-    if (unlikely(!__pyx_t_21.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(!__pyx_t_21.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
     __pyx_v_cpolarization = __pyx_t_21;
     __pyx_t_21.memview = NULL;
@@ -3243,7 +3406,7 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
   }
   __pyx_L7:;
 
-  /* "splitBBox.pyx":138
+  /* "splitBBox.pyx":139
  *         assert polarization.size == size
  *         cpolarization = numpy.ascontiguousarray(polarization.ravel(), dtype=numpy.float32)
  *     if solidangle is not None:             # <<<<<<<<<<<<<<
@@ -3251,9 +3414,10 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
  *         assert solidangle.size == size
  */
   __pyx_t_19 = (__pyx_v_solidangle != Py_None);
-  if (__pyx_t_19) {
+  __pyx_t_17 = (__pyx_t_19 != 0);
+  if (__pyx_t_17) {
 
-    /* "splitBBox.pyx":139
+    /* "splitBBox.pyx":140
  *         cpolarization = numpy.ascontiguousarray(polarization.ravel(), dtype=numpy.float32)
  *     if solidangle is not None:
  *         do_solidangle = True             # <<<<<<<<<<<<<<
@@ -3262,7 +3426,7 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
  */
     __pyx_v_do_solidangle = 1;
 
-    /* "splitBBox.pyx":140
+    /* "splitBBox.pyx":141
  *     if solidangle is not None:
  *         do_solidangle = True
  *         assert solidangle.size == size             # <<<<<<<<<<<<<<
@@ -3270,59 +3434,59 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
  * 
  */
     #ifndef CYTHON_WITHOUT_ASSERTIONS
-    __pyx_t_7 = PyObject_GetAttr(__pyx_v_solidangle, __pyx_n_s__size); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_solidangle, __pyx_n_s__size); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
-    __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_6 = PyObject_RichCompare(__pyx_t_7, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyObject_RichCompare(__pyx_t_7, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_17 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    if (unlikely(!__pyx_t_19)) {
+    if (unlikely(!__pyx_t_17)) {
       PyErr_SetNone(PyExc_AssertionError);
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     #endif
 
-    /* "splitBBox.pyx":141
+    /* "splitBBox.pyx":142
  *         do_solidangle = True
  *         assert solidangle.size == size
  *         csolidangle = numpy.ascontiguousarray(solidangle.ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
  * 
  * 
  */
-    __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_1 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_t_6 = PyObject_GetAttr(__pyx_v_solidangle, __pyx_n_s__ravel); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_solidangle, __pyx_n_s__ravel); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __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 = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __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 = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
     PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7);
     __Pyx_GIVEREF(__pyx_t_7);
     __pyx_t_7 = 0;
-    __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_7));
-    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__float32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__float32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __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_6), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
     __pyx_t_21 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_3);
-    if (unlikely(!__pyx_t_21.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(!__pyx_t_21.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     __pyx_v_csolidangle = __pyx_t_21;
     __pyx_t_21.memview = NULL;
@@ -3331,40 +3495,40 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
   }
   __pyx_L8:;
 
-  /* "splitBBox.pyx":144
+  /* "splitBBox.pyx":145
  * 
  * 
  *     cpos0_lower = numpy.zeros(size, dtype=numpy.float32)             # <<<<<<<<<<<<<<
  *     cpos0_upper = numpy.zeros(size, dtype=numpy.float32)
  *     pos0_min=cpos0[0]
  */
-  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_7 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__zeros); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__zeros); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_7);
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
   PyTuple_SET_ITEM(__pyx_t_6, 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 = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__float32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_t_4 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_t_9 = ((PyArrayObject *)__pyx_t_4);
   {
     __Pyx_BufFmt_StackElem __pyx_stack[1];
@@ -3380,46 +3544,46 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
       }
     }
     __pyx_pybuffernd_cpos0_lower.diminfo[0].strides = __pyx_pybuffernd_cpos0_lower.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cpos0_lower.diminfo[0].shape = __pyx_pybuffernd_cpos0_lower.rcbuffer->pybuffer.shape[0];
-    if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   __pyx_t_9 = 0;
   __pyx_v_cpos0_lower = ((PyArrayObject *)__pyx_t_4);
   __pyx_t_4 = 0;
 
-  /* "splitBBox.pyx":145
+  /* "splitBBox.pyx":146
  * 
  *     cpos0_lower = numpy.zeros(size, dtype=numpy.float32)
  *     cpos0_upper = numpy.zeros(size, dtype=numpy.float32)             # <<<<<<<<<<<<<<
  *     pos0_min=cpos0[0]
  *     pos0_max=cpos0[0]
  */
-  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
   PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
   __Pyx_GIVEREF(__pyx_t_4);
   __pyx_t_4 = 0;
-  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-  __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_7);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__float32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s__float32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __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_6)); __pyx_t_6 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_t_9 = ((PyArrayObject *)__pyx_t_1);
   {
     __Pyx_BufFmt_StackElem __pyx_stack[1];
@@ -3435,13 +3599,13 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
       }
     }
     __pyx_pybuffernd_cpos0_upper.diminfo[0].strides = __pyx_pybuffernd_cpos0_upper.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cpos0_upper.diminfo[0].shape = __pyx_pybuffernd_cpos0_upper.rcbuffer->pybuffer.shape[0];
-    if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   __pyx_t_9 = 0;
   __pyx_v_cpos0_upper = ((PyArrayObject *)__pyx_t_1);
   __pyx_t_1 = 0;
 
-  /* "splitBBox.pyx":146
+  /* "splitBBox.pyx":147
  *     cpos0_lower = numpy.zeros(size, dtype=numpy.float32)
  *     cpos0_upper = numpy.zeros(size, dtype=numpy.float32)
  *     pos0_min=cpos0[0]             # <<<<<<<<<<<<<<
@@ -3451,7 +3615,7 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
   __pyx_t_22 = 0;
   __pyx_v_pos0_min = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cpos0.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_cpos0.diminfo[0].strides));
 
-  /* "splitBBox.pyx":147
+  /* "splitBBox.pyx":148
  *     cpos0_upper = numpy.zeros(size, dtype=numpy.float32)
  *     pos0_min=cpos0[0]
  *     pos0_max=cpos0[0]             # <<<<<<<<<<<<<<
@@ -3461,84 +3625,113 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
   __pyx_t_23 = 0;
   __pyx_v_pos0_max = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cpos0.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_cpos0.diminfo[0].strides));
 
-  /* "splitBBox.pyx":148
+  /* "splitBBox.pyx":149
  *     pos0_min=cpos0[0]
  *     pos0_max=cpos0[0]
  *     with nogil:             # <<<<<<<<<<<<<<
  *         for idx in range(size):
- *             min0 = cpos0[idx] - dpos0[idx]
+ *             if (check_mask) and (cmask[idx]):
  */
   {
       #ifdef WITH_THREAD
-      PyThreadState *_save = NULL;
-      #endif
+      PyThreadState *_save;
       Py_UNBLOCK_THREADS
+      #endif
       /*try:*/ {
 
-        /* "splitBBox.pyx":149
+        /* "splitBBox.pyx":150
  *     pos0_max=cpos0[0]
  *     with nogil:
  *         for idx in range(size):             # <<<<<<<<<<<<<<
- *             min0 = cpos0[idx] - dpos0[idx]
- *             max0 = cpos0[idx] + dpos0[idx]
+ *             if (check_mask) and (cmask[idx]):
+ *                 continue
  */
         __pyx_t_2 = __pyx_v_size;
         for (__pyx_t_24 = 0; __pyx_t_24 < __pyx_t_2; __pyx_t_24+=1) {
           __pyx_v_idx = __pyx_t_24;
 
-          /* "splitBBox.pyx":150
+          /* "splitBBox.pyx":151
  *     with nogil:
  *         for idx in range(size):
+ *             if (check_mask) and (cmask[idx]):             # <<<<<<<<<<<<<<
+ *                 continue
+ *             min0 = cpos0[idx] - dpos0[idx]
+ */
+          __pyx_t_17 = __pyx_v_check_mask;
+          if (__pyx_t_17) {
+            if (unlikely(!__pyx_v_cmask.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cmask"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L10;} }
+            __pyx_t_25 = __pyx_v_idx;
+            __pyx_t_19 = ((*((__pyx_t_5numpy_int8_t *) ( /* dim=0 */ (__pyx_v_cmask.data + __pyx_t_25 * __pyx_v_cmask.strides[0]) ))) != 0);
+          } else {
+            __pyx_t_19 = __pyx_t_17;
+          }
+          if (__pyx_t_19) {
+
+            /* "splitBBox.pyx":152
+ *         for idx in range(size):
+ *             if (check_mask) and (cmask[idx]):
+ *                 continue             # <<<<<<<<<<<<<<
+ *             min0 = cpos0[idx] - dpos0[idx]
+ *             max0 = cpos0[idx] + dpos0[idx]
+ */
+            goto __pyx_L12_continue;
+            goto __pyx_L14;
+          }
+          __pyx_L14:;
+
+          /* "splitBBox.pyx":153
+ *             if (check_mask) and (cmask[idx]):
+ *                 continue
  *             min0 = cpos0[idx] - dpos0[idx]             # <<<<<<<<<<<<<<
  *             max0 = cpos0[idx] + dpos0[idx]
  *             cpos0_upper[idx]=max0
  */
-          __pyx_t_25 = __pyx_v_idx;
           __pyx_t_26 = __pyx_v_idx;
-          __pyx_v_min0 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cpos0.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_cpos0.diminfo[0].strides)) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_dpos0.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_dpos0.diminfo[0].strides)));
+          __pyx_t_27 = __pyx_v_idx;
+          __pyx_v_min0 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cpos0.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_cpos0.diminfo[0].strides)) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_dpos0.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_dpos0.diminfo[0].strides)));
 
-          /* "splitBBox.pyx":151
- *         for idx in range(size):
+          /* "splitBBox.pyx":154
+ *                 continue
  *             min0 = cpos0[idx] - dpos0[idx]
  *             max0 = cpos0[idx] + dpos0[idx]             # <<<<<<<<<<<<<<
  *             cpos0_upper[idx]=max0
  *             cpos0_lower[idx]=min0
  */
-          __pyx_t_27 = __pyx_v_idx;
           __pyx_t_28 = __pyx_v_idx;
-          __pyx_v_max0 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cpos0.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_cpos0.diminfo[0].strides)) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_dpos0.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_dpos0.diminfo[0].strides)));
+          __pyx_t_29 = __pyx_v_idx;
+          __pyx_v_max0 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cpos0.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_cpos0.diminfo[0].strides)) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_dpos0.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_dpos0.diminfo[0].strides)));
 
-          /* "splitBBox.pyx":152
+          /* "splitBBox.pyx":155
  *             min0 = cpos0[idx] - dpos0[idx]
  *             max0 = cpos0[idx] + dpos0[idx]
  *             cpos0_upper[idx]=max0             # <<<<<<<<<<<<<<
  *             cpos0_lower[idx]=min0
  *             if max0>pos0_max:
  */
-          __pyx_t_29 = __pyx_v_idx;
-          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cpos0_upper.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_cpos0_upper.diminfo[0].strides) = __pyx_v_max0;
+          __pyx_t_30 = __pyx_v_idx;
+          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cpos0_upper.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_cpos0_upper.diminfo[0].strides) = __pyx_v_max0;
 
-          /* "splitBBox.pyx":153
+          /* "splitBBox.pyx":156
  *             max0 = cpos0[idx] + dpos0[idx]
  *             cpos0_upper[idx]=max0
  *             cpos0_lower[idx]=min0             # <<<<<<<<<<<<<<
  *             if max0>pos0_max:
  *                 pos0_max=max0
  */
-          __pyx_t_30 = __pyx_v_idx;
-          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cpos0_lower.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_cpos0_lower.diminfo[0].strides) = __pyx_v_min0;
+          __pyx_t_31 = __pyx_v_idx;
+          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cpos0_lower.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_cpos0_lower.diminfo[0].strides) = __pyx_v_min0;
 
-          /* "splitBBox.pyx":154
+          /* "splitBBox.pyx":157
  *             cpos0_upper[idx]=max0
  *             cpos0_lower[idx]=min0
  *             if max0>pos0_max:             # <<<<<<<<<<<<<<
  *                 pos0_max=max0
  *             if min0<pos0_min:
  */
-          __pyx_t_19 = (__pyx_v_max0 > __pyx_v_pos0_max);
+          __pyx_t_19 = ((__pyx_v_max0 > __pyx_v_pos0_max) != 0);
           if (__pyx_t_19) {
 
-            /* "splitBBox.pyx":155
+            /* "splitBBox.pyx":158
  *             cpos0_lower[idx]=min0
  *             if max0>pos0_max:
  *                 pos0_max=max0             # <<<<<<<<<<<<<<
@@ -3546,21 +3739,21 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
  *                 pos0_min=min0
  */
             __pyx_v_pos0_max = __pyx_v_max0;
-            goto __pyx_L14;
+            goto __pyx_L15;
           }
-          __pyx_L14:;
+          __pyx_L15:;
 
-          /* "splitBBox.pyx":156
+          /* "splitBBox.pyx":159
  *             if max0>pos0_max:
  *                 pos0_max=max0
  *             if min0<pos0_min:             # <<<<<<<<<<<<<<
  *                 pos0_min=min0
  * 
  */
-          __pyx_t_19 = (__pyx_v_min0 < __pyx_v_pos0_min);
+          __pyx_t_19 = ((__pyx_v_min0 < __pyx_v_pos0_min) != 0);
           if (__pyx_t_19) {
 
-            /* "splitBBox.pyx":157
+            /* "splitBBox.pyx":160
  *                 pos0_max=max0
  *             if min0<pos0_min:
  *                 pos0_min=min0             # <<<<<<<<<<<<<<
@@ -3568,25 +3761,35 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
  *     if pos0Range is not None and len(pos0Range) > 1:
  */
             __pyx_v_pos0_min = __pyx_v_min0;
-            goto __pyx_L15;
+            goto __pyx_L16;
           }
-          __pyx_L15:;
+          __pyx_L16:;
+          __pyx_L12_continue:;
         }
       }
 
-      /* "splitBBox.pyx":148
+      /* "splitBBox.pyx":149
  *     pos0_min=cpos0[0]
  *     pos0_max=cpos0[0]
  *     with nogil:             # <<<<<<<<<<<<<<
  *         for idx in range(size):
- *             min0 = cpos0[idx] - dpos0[idx]
+ *             if (check_mask) and (cmask[idx]):
  */
       /*finally:*/ {
+        int __pyx_why;
+        __pyx_why = 0; goto __pyx_L11;
+        __pyx_L10: __pyx_why = 4; goto __pyx_L11;
+        __pyx_L11:;
+        #ifdef WITH_THREAD
         Py_BLOCK_THREADS
+        #endif
+        switch (__pyx_why) {
+          case 4: goto __pyx_L1_error;
+        }
       }
   }
 
-  /* "splitBBox.pyx":159
+  /* "splitBBox.pyx":162
  *                 pos0_min=min0
  * 
  *     if pos0Range is not None and len(pos0Range) > 1:             # <<<<<<<<<<<<<<
@@ -3594,57 +3797,57 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
  *         pos0_maxin = max(pos0Range)
  */
   __pyx_t_19 = (__pyx_v_pos0Range != Py_None);
-  if (__pyx_t_19) {
-    __pyx_t_31 = PyObject_Length(__pyx_v_pos0Range); if (unlikely(__pyx_t_31 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_5 = (__pyx_t_31 > 1);
-    __pyx_t_18 = __pyx_t_5;
+  if ((__pyx_t_19 != 0)) {
+    __pyx_t_32 = PyObject_Length(__pyx_v_pos0Range); if (unlikely(__pyx_t_32 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_17 = ((__pyx_t_32 > 1) != 0);
+    __pyx_t_5 = __pyx_t_17;
   } else {
-    __pyx_t_18 = __pyx_t_19;
+    __pyx_t_5 = (__pyx_t_19 != 0);
   }
-  if (__pyx_t_18) {
+  if (__pyx_t_5) {
 
-    /* "splitBBox.pyx":160
+    /* "splitBBox.pyx":163
  * 
  *     if pos0Range is not None and len(pos0Range) > 1:
  *         pos0_min = min(pos0Range)             # <<<<<<<<<<<<<<
  *         pos0_maxin = max(pos0Range)
  *     else:
  */
-    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_INCREF(__pyx_v_pos0Range);
     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_pos0Range);
     __Pyx_GIVEREF(__pyx_v_pos0Range);
-    __pyx_t_4 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-    __pyx_t_32 = __pyx_PyFloat_AsFloat(__pyx_t_4); if (unlikely((__pyx_t_32 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_33 = __pyx_PyFloat_AsFloat(__pyx_t_4); if (unlikely((__pyx_t_33 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_v_pos0_min = __pyx_t_32;
+    __pyx_v_pos0_min = __pyx_t_33;
 
-    /* "splitBBox.pyx":161
+    /* "splitBBox.pyx":164
  *     if pos0Range is not None and len(pos0Range) > 1:
  *         pos0_min = min(pos0Range)
  *         pos0_maxin = max(pos0Range)             # <<<<<<<<<<<<<<
  *     else:
  *         pos0_maxin = pos0_max
  */
-    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __Pyx_INCREF(__pyx_v_pos0Range);
     PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_pos0Range);
     __Pyx_GIVEREF(__pyx_v_pos0Range);
-    __pyx_t_1 = PyObject_Call(__pyx_builtin_max, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_Call(__pyx_builtin_max, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-    __pyx_t_32 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_32 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_33 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_33 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_v_pos0_maxin = __pyx_t_32;
-    goto __pyx_L16;
+    __pyx_v_pos0_maxin = __pyx_t_33;
+    goto __pyx_L18;
   }
   /*else*/ {
 
-    /* "splitBBox.pyx":163
+    /* "splitBBox.pyx":166
  *         pos0_maxin = max(pos0Range)
  *     else:
  *         pos0_maxin = pos0_max             # <<<<<<<<<<<<<<
@@ -3653,59 +3856,59 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
  */
     __pyx_v_pos0_maxin = __pyx_v_pos0_max;
   }
-  __pyx_L16:;
+  __pyx_L18:;
 
-  /* "splitBBox.pyx":164
+  /* "splitBBox.pyx":167
  *     else:
  *         pos0_maxin = pos0_max
  *     if pos0_min<0: pos0_min=0             # <<<<<<<<<<<<<<
  *     pos0_max = pos0_maxin * EPS32
  * 
  */
-  __pyx_t_18 = (__pyx_v_pos0_min < 0.0);
-  if (__pyx_t_18) {
+  __pyx_t_5 = ((__pyx_v_pos0_min < 0.0) != 0);
+  if (__pyx_t_5) {
     __pyx_v_pos0_min = 0.0;
-    goto __pyx_L17;
+    goto __pyx_L19;
   }
-  __pyx_L17:;
+  __pyx_L19:;
 
-  /* "splitBBox.pyx":165
+  /* "splitBBox.pyx":168
  *         pos0_maxin = pos0_max
  *     if pos0_min<0: pos0_min=0
  *     pos0_max = pos0_maxin * EPS32             # <<<<<<<<<<<<<<
  * 
  *     if pos1Range is not None and len(pos1Range) > 1:
  */
-  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_pos0_maxin); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_pos0_maxin); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__EPS32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__EPS32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_6 = PyNumber_Multiply(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = PyNumber_Multiply(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_t_32 = __pyx_PyFloat_AsFloat(__pyx_t_6); if (unlikely((__pyx_t_32 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_33 = __pyx_PyFloat_AsFloat(__pyx_t_6); if (unlikely((__pyx_t_33 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-  __pyx_v_pos0_max = __pyx_t_32;
+  __pyx_v_pos0_max = __pyx_t_33;
 
-  /* "splitBBox.pyx":167
+  /* "splitBBox.pyx":170
  *     pos0_max = pos0_maxin * EPS32
  * 
  *     if pos1Range is not None and len(pos1Range) > 1:             # <<<<<<<<<<<<<<
  *         assert pos1.size == size
  *         assert delta_pos1.size == size
  */
-  __pyx_t_18 = (__pyx_v_pos1Range != Py_None);
-  if (__pyx_t_18) {
-    __pyx_t_31 = PyObject_Length(__pyx_v_pos1Range); if (unlikely(__pyx_t_31 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_19 = (__pyx_t_31 > 1);
-    __pyx_t_5 = __pyx_t_19;
+  __pyx_t_5 = (__pyx_v_pos1Range != Py_None);
+  if ((__pyx_t_5 != 0)) {
+    __pyx_t_32 = PyObject_Length(__pyx_v_pos1Range); if (unlikely(__pyx_t_32 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_19 = ((__pyx_t_32 > 1) != 0);
+    __pyx_t_17 = __pyx_t_19;
   } else {
-    __pyx_t_5 = __pyx_t_18;
+    __pyx_t_17 = (__pyx_t_5 != 0);
   }
-  if (__pyx_t_5) {
+  if (__pyx_t_17) {
 
-    /* "splitBBox.pyx":168
+    /* "splitBBox.pyx":171
  * 
  *     if pos1Range is not None and len(pos1Range) > 1:
  *         assert pos1.size == size             # <<<<<<<<<<<<<<
@@ -3713,22 +3916,22 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
  *         check_pos1 = 1
  */
     #ifndef CYTHON_WITHOUT_ASSERTIONS
-    __pyx_t_6 = PyObject_GetAttr(__pyx_v_pos1, __pyx_n_s__size); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_pos1, __pyx_n_s__size); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_1 = PyObject_RichCompare(__pyx_t_6, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_RichCompare(__pyx_t_6, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_17 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    if (unlikely(!__pyx_t_5)) {
+    if (unlikely(!__pyx_t_17)) {
       PyErr_SetNone(PyExc_AssertionError);
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     #endif
 
-    /* "splitBBox.pyx":169
+    /* "splitBBox.pyx":172
  *     if pos1Range is not None and len(pos1Range) > 1:
  *         assert pos1.size == size
  *         assert delta_pos1.size == size             # <<<<<<<<<<<<<<
@@ -3736,22 +3939,22 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
  *         cpos1 = numpy.ascontiguousarray(pos1.ravel(),dtype=numpy.float32)
  */
     #ifndef CYTHON_WITHOUT_ASSERTIONS
-    __pyx_t_1 = PyObject_GetAttr(__pyx_v_delta_pos1, __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_delta_pos1, __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_v_size); 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);
-    __pyx_t_6 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_17 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    if (unlikely(!__pyx_t_5)) {
+    if (unlikely(!__pyx_t_17)) {
       PyErr_SetNone(PyExc_AssertionError);
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     #endif
 
-    /* "splitBBox.pyx":170
+    /* "splitBBox.pyx":173
  *         assert pos1.size == size
  *         assert delta_pos1.size == size
  *         check_pos1 = 1             # <<<<<<<<<<<<<<
@@ -3760,43 +3963,43 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
  */
     __pyx_v_check_pos1 = 1;
 
-    /* "splitBBox.pyx":171
+    /* "splitBBox.pyx":174
  *         assert delta_pos1.size == size
  *         check_pos1 = 1
  *         cpos1 = numpy.ascontiguousarray(pos1.ravel(),dtype=numpy.float32)             # <<<<<<<<<<<<<<
  *         dpos1 = numpy.ascontiguousarray(delta_pos1.ravel(),dtype=numpy.float32)
  *         pos1_min = min(pos1Range)
  */
-    __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_4 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_t_6 = PyObject_GetAttr(__pyx_v_pos1, __pyx_n_s__ravel); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_pos1, __pyx_n_s__ravel); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_1 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __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 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_7 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__float32); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__float32); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-    __pyx_t_7 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-    if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_t_9 = ((PyArrayObject *)__pyx_t_7);
     {
       __Pyx_BufFmt_StackElem __pyx_stack[1];
@@ -3812,49 +4015,49 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
         }
       }
       __pyx_pybuffernd_cpos1.diminfo[0].strides = __pyx_pybuffernd_cpos1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cpos1.diminfo[0].shape = __pyx_pybuffernd_cpos1.rcbuffer->pybuffer.shape[0];
-      if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     __pyx_t_9 = 0;
     __pyx_v_cpos1 = ((PyArrayObject *)__pyx_t_7);
     __pyx_t_7 = 0;
 
-    /* "splitBBox.pyx":172
+    /* "splitBBox.pyx":175
  *         check_pos1 = 1
  *         cpos1 = numpy.ascontiguousarray(pos1.ravel(),dtype=numpy.float32)
  *         dpos1 = numpy.ascontiguousarray(delta_pos1.ravel(),dtype=numpy.float32)             # <<<<<<<<<<<<<<
  *         pos1_min = min(pos1Range)
  *         pos1_maxin = max(pos1Range)
  */
-    __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
-    __pyx_t_1 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __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 = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-    __pyx_t_7 = PyObject_GetAttr(__pyx_v_delta_pos1, __pyx_n_s__ravel); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_delta_pos1, __pyx_n_s__ravel); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __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 = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __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 = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
     __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 = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __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 = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_6));
-    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__float32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__float32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __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_7), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __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_7)); __pyx_t_7 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 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 = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_t_9 = ((PyArrayObject *)__pyx_t_3);
     {
       __Pyx_BufFmt_StackElem __pyx_stack[1];
@@ -3870,73 +4073,73 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
         }
       }
       __pyx_pybuffernd_dpos1.diminfo[0].strides = __pyx_pybuffernd_dpos1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dpos1.diminfo[0].shape = __pyx_pybuffernd_dpos1.rcbuffer->pybuffer.shape[0];
-      if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     __pyx_t_9 = 0;
     __pyx_v_dpos1 = ((PyArrayObject *)__pyx_t_3);
     __pyx_t_3 = 0;
 
-    /* "splitBBox.pyx":173
+    /* "splitBBox.pyx":176
  *         cpos1 = numpy.ascontiguousarray(pos1.ravel(),dtype=numpy.float32)
  *         dpos1 = numpy.ascontiguousarray(delta_pos1.ravel(),dtype=numpy.float32)
  *         pos1_min = min(pos1Range)             # <<<<<<<<<<<<<<
  *         pos1_maxin = max(pos1Range)
  *         pos1_max = pos1_maxin * EPS32
  */
-    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __Pyx_INCREF(__pyx_v_pos1Range);
     PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_pos1Range);
     __Pyx_GIVEREF(__pyx_v_pos1Range);
-    __pyx_t_6 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
     __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-    __pyx_t_32 = __pyx_PyFloat_AsFloat(__pyx_t_6); if (unlikely((__pyx_t_32 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_33 = __pyx_PyFloat_AsFloat(__pyx_t_6); if (unlikely((__pyx_t_33 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_v_pos1_min = __pyx_t_32;
+    __pyx_v_pos1_min = __pyx_t_33;
 
-    /* "splitBBox.pyx":174
+    /* "splitBBox.pyx":177
  *         dpos1 = numpy.ascontiguousarray(delta_pos1.ravel(),dtype=numpy.float32)
  *         pos1_min = min(pos1Range)
  *         pos1_maxin = max(pos1Range)             # <<<<<<<<<<<<<<
  *         pos1_max = pos1_maxin * EPS32
  * 
  */
-    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
     __Pyx_INCREF(__pyx_v_pos1Range);
     PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_pos1Range);
     __Pyx_GIVEREF(__pyx_v_pos1Range);
-    __pyx_t_3 = PyObject_Call(__pyx_builtin_max, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_max, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
-    __pyx_t_32 = __pyx_PyFloat_AsFloat(__pyx_t_3); if (unlikely((__pyx_t_32 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_33 = __pyx_PyFloat_AsFloat(__pyx_t_3); if (unlikely((__pyx_t_33 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_v_pos1_maxin = __pyx_t_32;
+    __pyx_v_pos1_maxin = __pyx_t_33;
 
-    /* "splitBBox.pyx":175
+    /* "splitBBox.pyx":178
  *         pos1_min = min(pos1Range)
  *         pos1_maxin = max(pos1Range)
  *         pos1_max = pos1_maxin * EPS32             # <<<<<<<<<<<<<<
  * 
  *     cdef float delta = (pos0_max - pos0_min) / (< float > (bins))
  */
-    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_pos1_maxin); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_pos1_maxin); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__EPS32); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__EPS32); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_7 = PyNumber_Multiply(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = PyNumber_Multiply(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_t_32 = __pyx_PyFloat_AsFloat(__pyx_t_7); if (unlikely((__pyx_t_32 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_33 = __pyx_PyFloat_AsFloat(__pyx_t_7); if (unlikely((__pyx_t_33 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-    __pyx_v_pos1_max = __pyx_t_32;
-    goto __pyx_L18;
+    __pyx_v_pos1_max = __pyx_t_33;
+    goto __pyx_L20;
   }
-  __pyx_L18:;
+  __pyx_L20:;
 
-  /* "splitBBox.pyx":177
+  /* "splitBBox.pyx":180
  *         pos1_max = pos1_maxin * EPS32
  * 
  *     cdef float delta = (pos0_max - pos0_min) / (< float > (bins))             # <<<<<<<<<<<<<<
@@ -3945,25 +4148,25 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
  */
   __pyx_v_delta = ((__pyx_v_pos0_max - __pyx_v_pos0_min) / ((float)__pyx_v_bins));
 
-  /* "splitBBox.pyx":178
+  /* "splitBBox.pyx":181
  * 
  *     cdef float delta = (pos0_max - pos0_min) / (< float > (bins))
  *     outPos = numpy.linspace(pos0_min+0.5*delta, pos0_maxin-0.5*delta, bins)             # <<<<<<<<<<<<<<
  *     with nogil:
  * 
  */
-  __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_7);
-  __pyx_t_6 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__linspace); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s__linspace); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-  __pyx_t_7 = PyFloat_FromDouble((__pyx_v_pos0_min + (0.5 * __pyx_v_delta))); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = PyFloat_FromDouble((__pyx_v_pos0_min + (0.5 * __pyx_v_delta))); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_7);
-  __pyx_t_3 = PyFloat_FromDouble((__pyx_v_pos0_maxin - (0.5 * __pyx_v_delta))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyFloat_FromDouble((__pyx_v_pos0_maxin - (0.5 * __pyx_v_delta))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_bins); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_bins); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7);
   __Pyx_GIVEREF(__pyx_t_7);
@@ -3974,14 +4177,14 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
   __pyx_t_7 = 0;
   __pyx_t_3 = 0;
   __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __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_4)); __pyx_t_4 = 0;
   __pyx_v_outPos = __pyx_t_1;
   __pyx_t_1 = 0;
 
-  /* "splitBBox.pyx":179
+  /* "splitBBox.pyx":182
  *     cdef float delta = (pos0_max - pos0_min) / (< float > (bins))
  *     outPos = numpy.linspace(pos0_min+0.5*delta, pos0_maxin-0.5*delta, bins)
  *     with nogil:             # <<<<<<<<<<<<<<
@@ -3990,12 +4193,12 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
  */
   {
       #ifdef WITH_THREAD
-      PyThreadState *_save = NULL;
-      #endif
+      PyThreadState *_save;
       Py_UNBLOCK_THREADS
+      #endif
       /*try:*/ {
 
-        /* "splitBBox.pyx":181
+        /* "splitBBox.pyx":184
  *     with nogil:
  * 
  *         for idx in range(size):             # <<<<<<<<<<<<<<
@@ -4006,130 +4209,130 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
         for (__pyx_t_24 = 0; __pyx_t_24 < __pyx_t_2; __pyx_t_24+=1) {
           __pyx_v_idx = __pyx_t_24;
 
-          /* "splitBBox.pyx":182
+          /* "splitBBox.pyx":185
  * 
  *         for idx in range(size):
  *             if (check_mask) and (cmask[idx]):             # <<<<<<<<<<<<<<
  *                 continue
  * 
  */
-          __pyx_t_5 = __pyx_v_check_mask;
-          if (__pyx_t_5) {
-            if (unlikely(!__pyx_v_cmask.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cmask"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L20;} }
-            __pyx_t_33 = __pyx_v_idx;
-            __pyx_t_18 = (*((__pyx_t_5numpy_int8_t *) ( /* dim=0 */ (__pyx_v_cmask.data + __pyx_t_33 * __pyx_v_cmask.strides[0]) )));
+          __pyx_t_17 = __pyx_v_check_mask;
+          if (__pyx_t_17) {
+            if (unlikely(!__pyx_v_cmask.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cmask"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L22;} }
+            __pyx_t_34 = __pyx_v_idx;
+            __pyx_t_5 = ((*((__pyx_t_5numpy_int8_t *) ( /* dim=0 */ (__pyx_v_cmask.data + __pyx_t_34 * __pyx_v_cmask.strides[0]) ))) != 0);
           } else {
-            __pyx_t_18 = __pyx_t_5;
+            __pyx_t_5 = __pyx_t_17;
           }
-          if (__pyx_t_18) {
+          if (__pyx_t_5) {
 
-            /* "splitBBox.pyx":183
+            /* "splitBBox.pyx":186
  *         for idx in range(size):
  *             if (check_mask) and (cmask[idx]):
  *                 continue             # <<<<<<<<<<<<<<
  * 
  *             data = cdata[idx]
  */
-            goto __pyx_L22_continue;
-            goto __pyx_L24;
+            goto __pyx_L24_continue;
+            goto __pyx_L26;
           }
-          __pyx_L24:;
+          __pyx_L26:;
 
-          /* "splitBBox.pyx":185
+          /* "splitBBox.pyx":188
  *                 continue
  * 
  *             data = cdata[idx]             # <<<<<<<<<<<<<<
  *             if check_dummy and (fabs(data-cdummy)<=ddummy):
  *                 continue
  */
-          __pyx_t_34 = __pyx_v_idx;
-          __pyx_v_data = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cdata.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_cdata.diminfo[0].strides));
+          __pyx_t_35 = __pyx_v_idx;
+          __pyx_v_data = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cdata.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_cdata.diminfo[0].strides));
 
-          /* "splitBBox.pyx":186
+          /* "splitBBox.pyx":189
  * 
  *             data = cdata[idx]
  *             if check_dummy and (fabs(data-cdummy)<=ddummy):             # <<<<<<<<<<<<<<
  *                 continue
  * 
  */
-          if (__pyx_v_check_dummy) {
-            __pyx_t_18 = (fabs((__pyx_v_data - __pyx_v_cdummy)) <= __pyx_v_ddummy);
-            __pyx_t_5 = __pyx_t_18;
+          if ((__pyx_v_check_dummy != 0)) {
+            __pyx_t_5 = ((fabs((__pyx_v_data - __pyx_v_cdummy)) <= __pyx_v_ddummy) != 0);
+            __pyx_t_17 = __pyx_t_5;
           } else {
-            __pyx_t_5 = __pyx_v_check_dummy;
+            __pyx_t_17 = (__pyx_v_check_dummy != 0);
           }
-          if (__pyx_t_5) {
+          if (__pyx_t_17) {
 
-            /* "splitBBox.pyx":187
+            /* "splitBBox.pyx":190
  *             data = cdata[idx]
  *             if check_dummy and (fabs(data-cdummy)<=ddummy):
  *                 continue             # <<<<<<<<<<<<<<
  * 
  *             min0 = cpos0_lower[idx]
  */
-            goto __pyx_L22_continue;
-            goto __pyx_L25;
+            goto __pyx_L24_continue;
+            goto __pyx_L27;
           }
-          __pyx_L25:;
+          __pyx_L27:;
 
-          /* "splitBBox.pyx":189
+          /* "splitBBox.pyx":192
  *                 continue
  * 
  *             min0 = cpos0_lower[idx]             # <<<<<<<<<<<<<<
  *             max0 = cpos0_upper[idx]
  * 
  */
-          __pyx_t_35 = __pyx_v_idx;
-          __pyx_v_min0 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cpos0_lower.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_cpos0_lower.diminfo[0].strides));
+          __pyx_t_36 = __pyx_v_idx;
+          __pyx_v_min0 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cpos0_lower.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_cpos0_lower.diminfo[0].strides));
 
-          /* "splitBBox.pyx":190
+          /* "splitBBox.pyx":193
  * 
  *             min0 = cpos0_lower[idx]
  *             max0 = cpos0_upper[idx]             # <<<<<<<<<<<<<<
  * 
  *             if check_pos1 and (((cpos1[idx]+dpos1[idx]) < pos1_min) or ((cpos1[idx]-dpos1[idx]) > pos1_max)):
  */
-          __pyx_t_36 = __pyx_v_idx;
-          __pyx_v_max0 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cpos0_upper.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_cpos0_upper.diminfo[0].strides));
+          __pyx_t_37 = __pyx_v_idx;
+          __pyx_v_max0 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cpos0_upper.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_cpos0_upper.diminfo[0].strides));
 
-          /* "splitBBox.pyx":192
+          /* "splitBBox.pyx":195
  *             max0 = cpos0_upper[idx]
  * 
  *             if check_pos1 and (((cpos1[idx]+dpos1[idx]) < pos1_min) or ((cpos1[idx]-dpos1[idx]) > pos1_max)):             # <<<<<<<<<<<<<<
  *                     continue
  * 
  */
-          if (__pyx_v_check_pos1) {
-            __pyx_t_37 = __pyx_v_idx;
+          if ((__pyx_v_check_pos1 != 0)) {
             __pyx_t_38 = __pyx_v_idx;
-            __pyx_t_5 = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cpos1.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_cpos1.diminfo[0].strides)) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_dpos1.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_dpos1.diminfo[0].strides))) < __pyx_v_pos1_min);
-            if (!__pyx_t_5) {
-              __pyx_t_39 = __pyx_v_idx;
+            __pyx_t_39 = __pyx_v_idx;
+            __pyx_t_17 = ((((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cpos1.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_cpos1.diminfo[0].strides)) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_dpos1.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_dpos1.diminfo[0].strides))) < __pyx_v_pos1_min) != 0);
+            if (!__pyx_t_17) {
               __pyx_t_40 = __pyx_v_idx;
-              __pyx_t_18 = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cpos1.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_cpos1.diminfo[0].strides)) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_dpos1.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_dpos1.diminfo[0].strides))) > __pyx_v_pos1_max);
-              __pyx_t_19 = __pyx_t_18;
-            } else {
+              __pyx_t_41 = __pyx_v_idx;
+              __pyx_t_5 = ((((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cpos1.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_cpos1.diminfo[0].strides)) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_dpos1.rcbuffer->pybuffer.buf, __pyx_t_41, __pyx_pybuffernd_dpos1.diminfo[0].strides))) > __pyx_v_pos1_max) != 0);
               __pyx_t_19 = __pyx_t_5;
+            } else {
+              __pyx_t_19 = __pyx_t_17;
             }
-            __pyx_t_5 = __pyx_t_19;
+            __pyx_t_17 = __pyx_t_19;
           } else {
-            __pyx_t_5 = __pyx_v_check_pos1;
+            __pyx_t_17 = (__pyx_v_check_pos1 != 0);
           }
-          if (__pyx_t_5) {
+          if (__pyx_t_17) {
 
-            /* "splitBBox.pyx":193
+            /* "splitBBox.pyx":196
  * 
  *             if check_pos1 and (((cpos1[idx]+dpos1[idx]) < pos1_min) or ((cpos1[idx]-dpos1[idx]) > pos1_max)):
  *                     continue             # <<<<<<<<<<<<<<
  * 
  *             fbin0_min = getBinNr(min0, pos0_min, delta)
  */
-            goto __pyx_L22_continue;
-            goto __pyx_L26;
+            goto __pyx_L24_continue;
+            goto __pyx_L28;
           }
-          __pyx_L26:;
+          __pyx_L28:;
 
-          /* "splitBBox.pyx":195
+          /* "splitBBox.pyx":198
  *                     continue
  * 
  *             fbin0_min = getBinNr(min0, pos0_min, delta)             # <<<<<<<<<<<<<<
@@ -4138,7 +4341,7 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
  */
           __pyx_v_fbin0_min = __pyx_f_9splitBBox_getBinNr(__pyx_v_min0, __pyx_v_pos0_min, __pyx_v_delta);
 
-          /* "splitBBox.pyx":196
+          /* "splitBBox.pyx":199
  * 
  *             fbin0_min = getBinNr(min0, pos0_min, delta)
  *             fbin0_max = getBinNr(max0, pos0_min, delta)             # <<<<<<<<<<<<<<
@@ -4147,45 +4350,45 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
  */
           __pyx_v_fbin0_max = __pyx_f_9splitBBox_getBinNr(__pyx_v_max0, __pyx_v_pos0_min, __pyx_v_delta);
 
-          /* "splitBBox.pyx":197
+          /* "splitBBox.pyx":200
  *             fbin0_min = getBinNr(min0, pos0_min, delta)
  *             fbin0_max = getBinNr(max0, pos0_min, delta)
  *             if (fbin0_max<0) or (fbin0_min>=bins):             # <<<<<<<<<<<<<<
  *                 continue
  *             if fbin0_max>=bins:
  */
-          __pyx_t_5 = (__pyx_v_fbin0_max < 0.0);
-          if (!__pyx_t_5) {
-            __pyx_t_19 = (__pyx_v_fbin0_min >= __pyx_v_bins);
-            __pyx_t_18 = __pyx_t_19;
+          __pyx_t_17 = ((__pyx_v_fbin0_max < 0.0) != 0);
+          if (!__pyx_t_17) {
+            __pyx_t_19 = ((__pyx_v_fbin0_min >= __pyx_v_bins) != 0);
+            __pyx_t_5 = __pyx_t_19;
           } else {
-            __pyx_t_18 = __pyx_t_5;
+            __pyx_t_5 = __pyx_t_17;
           }
-          if (__pyx_t_18) {
+          if (__pyx_t_5) {
 
-            /* "splitBBox.pyx":198
+            /* "splitBBox.pyx":201
  *             fbin0_max = getBinNr(max0, pos0_min, delta)
  *             if (fbin0_max<0) or (fbin0_min>=bins):
  *                 continue             # <<<<<<<<<<<<<<
  *             if fbin0_max>=bins:
  *                 bin0_max=bins-1
  */
-            goto __pyx_L22_continue;
-            goto __pyx_L27;
+            goto __pyx_L24_continue;
+            goto __pyx_L29;
           }
-          __pyx_L27:;
+          __pyx_L29:;
 
-          /* "splitBBox.pyx":199
+          /* "splitBBox.pyx":202
  *             if (fbin0_max<0) or (fbin0_min>=bins):
  *                 continue
  *             if fbin0_max>=bins:             # <<<<<<<<<<<<<<
  *                 bin0_max=bins-1
  *             else:
  */
-          __pyx_t_18 = (__pyx_v_fbin0_max >= __pyx_v_bins);
-          if (__pyx_t_18) {
+          __pyx_t_5 = ((__pyx_v_fbin0_max >= __pyx_v_bins) != 0);
+          if (__pyx_t_5) {
 
-            /* "splitBBox.pyx":200
+            /* "splitBBox.pyx":203
  *                 continue
  *             if fbin0_max>=bins:
  *                 bin0_max=bins-1             # <<<<<<<<<<<<<<
@@ -4193,11 +4396,11 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
  *                 bin0_max = < ssize_t > fbin0_max
  */
             __pyx_v_bin0_max = (__pyx_v_bins - 1);
-            goto __pyx_L28;
+            goto __pyx_L30;
           }
           /*else*/ {
 
-            /* "splitBBox.pyx":202
+            /* "splitBBox.pyx":205
  *                 bin0_max=bins-1
  *             else:
  *                 bin0_max = < ssize_t > fbin0_max             # <<<<<<<<<<<<<<
@@ -4206,19 +4409,19 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
  */
             __pyx_v_bin0_max = ((Py_ssize_t)__pyx_v_fbin0_max);
           }
-          __pyx_L28:;
+          __pyx_L30:;
 
-          /* "splitBBox.pyx":203
+          /* "splitBBox.pyx":206
  *             else:
  *                 bin0_max = < ssize_t > fbin0_max
  *             if  fbin0_min<0:             # <<<<<<<<<<<<<<
  *                 bin0_min=0
  *             else:
  */
-          __pyx_t_18 = (__pyx_v_fbin0_min < 0.0);
-          if (__pyx_t_18) {
+          __pyx_t_5 = ((__pyx_v_fbin0_min < 0.0) != 0);
+          if (__pyx_t_5) {
 
-            /* "splitBBox.pyx":204
+            /* "splitBBox.pyx":207
  *                 bin0_max = < ssize_t > fbin0_max
  *             if  fbin0_min<0:
  *                 bin0_min=0             # <<<<<<<<<<<<<<
@@ -4226,11 +4429,11 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
  *                 bin0_min = < ssize_t > fbin0_min
  */
             __pyx_v_bin0_min = 0;
-            goto __pyx_L29;
+            goto __pyx_L31;
           }
           /*else*/ {
 
-            /* "splitBBox.pyx":206
+            /* "splitBBox.pyx":209
  *                 bin0_min=0
  *             else:
  *                 bin0_min = < ssize_t > fbin0_min             # <<<<<<<<<<<<<<
@@ -4239,134 +4442,138 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
  */
             __pyx_v_bin0_min = ((Py_ssize_t)__pyx_v_fbin0_min);
           }
-          __pyx_L29:;
+          __pyx_L31:;
 
-          /* "splitBBox.pyx":208
+          /* "splitBBox.pyx":211
  *                 bin0_min = < ssize_t > fbin0_min
  * 
  *             if do_dark:             # <<<<<<<<<<<<<<
  *                 data -= cdark[idx]
  *             if do_flat:
  */
-          if (__pyx_v_do_dark) {
+          __pyx_t_5 = (__pyx_v_do_dark != 0);
+          if (__pyx_t_5) {
 
-            /* "splitBBox.pyx":209
+            /* "splitBBox.pyx":212
  * 
  *             if do_dark:
  *                 data -= cdark[idx]             # <<<<<<<<<<<<<<
  *             if do_flat:
  *                 data /= cflat[idx]
  */
-            if (unlikely(!__pyx_v_cdark.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cdark"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L20;} }
-            __pyx_t_41 = __pyx_v_idx;
-            __pyx_v_data = (__pyx_v_data - (*((float *) ( /* dim=0 */ (__pyx_v_cdark.data + __pyx_t_41 * __pyx_v_cdark.strides[0]) ))));
-            goto __pyx_L30;
+            if (unlikely(!__pyx_v_cdark.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cdark"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L22;} }
+            __pyx_t_42 = __pyx_v_idx;
+            __pyx_v_data = (__pyx_v_data - (*((float *) ( /* dim=0 */ (__pyx_v_cdark.data + __pyx_t_42 * __pyx_v_cdark.strides[0]) ))));
+            goto __pyx_L32;
           }
-          __pyx_L30:;
+          __pyx_L32:;
 
-          /* "splitBBox.pyx":210
+          /* "splitBBox.pyx":213
  *             if do_dark:
  *                 data -= cdark[idx]
  *             if do_flat:             # <<<<<<<<<<<<<<
  *                 data /= cflat[idx]
  *             if do_polarization:
  */
-          if (__pyx_v_do_flat) {
+          __pyx_t_5 = (__pyx_v_do_flat != 0);
+          if (__pyx_t_5) {
 
-            /* "splitBBox.pyx":211
+            /* "splitBBox.pyx":214
  *                 data -= cdark[idx]
  *             if do_flat:
  *                 data /= cflat[idx]             # <<<<<<<<<<<<<<
  *             if do_polarization:
  *                 data /= cpolarization[idx]
  */
-            if (unlikely(!__pyx_v_cflat.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cflat"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L20;} }
-            __pyx_t_42 = __pyx_v_idx;
-            __pyx_v_data = (__pyx_v_data / (*((float *) ( /* dim=0 */ (__pyx_v_cflat.data + __pyx_t_42 * __pyx_v_cflat.strides[0]) ))));
-            goto __pyx_L31;
+            if (unlikely(!__pyx_v_cflat.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cflat"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L22;} }
+            __pyx_t_43 = __pyx_v_idx;
+            __pyx_v_data = (__pyx_v_data / (*((float *) ( /* dim=0 */ (__pyx_v_cflat.data + __pyx_t_43 * __pyx_v_cflat.strides[0]) ))));
+            goto __pyx_L33;
           }
-          __pyx_L31:;
+          __pyx_L33:;
 
-          /* "splitBBox.pyx":212
+          /* "splitBBox.pyx":215
  *             if do_flat:
  *                 data /= cflat[idx]
  *             if do_polarization:             # <<<<<<<<<<<<<<
  *                 data /= cpolarization[idx]
  *             if do_solidangle:
  */
-          if (__pyx_v_do_polarization) {
+          __pyx_t_5 = (__pyx_v_do_polarization != 0);
+          if (__pyx_t_5) {
 
-            /* "splitBBox.pyx":213
+            /* "splitBBox.pyx":216
  *                 data /= cflat[idx]
  *             if do_polarization:
  *                 data /= cpolarization[idx]             # <<<<<<<<<<<<<<
  *             if do_solidangle:
  *                 data /= csolidangle[idx]
  */
-            if (unlikely(!__pyx_v_cpolarization.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cpolarization"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L20;} }
-            __pyx_t_43 = __pyx_v_idx;
-            __pyx_v_data = (__pyx_v_data / (*((float *) ( /* dim=0 */ (__pyx_v_cpolarization.data + __pyx_t_43 * __pyx_v_cpolarization.strides[0]) ))));
-            goto __pyx_L32;
+            if (unlikely(!__pyx_v_cpolarization.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cpolarization"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L22;} }
+            __pyx_t_44 = __pyx_v_idx;
+            __pyx_v_data = (__pyx_v_data / (*((float *) ( /* dim=0 */ (__pyx_v_cpolarization.data + __pyx_t_44 * __pyx_v_cpolarization.strides[0]) ))));
+            goto __pyx_L34;
           }
-          __pyx_L32:;
+          __pyx_L34:;
 
-          /* "splitBBox.pyx":214
+          /* "splitBBox.pyx":217
  *             if do_polarization:
  *                 data /= cpolarization[idx]
  *             if do_solidangle:             # <<<<<<<<<<<<<<
  *                 data /= csolidangle[idx]
  * 
  */
-          if (__pyx_v_do_solidangle) {
+          __pyx_t_5 = (__pyx_v_do_solidangle != 0);
+          if (__pyx_t_5) {
 
-            /* "splitBBox.pyx":215
+            /* "splitBBox.pyx":218
  *                 data /= cpolarization[idx]
  *             if do_solidangle:
  *                 data /= csolidangle[idx]             # <<<<<<<<<<<<<<
  * 
  *             if bin0_min == bin0_max:
  */
-            if (unlikely(!__pyx_v_csolidangle.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("csolidangle"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L20;} }
-            __pyx_t_44 = __pyx_v_idx;
-            __pyx_v_data = (__pyx_v_data / (*((float *) ( /* dim=0 */ (__pyx_v_csolidangle.data + __pyx_t_44 * __pyx_v_csolidangle.strides[0]) ))));
-            goto __pyx_L33;
+            if (unlikely(!__pyx_v_csolidangle.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("csolidangle"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L22;} }
+            __pyx_t_45 = __pyx_v_idx;
+            __pyx_v_data = (__pyx_v_data / (*((float *) ( /* dim=0 */ (__pyx_v_csolidangle.data + __pyx_t_45 * __pyx_v_csolidangle.strides[0]) ))));
+            goto __pyx_L35;
           }
-          __pyx_L33:;
+          __pyx_L35:;
 
-          /* "splitBBox.pyx":217
+          /* "splitBBox.pyx":220
  *                 data /= csolidangle[idx]
  * 
  *             if bin0_min == bin0_max:             # <<<<<<<<<<<<<<
  *                 #All pixel is within a single bin
  *                 outCount[bin0_min] +=  1.0
  */
-          __pyx_t_18 = (__pyx_v_bin0_min == __pyx_v_bin0_max);
-          if (__pyx_t_18) {
+          __pyx_t_5 = ((__pyx_v_bin0_min == __pyx_v_bin0_max) != 0);
+          if (__pyx_t_5) {
 
-            /* "splitBBox.pyx":219
+            /* "splitBBox.pyx":222
  *             if bin0_min == bin0_max:
  *                 #All pixel is within a single bin
  *                 outCount[bin0_min] +=  1.0             # <<<<<<<<<<<<<<
  *                 outData[bin0_min] +=  data
  * 
  */
-            __pyx_t_45 = __pyx_v_bin0_min;
-            *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_45, __pyx_pybuffernd_outCount.diminfo[0].strides) += 1.0;
+            __pyx_t_46 = __pyx_v_bin0_min;
+            *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_46, __pyx_pybuffernd_outCount.diminfo[0].strides) += 1.0;
 
-            /* "splitBBox.pyx":220
+            /* "splitBBox.pyx":223
  *                 #All pixel is within a single bin
  *                 outCount[bin0_min] +=  1.0
  *                 outData[bin0_min] +=  data             # <<<<<<<<<<<<<<
  * 
  *             else: #we have pixel spliting.
  */
-            __pyx_t_46 = __pyx_v_bin0_min;
-            *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_46, __pyx_pybuffernd_outData.diminfo[0].strides) += __pyx_v_data;
-            goto __pyx_L34;
+            __pyx_t_47 = __pyx_v_bin0_min;
+            *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_47, __pyx_pybuffernd_outData.diminfo[0].strides) += __pyx_v_data;
+            goto __pyx_L36;
           }
           /*else*/ {
 
-            /* "splitBBox.pyx":223
+            /* "splitBBox.pyx":226
  * 
  *             else: #we have pixel spliting.
  *                 deltaA = 1.0 / (fbin0_max - fbin0_min)             # <<<<<<<<<<<<<<
@@ -4375,7 +4582,7 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
  */
             __pyx_v_deltaA = (1.0 / (__pyx_v_fbin0_max - __pyx_v_fbin0_min));
 
-            /* "splitBBox.pyx":225
+            /* "splitBBox.pyx":228
  *                 deltaA = 1.0 / (fbin0_max - fbin0_min)
  * 
  *                 deltaL = < float > (bin0_min + 1) - fbin0_min             # <<<<<<<<<<<<<<
@@ -4384,7 +4591,7 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
  */
             __pyx_v_deltaL = (((float)(__pyx_v_bin0_min + 1)) - __pyx_v_fbin0_min);
 
-            /* "splitBBox.pyx":226
+            /* "splitBBox.pyx":229
  * 
  *                 deltaL = < float > (bin0_min + 1) - fbin0_min
  *                 deltaR = fbin0_max - (< float > bin0_max)             # <<<<<<<<<<<<<<
@@ -4393,96 +4600,96 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
  */
             __pyx_v_deltaR = (__pyx_v_fbin0_max - ((float)__pyx_v_bin0_max));
 
-            /* "splitBBox.pyx":228
+            /* "splitBBox.pyx":231
  *                 deltaR = fbin0_max - (< float > bin0_max)
  * 
  *                 outCount[bin0_min] +=  (deltaA * deltaL)             # <<<<<<<<<<<<<<
  *                 outData[bin0_min] +=  (data * deltaA * deltaL)
  * 
  */
-            __pyx_t_47 = __pyx_v_bin0_min;
-            *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_47, __pyx_pybuffernd_outCount.diminfo[0].strides) += (__pyx_v_deltaA * __pyx_v_deltaL);
+            __pyx_t_48 = __pyx_v_bin0_min;
+            *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_48, __pyx_pybuffernd_outCount.diminfo[0].strides) += (__pyx_v_deltaA * __pyx_v_deltaL);
 
-            /* "splitBBox.pyx":229
+            /* "splitBBox.pyx":232
  * 
  *                 outCount[bin0_min] +=  (deltaA * deltaL)
  *                 outData[bin0_min] +=  (data * deltaA * deltaL)             # <<<<<<<<<<<<<<
  * 
  *                 outCount[bin0_max] +=  (deltaA * deltaR)
  */
-            __pyx_t_48 = __pyx_v_bin0_min;
-            *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_48, __pyx_pybuffernd_outData.diminfo[0].strides) += ((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaL);
+            __pyx_t_49 = __pyx_v_bin0_min;
+            *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_49, __pyx_pybuffernd_outData.diminfo[0].strides) += ((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaL);
 
-            /* "splitBBox.pyx":231
+            /* "splitBBox.pyx":234
  *                 outData[bin0_min] +=  (data * deltaA * deltaL)
  * 
  *                 outCount[bin0_max] +=  (deltaA * deltaR)             # <<<<<<<<<<<<<<
  *                 outData[bin0_max] +=  (data * deltaA * deltaR)
  * 
  */
-            __pyx_t_49 = __pyx_v_bin0_max;
-            *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_49, __pyx_pybuffernd_outCount.diminfo[0].strides) += (__pyx_v_deltaA * __pyx_v_deltaR);
+            __pyx_t_50 = __pyx_v_bin0_max;
+            *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_50, __pyx_pybuffernd_outCount.diminfo[0].strides) += (__pyx_v_deltaA * __pyx_v_deltaR);
 
-            /* "splitBBox.pyx":232
+            /* "splitBBox.pyx":235
  * 
  *                 outCount[bin0_max] +=  (deltaA * deltaR)
  *                 outData[bin0_max] +=  (data * deltaA * deltaR)             # <<<<<<<<<<<<<<
  * 
  *                 if bin0_min + 1 < bin0_max:
  */
-            __pyx_t_50 = __pyx_v_bin0_max;
-            *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_50, __pyx_pybuffernd_outData.diminfo[0].strides) += ((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaR);
+            __pyx_t_51 = __pyx_v_bin0_max;
+            *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_51, __pyx_pybuffernd_outData.diminfo[0].strides) += ((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaR);
 
-            /* "splitBBox.pyx":234
+            /* "splitBBox.pyx":237
  *                 outData[bin0_max] +=  (data * deltaA * deltaR)
  * 
  *                 if bin0_min + 1 < bin0_max:             # <<<<<<<<<<<<<<
  *                     for i in range(bin0_min + 1, bin0_max):
  *                         outCount[i] +=  deltaA
  */
-            __pyx_t_18 = ((__pyx_v_bin0_min + 1) < __pyx_v_bin0_max);
-            if (__pyx_t_18) {
+            __pyx_t_5 = (((__pyx_v_bin0_min + 1) < __pyx_v_bin0_max) != 0);
+            if (__pyx_t_5) {
 
-              /* "splitBBox.pyx":235
+              /* "splitBBox.pyx":238
  * 
  *                 if bin0_min + 1 < bin0_max:
  *                     for i in range(bin0_min + 1, bin0_max):             # <<<<<<<<<<<<<<
  *                         outCount[i] +=  deltaA
  *                         outData[i] +=  (data *  deltaA)
  */
-              __pyx_t_51 = __pyx_v_bin0_max;
-              for (__pyx_t_52 = (__pyx_v_bin0_min + 1); __pyx_t_52 < __pyx_t_51; __pyx_t_52+=1) {
-                __pyx_v_i = __pyx_t_52;
+              __pyx_t_52 = __pyx_v_bin0_max;
+              for (__pyx_t_53 = (__pyx_v_bin0_min + 1); __pyx_t_53 < __pyx_t_52; __pyx_t_53+=1) {
+                __pyx_v_i = __pyx_t_53;
 
-                /* "splitBBox.pyx":236
+                /* "splitBBox.pyx":239
  *                 if bin0_min + 1 < bin0_max:
  *                     for i in range(bin0_min + 1, bin0_max):
  *                         outCount[i] +=  deltaA             # <<<<<<<<<<<<<<
  *                         outData[i] +=  (data *  deltaA)
  * 
  */
-                __pyx_t_53 = __pyx_v_i;
-                *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_53, __pyx_pybuffernd_outCount.diminfo[0].strides) += __pyx_v_deltaA;
+                __pyx_t_54 = __pyx_v_i;
+                *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_54, __pyx_pybuffernd_outCount.diminfo[0].strides) += __pyx_v_deltaA;
 
-                /* "splitBBox.pyx":237
+                /* "splitBBox.pyx":240
  *                     for i in range(bin0_min + 1, bin0_max):
  *                         outCount[i] +=  deltaA
  *                         outData[i] +=  (data *  deltaA)             # <<<<<<<<<<<<<<
  * 
  *         for i in range(bins):
  */
-                __pyx_t_54 = __pyx_v_i;
-                *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_54, __pyx_pybuffernd_outData.diminfo[0].strides) += (__pyx_v_data * __pyx_v_deltaA);
+                __pyx_t_55 = __pyx_v_i;
+                *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_55, __pyx_pybuffernd_outData.diminfo[0].strides) += (__pyx_v_data * __pyx_v_deltaA);
               }
-              goto __pyx_L35;
+              goto __pyx_L37;
             }
-            __pyx_L35:;
+            __pyx_L37:;
           }
-          __pyx_L34:;
-          __pyx_L22_continue:;
+          __pyx_L36:;
+          __pyx_L24_continue:;
         }
 
-        /* "splitBBox.pyx":239
+        /* "splitBBox.pyx":242
  *                         outData[i] +=  (data *  deltaA)
  * 
  *         for i in range(bins):             # <<<<<<<<<<<<<<
@@ -4493,47 +4700,47 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
         for (__pyx_t_24 = 0; __pyx_t_24 < __pyx_t_2; __pyx_t_24+=1) {
           __pyx_v_i = __pyx_t_24;
 
-          /* "splitBBox.pyx":240
+          /* "splitBBox.pyx":243
  * 
  *         for i in range(bins):
  *                 if outCount[i] > epsilon:             # <<<<<<<<<<<<<<
  *                     outMerge[i] = < float > (outData[i] / outCount[i])
  *                 else:
  */
-          __pyx_t_52 = __pyx_v_i;
-          __pyx_t_18 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_52, __pyx_pybuffernd_outCount.diminfo[0].strides)) > __pyx_v_epsilon);
-          if (__pyx_t_18) {
+          __pyx_t_53 = __pyx_v_i;
+          __pyx_t_5 = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_53, __pyx_pybuffernd_outCount.diminfo[0].strides)) > __pyx_v_epsilon) != 0);
+          if (__pyx_t_5) {
 
-            /* "splitBBox.pyx":241
+            /* "splitBBox.pyx":244
  *         for i in range(bins):
  *                 if outCount[i] > epsilon:
  *                     outMerge[i] = < float > (outData[i] / outCount[i])             # <<<<<<<<<<<<<<
  *                 else:
  *                     outMerge[i] = cdummy
  */
-            __pyx_t_55 = __pyx_v_i;
             __pyx_t_56 = __pyx_v_i;
             __pyx_t_57 = __pyx_v_i;
-            *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.buf, __pyx_t_57, __pyx_pybuffernd_outMerge.diminfo[0].strides) = ((float)((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_55, __pyx_pybuffernd_outData.diminfo[0].strides)) / (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_56, __pyx_pybuffernd_outCount.diminfo[0 [...]
-            goto __pyx_L40;
+            __pyx_t_58 = __pyx_v_i;
+            *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.buf, __pyx_t_58, __pyx_pybuffernd_outMerge.diminfo[0].strides) = ((float)((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_56, __pyx_pybuffernd_outData.diminfo[0].strides)) / (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_57, __pyx_pybuffernd_outCount.diminfo[0 [...]
+            goto __pyx_L42;
           }
           /*else*/ {
 
-            /* "splitBBox.pyx":243
+            /* "splitBBox.pyx":246
  *                     outMerge[i] = < float > (outData[i] / outCount[i])
  *                 else:
  *                     outMerge[i] = cdummy             # <<<<<<<<<<<<<<
  * 
  *     return  outPos, outMerge, outData, outCount
  */
-            __pyx_t_58 = __pyx_v_i;
-            *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.buf, __pyx_t_58, __pyx_pybuffernd_outMerge.diminfo[0].strides) = __pyx_v_cdummy;
+            __pyx_t_59 = __pyx_v_i;
+            *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.buf, __pyx_t_59, __pyx_pybuffernd_outMerge.diminfo[0].strides) = __pyx_v_cdummy;
           }
-          __pyx_L40:;
+          __pyx_L42:;
         }
       }
 
-      /* "splitBBox.pyx":179
+      /* "splitBBox.pyx":182
  *     cdef float delta = (pos0_max - pos0_min) / (< float > (bins))
  *     outPos = numpy.linspace(pos0_min+0.5*delta, pos0_maxin-0.5*delta, bins)
  *     with nogil:             # <<<<<<<<<<<<<<
@@ -4542,17 +4749,19 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
  */
       /*finally:*/ {
         int __pyx_why;
-        __pyx_why = 0; goto __pyx_L21;
-        __pyx_L20: __pyx_why = 4; goto __pyx_L21;
-        __pyx_L21:;
+        __pyx_why = 0; goto __pyx_L23;
+        __pyx_L22: __pyx_why = 4; goto __pyx_L23;
+        __pyx_L23:;
+        #ifdef WITH_THREAD
         Py_BLOCK_THREADS
+        #endif
         switch (__pyx_why) {
           case 4: goto __pyx_L1_error;
         }
       }
   }
 
-  /* "splitBBox.pyx":245
+  /* "splitBBox.pyx":248
  *                     outMerge[i] = cdummy
  * 
  *     return  outPos, outMerge, outData, outCount             # <<<<<<<<<<<<<<
@@ -4560,7 +4769,7 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
  * 
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_INCREF(__pyx_v_outPos);
   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_outPos);
@@ -4586,7 +4795,7 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
   __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_6);
   __Pyx_XDECREF(__pyx_t_7);
-  __PYX_XDEC_MEMVIEW(&__pyx_t_17, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_t_18, 1);
   __PYX_XDEC_MEMVIEW(&__pyx_t_21, 1);
   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
@@ -4639,7 +4848,7 @@ static PyObject *__pyx_pf_9splitBBox_histoBBox1d(CYTHON_UNUSED PyObject *__pyx_s
 
 /* Python wrapper */
 static PyObject *__pyx_pw_9splitBBox_3histoBBox2d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_9splitBBox_2histoBBox2d[] = "\n    Calculate 2D histogram of pos0(tth),pos1(chi) weighted by weights\n\n    Splitting is done on the pixel's bounding box like fit2D\n\n\n    @param weights: array with intensities\n    @param pos0: 1D array with pos0: tth or q_vect\n    @param delta_pos0: 1D array with delta pos0: max center-corner distance\n    @param pos1: 1D array with pos1: chi\n    @param delta_pos1: 1D array with max pos1: max center-corner distance, unused !\n [...]
+static char __pyx_doc_9splitBBox_2histoBBox2d[] = "\n    Calculate 2D histogram of pos0(tth),pos1(chi) weighted by weights\n\n    Splitting is done on the pixel's bounding box like fit2D\n\n\n    @param weights: array with intensities\n    @param pos0: 1D array with pos0: tth or q_vect\n    @param delta_pos0: 1D array with delta pos0: max center-corner distance\n    @param pos1: 1D array with pos1: chi\n    @param delta_pos1: 1D array with max pos1: max center-corner distance, unused !\n [...]
 static PyMethodDef __pyx_mdef_9splitBBox_3histoBBox2d = {__Pyx_NAMESTR("histoBBox2d"), (PyCFunction)__pyx_pw_9splitBBox_3histoBBox2d, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9splitBBox_2histoBBox2d)};
 static PyObject *__pyx_pw_9splitBBox_3histoBBox2d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyArrayObject *__pyx_v_weights = 0;
@@ -4657,14 +4866,19 @@ static PyObject *__pyx_pw_9splitBBox_3histoBBox2d(PyObject *__pyx_self, PyObject
   PyObject *__pyx_v_flat = 0;
   PyObject *__pyx_v_solidangle = 0;
   PyObject *__pyx_v_polarization = 0;
+  int __pyx_v_allow_pos0_neg;
+  int __pyx_v_chiDiscAtPi;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("histoBBox2d (wrapper)", 0);
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__weights,&__pyx_n_s__pos0,&__pyx_n_s__delta_pos0,&__pyx_n_s__pos1,&__pyx_n_s__delta_pos1,&__pyx_n_s__bins,&__pyx_n_s__pos0Range,&__pyx_n_s__pos1Range,&__pyx_n_s__dummy,&__pyx_n_s__delta_dummy,&__pyx_n_s__mask,&__pyx_n_s__dark,&__pyx_n_s__flat,&__pyx_n_s__solidangle,&__pyx_n_s__polarization,0};
-    PyObject* values[15] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__weights,&__pyx_n_s__pos0,&__pyx_n_s__delta_pos0,&__pyx_n_s__pos1,&__pyx_n_s__delta_pos1,&__pyx_n_s__bins,&__pyx_n_s__pos0Range,&__pyx_n_s__pos1Range,&__pyx_n_s__dummy,&__pyx_n_s__delta_dummy,&__pyx_n_s__mask,&__pyx_n_s__dark,&__pyx_n_s__flat,&__pyx_n_s__solidangle,&__pyx_n_s__polarization,&__pyx_n_s__allow_pos0_neg,&__pyx_n_s__chiDiscAtPi,0};
+    PyObject* values[17] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
 
-    /* "splitBBox.pyx":258
+    /* "splitBBox.pyx":261
  *                 numpy.ndarray pos1 not None,
  *                 numpy.ndarray delta_pos1 not None,
  *                 bins=(100, 36),             # <<<<<<<<<<<<<<
@@ -4673,7 +4887,7 @@ static PyObject *__pyx_pw_9splitBBox_3histoBBox2d(PyObject *__pyx_self, PyObject
  */
     values[5] = ((PyObject *)__pyx_k_tuple_1);
 
-    /* "splitBBox.pyx":259
+    /* "splitBBox.pyx":262
  *                 numpy.ndarray delta_pos1 not None,
  *                 bins=(100, 36),
  *                 pos0Range=None,             # <<<<<<<<<<<<<<
@@ -4682,7 +4896,7 @@ static PyObject *__pyx_pw_9splitBBox_3histoBBox2d(PyObject *__pyx_self, PyObject
  */
     values[6] = ((PyObject *)Py_None);
 
-    /* "splitBBox.pyx":260
+    /* "splitBBox.pyx":263
  *                 bins=(100, 36),
  *                 pos0Range=None,
  *                 pos1Range=None,             # <<<<<<<<<<<<<<
@@ -4691,7 +4905,7 @@ static PyObject *__pyx_pw_9splitBBox_3histoBBox2d(PyObject *__pyx_self, PyObject
  */
     values[7] = ((PyObject *)Py_None);
 
-    /* "splitBBox.pyx":261
+    /* "splitBBox.pyx":264
  *                 pos0Range=None,
  *                 pos1Range=None,
  *                 dummy=None,             # <<<<<<<<<<<<<<
@@ -4700,7 +4914,7 @@ static PyObject *__pyx_pw_9splitBBox_3histoBBox2d(PyObject *__pyx_self, PyObject
  */
     values[8] = ((PyObject *)Py_None);
 
-    /* "splitBBox.pyx":262
+    /* "splitBBox.pyx":265
  *                 pos1Range=None,
  *                 dummy=None,
  *                 delta_dummy=None,             # <<<<<<<<<<<<<<
@@ -4709,7 +4923,7 @@ static PyObject *__pyx_pw_9splitBBox_3histoBBox2d(PyObject *__pyx_self, PyObject
  */
     values[9] = ((PyObject *)Py_None);
 
-    /* "splitBBox.pyx":263
+    /* "splitBBox.pyx":266
  *                 dummy=None,
  *                 delta_dummy=None,
  *                 mask=None,             # <<<<<<<<<<<<<<
@@ -4718,7 +4932,7 @@ static PyObject *__pyx_pw_9splitBBox_3histoBBox2d(PyObject *__pyx_self, PyObject
  */
     values[10] = ((PyObject *)Py_None);
 
-    /* "splitBBox.pyx":264
+    /* "splitBBox.pyx":267
  *                 delta_dummy=None,
  *                 mask=None,
  *                 dark=None,             # <<<<<<<<<<<<<<
@@ -4727,36 +4941,38 @@ static PyObject *__pyx_pw_9splitBBox_3histoBBox2d(PyObject *__pyx_self, PyObject
  */
     values[11] = ((PyObject *)Py_None);
 
-    /* "splitBBox.pyx":265
+    /* "splitBBox.pyx":268
  *                 mask=None,
  *                 dark=None,
  *                 flat=None,             # <<<<<<<<<<<<<<
  *                 solidangle=None,
- *                 polarization=None):
+ *                 polarization=None,
  */
     values[12] = ((PyObject *)Py_None);
 
-    /* "splitBBox.pyx":266
+    /* "splitBBox.pyx":269
  *                 dark=None,
  *                 flat=None,
  *                 solidangle=None,             # <<<<<<<<<<<<<<
- *                 polarization=None):
- *     """
+ *                 polarization=None,
+ *                 bint allow_pos0_neg=0,
  */
     values[13] = ((PyObject *)Py_None);
 
-    /* "splitBBox.pyx":267
+    /* "splitBBox.pyx":270
  *                 flat=None,
  *                 solidangle=None,
- *                 polarization=None):             # <<<<<<<<<<<<<<
- *     """
- *     Calculate 2D histogram of pos0(tth),pos1(chi) weighted by weights
+ *                 polarization=None,             # <<<<<<<<<<<<<<
+ *                 bint allow_pos0_neg=0,
+ *                 bint chiDiscAtPi=1):
  */
     values[14] = ((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 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
+        case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
         case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
         case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
         case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
@@ -4783,22 +4999,22 @@ static PyObject *__pyx_pw_9splitBBox_3histoBBox2d(PyObject *__pyx_self, PyObject
         case  1:
         if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos0)) != 0)) kw_args--;
         else {
-          __Pyx_RaiseArgtupleInvalid("histoBBox2d", 0, 5, 15, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+          __Pyx_RaiseArgtupleInvalid("histoBBox2d", 0, 5, 17, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  2:
         if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__delta_pos0)) != 0)) kw_args--;
         else {
-          __Pyx_RaiseArgtupleInvalid("histoBBox2d", 0, 5, 15, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+          __Pyx_RaiseArgtupleInvalid("histoBBox2d", 0, 5, 17, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  3:
         if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos1)) != 0)) kw_args--;
         else {
-          __Pyx_RaiseArgtupleInvalid("histoBBox2d", 0, 5, 15, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+          __Pyx_RaiseArgtupleInvalid("histoBBox2d", 0, 5, 17, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  4:
         if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__delta_pos1)) != 0)) kw_args--;
         else {
-          __Pyx_RaiseArgtupleInvalid("histoBBox2d", 0, 5, 15, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+          __Pyx_RaiseArgtupleInvalid("histoBBox2d", 0, 5, 17, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  5:
         if (kw_args > 0) {
@@ -4850,12 +5066,24 @@ static PyObject *__pyx_pw_9splitBBox_3histoBBox2d(PyObject *__pyx_self, PyObject
           PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__polarization);
           if (value) { values[14] = value; kw_args--; }
         }
+        case 15:
+        if (kw_args > 0) {
+          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__allow_pos0_neg);
+          if (value) { values[15] = value; kw_args--; }
+        }
+        case 16:
+        if (kw_args > 0) {
+          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__chiDiscAtPi);
+          if (value) { values[16] = value; kw_args--; }
+        }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "histoBBox2d") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "histoBBox2d") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     } else {
       switch (PyTuple_GET_SIZE(__pyx_args)) {
+        case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
+        case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
         case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
         case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
         case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
@@ -4890,21 +5118,31 @@ static PyObject *__pyx_pw_9splitBBox_3histoBBox2d(PyObject *__pyx_self, PyObject
     __pyx_v_flat = values[12];
     __pyx_v_solidangle = values[13];
     __pyx_v_polarization = values[14];
+    if (values[15]) {
+      __pyx_v_allow_pos0_neg = __Pyx_PyObject_IsTrue(values[15]); if (unlikely((__pyx_v_allow_pos0_neg == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    } else {
+      __pyx_v_allow_pos0_neg = ((int)0);
+    }
+    if (values[16]) {
+      __pyx_v_chiDiscAtPi = __Pyx_PyObject_IsTrue(values[16]); if (unlikely((__pyx_v_chiDiscAtPi == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    } else {
+      __pyx_v_chiDiscAtPi = ((int)1);
+    }
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("histoBBox2d", 0, 5, 15, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __Pyx_RaiseArgtupleInvalid("histoBBox2d", 0, 5, 17, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_AddTraceback("splitBBox.histoBBox2d", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weights), __pyx_ptype_5numpy_ndarray, 0, "weights", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos0), __pyx_ptype_5numpy_ndarray, 0, "pos0", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_delta_pos0), __pyx_ptype_5numpy_ndarray, 0, "delta_pos0", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __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 = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_delta_pos1), __pyx_ptype_5numpy_ndarray, 0, "delta_pos1", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_r = __pyx_pf_9splitBBox_2histoBBox2d(__pyx_self, __pyx_v_weights, __pyx_v_pos0, __pyx_v_delta_pos0, __pyx_v_pos1, __pyx_v_delta_pos1, __pyx_v_bins, __pyx_v_pos0Range, __pyx_v_pos1Range, __pyx_v_dummy, __pyx_v_delta_dummy, __pyx_v_mask, __pyx_v_dark, __pyx_v_flat, __pyx_v_solidangle, __pyx_v_polarization);
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weights), __pyx_ptype_5numpy_ndarray, 0, "weights", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos0), __pyx_ptype_5numpy_ndarray, 0, "pos0", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_delta_pos0), __pyx_ptype_5numpy_ndarray, 0, "delta_pos0", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __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 = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_delta_pos1), __pyx_ptype_5numpy_ndarray, 0, "delta_pos1", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_r = __pyx_pf_9splitBBox_2histoBBox2d(__pyx_self, __pyx_v_weights, __pyx_v_pos0, __pyx_v_delta_pos0, __pyx_v_pos1, __pyx_v_delta_pos1, __pyx_v_bins, __pyx_v_pos0Range, __pyx_v_pos1Range, __pyx_v_dummy, __pyx_v_delta_dummy, __pyx_v_mask, __pyx_v_dark, __pyx_v_flat, __pyx_v_solidangle, __pyx_v_polarization, __pyx_v_allow_pos0_neg, __pyx_v_chiDiscAtPi);
   goto __pyx_L0;
   __pyx_L1_error:;
   __pyx_r = NULL;
@@ -4913,7 +5151,7 @@ static PyObject *__pyx_pw_9splitBBox_3histoBBox2d(PyObject *__pyx_self, PyObject
   return __pyx_r;
 }
 
-/* "splitBBox.pyx":253
+/* "splitBBox.pyx":256
  * @cython.boundscheck(False)
  * @cython.wraparound(False)
  * def histoBBox2d(numpy.ndarray weights not None,             # <<<<<<<<<<<<<<
@@ -4921,7 +5159,7 @@ static PyObject *__pyx_pw_9splitBBox_3histoBBox2d(PyObject *__pyx_self, PyObject
  *                 numpy.ndarray delta_pos0 not None,
  */
 
-static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_weights, PyArrayObject *__pyx_v_pos0, PyArrayObject *__pyx_v_delta_pos0, PyArrayObject *__pyx_v_pos1, PyArrayObject *__pyx_v_delta_pos1, PyObject *__pyx_v_bins, PyObject *__pyx_v_pos0Range, PyObject *__pyx_v_pos1Range, PyObject *__pyx_v_dummy, PyObject *__pyx_v_delta_dummy, PyObject *__pyx_v_mask, PyObject *__pyx_v_dark, PyObject *__pyx_v_flat, PyObject *__pyx_v_solidangle, PyObje [...]
+static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_weights, PyArrayObject *__pyx_v_pos0, PyArrayObject *__pyx_v_delta_pos0, PyArrayObject *__pyx_v_pos1, PyArrayObject *__pyx_v_delta_pos1, PyObject *__pyx_v_bins, PyObject *__pyx_v_pos0Range, PyObject *__pyx_v_pos1Range, PyObject *__pyx_v_dummy, PyObject *__pyx_v_delta_dummy, PyObject *__pyx_v_mask, PyObject *__pyx_v_dark, PyObject *__pyx_v_flat, PyObject *__pyx_v_solidangle, PyObje [...]
   Py_ssize_t __pyx_v_bins0;
   Py_ssize_t __pyx_v_bins1;
   Py_ssize_t __pyx_v_i;
@@ -4935,9 +5173,15 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
   PyArrayObject *__pyx_v_dpos1 = 0;
   PyArrayObject *__pyx_v_cpos0_upper = 0;
   PyArrayObject *__pyx_v_cpos0_lower = 0;
+  PyArrayObject *__pyx_v_cpos1_upper = 0;
+  PyArrayObject *__pyx_v_cpos1_lower = 0;
   PyArrayObject *__pyx_v_outData = 0;
   PyArrayObject *__pyx_v_outCount = 0;
   PyArrayObject *__pyx_v_outMerge = 0;
+  float __pyx_v_c0;
+  float __pyx_v_c1;
+  float __pyx_v_d0;
+  float __pyx_v_d1;
   float __pyx_v_min0;
   float __pyx_v_max0;
   float __pyx_v_min1;
@@ -4978,6 +5222,7 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
   __Pyx_memviewslice __pyx_v_cdark = { 0, 0, { 0 }, { 0 }, { 0 } };
   __Pyx_memviewslice __pyx_v_cpolarization = { 0, 0, { 0 }, { 0 }, { 0 } };
   __Pyx_memviewslice __pyx_v_csolidangle = { 0, 0, { 0 }, { 0 }, { 0 } };
+  long __pyx_v_lower0;
   PyObject *__pyx_v_edges0 = NULL;
   PyObject *__pyx_v_edges1 = NULL;
   __Pyx_LocalBuf_ND __pyx_pybuffernd_cdata;
@@ -4990,6 +5235,10 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
   __Pyx_Buffer __pyx_pybuffer_cpos0_upper;
   __Pyx_LocalBuf_ND __pyx_pybuffernd_cpos1;
   __Pyx_Buffer __pyx_pybuffer_cpos1;
+  __Pyx_LocalBuf_ND __pyx_pybuffernd_cpos1_lower;
+  __Pyx_Buffer __pyx_pybuffer_cpos1_lower;
+  __Pyx_LocalBuf_ND __pyx_pybuffernd_cpos1_upper;
+  __Pyx_Buffer __pyx_pybuffer_cpos1_upper;
   __Pyx_LocalBuf_ND __pyx_pybuffernd_dpos0;
   __Pyx_Buffer __pyx_pybuffer_dpos0;
   __Pyx_LocalBuf_ND __pyx_pybuffernd_dpos1;
@@ -5025,41 +5274,41 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
   PyArrayObject *__pyx_t_21 = NULL;
   PyArrayObject *__pyx_t_22 = NULL;
   PyArrayObject *__pyx_t_23 = NULL;
-  __Pyx_memviewslice __pyx_t_24 = { 0, 0, { 0 }, { 0 }, { 0 } };
-  int __pyx_t_25;
+  PyArrayObject *__pyx_t_24 = NULL;
+  PyArrayObject *__pyx_t_25 = NULL;
   int __pyx_t_26;
-  double __pyx_t_27;
-  __Pyx_memviewslice __pyx_t_28 = { 0, 0, { 0 }, { 0 }, { 0 } };
-  long __pyx_t_29;
-  long __pyx_t_30;
-  Py_ssize_t __pyx_t_31;
-  Py_ssize_t __pyx_t_32;
-  Py_ssize_t __pyx_t_33;
-  Py_ssize_t __pyx_t_34;
+  __Pyx_memviewslice __pyx_t_27 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  int __pyx_t_28;
+  double __pyx_t_29;
+  __Pyx_memviewslice __pyx_t_30 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  long __pyx_t_31;
+  long __pyx_t_32;
+  long __pyx_t_33;
+  long __pyx_t_34;
   Py_ssize_t __pyx_t_35;
   Py_ssize_t __pyx_t_36;
-  float __pyx_t_37;
+  Py_ssize_t __pyx_t_37;
   Py_ssize_t __pyx_t_38;
   Py_ssize_t __pyx_t_39;
   Py_ssize_t __pyx_t_40;
   Py_ssize_t __pyx_t_41;
   Py_ssize_t __pyx_t_42;
   Py_ssize_t __pyx_t_43;
-  Py_ssize_t __pyx_t_44;
+  float __pyx_t_44;
   Py_ssize_t __pyx_t_45;
   Py_ssize_t __pyx_t_46;
   Py_ssize_t __pyx_t_47;
   Py_ssize_t __pyx_t_48;
   Py_ssize_t __pyx_t_49;
-  int __pyx_t_50;
-  int __pyx_t_51;
+  Py_ssize_t __pyx_t_50;
+  Py_ssize_t __pyx_t_51;
   Py_ssize_t __pyx_t_52;
   Py_ssize_t __pyx_t_53;
   Py_ssize_t __pyx_t_54;
   Py_ssize_t __pyx_t_55;
   Py_ssize_t __pyx_t_56;
-  Py_ssize_t __pyx_t_57;
-  Py_ssize_t __pyx_t_58;
+  int __pyx_t_57;
+  int __pyx_t_58;
   Py_ssize_t __pyx_t_59;
   Py_ssize_t __pyx_t_60;
   Py_ssize_t __pyx_t_61;
@@ -5130,6 +5379,13 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
   Py_ssize_t __pyx_t_126;
   Py_ssize_t __pyx_t_127;
   Py_ssize_t __pyx_t_128;
+  Py_ssize_t __pyx_t_129;
+  Py_ssize_t __pyx_t_130;
+  Py_ssize_t __pyx_t_131;
+  Py_ssize_t __pyx_t_132;
+  Py_ssize_t __pyx_t_133;
+  Py_ssize_t __pyx_t_134;
+  Py_ssize_t __pyx_t_135;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -5162,6 +5418,14 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
   __pyx_pybuffer_cpos0_lower.refcount = 0;
   __pyx_pybuffernd_cpos0_lower.data = NULL;
   __pyx_pybuffernd_cpos0_lower.rcbuffer = &__pyx_pybuffer_cpos0_lower;
+  __pyx_pybuffer_cpos1_upper.pybuffer.buf = NULL;
+  __pyx_pybuffer_cpos1_upper.refcount = 0;
+  __pyx_pybuffernd_cpos1_upper.data = NULL;
+  __pyx_pybuffernd_cpos1_upper.rcbuffer = &__pyx_pybuffer_cpos1_upper;
+  __pyx_pybuffer_cpos1_lower.pybuffer.buf = NULL;
+  __pyx_pybuffer_cpos1_lower.refcount = 0;
+  __pyx_pybuffernd_cpos1_lower.data = NULL;
+  __pyx_pybuffernd_cpos1_lower.rcbuffer = &__pyx_pybuffer_cpos1_lower;
   __pyx_pybuffer_outData.pybuffer.buf = NULL;
   __pyx_pybuffer_outData.refcount = 0;
   __pyx_pybuffernd_outData.data = NULL;
@@ -5175,20 +5439,20 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
   __pyx_pybuffernd_outMerge.data = NULL;
   __pyx_pybuffernd_outMerge.rcbuffer = &__pyx_pybuffer_outMerge;
 
-  /* "splitBBox.pyx":294
+  /* "splitBBox.pyx":300
  * 
  *     cdef ssize_t bins0, bins1, i, j, idx
  *     cdef size_t size = weights.size             # <<<<<<<<<<<<<<
  *     assert pos0.size == size
  *     assert pos1.size == size
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_weights), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_weights), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_PyInt_AsSize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyInt_AsSize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __pyx_v_size = __pyx_t_2;
 
-  /* "splitBBox.pyx":295
+  /* "splitBBox.pyx":301
  *     cdef ssize_t bins0, bins1, i, j, idx
  *     cdef size_t size = weights.size
  *     assert pos0.size == size             # <<<<<<<<<<<<<<
@@ -5196,22 +5460,22 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
  *     assert delta_pos0.size == size
  */
   #ifndef CYTHON_WITHOUT_ASSERTIONS
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_pos0), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __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 = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   if (unlikely(!__pyx_t_5)) {
     PyErr_SetNone(PyExc_AssertionError);
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   #endif
 
-  /* "splitBBox.pyx":296
+  /* "splitBBox.pyx":302
  *     cdef size_t size = weights.size
  *     assert pos0.size == size
  *     assert pos1.size == size             # <<<<<<<<<<<<<<
@@ -5219,22 +5483,22 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
  *     assert delta_pos1.size == size
  */
   #ifndef CYTHON_WITHOUT_ASSERTIONS
-  __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_pos1), __pyx_n_s__size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_pos1), __pyx_n_s__size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (unlikely(!__pyx_t_5)) {
     PyErr_SetNone(PyExc_AssertionError);
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   #endif
 
-  /* "splitBBox.pyx":297
+  /* "splitBBox.pyx":303
  *     assert pos0.size == size
  *     assert pos1.size == size
  *     assert delta_pos0.size == size             # <<<<<<<<<<<<<<
@@ -5242,22 +5506,22 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
  *     try:
  */
   #ifndef CYTHON_WITHOUT_ASSERTIONS
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_delta_pos0), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_delta_pos0), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   if (unlikely(!__pyx_t_5)) {
     PyErr_SetNone(PyExc_AssertionError);
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   #endif
 
-  /* "splitBBox.pyx":298
+  /* "splitBBox.pyx":304
  *     assert pos1.size == size
  *     assert delta_pos0.size == size
  *     assert delta_pos1.size == size             # <<<<<<<<<<<<<<
@@ -5265,22 +5529,22 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
  *         bins0, bins1 = tuple(bins)
  */
   #ifndef CYTHON_WITHOUT_ASSERTIONS
-  __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_delta_pos1), __pyx_n_s__size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_delta_pos1), __pyx_n_s__size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (unlikely(!__pyx_t_5)) {
     PyErr_SetNone(PyExc_AssertionError);
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   #endif
 
-  /* "splitBBox.pyx":299
+  /* "splitBBox.pyx":305
  *     assert delta_pos0.size == size
  *     assert delta_pos1.size == size
  *     try:             # <<<<<<<<<<<<<<
@@ -5294,19 +5558,19 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
     __Pyx_XGOTREF(__pyx_t_8);
     /*try:*/ {
 
-      /* "splitBBox.pyx":300
+      /* "splitBBox.pyx":306
  *     assert delta_pos1.size == size
  *     try:
  *         bins0, bins1 = tuple(bins)             # <<<<<<<<<<<<<<
  *     except:
  *         bins0 = bins1 = bins
  */
-      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __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_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       __Pyx_GOTREF(__pyx_t_3);
       __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
       if (1) {
@@ -5319,7 +5583,7 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
         if (unlikely(size != 2)) {
           if (size > 2) __Pyx_RaiseTooManyValuesError(2);
           else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
-          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         #if CYTHON_COMPILING_IN_CPYTHON
         __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
@@ -5327,16 +5591,18 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
         __Pyx_INCREF(__pyx_t_1);
         __Pyx_INCREF(__pyx_t_4);
         #else
-        __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-        __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        __Pyx_GOTREF(__pyx_t_1);
+        __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        __Pyx_GOTREF(__pyx_t_4);
         #endif
         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
       } else if (1) {
-        __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       } else
       {
         Py_ssize_t index = -1;
-        __pyx_t_9 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        __pyx_t_9 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         __Pyx_GOTREF(__pyx_t_9);
         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
         __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext;
@@ -5344,7 +5610,7 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
         __Pyx_GOTREF(__pyx_t_1);
         index = 1; __pyx_t_4 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_4)) goto __pyx_L11_unpacking_failed;
         __Pyx_GOTREF(__pyx_t_4);
-        if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __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;
@@ -5352,12 +5618,12 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
         __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 = 300; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         __pyx_L12_unpacking_done:;
       }
-      __pyx_t_11 = PyInt_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      __pyx_t_11 = PyInt_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __pyx_t_12 = PyInt_AsSsize_t(__pyx_t_4); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      __pyx_t_12 = PyInt_AsSsize_t(__pyx_t_4); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
       __pyx_v_bins0 = __pyx_t_11;
       __pyx_v_bins1 = __pyx_t_12;
@@ -5372,7 +5638,7 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
 
-    /* "splitBBox.pyx":301
+    /* "splitBBox.pyx":307
  *     try:
  *         bins0, bins1 = tuple(bins)
  *     except:             # <<<<<<<<<<<<<<
@@ -5381,21 +5647,21 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
  */
     /*except:*/ {
       __Pyx_AddTraceback("splitBBox.histoBBox2d", __pyx_clineno, __pyx_lineno, __pyx_filename);
-      if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_4, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
+      if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_4, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
       __Pyx_GOTREF(__pyx_t_3);
       __Pyx_GOTREF(__pyx_t_4);
       __Pyx_GOTREF(__pyx_t_1);
 
-      /* "splitBBox.pyx":302
+      /* "splitBBox.pyx":308
  *         bins0, bins1 = tuple(bins)
  *     except:
  *         bins0 = bins1 = bins             # <<<<<<<<<<<<<<
  *     if bins0 <= 0:
  *         bins0 = 1
  */
-      __pyx_t_12 = PyInt_AsSsize_t(__pyx_v_bins); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
+      __pyx_t_12 = PyInt_AsSsize_t(__pyx_v_bins); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
       __pyx_v_bins0 = __pyx_t_12;
-      __pyx_t_12 = PyInt_AsSsize_t(__pyx_v_bins); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
+      __pyx_t_12 = PyInt_AsSsize_t(__pyx_v_bins); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
       __pyx_v_bins1 = __pyx_t_12;
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
@@ -5416,17 +5682,17 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
     __pyx_L10_try_end:;
   }
 
-  /* "splitBBox.pyx":303
+  /* "splitBBox.pyx":309
  *     except:
  *         bins0 = bins1 = bins
  *     if bins0 <= 0:             # <<<<<<<<<<<<<<
  *         bins0 = 1
  *     if bins1 <= 0:
  */
-  __pyx_t_5 = (__pyx_v_bins0 <= 0);
+  __pyx_t_5 = ((__pyx_v_bins0 <= 0) != 0);
   if (__pyx_t_5) {
 
-    /* "splitBBox.pyx":304
+    /* "splitBBox.pyx":310
  *         bins0 = bins1 = bins
  *     if bins0 <= 0:
  *         bins0 = 1             # <<<<<<<<<<<<<<
@@ -5438,17 +5704,17 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
   }
   __pyx_L15:;
 
-  /* "splitBBox.pyx":305
+  /* "splitBBox.pyx":311
  *     if bins0 <= 0:
  *         bins0 = 1
  *     if bins1 <= 0:             # <<<<<<<<<<<<<<
  *         bins1 = 1
  *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cdata = numpy.ascontiguousarray(weights.ravel(),dtype=numpy.float32)
  */
-  __pyx_t_5 = (__pyx_v_bins1 <= 0);
+  __pyx_t_5 = ((__pyx_v_bins1 <= 0) != 0);
   if (__pyx_t_5) {
 
-    /* "splitBBox.pyx":306
+    /* "splitBBox.pyx":312
  *         bins0 = 1
  *     if bins1 <= 0:
  *         bins1 = 1             # <<<<<<<<<<<<<<
@@ -5460,49 +5726,49 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
   }
   __pyx_L16:;
 
-  /* "splitBBox.pyx":307
+  /* "splitBBox.pyx":313
  *     if bins1 <= 0:
  *         bins1 = 1
  *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cdata = numpy.ascontiguousarray(weights.ravel(),dtype=numpy.float32)             # <<<<<<<<<<<<<<
  *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos0 = numpy.ascontiguousarray(pos0.ravel(),dtype=numpy.float32)
  *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] dpos0 = numpy.ascontiguousarray(delta_pos0.ravel(),dtype=numpy.float32)
  */
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_weights), __pyx_n_s__ravel); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_weights), __pyx_n_s__ravel); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __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 = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __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 = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __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);
   __pyx_t_3 = 0;
-  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-  __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_9);
-  __pyx_t_13 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__float32); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s__float32); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __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_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  __pyx_t_13 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_13 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_13);
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-  if (!(likely(((__pyx_t_13) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_13, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (!(likely(((__pyx_t_13) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_13, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_t_14 = ((PyArrayObject *)__pyx_t_13);
   {
     __Pyx_BufFmt_StackElem __pyx_stack[1];
     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cdata.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
       __pyx_v_cdata = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_cdata.rcbuffer->pybuffer.buf = NULL;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     } else {__pyx_pybuffernd_cdata.diminfo[0].strides = __pyx_pybuffernd_cdata.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cdata.diminfo[0].shape = __pyx_pybuffernd_cdata.rcbuffer->pybuffer.shape[0];
     }
   }
@@ -5510,49 +5776,49 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
   __pyx_v_cdata = ((PyArrayObject *)__pyx_t_13);
   __pyx_t_13 = 0;
 
-  /* "splitBBox.pyx":308
+  /* "splitBBox.pyx":314
  *         bins1 = 1
  *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cdata = numpy.ascontiguousarray(weights.ravel(),dtype=numpy.float32)
  *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos0 = numpy.ascontiguousarray(pos0.ravel(),dtype=numpy.float32)             # <<<<<<<<<<<<<<
  *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] dpos0 = numpy.ascontiguousarray(delta_pos0.ravel(),dtype=numpy.float32)
  *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos1 = numpy.ascontiguousarray(pos1.ravel(),dtype=numpy.float32)
  */
-  __pyx_t_13 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_13);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_13, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  __pyx_t_13 = PyObject_GetAttr(((PyObject *)__pyx_v_pos0), __pyx_n_s__ravel); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_13 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_pos0), __pyx_n_s__ravel); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __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 = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __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 = 314; __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 = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __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 = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_9 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__float32); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__float32); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_9);
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-  __pyx_t_9 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_13), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_9 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_13), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_9);
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-  if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_t_15 = ((PyArrayObject *)__pyx_t_9);
   {
     __Pyx_BufFmt_StackElem __pyx_stack[1];
     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cpos0.rcbuffer->pybuffer, (PyObject*)__pyx_t_15, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
       __pyx_v_cpos0 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_cpos0.rcbuffer->pybuffer.buf = NULL;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     } else {__pyx_pybuffernd_cpos0.diminfo[0].strides = __pyx_pybuffernd_cpos0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cpos0.diminfo[0].shape = __pyx_pybuffernd_cpos0.rcbuffer->pybuffer.shape[0];
     }
   }
@@ -5560,49 +5826,49 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
   __pyx_v_cpos0 = ((PyArrayObject *)__pyx_t_9);
   __pyx_t_9 = 0;
 
-  /* "splitBBox.pyx":309
+  /* "splitBBox.pyx":315
  *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cdata = numpy.ascontiguousarray(weights.ravel(),dtype=numpy.float32)
  *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos0 = numpy.ascontiguousarray(pos0.ravel(),dtype=numpy.float32)
  *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] dpos0 = numpy.ascontiguousarray(delta_pos0.ravel(),dtype=numpy.float32)             # <<<<<<<<<<<<<<
  *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos1 = numpy.ascontiguousarray(pos1.ravel(),dtype=numpy.float32)
  *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] dpos1 = numpy.ascontiguousarray(delta_pos1.ravel(),dtype=numpy.float32)
  */
-  __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_9);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __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 = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-  __pyx_t_9 = PyObject_GetAttr(((PyObject *)__pyx_v_delta_pos0), __pyx_n_s__ravel); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_delta_pos0), __pyx_n_s__ravel); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __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 = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __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 = 315; __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 = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __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 = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_13 = PyDict_New(); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_13));
-  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__float32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__float32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyDict_SetItem(__pyx_t_13, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_13, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_9), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_9), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
-  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_t_16 = ((PyArrayObject *)__pyx_t_4);
   {
     __Pyx_BufFmt_StackElem __pyx_stack[1];
     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dpos0.rcbuffer->pybuffer, (PyObject*)__pyx_t_16, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
       __pyx_v_dpos0 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_dpos0.rcbuffer->pybuffer.buf = NULL;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     } else {__pyx_pybuffernd_dpos0.diminfo[0].strides = __pyx_pybuffernd_dpos0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dpos0.diminfo[0].shape = __pyx_pybuffernd_dpos0.rcbuffer->pybuffer.shape[0];
     }
   }
@@ -5610,49 +5876,49 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
   __pyx_v_dpos0 = ((PyArrayObject *)__pyx_t_4);
   __pyx_t_4 = 0;
 
-  /* "splitBBox.pyx":310
+  /* "splitBBox.pyx":316
  *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos0 = numpy.ascontiguousarray(pos0.ravel(),dtype=numpy.float32)
  *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] dpos0 = numpy.ascontiguousarray(delta_pos0.ravel(),dtype=numpy.float32)
  *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos1 = numpy.ascontiguousarray(pos1.ravel(),dtype=numpy.float32)             # <<<<<<<<<<<<<<
  *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] dpos1 = numpy.ascontiguousarray(delta_pos1.ravel(),dtype=numpy.float32)
  *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos0_upper = numpy.empty(size,dtype=numpy.float32)
  */
-  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_13 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_13);
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_pos1), __pyx_n_s__ravel); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_pos1), __pyx_n_s__ravel); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_9 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_9 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_9);
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_9);
   __Pyx_GIVEREF(__pyx_t_9);
   __pyx_t_9 = 0;
-  __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_9));
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__float32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __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_4)); __pyx_t_4 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
-  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __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_cpos1.rcbuffer->pybuffer, (PyObject*)__pyx_t_17, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
       __pyx_v_cpos1 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_cpos1.rcbuffer->pybuffer.buf = NULL;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     } else {__pyx_pybuffernd_cpos1.diminfo[0].strides = __pyx_pybuffernd_cpos1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cpos1.diminfo[0].shape = __pyx_pybuffernd_cpos1.rcbuffer->pybuffer.shape[0];
     }
   }
@@ -5660,49 +5926,49 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
   __pyx_v_cpos1 = ((PyArrayObject *)__pyx_t_3);
   __pyx_t_3 = 0;
 
-  /* "splitBBox.pyx":311
+  /* "splitBBox.pyx":317
  *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] dpos0 = numpy.ascontiguousarray(delta_pos0.ravel(),dtype=numpy.float32)
  *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos1 = numpy.ascontiguousarray(pos1.ravel(),dtype=numpy.float32)
  *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] dpos1 = numpy.ascontiguousarray(delta_pos1.ravel(),dtype=numpy.float32)             # <<<<<<<<<<<<<<
  *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos0_upper = numpy.empty(size,dtype=numpy.float32)
  *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos0_lower = numpy.empty(size,dtype=numpy.float32)
  */
-  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_9 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_9);
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_delta_pos1), __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_delta_pos1), __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __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 = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
   __Pyx_GIVEREF(__pyx_t_4);
   __pyx_t_4 = 0;
-  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-  __pyx_t_13 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_13);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_13, __pyx_n_s__float32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s__float32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_t_18 = ((PyArrayObject *)__pyx_t_1);
   {
     __Pyx_BufFmt_StackElem __pyx_stack[1];
     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dpos1.rcbuffer->pybuffer, (PyObject*)__pyx_t_18, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
       __pyx_v_dpos1 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_dpos1.rcbuffer->pybuffer.buf = NULL;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     } else {__pyx_pybuffernd_dpos1.diminfo[0].strides = __pyx_pybuffernd_dpos1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dpos1.diminfo[0].shape = __pyx_pybuffernd_dpos1.rcbuffer->pybuffer.shape[0];
     }
   }
@@ -5710,46 +5976,46 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
   __pyx_v_dpos1 = ((PyArrayObject *)__pyx_t_1);
   __pyx_t_1 = 0;
 
-  /* "splitBBox.pyx":312
+  /* "splitBBox.pyx":318
  *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos1 = numpy.ascontiguousarray(pos1.ravel(),dtype=numpy.float32)
  *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] dpos1 = numpy.ascontiguousarray(delta_pos1.ravel(),dtype=numpy.float32)
  *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos0_upper = numpy.empty(size,dtype=numpy.float32)             # <<<<<<<<<<<<<<
  *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos0_lower = numpy.empty(size,dtype=numpy.float32)
- *     cdef numpy.ndarray[numpy.float64_t, ndim = 2] outData = numpy.zeros((bins0, bins1), dtype=numpy.float64)
+ *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos1_upper = numpy.empty(size,dtype=numpy.float32)
  */
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __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 = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_9);
-  __pyx_t_13 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__float32); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s__float32); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __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_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  __pyx_t_13 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_13 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_13);
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-  if (!(likely(((__pyx_t_13) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_13, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (!(likely(((__pyx_t_13) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_13, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_t_19 = ((PyArrayObject *)__pyx_t_13);
   {
     __Pyx_BufFmt_StackElem __pyx_stack[1];
     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cpos0_upper.rcbuffer->pybuffer, (PyObject*)__pyx_t_19, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
       __pyx_v_cpos0_upper = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_cpos0_upper.rcbuffer->pybuffer.buf = NULL;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     } else {__pyx_pybuffernd_cpos0_upper.diminfo[0].strides = __pyx_pybuffernd_cpos0_upper.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cpos0_upper.diminfo[0].shape = __pyx_pybuffernd_cpos0_upper.rcbuffer->pybuffer.shape[0];
     }
   }
@@ -5757,46 +6023,46 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
   __pyx_v_cpos0_upper = ((PyArrayObject *)__pyx_t_13);
   __pyx_t_13 = 0;
 
-  /* "splitBBox.pyx":313
+  /* "splitBBox.pyx":319
  *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] dpos1 = numpy.ascontiguousarray(delta_pos1.ravel(),dtype=numpy.float32)
  *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos0_upper = numpy.empty(size,dtype=numpy.float32)
  *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos0_lower = numpy.empty(size,dtype=numpy.float32)             # <<<<<<<<<<<<<<
- *     cdef numpy.ndarray[numpy.float64_t, ndim = 2] outData = numpy.zeros((bins0, bins1), dtype=numpy.float64)
- *     cdef numpy.ndarray[numpy.float64_t, ndim = 2] outCount = numpy.zeros((bins0, bins1), dtype=numpy.float64)
+ *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos1_upper = numpy.empty(size,dtype=numpy.float32)
+ *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos1_lower = numpy.empty(size,dtype=numpy.float32)
  */
-  __pyx_t_13 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_13);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_13, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  __pyx_t_13 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_13 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_13);
-  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __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);
   __pyx_t_13 = 0;
-  __pyx_t_13 = PyDict_New(); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_13 = PyDict_New(); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_13));
-  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_9 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__float32); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__float32); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_9);
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyDict_SetItem(__pyx_t_13, ((PyObject *)__pyx_n_s__dtype), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_13, ((PyObject *)__pyx_n_s__dtype), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-  __pyx_t_9 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_9 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_9);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 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 = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_t_20 = ((PyArrayObject *)__pyx_t_9);
   {
     __Pyx_BufFmt_StackElem __pyx_stack[1];
     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cpos0_lower.rcbuffer->pybuffer, (PyObject*)__pyx_t_20, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
       __pyx_v_cpos0_lower = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_cpos0_lower.rcbuffer->pybuffer.buf = NULL;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     } else {__pyx_pybuffernd_cpos0_lower.diminfo[0].strides = __pyx_pybuffernd_cpos0_lower.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cpos0_lower.diminfo[0].shape = __pyx_pybuffernd_cpos0_lower.rcbuffer->pybuffer.shape[0];
     }
   }
@@ -5804,178 +6070,272 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
   __pyx_v_cpos0_lower = ((PyArrayObject *)__pyx_t_9);
   __pyx_t_9 = 0;
 
-  /* "splitBBox.pyx":314
+  /* "splitBBox.pyx":320
  *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos0_upper = numpy.empty(size,dtype=numpy.float32)
  *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos0_lower = numpy.empty(size,dtype=numpy.float32)
- *     cdef numpy.ndarray[numpy.float64_t, ndim = 2] outData = numpy.zeros((bins0, bins1), dtype=numpy.float64)             # <<<<<<<<<<<<<<
- *     cdef numpy.ndarray[numpy.float64_t, ndim = 2] outCount = numpy.zeros((bins0, bins1), dtype=numpy.float64)
- *     cdef numpy.ndarray[numpy.float32_t, ndim = 2] outMerge = numpy.zeros((bins0, bins1), dtype=numpy.float32)
+ *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos1_upper = numpy.empty(size,dtype=numpy.float32)             # <<<<<<<<<<<<<<
+ *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos1_lower = numpy.empty(size,dtype=numpy.float32)
+ *     cdef numpy.ndarray[numpy.float64_t, ndim = 2] outData = numpy.zeros((bins0, bins1), dtype=numpy.float64)
  */
-  __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_9);
-  __pyx_t_13 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__zeros); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s__empty); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_13);
   __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-  __pyx_t_9 = PyInt_FromSsize_t(__pyx_v_bins0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_9 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_9);
-  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_bins1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9);
+  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_9);
   __Pyx_GIVEREF(__pyx_t_9);
-  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
-  __Pyx_GIVEREF(__pyx_t_3);
   __pyx_t_9 = 0;
-  __pyx_t_3 = 0;
-  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
-  __pyx_t_1 = 0;
-  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__float64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_9));
+  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__float32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_t_4 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
+  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_t_21 = ((PyArrayObject *)__pyx_t_4);
   {
     __Pyx_BufFmt_StackElem __pyx_stack[1];
-    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outData.rcbuffer->pybuffer, (PyObject*)__pyx_t_21, &__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 = 314; __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];
+    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cpos1_upper.rcbuffer->pybuffer, (PyObject*)__pyx_t_21, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
+      __pyx_v_cpos1_upper = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_cpos1_upper.rcbuffer->pybuffer.buf = NULL;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    } else {__pyx_pybuffernd_cpos1_upper.diminfo[0].strides = __pyx_pybuffernd_cpos1_upper.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cpos1_upper.diminfo[0].shape = __pyx_pybuffernd_cpos1_upper.rcbuffer->pybuffer.shape[0];
     }
   }
   __pyx_t_21 = 0;
-  __pyx_v_outData = ((PyArrayObject *)__pyx_t_4);
+  __pyx_v_cpos1_upper = ((PyArrayObject *)__pyx_t_4);
   __pyx_t_4 = 0;
 
-  /* "splitBBox.pyx":315
+  /* "splitBBox.pyx":321
  *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos0_lower = numpy.empty(size,dtype=numpy.float32)
+ *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos1_upper = numpy.empty(size,dtype=numpy.float32)
+ *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos1_lower = numpy.empty(size,dtype=numpy.float32)             # <<<<<<<<<<<<<<
  *     cdef numpy.ndarray[numpy.float64_t, ndim = 2] outData = numpy.zeros((bins0, bins1), dtype=numpy.float64)
- *     cdef numpy.ndarray[numpy.float64_t, ndim = 2] outCount = numpy.zeros((bins0, bins1), dtype=numpy.float64)             # <<<<<<<<<<<<<<
- *     cdef numpy.ndarray[numpy.float32_t, ndim = 2] outMerge = numpy.zeros((bins0, bins1), dtype=numpy.float32)
- * 
+ *     cdef numpy.ndarray[numpy.float64_t, ndim = 2] outCount = numpy.zeros((bins0, bins1), dtype=numpy.float64)
  */
-  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__empty); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_9);
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_bins0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_bins1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_13);
-  PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_4);
+  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
   __Pyx_GIVEREF(__pyx_t_4);
-  PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_3);
-  __Pyx_GIVEREF(__pyx_t_3);
   __pyx_t_4 = 0;
-  __pyx_t_3 = 0;
-  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  PyTuple_SET_ITEM(__pyx_t_3, 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 = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_13));
-  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+  __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_13);
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s__float32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_1 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_22 = ((PyArrayObject *)__pyx_t_1);
+  {
+    __Pyx_BufFmt_StackElem __pyx_stack[1];
+    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cpos1_lower.rcbuffer->pybuffer, (PyObject*)__pyx_t_22, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
+      __pyx_v_cpos1_lower = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_cpos1_lower.rcbuffer->pybuffer.buf = NULL;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    } else {__pyx_pybuffernd_cpos1_lower.diminfo[0].strides = __pyx_pybuffernd_cpos1_lower.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cpos1_lower.diminfo[0].shape = __pyx_pybuffernd_cpos1_lower.rcbuffer->pybuffer.shape[0];
+    }
+  }
+  __pyx_t_22 = 0;
+  __pyx_v_cpos1_lower = ((PyArrayObject *)__pyx_t_1);
+  __pyx_t_1 = 0;
+
+  /* "splitBBox.pyx":322
+ *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos1_upper = numpy.empty(size,dtype=numpy.float32)
+ *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos1_lower = numpy.empty(size,dtype=numpy.float32)
+ *     cdef numpy.ndarray[numpy.float64_t, ndim = 2] outData = numpy.zeros((bins0, bins1), dtype=numpy.float64)             # <<<<<<<<<<<<<<
+ *     cdef numpy.ndarray[numpy.float64_t, ndim = 2] outCount = numpy.zeros((bins0, bins1), dtype=numpy.float64)
+ *     cdef numpy.ndarray[numpy.float32_t, ndim = 2] outMerge = numpy.zeros((bins0, bins1), dtype=numpy.float32)
+ */
+  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_9 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__float64); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_bins0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_bins1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_9);
+  PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_1);
+  __Pyx_GIVEREF(__pyx_t_1);
+  PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_3);
+  __Pyx_GIVEREF(__pyx_t_3);
+  __pyx_t_1 = 0;
+  __pyx_t_3 = 0;
+  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_9));
+  __Pyx_GIVEREF(((PyObject *)__pyx_t_9));
+  __pyx_t_9 = 0;
+  __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_9));
+  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__float64); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_13);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__dtype), __pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+  __pyx_t_13 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_13);
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyDict_SetItem(__pyx_t_13, ((PyObject *)__pyx_n_s__dtype), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-  __pyx_t_9 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 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 = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_23 = ((PyArrayObject *)__pyx_t_13);
+  {
+    __Pyx_BufFmt_StackElem __pyx_stack[1];
+    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outData.rcbuffer->pybuffer, (PyObject*)__pyx_t_23, &__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 = 322; __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_23 = 0;
+  __pyx_v_outData = ((PyArrayObject *)__pyx_t_13);
+  __pyx_t_13 = 0;
+
+  /* "splitBBox.pyx":323
+ *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos1_lower = numpy.empty(size,dtype=numpy.float32)
+ *     cdef numpy.ndarray[numpy.float64_t, ndim = 2] outData = numpy.zeros((bins0, bins1), dtype=numpy.float64)
+ *     cdef numpy.ndarray[numpy.float64_t, ndim = 2] outCount = numpy.zeros((bins0, bins1), dtype=numpy.float64)             # <<<<<<<<<<<<<<
+ *     cdef numpy.ndarray[numpy.float32_t, ndim = 2] outMerge = numpy.zeros((bins0, bins1), dtype=numpy.float32)
+ * 
+ */
+  __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_13);
+  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s__zeros); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_9);
+  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+  __pyx_t_13 = PyInt_FromSsize_t(__pyx_v_bins0); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_13);
+  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_bins1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
+  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_13);
+  __Pyx_GIVEREF(__pyx_t_13);
+  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
+  __Pyx_GIVEREF(__pyx_t_3);
+  __pyx_t_13 = 0;
+  __pyx_t_3 = 0;
+  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
+  __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
+  __pyx_t_4 = 0;
+  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+  __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_13);
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s__float64); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_1 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 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 = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_22 = ((PyArrayObject *)__pyx_t_9);
+  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_24 = ((PyArrayObject *)__pyx_t_1);
   {
     __Pyx_BufFmt_StackElem __pyx_stack[1];
-    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outCount.rcbuffer->pybuffer, (PyObject*)__pyx_t_22, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
+    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outCount.rcbuffer->pybuffer, (PyObject*)__pyx_t_24, &__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 = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __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_22 = 0;
-  __pyx_v_outCount = ((PyArrayObject *)__pyx_t_9);
-  __pyx_t_9 = 0;
+  __pyx_t_24 = 0;
+  __pyx_v_outCount = ((PyArrayObject *)__pyx_t_1);
+  __pyx_t_1 = 0;
 
-  /* "splitBBox.pyx":316
+  /* "splitBBox.pyx":324
  *     cdef numpy.ndarray[numpy.float64_t, ndim = 2] outData = numpy.zeros((bins0, bins1), dtype=numpy.float64)
  *     cdef numpy.ndarray[numpy.float64_t, ndim = 2] outCount = numpy.zeros((bins0, bins1), dtype=numpy.float64)
  *     cdef numpy.ndarray[numpy.float32_t, ndim = 2] outMerge = numpy.zeros((bins0, bins1), dtype=numpy.float32)             # <<<<<<<<<<<<<<
  * 
- *     cdef float min0, max0, min1, max1, deltaR, deltaL, deltaU, deltaD, deltaA, tmp, delta0, delta1
+ *     cdef float c0, c1, d0, d1
  */
-  __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
-  __pyx_t_13 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__zeros); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_13);
-  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-  __pyx_t_9 = PyInt_FromSsize_t(__pyx_v_bins0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
-  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_bins1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9);
-  __Pyx_GIVEREF(__pyx_t_9);
-  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_bins0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_bins1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_9);
+  PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_1);
+  __Pyx_GIVEREF(__pyx_t_1);
+  PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_3);
   __Pyx_GIVEREF(__pyx_t_3);
-  __pyx_t_9 = 0;
+  __pyx_t_1 = 0;
   __pyx_t_3 = 0;
-  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
-  __pyx_t_1 = 0;
-  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__float32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_t_4 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
+  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_9));
+  __Pyx_GIVEREF(((PyObject *)__pyx_t_9));
+  __pyx_t_9 = 0;
+  __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_9));
+  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__float32); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_13);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__dtype), __pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+  __pyx_t_13 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_13);
+  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_23 = ((PyArrayObject *)__pyx_t_4);
+  __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 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 = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_25 = ((PyArrayObject *)__pyx_t_13);
   {
     __Pyx_BufFmt_StackElem __pyx_stack[1];
-    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outMerge.rcbuffer->pybuffer, (PyObject*)__pyx_t_23, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
+    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outMerge.rcbuffer->pybuffer, (PyObject*)__pyx_t_25, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
       __pyx_v_outMerge = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.buf = NULL;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __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_23 = 0;
-  __pyx_v_outMerge = ((PyArrayObject *)__pyx_t_4);
-  __pyx_t_4 = 0;
+  __pyx_t_25 = 0;
+  __pyx_v_outMerge = ((PyArrayObject *)__pyx_t_13);
+  __pyx_t_13 = 0;
 
-  /* "splitBBox.pyx":320
+  /* "splitBBox.pyx":329
  *     cdef float min0, max0, min1, max1, deltaR, deltaL, deltaU, deltaD, deltaA, tmp, delta0, delta1
  *     cdef float pos0_min, pos0_max, pos1_min, pos1_max, pos0_maxin, pos1_maxin
  *     cdef float fbin0_min, fbin0_max, fbin1_min, fbin1_max, data, epsilon = 1e-10, cdummy, ddummy             # <<<<<<<<<<<<<<
@@ -5984,7 +6344,7 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
  */
   __pyx_v_epsilon = 1e-10;
 
-  /* "splitBBox.pyx":322
+  /* "splitBBox.pyx":331
  *     cdef float fbin0_min, fbin0_max, fbin1_min, fbin1_max, data, epsilon = 1e-10, cdummy, ddummy
  *     cdef ssize_t  bin0_max, bin0_min, bin1_max, bin1_min
  *     cdef bint check_mask=False, check_dummy=False, do_dark=False, do_flat=False, do_polarization=False, do_solidangle=False             # <<<<<<<<<<<<<<
@@ -5998,7 +6358,7 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
   __pyx_v_do_polarization = 0;
   __pyx_v_do_solidangle = 0;
 
-  /* "splitBBox.pyx":326
+  /* "splitBBox.pyx":335
  *     cdef float[:] cflat, cdark, cpolarization, csolidangle
  * 
  *     if  mask is not None:             # <<<<<<<<<<<<<<
@@ -6006,9 +6366,10 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
  *         check_mask = True
  */
   __pyx_t_5 = (__pyx_v_mask != Py_None);
-  if (__pyx_t_5) {
+  __pyx_t_26 = (__pyx_t_5 != 0);
+  if (__pyx_t_26) {
 
-    /* "splitBBox.pyx":327
+    /* "splitBBox.pyx":336
  * 
  *     if  mask is not None:
  *         assert mask.size == size             # <<<<<<<<<<<<<<
@@ -6016,22 +6377,22 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
  *         cmask = numpy.ascontiguousarray(mask.ravel(),dtype=numpy.int8)
  */
     #ifndef CYTHON_WITHOUT_ASSERTIONS
-    __pyx_t_4 = PyObject_GetAttr(__pyx_v_mask, __pyx_n_s__size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_mask, __pyx_n_s__size); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_13);
+    __pyx_t_9 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_9);
+    __pyx_t_3 = PyObject_RichCompare(__pyx_t_13, __pyx_t_9, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    __pyx_t_26 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_26 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    if (unlikely(!__pyx_t_5)) {
+    if (unlikely(!__pyx_t_26)) {
       PyErr_SetNone(PyExc_AssertionError);
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     #endif
 
-    /* "splitBBox.pyx":328
+    /* "splitBBox.pyx":337
  *     if  mask is not None:
  *         assert mask.size == size
  *         check_mask = True             # <<<<<<<<<<<<<<
@@ -6040,69 +6401,69 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
  */
     __pyx_v_check_mask = 1;
 
-    /* "splitBBox.pyx":329
+    /* "splitBBox.pyx":338
  *         assert mask.size == size
  *         check_mask = True
  *         cmask = numpy.ascontiguousarray(mask.ravel(),dtype=numpy.int8)             # <<<<<<<<<<<<<<
  * 
  *     if (dummy is not None) and delta_dummy is not None:
  */
-    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_9);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_3 = PyObject_GetAttr(__pyx_v_mask, __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_mask, __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_13 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_13);
     __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 = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
-    __Pyx_GIVEREF(__pyx_t_4);
-    __pyx_t_4 = 0;
-    __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-    __pyx_t_13 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_13);
-    __pyx_t_9 = PyObject_GetAttr(__pyx_t_13, __pyx_n_s__int8); 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_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-    if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-    __pyx_t_9 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_4)); 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_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-    __pyx_t_24 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int8_t(__pyx_t_9);
-    if (unlikely(!__pyx_t_24.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-    __pyx_v_cmask = __pyx_t_24;
-    __pyx_t_24.memview = NULL;
-    __pyx_t_24.data = NULL;
-    goto __pyx_L17;
-  }
+    PyTuple_SET_ITEM(__pyx_t_3, 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 = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_13));
+    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__int8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    if (PyDict_SetItem(__pyx_t_13, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_1 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
+    __pyx_t_27 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int8_t(__pyx_t_1);
+    if (unlikely(!__pyx_t_27.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_v_cmask = __pyx_t_27;
+    __pyx_t_27.memview = NULL;
+    __pyx_t_27.data = NULL;
+    goto __pyx_L17;
+  }
   __pyx_L17:;
 
-  /* "splitBBox.pyx":331
+  /* "splitBBox.pyx":340
  *         cmask = numpy.ascontiguousarray(mask.ravel(),dtype=numpy.int8)
  * 
  *     if (dummy is not None) and delta_dummy is not None:             # <<<<<<<<<<<<<<
  *         check_dummy = True
  *         cdummy =  float(dummy)
  */
-  __pyx_t_5 = (__pyx_v_dummy != Py_None);
-  if (__pyx_t_5) {
-    __pyx_t_25 = (__pyx_v_delta_dummy != Py_None);
-    __pyx_t_26 = __pyx_t_25;
+  __pyx_t_26 = (__pyx_v_dummy != Py_None);
+  if ((__pyx_t_26 != 0)) {
+    __pyx_t_5 = (__pyx_v_delta_dummy != Py_None);
+    __pyx_t_28 = (__pyx_t_5 != 0);
   } else {
-    __pyx_t_26 = __pyx_t_5;
+    __pyx_t_28 = (__pyx_t_26 != 0);
   }
-  if (__pyx_t_26) {
+  if (__pyx_t_28) {
 
-    /* "splitBBox.pyx":332
+    /* "splitBBox.pyx":341
  * 
  *     if (dummy is not None) and delta_dummy is not None:
  *         check_dummy = True             # <<<<<<<<<<<<<<
@@ -6111,52 +6472,53 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
  */
     __pyx_v_check_dummy = 1;
 
-    /* "splitBBox.pyx":333
+    /* "splitBBox.pyx":342
  *     if (dummy is not None) and delta_dummy is not None:
  *         check_dummy = True
  *         cdummy =  float(dummy)             # <<<<<<<<<<<<<<
  *         ddummy =  float(delta_dummy)
  *     elif (dummy is not None):
  */
-    __pyx_t_27 = __Pyx_PyObject_AsDouble(__pyx_v_dummy); if (unlikely(__pyx_t_27 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_v_cdummy = __pyx_t_27;
+    __pyx_t_29 = __Pyx_PyObject_AsDouble(__pyx_v_dummy); if (unlikely(__pyx_t_29 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_v_cdummy = __pyx_t_29;
 
-    /* "splitBBox.pyx":334
+    /* "splitBBox.pyx":343
  *         check_dummy = True
  *         cdummy =  float(dummy)
  *         ddummy =  float(delta_dummy)             # <<<<<<<<<<<<<<
  *     elif (dummy is not None):
  *         cdummy = float(dummy)
  */
-    __pyx_t_27 = __Pyx_PyObject_AsDouble(__pyx_v_delta_dummy); if (unlikely(__pyx_t_27 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_v_ddummy = __pyx_t_27;
+    __pyx_t_29 = __Pyx_PyObject_AsDouble(__pyx_v_delta_dummy); if (unlikely(__pyx_t_29 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_v_ddummy = __pyx_t_29;
     goto __pyx_L18;
   }
 
-  /* "splitBBox.pyx":335
+  /* "splitBBox.pyx":344
  *         cdummy =  float(dummy)
  *         ddummy =  float(delta_dummy)
  *     elif (dummy is not None):             # <<<<<<<<<<<<<<
  *         cdummy = float(dummy)
  *     else:
  */
-  __pyx_t_26 = (__pyx_v_dummy != Py_None);
+  __pyx_t_28 = (__pyx_v_dummy != Py_None);
+  __pyx_t_26 = (__pyx_t_28 != 0);
   if (__pyx_t_26) {
 
-    /* "splitBBox.pyx":336
+    /* "splitBBox.pyx":345
  *         ddummy =  float(delta_dummy)
  *     elif (dummy is not None):
  *         cdummy = float(dummy)             # <<<<<<<<<<<<<<
  *     else:
  *         cdummy=0.0
  */
-    __pyx_t_27 = __Pyx_PyObject_AsDouble(__pyx_v_dummy); if (unlikely(__pyx_t_27 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_v_cdummy = __pyx_t_27;
+    __pyx_t_29 = __Pyx_PyObject_AsDouble(__pyx_v_dummy); if (unlikely(__pyx_t_29 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_v_cdummy = __pyx_t_29;
     goto __pyx_L18;
   }
   /*else*/ {
 
-    /* "splitBBox.pyx":338
+    /* "splitBBox.pyx":347
  *         cdummy = float(dummy)
  *     else:
  *         cdummy=0.0             # <<<<<<<<<<<<<<
@@ -6167,7 +6529,7 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
   }
   __pyx_L18:;
 
-  /* "splitBBox.pyx":340
+  /* "splitBBox.pyx":349
  *         cdummy=0.0
  * 
  *     if dark is not None:             # <<<<<<<<<<<<<<
@@ -6175,9 +6537,10 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
  *         do_dark = True
  */
   __pyx_t_26 = (__pyx_v_dark != Py_None);
-  if (__pyx_t_26) {
+  __pyx_t_28 = (__pyx_t_26 != 0);
+  if (__pyx_t_28) {
 
-    /* "splitBBox.pyx":341
+    /* "splitBBox.pyx":350
  * 
  *     if dark is not None:
  *         assert dark.size == size             # <<<<<<<<<<<<<<
@@ -6185,22 +6548,22 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
  *         cdark = numpy.ascontiguousarray(dark.ravel(),dtype=numpy.float32)
  */
     #ifndef CYTHON_WITHOUT_ASSERTIONS
-    __pyx_t_9 = PyObject_GetAttr(__pyx_v_dark, __pyx_n_s__size); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
-    __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_3 = PyObject_RichCompare(__pyx_t_9, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_26 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_26 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_dark, __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_13 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_13);
+    __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_13, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+    __pyx_t_28 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_28 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    if (unlikely(!__pyx_t_26)) {
+    if (unlikely(!__pyx_t_28)) {
       PyErr_SetNone(PyExc_AssertionError);
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     #endif
 
-    /* "splitBBox.pyx":342
+    /* "splitBBox.pyx":351
  *     if dark is not None:
  *         assert dark.size == size
  *         do_dark = True             # <<<<<<<<<<<<<<
@@ -6209,63 +6572,64 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
  */
     __pyx_v_do_dark = 1;
 
-    /* "splitBBox.pyx":343
+    /* "splitBBox.pyx":352
  *         assert dark.size == size
  *         do_dark = True
  *         cdark = numpy.ascontiguousarray(dark.ravel(),dtype=numpy.float32)             # <<<<<<<<<<<<<<
  *     if flat is not None:
  *         assert flat.size == size
  */
-    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_13);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_3 = PyObject_GetAttr(__pyx_v_dark, __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_dark, __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_9 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
+    __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 = 352; __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 = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_9);
-    __Pyx_GIVEREF(__pyx_t_9);
-    __pyx_t_9 = 0;
-    __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_9));
-    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_13 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float32); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_13);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__dtype), __pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-    __pyx_t_13 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_13);
+    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 = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+    __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_9);
+    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s__float32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
-    __pyx_t_28 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_13);
-    if (unlikely(!__pyx_t_28.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-    __pyx_v_cdark = __pyx_t_28;
-    __pyx_t_28.memview = NULL;
-    __pyx_t_28.data = NULL;
+    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+    __pyx_t_30 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_4);
+    if (unlikely(!__pyx_t_30.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_v_cdark = __pyx_t_30;
+    __pyx_t_30.memview = NULL;
+    __pyx_t_30.data = NULL;
     goto __pyx_L19;
   }
   __pyx_L19:;
 
-  /* "splitBBox.pyx":344
+  /* "splitBBox.pyx":353
  *         do_dark = True
  *         cdark = numpy.ascontiguousarray(dark.ravel(),dtype=numpy.float32)
  *     if flat is not None:             # <<<<<<<<<<<<<<
  *         assert flat.size == size
  *         do_flat = True
  */
-  __pyx_t_26 = (__pyx_v_flat != Py_None);
+  __pyx_t_28 = (__pyx_v_flat != Py_None);
+  __pyx_t_26 = (__pyx_t_28 != 0);
   if (__pyx_t_26) {
 
-    /* "splitBBox.pyx":345
+    /* "splitBBox.pyx":354
  *         cdark = numpy.ascontiguousarray(dark.ravel(),dtype=numpy.float32)
  *     if flat is not None:
  *         assert flat.size == size             # <<<<<<<<<<<<<<
@@ -6273,22 +6637,22 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
  *         cflat = numpy.ascontiguousarray(flat.ravel(),dtype=numpy.float32)
  */
     #ifndef CYTHON_WITHOUT_ASSERTIONS
-    __pyx_t_13 = PyObject_GetAttr(__pyx_v_flat, __pyx_n_s__size); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_13);
-    __pyx_t_9 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
-    __pyx_t_3 = PyObject_RichCompare(__pyx_t_13, __pyx_t_9, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-    __pyx_t_26 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_26 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_flat, __pyx_n_s__size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_26 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_26 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     if (unlikely(!__pyx_t_26)) {
       PyErr_SetNone(PyExc_AssertionError);
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     #endif
 
-    /* "splitBBox.pyx":346
+    /* "splitBBox.pyx":355
  *     if flat is not None:
  *         assert flat.size == size
  *         do_flat = True             # <<<<<<<<<<<<<<
@@ -6297,53 +6661,53 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
  */
     __pyx_v_do_flat = 1;
 
-    /* "splitBBox.pyx":347
+    /* "splitBBox.pyx":356
  *         assert flat.size == size
  *         do_flat = True
  *         cflat = numpy.ascontiguousarray(flat.ravel(),dtype=numpy.float32)             # <<<<<<<<<<<<<<
  *     if polarization is not None:
  *         do_polarization = True
  */
-    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_9 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_3 = PyObject_GetAttr(__pyx_v_flat, __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_flat, __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_13 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_13);
+    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
     __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 = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __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);
-    __pyx_t_13 = 0;
-    __pyx_t_13 = PyDict_New(); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_13));
-    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__float32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    if (PyDict_SetItem(__pyx_t_13, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_1 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
+    __Pyx_GIVEREF(__pyx_t_4);
+    __pyx_t_4 = 0;
+    __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+    __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_13);
+    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s__float32); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_9);
+    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+    if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
-    __pyx_t_28 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_1);
-    if (unlikely(!__pyx_t_28.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_9 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_9);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_v_cflat = __pyx_t_28;
-    __pyx_t_28.memview = NULL;
-    __pyx_t_28.data = NULL;
+    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+    __pyx_t_30 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_9);
+    if (unlikely(!__pyx_t_30.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    __pyx_v_cflat = __pyx_t_30;
+    __pyx_t_30.memview = NULL;
+    __pyx_t_30.data = NULL;
     goto __pyx_L20;
   }
   __pyx_L20:;
 
-  /* "splitBBox.pyx":348
+  /* "splitBBox.pyx":357
  *         do_flat = True
  *         cflat = numpy.ascontiguousarray(flat.ravel(),dtype=numpy.float32)
  *     if polarization is not None:             # <<<<<<<<<<<<<<
@@ -6351,9 +6715,10 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
  *         assert polarization.size == size
  */
   __pyx_t_26 = (__pyx_v_polarization != Py_None);
-  if (__pyx_t_26) {
+  __pyx_t_28 = (__pyx_t_26 != 0);
+  if (__pyx_t_28) {
 
-    /* "splitBBox.pyx":349
+    /* "splitBBox.pyx":358
  *         cflat = numpy.ascontiguousarray(flat.ravel(),dtype=numpy.float32)
  *     if polarization is not None:
  *         do_polarization = True             # <<<<<<<<<<<<<<
@@ -6362,7 +6727,7 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
  */
     __pyx_v_do_polarization = 1;
 
-    /* "splitBBox.pyx":350
+    /* "splitBBox.pyx":359
  *     if polarization is not None:
  *         do_polarization = True
  *         assert polarization.size == size             # <<<<<<<<<<<<<<
@@ -6370,78 +6735,79 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
  *     if solidangle is not None:
  */
     #ifndef CYTHON_WITHOUT_ASSERTIONS
-    __pyx_t_1 = PyObject_GetAttr(__pyx_v_polarization, __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_13 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_13);
-    __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_13, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-    __pyx_t_26 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_26 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_polarization, __pyx_n_s__size); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_9);
+    __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_3 = PyObject_RichCompare(__pyx_t_9, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_t_28 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_28 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    if (unlikely(!__pyx_t_26)) {
+    if (unlikely(!__pyx_t_28)) {
       PyErr_SetNone(PyExc_AssertionError);
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     #endif
 
-    /* "splitBBox.pyx":351
+    /* "splitBBox.pyx":360
  *         do_polarization = True
  *         assert polarization.size == size
  *         cpolarization = numpy.ascontiguousarray(polarization.ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
  *     if solidangle is not None:
  *         do_solidangle = True
  */
-    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_13 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_13);
+    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_3 = PyObject_GetAttr(__pyx_v_polarization, __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_polarization, __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __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 = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_9 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_9);
     __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 = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __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 = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-    __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
-    __pyx_t_4 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__float32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-    if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_4 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
+    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_9);
+    __Pyx_GIVEREF(__pyx_t_9);
+    __pyx_t_9 = 0;
+    __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_9));
+    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__float32); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_13);
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__dtype), __pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-    __pyx_t_28 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_4);
-    if (unlikely(!__pyx_t_28.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_13 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_13);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_v_cpolarization = __pyx_t_28;
-    __pyx_t_28.memview = NULL;
-    __pyx_t_28.data = NULL;
+    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
+    __pyx_t_30 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_13);
+    if (unlikely(!__pyx_t_30.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+    __pyx_v_cpolarization = __pyx_t_30;
+    __pyx_t_30.memview = NULL;
+    __pyx_t_30.data = NULL;
     goto __pyx_L21;
   }
   __pyx_L21:;
 
-  /* "splitBBox.pyx":352
+  /* "splitBBox.pyx":361
  *         assert polarization.size == size
  *         cpolarization = numpy.ascontiguousarray(polarization.ravel(), dtype=numpy.float32)
  *     if solidangle is not None:             # <<<<<<<<<<<<<<
  *         do_solidangle = True
  *         assert solidangle.size == size
  */
-  __pyx_t_26 = (__pyx_v_solidangle != Py_None);
+  __pyx_t_28 = (__pyx_v_solidangle != Py_None);
+  __pyx_t_26 = (__pyx_t_28 != 0);
   if (__pyx_t_26) {
 
-    /* "splitBBox.pyx":353
+    /* "splitBBox.pyx":362
  *         cpolarization = numpy.ascontiguousarray(polarization.ravel(), dtype=numpy.float32)
  *     if solidangle is not None:
  *         do_solidangle = True             # <<<<<<<<<<<<<<
@@ -6450,7 +6816,7 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
  */
     __pyx_v_do_solidangle = 1;
 
-    /* "splitBBox.pyx":354
+    /* "splitBBox.pyx":363
  *     if solidangle is not None:
  *         do_solidangle = True
  *         assert solidangle.size == size             # <<<<<<<<<<<<<<
@@ -6458,539 +6824,771 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
  * 
  */
     #ifndef CYTHON_WITHOUT_ASSERTIONS
-    __pyx_t_4 = PyObject_GetAttr(__pyx_v_solidangle, __pyx_n_s__size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_26 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_26 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_solidangle, __pyx_n_s__size); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_13);
+    __pyx_t_9 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_9);
+    __pyx_t_3 = PyObject_RichCompare(__pyx_t_13, __pyx_t_9, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    __pyx_t_26 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_26 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     if (unlikely(!__pyx_t_26)) {
       PyErr_SetNone(PyExc_AssertionError);
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     #endif
 
-    /* "splitBBox.pyx":355
+    /* "splitBBox.pyx":364
  *         do_solidangle = True
  *         assert solidangle.size == size
  *         csolidangle = numpy.ascontiguousarray(solidangle.ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
  * 
- * 
+ *     pos0_min=cpos0[0]
  */
-    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_9);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_3 = PyObject_GetAttr(__pyx_v_solidangle, __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_solidangle, __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_13 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_13);
     __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 = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
-    __Pyx_GIVEREF(__pyx_t_4);
-    __pyx_t_4 = 0;
-    __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-    __pyx_t_13 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_13);
-    __pyx_t_9 = PyObject_GetAttr(__pyx_t_13, __pyx_n_s__float32); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
-    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-    if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-    __pyx_t_9 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
+    PyTuple_SET_ITEM(__pyx_t_3, 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 = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_13));
+    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__float32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    if (PyDict_SetItem(__pyx_t_13, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-    __pyx_t_28 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_9);
-    if (unlikely(!__pyx_t_28.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-    __pyx_v_csolidangle = __pyx_t_28;
-    __pyx_t_28.memview = NULL;
-    __pyx_t_28.data = NULL;
+    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
+    __pyx_t_30 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_1);
+    if (unlikely(!__pyx_t_30.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_v_csolidangle = __pyx_t_30;
+    __pyx_t_30.memview = NULL;
+    __pyx_t_30.data = NULL;
     goto __pyx_L22;
   }
   __pyx_L22:;
 
-  /* "splitBBox.pyx":358
- * 
+  /* "splitBBox.pyx":366
+ *         csolidangle = numpy.ascontiguousarray(solidangle.ravel(), dtype=numpy.float32)
  * 
  *     pos0_min=cpos0[0]             # <<<<<<<<<<<<<<
  *     pos0_max=cpos0[0]
- * 
+ *     pos1_min=cpos1[0]
  */
-  __pyx_t_29 = 0;
-  __pyx_v_pos0_min = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cpos0.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_cpos0.diminfo[0].strides));
+  __pyx_t_31 = 0;
+  __pyx_v_pos0_min = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cpos0.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_cpos0.diminfo[0].strides));
 
-  /* "splitBBox.pyx":359
+  /* "splitBBox.pyx":367
  * 
  *     pos0_min=cpos0[0]
  *     pos0_max=cpos0[0]             # <<<<<<<<<<<<<<
+ *     pos1_min=cpos1[0]
+ *     pos1_max=cpos1[0]
+ */
+  __pyx_t_32 = 0;
+  __pyx_v_pos0_max = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cpos0.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_cpos0.diminfo[0].strides));
+
+  /* "splitBBox.pyx":368
+ *     pos0_min=cpos0[0]
+ *     pos0_max=cpos0[0]
+ *     pos1_min=cpos1[0]             # <<<<<<<<<<<<<<
+ *     pos1_max=cpos1[0]
  * 
- *     with nogil:
  */
-  __pyx_t_30 = 0;
-  __pyx_v_pos0_max = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cpos0.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_cpos0.diminfo[0].strides));
+  __pyx_t_33 = 0;
+  __pyx_v_pos1_min = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cpos1.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_cpos1.diminfo[0].strides));
 
-  /* "splitBBox.pyx":361
+  /* "splitBBox.pyx":369
  *     pos0_max=cpos0[0]
+ *     pos1_min=cpos1[0]
+ *     pos1_max=cpos1[0]             # <<<<<<<<<<<<<<
+ * 
+ *     with nogil:
+ */
+  __pyx_t_34 = 0;
+  __pyx_v_pos1_max = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cpos1.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_cpos1.diminfo[0].strides));
+
+  /* "splitBBox.pyx":371
+ *     pos1_max=cpos1[0]
  * 
  *     with nogil:             # <<<<<<<<<<<<<<
  *         for idx in range(size):
- *             min0 = cpos0[idx] - dpos0[idx]
+ *             if (check_mask and cmask[idx]):
  */
   {
       #ifdef WITH_THREAD
-      PyThreadState *_save = NULL;
-      #endif
+      PyThreadState *_save;
       Py_UNBLOCK_THREADS
+      #endif
       /*try:*/ {
 
-        /* "splitBBox.pyx":362
+        /* "splitBBox.pyx":372
  * 
  *     with nogil:
  *         for idx in range(size):             # <<<<<<<<<<<<<<
- *             min0 = cpos0[idx] - dpos0[idx]
- *             max0 = cpos0[idx] + dpos0[idx]
+ *             if (check_mask and cmask[idx]):
+ *                 continue
  */
         __pyx_t_2 = __pyx_v_size;
         for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_2; __pyx_t_12+=1) {
           __pyx_v_idx = __pyx_t_12;
 
-          /* "splitBBox.pyx":363
+          /* "splitBBox.pyx":373
  *     with nogil:
  *         for idx in range(size):
- *             min0 = cpos0[idx] - dpos0[idx]             # <<<<<<<<<<<<<<
- *             max0 = cpos0[idx] + dpos0[idx]
- *             cpos0_upper[idx]=max0
+ *             if (check_mask and cmask[idx]):             # <<<<<<<<<<<<<<
+ *                 continue
+ *             c0 = cpos0[idx]
  */
-          __pyx_t_11 = __pyx_v_idx;
-          __pyx_t_31 = __pyx_v_idx;
-          __pyx_v_min0 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cpos0.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_cpos0.diminfo[0].strides)) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_dpos0.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_dpos0.diminfo[0].strides)));
+          __pyx_t_26 = __pyx_v_check_mask;
+          if (__pyx_t_26) {
+            if (unlikely(!__pyx_v_cmask.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cmask"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L24;} }
+            __pyx_t_11 = __pyx_v_idx;
+            __pyx_t_28 = ((*((__pyx_t_5numpy_int8_t *) ( /* dim=0 */ (__pyx_v_cmask.data + __pyx_t_11 * __pyx_v_cmask.strides[0]) ))) != 0);
+          } else {
+            __pyx_t_28 = __pyx_t_26;
+          }
+          if (__pyx_t_28) {
 
-          /* "splitBBox.pyx":364
+            /* "splitBBox.pyx":374
  *         for idx in range(size):
- *             min0 = cpos0[idx] - dpos0[idx]
- *             max0 = cpos0[idx] + dpos0[idx]             # <<<<<<<<<<<<<<
- *             cpos0_upper[idx]=max0
- *             cpos0_lower[idx]=min0
- */
-          __pyx_t_32 = __pyx_v_idx;
-          __pyx_t_33 = __pyx_v_idx;
-          __pyx_v_max0 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cpos0.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_cpos0.diminfo[0].strides)) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_dpos0.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_dpos0.diminfo[0].strides)));
-
-          /* "splitBBox.pyx":365
- *             min0 = cpos0[idx] - dpos0[idx]
- *             max0 = cpos0[idx] + dpos0[idx]
- *             cpos0_upper[idx]=max0             # <<<<<<<<<<<<<<
- *             cpos0_lower[idx]=min0
- *             if max0>pos0_max:
+ *             if (check_mask and cmask[idx]):
+ *                 continue             # <<<<<<<<<<<<<<
+ *             c0 = cpos0[idx]
+ *             d0 = dpos0[idx]
  */
-          __pyx_t_34 = __pyx_v_idx;
-          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cpos0_upper.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_cpos0_upper.diminfo[0].strides) = __pyx_v_max0;
+            goto __pyx_L26_continue;
+            goto __pyx_L28;
+          }
+          __pyx_L28:;
 
-          /* "splitBBox.pyx":366
- *             max0 = cpos0[idx] + dpos0[idx]
- *             cpos0_upper[idx]=max0
- *             cpos0_lower[idx]=min0             # <<<<<<<<<<<<<<
- *             if max0>pos0_max:
- *                 pos0_max=max0
+          /* "splitBBox.pyx":375
+ *             if (check_mask and cmask[idx]):
+ *                 continue
+ *             c0 = cpos0[idx]             # <<<<<<<<<<<<<<
+ *             d0 = dpos0[idx]
+ *             min0 = c0 - d0
  */
           __pyx_t_35 = __pyx_v_idx;
-          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cpos0_lower.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_cpos0_lower.diminfo[0].strides) = __pyx_v_min0;
+          __pyx_v_c0 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cpos0.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_cpos0.diminfo[0].strides));
 
-          /* "splitBBox.pyx":367
- *             cpos0_upper[idx]=max0
- *             cpos0_lower[idx]=min0
- *             if max0>pos0_max:             # <<<<<<<<<<<<<<
- *                 pos0_max=max0
- *             if min0<pos0_min:
+          /* "splitBBox.pyx":376
+ *                 continue
+ *             c0 = cpos0[idx]
+ *             d0 = dpos0[idx]             # <<<<<<<<<<<<<<
+ *             min0 = c0 - d0
+ *             max0 = c0 + d0
  */
-          __pyx_t_26 = (__pyx_v_max0 > __pyx_v_pos0_max);
-          if (__pyx_t_26) {
+          __pyx_t_36 = __pyx_v_idx;
+          __pyx_v_d0 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_dpos0.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_dpos0.diminfo[0].strides));
+
+          /* "splitBBox.pyx":377
+ *             c0 = cpos0[idx]
+ *             d0 = dpos0[idx]
+ *             min0 = c0 - d0             # <<<<<<<<<<<<<<
+ *             max0 = c0 + d0
+ *             c1 = cpos1[idx]
+ */
+          __pyx_v_min0 = (__pyx_v_c0 - __pyx_v_d0);
+
+          /* "splitBBox.pyx":378
+ *             d0 = dpos0[idx]
+ *             min0 = c0 - d0
+ *             max0 = c0 + d0             # <<<<<<<<<<<<<<
+ *             c1 = cpos1[idx]
+ *             d1 = dpos1[idx]
+ */
+          __pyx_v_max0 = (__pyx_v_c0 + __pyx_v_d0);
+
+          /* "splitBBox.pyx":379
+ *             min0 = c0 - d0
+ *             max0 = c0 + d0
+ *             c1 = cpos1[idx]             # <<<<<<<<<<<<<<
+ *             d1 = dpos1[idx]
+ *             min1 = c1 - d1
+ */
+          __pyx_t_37 = __pyx_v_idx;
+          __pyx_v_c1 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cpos1.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_cpos1.diminfo[0].strides));
+
+          /* "splitBBox.pyx":380
+ *             max0 = c0 + d0
+ *             c1 = cpos1[idx]
+ *             d1 = dpos1[idx]             # <<<<<<<<<<<<<<
+ *             min1 = c1 - d1
+ *             max1 = c1 + d1
+ */
+          __pyx_t_38 = __pyx_v_idx;
+          __pyx_v_d1 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_dpos1.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_dpos1.diminfo[0].strides));
+
+          /* "splitBBox.pyx":381
+ *             c1 = cpos1[idx]
+ *             d1 = dpos1[idx]
+ *             min1 = c1 - d1             # <<<<<<<<<<<<<<
+ *             max1 = c1 + d1
+ *             if not allow_pos0_neg and lower0<0:
+ */
+          __pyx_v_min1 = (__pyx_v_c1 - __pyx_v_d1);
+
+          /* "splitBBox.pyx":382
+ *             d1 = dpos1[idx]
+ *             min1 = c1 - d1
+ *             max1 = c1 + d1             # <<<<<<<<<<<<<<
+ *             if not allow_pos0_neg and lower0<0:
+ *                 lower0=0
+ */
+          __pyx_v_max1 = (__pyx_v_c1 + __pyx_v_d1);
+
+          /* "splitBBox.pyx":383
+ *             min1 = c1 - d1
+ *             max1 = c1 + d1
+ *             if not allow_pos0_neg and lower0<0:             # <<<<<<<<<<<<<<
+ *                 lower0=0
+ *             if max1 > (2-chiDiscAtPi)*pi:
+ */
+          __pyx_t_28 = ((!(__pyx_v_allow_pos0_neg != 0)) != 0);
+          if (__pyx_t_28) {
+            __pyx_t_26 = ((__pyx_v_lower0 < 0) != 0);
+            __pyx_t_5 = __pyx_t_26;
+          } else {
+            __pyx_t_5 = __pyx_t_28;
+          }
+          if (__pyx_t_5) {
 
-            /* "splitBBox.pyx":368
- *             cpos0_lower[idx]=min0
+            /* "splitBBox.pyx":384
+ *             max1 = c1 + d1
+ *             if not allow_pos0_neg and lower0<0:
+ *                 lower0=0             # <<<<<<<<<<<<<<
+ *             if max1 > (2-chiDiscAtPi)*pi:
+ *                 max1 = (2-chiDiscAtPi)*pi
+ */
+            __pyx_v_lower0 = 0;
+            goto __pyx_L29;
+          }
+          __pyx_L29:;
+
+          /* "splitBBox.pyx":385
+ *             if not allow_pos0_neg and lower0<0:
+ *                 lower0=0
+ *             if max1 > (2-chiDiscAtPi)*pi:             # <<<<<<<<<<<<<<
+ *                 max1 = (2-chiDiscAtPi)*pi
+ *             if min1 < (-chiDiscAtPi)*pi:
+ */
+          __pyx_t_5 = ((__pyx_v_max1 > ((2 - __pyx_v_chiDiscAtPi) * __pyx_v_9splitBBox_pi)) != 0);
+          if (__pyx_t_5) {
+
+            /* "splitBBox.pyx":386
+ *                 lower0=0
+ *             if max1 > (2-chiDiscAtPi)*pi:
+ *                 max1 = (2-chiDiscAtPi)*pi             # <<<<<<<<<<<<<<
+ *             if min1 < (-chiDiscAtPi)*pi:
+ *                 min1 = (-chiDiscAtPi)*pi
+ */
+            __pyx_v_max1 = ((2 - __pyx_v_chiDiscAtPi) * __pyx_v_9splitBBox_pi);
+            goto __pyx_L30;
+          }
+          __pyx_L30:;
+
+          /* "splitBBox.pyx":387
+ *             if max1 > (2-chiDiscAtPi)*pi:
+ *                 max1 = (2-chiDiscAtPi)*pi
+ *             if min1 < (-chiDiscAtPi)*pi:             # <<<<<<<<<<<<<<
+ *                 min1 = (-chiDiscAtPi)*pi
+ *             cpos0_upper[idx] = max0
+ */
+          __pyx_t_5 = ((__pyx_v_min1 < ((-__pyx_v_chiDiscAtPi) * __pyx_v_9splitBBox_pi)) != 0);
+          if (__pyx_t_5) {
+
+            /* "splitBBox.pyx":388
+ *                 max1 = (2-chiDiscAtPi)*pi
+ *             if min1 < (-chiDiscAtPi)*pi:
+ *                 min1 = (-chiDiscAtPi)*pi             # <<<<<<<<<<<<<<
+ *             cpos0_upper[idx] = max0
+ *             cpos0_lower[idx] = min0
+ */
+            __pyx_v_min1 = ((-__pyx_v_chiDiscAtPi) * __pyx_v_9splitBBox_pi);
+            goto __pyx_L31;
+          }
+          __pyx_L31:;
+
+          /* "splitBBox.pyx":389
+ *             if min1 < (-chiDiscAtPi)*pi:
+ *                 min1 = (-chiDiscAtPi)*pi
+ *             cpos0_upper[idx] = max0             # <<<<<<<<<<<<<<
+ *             cpos0_lower[idx] = min0
+ *             cpos1_upper[idx] = max1
+ */
+          __pyx_t_39 = __pyx_v_idx;
+          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cpos0_upper.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_cpos0_upper.diminfo[0].strides) = __pyx_v_max0;
+
+          /* "splitBBox.pyx":390
+ *                 min1 = (-chiDiscAtPi)*pi
+ *             cpos0_upper[idx] = max0
+ *             cpos0_lower[idx] = min0             # <<<<<<<<<<<<<<
+ *             cpos1_upper[idx] = max1
+ *             cpos1_lower[idx] = min1
+ */
+          __pyx_t_40 = __pyx_v_idx;
+          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cpos0_lower.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_cpos0_lower.diminfo[0].strides) = __pyx_v_min0;
+
+          /* "splitBBox.pyx":391
+ *             cpos0_upper[idx] = max0
+ *             cpos0_lower[idx] = min0
+ *             cpos1_upper[idx] = max1             # <<<<<<<<<<<<<<
+ *             cpos1_lower[idx] = min1
  *             if max0>pos0_max:
- *                 pos0_max=max0             # <<<<<<<<<<<<<<
+ */
+          __pyx_t_41 = __pyx_v_idx;
+          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cpos1_upper.rcbuffer->pybuffer.buf, __pyx_t_41, __pyx_pybuffernd_cpos1_upper.diminfo[0].strides) = __pyx_v_max1;
+
+          /* "splitBBox.pyx":392
+ *             cpos0_lower[idx] = min0
+ *             cpos1_upper[idx] = max1
+ *             cpos1_lower[idx] = min1             # <<<<<<<<<<<<<<
+ *             if max0>pos0_max:
+ *                 pos0_max = max0
+ */
+          __pyx_t_42 = __pyx_v_idx;
+          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cpos1_lower.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_cpos1_lower.diminfo[0].strides) = __pyx_v_min1;
+
+          /* "splitBBox.pyx":393
+ *             cpos1_upper[idx] = max1
+ *             cpos1_lower[idx] = min1
+ *             if max0>pos0_max:             # <<<<<<<<<<<<<<
+ *                 pos0_max = max0
  *             if min0<pos0_min:
- *                 pos0_min=min0
+ */
+          __pyx_t_5 = ((__pyx_v_max0 > __pyx_v_pos0_max) != 0);
+          if (__pyx_t_5) {
+
+            /* "splitBBox.pyx":394
+ *             cpos1_lower[idx] = min1
+ *             if max0>pos0_max:
+ *                 pos0_max = max0             # <<<<<<<<<<<<<<
+ *             if min0<pos0_min:
+ *                 pos0_min = min0
  */
             __pyx_v_pos0_max = __pyx_v_max0;
-            goto __pyx_L28;
+            goto __pyx_L32;
           }
-          __pyx_L28:;
+          __pyx_L32:;
 
-          /* "splitBBox.pyx":369
+          /* "splitBBox.pyx":395
  *             if max0>pos0_max:
- *                 pos0_max=max0
+ *                 pos0_max = max0
  *             if min0<pos0_min:             # <<<<<<<<<<<<<<
- *                 pos0_min=min0
- * 
+ *                 pos0_min = min0
+ *             if max1>pos1_max:
  */
-          __pyx_t_26 = (__pyx_v_min0 < __pyx_v_pos0_min);
-          if (__pyx_t_26) {
+          __pyx_t_5 = ((__pyx_v_min0 < __pyx_v_pos0_min) != 0);
+          if (__pyx_t_5) {
 
-            /* "splitBBox.pyx":370
- *                 pos0_max=max0
+            /* "splitBBox.pyx":396
+ *                 pos0_max = max0
  *             if min0<pos0_min:
- *                 pos0_min=min0             # <<<<<<<<<<<<<<
- * 
- *     if (pos0Range is not None) and (len(pos0Range) == 2):
+ *                 pos0_min = min0             # <<<<<<<<<<<<<<
+ *             if max1>pos1_max:
+ *                 pos1_max = max1
  */
             __pyx_v_pos0_min = __pyx_v_min0;
-            goto __pyx_L29;
+            goto __pyx_L33;
           }
-          __pyx_L29:;
+          __pyx_L33:;
+
+          /* "splitBBox.pyx":397
+ *             if min0<pos0_min:
+ *                 pos0_min = min0
+ *             if max1>pos1_max:             # <<<<<<<<<<<<<<
+ *                 pos1_max = max1
+ *             if min1<pos1_min:
+ */
+          __pyx_t_5 = ((__pyx_v_max1 > __pyx_v_pos1_max) != 0);
+          if (__pyx_t_5) {
+
+            /* "splitBBox.pyx":398
+ *                 pos0_min = min0
+ *             if max1>pos1_max:
+ *                 pos1_max = max1             # <<<<<<<<<<<<<<
+ *             if min1<pos1_min:
+ *                 pos1_min = min1
+ */
+            __pyx_v_pos1_max = __pyx_v_max1;
+            goto __pyx_L34;
+          }
+          __pyx_L34:;
+
+          /* "splitBBox.pyx":399
+ *             if max1>pos1_max:
+ *                 pos1_max = max1
+ *             if min1<pos1_min:             # <<<<<<<<<<<<<<
+ *                 pos1_min = min1
+ * 
+ */
+          __pyx_t_5 = ((__pyx_v_min1 < __pyx_v_pos1_min) != 0);
+          if (__pyx_t_5) {
+
+            /* "splitBBox.pyx":400
+ *                 pos1_max = max1
+ *             if min1<pos1_min:
+ *                 pos1_min = min1             # <<<<<<<<<<<<<<
+ * 
+ *     if pos0Range is not None and len(pos0Range) > 1:
+ */
+            __pyx_v_pos1_min = __pyx_v_min1;
+            goto __pyx_L35;
+          }
+          __pyx_L35:;
+          __pyx_L26_continue:;
         }
       }
 
-      /* "splitBBox.pyx":361
- *     pos0_max=cpos0[0]
+      /* "splitBBox.pyx":371
+ *     pos1_max=cpos1[0]
  * 
  *     with nogil:             # <<<<<<<<<<<<<<
  *         for idx in range(size):
- *             min0 = cpos0[idx] - dpos0[idx]
+ *             if (check_mask and cmask[idx]):
  */
       /*finally:*/ {
+        int __pyx_why;
+        __pyx_why = 0; goto __pyx_L25;
+        __pyx_L24: __pyx_why = 4; goto __pyx_L25;
+        __pyx_L25:;
+        #ifdef WITH_THREAD
         Py_BLOCK_THREADS
+        #endif
+        switch (__pyx_why) {
+          case 4: goto __pyx_L1_error;
+        }
       }
   }
 
-  /* "splitBBox.pyx":372
- *                 pos0_min=min0
+  /* "splitBBox.pyx":402
+ *                 pos1_min = min1
  * 
- *     if (pos0Range is not None) and (len(pos0Range) == 2):             # <<<<<<<<<<<<<<
+ *     if pos0Range is not None and len(pos0Range) > 1:             # <<<<<<<<<<<<<<
  *         pos0_min = min(pos0Range)
  *         pos0_maxin = max(pos0Range)
  */
-  __pyx_t_26 = (__pyx_v_pos0Range != Py_None);
-  if (__pyx_t_26) {
-    __pyx_t_36 = PyObject_Length(__pyx_v_pos0Range); if (unlikely(__pyx_t_36 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_5 = (__pyx_t_36 == 2);
-    __pyx_t_25 = __pyx_t_5;
+  __pyx_t_5 = (__pyx_v_pos0Range != Py_None);
+  if ((__pyx_t_5 != 0)) {
+    __pyx_t_43 = PyObject_Length(__pyx_v_pos0Range); if (unlikely(__pyx_t_43 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_28 = ((__pyx_t_43 > 1) != 0);
+    __pyx_t_26 = __pyx_t_28;
   } else {
-    __pyx_t_25 = __pyx_t_26;
+    __pyx_t_26 = (__pyx_t_5 != 0);
   }
-  if (__pyx_t_25) {
+  if (__pyx_t_26) {
 
-    /* "splitBBox.pyx":373
+    /* "splitBBox.pyx":403
  * 
- *     if (pos0Range is not None) and (len(pos0Range) == 2):
+ *     if pos0Range is not None and len(pos0Range) > 1:
  *         pos0_min = min(pos0Range)             # <<<<<<<<<<<<<<
  *         pos0_maxin = max(pos0Range)
  *     else:
  */
-    __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
+    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
     __Pyx_INCREF(__pyx_v_pos0Range);
-    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_pos0Range);
+    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_pos0Range);
     __Pyx_GIVEREF(__pyx_v_pos0Range);
-    __pyx_t_4 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
-    __pyx_t_37 = __pyx_PyFloat_AsFloat(__pyx_t_4); if (unlikely((__pyx_t_37 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_v_pos0_min = __pyx_t_37;
+    __pyx_t_13 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_13);
+    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+    __pyx_t_44 = __pyx_PyFloat_AsFloat(__pyx_t_13); if (unlikely((__pyx_t_44 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+    __pyx_v_pos0_min = __pyx_t_44;
 
-    /* "splitBBox.pyx":374
- *     if (pos0Range is not None) and (len(pos0Range) == 2):
+    /* "splitBBox.pyx":404
+ *     if pos0Range is not None and len(pos0Range) > 1:
  *         pos0_min = min(pos0Range)
  *         pos0_maxin = max(pos0Range)             # <<<<<<<<<<<<<<
  *     else:
- * #        pos0_min = pos0_min
+ *         pos0_maxin = pos0_max
  */
-    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_13);
     __Pyx_INCREF(__pyx_v_pos0Range);
-    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_pos0Range);
+    PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_v_pos0Range);
     __Pyx_GIVEREF(__pyx_v_pos0Range);
-    __pyx_t_9 = PyObject_Call(__pyx_builtin_max, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
-    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-    __pyx_t_37 = __pyx_PyFloat_AsFloat(__pyx_t_9); if (unlikely((__pyx_t_37 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-    __pyx_v_pos0_maxin = __pyx_t_37;
-    goto __pyx_L30;
+    __pyx_t_1 = PyObject_Call(__pyx_builtin_max, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
+    __pyx_t_44 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_44 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_v_pos0_maxin = __pyx_t_44;
+    goto __pyx_L37;
   }
   /*else*/ {
 
-    /* "splitBBox.pyx":377
+    /* "splitBBox.pyx":406
+ *         pos0_maxin = max(pos0Range)
  *     else:
- * #        pos0_min = pos0_min
  *         pos0_maxin = pos0_max             # <<<<<<<<<<<<<<
- *     if pos0_min<0:
- *         pos0_min=0
- */
-    __pyx_v_pos0_maxin = __pyx_v_pos0_max;
-  }
-  __pyx_L30:;
-
-  /* "splitBBox.pyx":378
- * #        pos0_min = pos0_min
- *         pos0_maxin = pos0_max
- *     if pos0_min<0:             # <<<<<<<<<<<<<<
- *         pos0_min=0
- *     pos0_max = pos0_maxin * EPS32
- */
-  __pyx_t_25 = (__pyx_v_pos0_min < 0.0);
-  if (__pyx_t_25) {
-
-    /* "splitBBox.pyx":379
- *         pos0_maxin = pos0_max
- *     if pos0_min<0:
- *         pos0_min=0             # <<<<<<<<<<<<<<
- *     pos0_max = pos0_maxin * EPS32
+ * 
  * 
  */
-    __pyx_v_pos0_min = 0.0;
-    goto __pyx_L31;
+    __pyx_v_pos0_maxin = __pyx_v_pos0_max;
   }
-  __pyx_L31:;
+  __pyx_L37:;
 
-  /* "splitBBox.pyx":380
- *     if pos0_min<0:
- *         pos0_min=0
- *     pos0_max = pos0_maxin * EPS32             # <<<<<<<<<<<<<<
+  /* "splitBBox.pyx":409
  * 
- *     if (pos1Range is not None) and (len(pos1Range) == 2):
- */
-  __pyx_t_9 = PyFloat_FromDouble(__pyx_v_pos0_maxin); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
-  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__EPS32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_3 = PyNumber_Multiply(__pyx_t_9, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __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_4); __pyx_t_4 = 0;
-  __pyx_t_37 = __pyx_PyFloat_AsFloat(__pyx_t_3); if (unlikely((__pyx_t_37 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_v_pos0_max = __pyx_t_37;
-
-  /* "splitBBox.pyx":382
- *     pos0_max = pos0_maxin * EPS32
  * 
- *     if (pos1Range is not None) and (len(pos1Range) == 2):             # <<<<<<<<<<<<<<
+ *     if pos1Range is not None and len(pos1Range) > 1:             # <<<<<<<<<<<<<<
  *         pos1_min = min(pos1Range)
  *         pos1_maxin = max(pos1Range)
  */
-  __pyx_t_25 = (__pyx_v_pos1Range != Py_None);
-  if (__pyx_t_25) {
-    __pyx_t_36 = PyObject_Length(__pyx_v_pos1Range); if (unlikely(__pyx_t_36 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_26 = (__pyx_t_36 == 2);
-    __pyx_t_5 = __pyx_t_26;
+  __pyx_t_26 = (__pyx_v_pos1Range != Py_None);
+  if ((__pyx_t_26 != 0)) {
+    __pyx_t_43 = PyObject_Length(__pyx_v_pos1Range); if (unlikely(__pyx_t_43 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = ((__pyx_t_43 > 1) != 0);
+    __pyx_t_28 = __pyx_t_5;
   } else {
-    __pyx_t_5 = __pyx_t_25;
+    __pyx_t_28 = (__pyx_t_26 != 0);
   }
-  if (__pyx_t_5) {
+  if (__pyx_t_28) {
 
-    /* "splitBBox.pyx":383
+    /* "splitBBox.pyx":410
  * 
- *     if (pos1Range is not None) and (len(pos1Range) == 2):
+ *     if pos1Range is not None and len(pos1Range) > 1:
  *         pos1_min = min(pos1Range)             # <<<<<<<<<<<<<<
  *         pos1_maxin = max(pos1Range)
  *     else:
  */
-    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
     __Pyx_INCREF(__pyx_v_pos1Range);
-    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_pos1Range);
+    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_pos1Range);
     __Pyx_GIVEREF(__pyx_v_pos1Range);
-    __pyx_t_4 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-    __pyx_t_37 = __pyx_PyFloat_AsFloat(__pyx_t_4); if (unlikely((__pyx_t_37 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_v_pos1_min = __pyx_t_37;
+    __pyx_t_13 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_13);
+    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+    __pyx_t_44 = __pyx_PyFloat_AsFloat(__pyx_t_13); if (unlikely((__pyx_t_44 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+    __pyx_v_pos1_min = __pyx_t_44;
 
-    /* "splitBBox.pyx":384
- *     if (pos1Range is not None) and (len(pos1Range) == 2):
+    /* "splitBBox.pyx":411
+ *     if pos1Range is not None and len(pos1Range) > 1:
  *         pos1_min = min(pos1Range)
  *         pos1_maxin = max(pos1Range)             # <<<<<<<<<<<<<<
  *     else:
- *         pos1_min = cpos1.min()
+ *         pos1_maxin = pos1_max
  */
-    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_13);
     __Pyx_INCREF(__pyx_v_pos1Range);
-    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_pos1Range);
+    PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_v_pos1Range);
     __Pyx_GIVEREF(__pyx_v_pos1Range);
-    __pyx_t_3 = PyObject_Call(__pyx_builtin_max, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-    __pyx_t_37 = __pyx_PyFloat_AsFloat(__pyx_t_3); if (unlikely((__pyx_t_37 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_v_pos1_maxin = __pyx_t_37;
-    goto __pyx_L32;
+    __pyx_t_1 = PyObject_Call(__pyx_builtin_max, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
+    __pyx_t_44 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_44 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_v_pos1_maxin = __pyx_t_44;
+    goto __pyx_L38;
   }
   /*else*/ {
 
-    /* "splitBBox.pyx":386
+    /* "splitBBox.pyx":413
  *         pos1_maxin = max(pos1Range)
  *     else:
- *         pos1_min = cpos1.min()             # <<<<<<<<<<<<<<
- *         pos1_maxin = cpos1.max()
- *     pos1_max = pos1_maxin * EPS32
+ *         pos1_maxin = pos1_max             # <<<<<<<<<<<<<<
+ * 
+ *     if (not allow_pos0_neg) and pos0_min < 0:
  */
-    __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_cpos1), __pyx_n_s__min); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_37 = __pyx_PyFloat_AsFloat(__pyx_t_4); if (unlikely((__pyx_t_37 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_v_pos1_min = __pyx_t_37;
+    __pyx_v_pos1_maxin = __pyx_v_pos1_max;
+  }
+  __pyx_L38:;
 
-    /* "splitBBox.pyx":387
- *     else:
- *         pos1_min = cpos1.min()
- *         pos1_maxin = cpos1.max()             # <<<<<<<<<<<<<<
- *     pos1_max = pos1_maxin * EPS32
+  /* "splitBBox.pyx":415
+ *         pos1_maxin = pos1_max
+ * 
+ *     if (not allow_pos0_neg) and pos0_min < 0:             # <<<<<<<<<<<<<<
+ *         pos0_min = 0
  * 
  */
-    __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_cpos1), __pyx_n_s__max); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_37 = __pyx_PyFloat_AsFloat(__pyx_t_3); if (unlikely((__pyx_t_37 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_v_pos1_maxin = __pyx_t_37;
+  __pyx_t_28 = ((!(__pyx_v_allow_pos0_neg != 0)) != 0);
+  if (__pyx_t_28) {
+    __pyx_t_26 = ((__pyx_v_pos0_min < 0.0) != 0);
+    __pyx_t_5 = __pyx_t_26;
+  } else {
+    __pyx_t_5 = __pyx_t_28;
+  }
+  if (__pyx_t_5) {
+
+    /* "splitBBox.pyx":416
+ * 
+ *     if (not allow_pos0_neg) and pos0_min < 0:
+ *         pos0_min = 0             # <<<<<<<<<<<<<<
+ * 
+ *     pos0_max = pos0_maxin * EPS32
+ */
+    __pyx_v_pos0_min = 0.0;
+    goto __pyx_L39;
   }
-  __pyx_L32:;
+  __pyx_L39:;
+
+  /* "splitBBox.pyx":418
+ *         pos0_min = 0
+ * 
+ *     pos0_max = pos0_maxin * EPS32             # <<<<<<<<<<<<<<
+ *     pos1_max = pos1_maxin * EPS32
+ * 
+ */
+  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_pos0_maxin); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s__EPS32); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_13);
+  __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_13); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+  __pyx_t_44 = __pyx_PyFloat_AsFloat(__pyx_t_3); if (unlikely((__pyx_t_44 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_v_pos0_max = __pyx_t_44;
 
-  /* "splitBBox.pyx":388
- *         pos1_min = cpos1.min()
- *         pos1_maxin = cpos1.max()
+  /* "splitBBox.pyx":419
+ * 
+ *     pos0_max = pos0_maxin * EPS32
  *     pos1_max = pos1_maxin * EPS32             # <<<<<<<<<<<<<<
  * 
  *     delta0 = (pos0_max - pos0_min) / (< float > (bins0))
  */
-  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_pos1_maxin); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_pos1_maxin); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__EPS32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_9 = PyNumber_Multiply(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
+  __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s__EPS32); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_13);
+  __pyx_t_1 = PyNumber_Multiply(__pyx_t_3, __pyx_t_13); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_t_37 = __pyx_PyFloat_AsFloat(__pyx_t_9); if (unlikely((__pyx_t_37 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-  __pyx_v_pos1_max = __pyx_t_37;
+  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+  __pyx_t_44 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_44 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_v_pos1_max = __pyx_t_44;
 
-  /* "splitBBox.pyx":390
+  /* "splitBBox.pyx":421
  *     pos1_max = pos1_maxin * EPS32
  * 
  *     delta0 = (pos0_max - pos0_min) / (< float > (bins0))             # <<<<<<<<<<<<<<
  *     delta1 = (pos1_max - pos1_min) / (< float > (bins1))
- *     edges0 = numpy.linspace(pos0_min+0.5*delta0, pos0_maxin-0.5*delta0, bins0)
+ * 
  */
   __pyx_v_delta0 = ((__pyx_v_pos0_max - __pyx_v_pos0_min) / ((float)__pyx_v_bins0));
 
-  /* "splitBBox.pyx":391
+  /* "splitBBox.pyx":422
  * 
  *     delta0 = (pos0_max - pos0_min) / (< float > (bins0))
  *     delta1 = (pos1_max - pos1_min) / (< float > (bins1))             # <<<<<<<<<<<<<<
+ * 
  *     edges0 = numpy.linspace(pos0_min+0.5*delta0, pos0_maxin-0.5*delta0, bins0)
- *     edges1 = numpy.linspace(pos1_min+0.5*delta1, pos1_maxin-0.5*delta1, bins1)
  */
   __pyx_v_delta1 = ((__pyx_v_pos1_max - __pyx_v_pos1_min) / ((float)__pyx_v_bins1));
 
-  /* "splitBBox.pyx":392
- *     delta0 = (pos0_max - pos0_min) / (< float > (bins0))
+  /* "splitBBox.pyx":424
  *     delta1 = (pos1_max - pos1_min) / (< float > (bins1))
+ * 
  *     edges0 = numpy.linspace(pos0_min+0.5*delta0, pos0_maxin-0.5*delta0, bins0)             # <<<<<<<<<<<<<<
  *     edges1 = numpy.linspace(pos1_min+0.5*delta1, pos1_maxin-0.5*delta1, bins1)
- *     with nogil:
- */
-  __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__linspace); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-  __pyx_t_9 = PyFloat_FromDouble((__pyx_v_pos0_min + (0.5 * __pyx_v_delta0))); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
-  __pyx_t_3 = PyFloat_FromDouble((__pyx_v_pos0_maxin - (0.5 * __pyx_v_delta0))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_bins0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_13 = PyTuple_New(3); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_13);
-  PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_9);
-  __Pyx_GIVEREF(__pyx_t_9);
-  PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_3);
-  __Pyx_GIVEREF(__pyx_t_3);
-  PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_t_1);
-  __Pyx_GIVEREF(__pyx_t_1);
-  __pyx_t_9 = 0;
-  __pyx_t_3 = 0;
-  __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
-  __pyx_v_edges0 = __pyx_t_1;
-  __pyx_t_1 = 0;
-
-  /* "splitBBox.pyx":393
- *     delta1 = (pos1_max - pos1_min) / (< float > (bins1))
- *     edges0 = numpy.linspace(pos0_min+0.5*delta0, pos0_maxin-0.5*delta0, bins0)
- *     edges1 = numpy.linspace(pos1_min+0.5*delta1, pos1_maxin-0.5*delta1, bins1)             # <<<<<<<<<<<<<<
- *     with nogil:
- *         for idx in range(size):
+ * 
  */
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_13 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__linspace); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__linspace); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_13);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyFloat_FromDouble((__pyx_v_pos1_min + (0.5 * __pyx_v_delta1))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyFloat_FromDouble((__pyx_v_pos0_min + (0.5 * __pyx_v_delta0))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyFloat_FromDouble((__pyx_v_pos1_maxin - (0.5 * __pyx_v_delta1))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_bins1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyFloat_FromDouble((__pyx_v_pos0_maxin - (0.5 * __pyx_v_delta0))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_9 = PyInt_FromSsize_t(__pyx_v_bins0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_9);
-  PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_1);
+  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
+  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
-  PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_4);
-  __Pyx_GIVEREF(__pyx_t_4);
-  PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_3);
+  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
   __Pyx_GIVEREF(__pyx_t_3);
+  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_9);
+  __Pyx_GIVEREF(__pyx_t_9);
   __pyx_t_1 = 0;
-  __pyx_t_4 = 0;
   __pyx_t_3 = 0;
-  __pyx_t_3 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_9 = 0;
+  __pyx_t_9 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_9);
   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
-  __pyx_v_edges1 = __pyx_t_3;
-  __pyx_t_3 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+  __pyx_v_edges0 = __pyx_t_9;
+  __pyx_t_9 = 0;
 
-  /* "splitBBox.pyx":394
+  /* "splitBBox.pyx":425
+ * 
  *     edges0 = numpy.linspace(pos0_min+0.5*delta0, pos0_maxin-0.5*delta0, bins0)
- *     edges1 = numpy.linspace(pos1_min+0.5*delta1, pos1_maxin-0.5*delta1, bins1)
- *     with nogil:             # <<<<<<<<<<<<<<
- *         for idx in range(size):
- *             if (check_mask) and cmask[idx]:
- */
-  {
+ *     edges1 = numpy.linspace(pos1_min+0.5*delta1, pos1_maxin-0.5*delta1, bins1)             # <<<<<<<<<<<<<<
+ * 
+ * 
+ */
+  __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_9);
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s__linspace); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
+  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+  __pyx_t_9 = PyFloat_FromDouble((__pyx_v_pos1_min + (0.5 * __pyx_v_delta1))); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_9);
+  __pyx_t_13 = PyFloat_FromDouble((__pyx_v_pos1_maxin - (0.5 * __pyx_v_delta1))); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_13);
+  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_bins1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9);
+  __Pyx_GIVEREF(__pyx_t_9);
+  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_13);
+  __Pyx_GIVEREF(__pyx_t_13);
+  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_3);
+  __Pyx_GIVEREF(__pyx_t_3);
+  __pyx_t_9 = 0;
+  __pyx_t_13 = 0;
+  __pyx_t_3 = 0;
+  __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+  __pyx_v_edges1 = __pyx_t_3;
+  __pyx_t_3 = 0;
+
+  /* "splitBBox.pyx":430
+ * 
+ * 
+ *     with nogil:             # <<<<<<<<<<<<<<
+ *         for idx in range(size):
+ *             if (check_mask) and cmask[idx]:
+ */
+  {
       #ifdef WITH_THREAD
-      PyThreadState *_save = NULL;
-      #endif
+      PyThreadState *_save;
       Py_UNBLOCK_THREADS
+      #endif
       /*try:*/ {
 
-        /* "splitBBox.pyx":395
- *     edges1 = numpy.linspace(pos1_min+0.5*delta1, pos1_maxin-0.5*delta1, bins1)
+        /* "splitBBox.pyx":431
+ * 
  *     with nogil:
  *         for idx in range(size):             # <<<<<<<<<<<<<<
  *             if (check_mask) and cmask[idx]:
@@ -7000,7 +7598,7 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
         for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_2; __pyx_t_12+=1) {
           __pyx_v_idx = __pyx_t_12;
 
-          /* "splitBBox.pyx":396
+          /* "splitBBox.pyx":432
  *     with nogil:
  *         for idx in range(size):
  *             if (check_mask) and cmask[idx]:             # <<<<<<<<<<<<<<
@@ -7009,248 +7607,252 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
  */
           __pyx_t_5 = __pyx_v_check_mask;
           if (__pyx_t_5) {
-            if (unlikely(!__pyx_v_cmask.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cmask"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L34;} }
-            __pyx_t_38 = __pyx_v_idx;
-            __pyx_t_25 = (*((__pyx_t_5numpy_int8_t *) ( /* dim=0 */ (__pyx_v_cmask.data + __pyx_t_38 * __pyx_v_cmask.strides[0]) )));
+            if (unlikely(!__pyx_v_cmask.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cmask"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L41;} }
+            __pyx_t_45 = __pyx_v_idx;
+            __pyx_t_28 = ((*((__pyx_t_5numpy_int8_t *) ( /* dim=0 */ (__pyx_v_cmask.data + __pyx_t_45 * __pyx_v_cmask.strides[0]) ))) != 0);
           } else {
-            __pyx_t_25 = __pyx_t_5;
+            __pyx_t_28 = __pyx_t_5;
           }
-          if (__pyx_t_25) {
+          if (__pyx_t_28) {
 
-            /* "splitBBox.pyx":397
+            /* "splitBBox.pyx":433
  *         for idx in range(size):
  *             if (check_mask) and cmask[idx]:
  *                 continue             # <<<<<<<<<<<<<<
  * 
  *             data = cdata[idx]
  */
-            goto __pyx_L36_continue;
-            goto __pyx_L38;
+            goto __pyx_L43_continue;
+            goto __pyx_L45;
           }
-          __pyx_L38:;
+          __pyx_L45:;
 
-          /* "splitBBox.pyx":399
+          /* "splitBBox.pyx":435
  *                 continue
  * 
  *             data = cdata[idx]             # <<<<<<<<<<<<<<
  *             if (check_dummy) and (fabs(data-cdummy)<=ddummy):
  *                 continue
  */
-          __pyx_t_39 = __pyx_v_idx;
-          __pyx_v_data = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cdata.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_cdata.diminfo[0].strides));
+          __pyx_t_46 = __pyx_v_idx;
+          __pyx_v_data = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cdata.rcbuffer->pybuffer.buf, __pyx_t_46, __pyx_pybuffernd_cdata.diminfo[0].strides));
 
-          /* "splitBBox.pyx":400
+          /* "splitBBox.pyx":436
  * 
  *             data = cdata[idx]
  *             if (check_dummy) and (fabs(data-cdummy)<=ddummy):             # <<<<<<<<<<<<<<
  *                 continue
  * 
  */
-          if (__pyx_v_check_dummy) {
-            __pyx_t_25 = (fabs((__pyx_v_data - __pyx_v_cdummy)) <= __pyx_v_ddummy);
-            __pyx_t_5 = __pyx_t_25;
+          if ((__pyx_v_check_dummy != 0)) {
+            __pyx_t_28 = ((fabs((__pyx_v_data - __pyx_v_cdummy)) <= __pyx_v_ddummy) != 0);
+            __pyx_t_5 = __pyx_t_28;
           } else {
-            __pyx_t_5 = __pyx_v_check_dummy;
+            __pyx_t_5 = (__pyx_v_check_dummy != 0);
           }
           if (__pyx_t_5) {
 
-            /* "splitBBox.pyx":401
+            /* "splitBBox.pyx":437
  *             data = cdata[idx]
  *             if (check_dummy) and (fabs(data-cdummy)<=ddummy):
  *                 continue             # <<<<<<<<<<<<<<
  * 
  *             if do_dark:
  */
-            goto __pyx_L36_continue;
-            goto __pyx_L39;
+            goto __pyx_L43_continue;
+            goto __pyx_L46;
           }
-          __pyx_L39:;
+          __pyx_L46:;
 
-          /* "splitBBox.pyx":403
+          /* "splitBBox.pyx":439
  *                 continue
  * 
  *             if do_dark:             # <<<<<<<<<<<<<<
  *                 data -= cdark[idx]
  *             if do_flat:
  */
-          if (__pyx_v_do_dark) {
+          __pyx_t_5 = (__pyx_v_do_dark != 0);
+          if (__pyx_t_5) {
 
-            /* "splitBBox.pyx":404
+            /* "splitBBox.pyx":440
  * 
  *             if do_dark:
  *                 data -= cdark[idx]             # <<<<<<<<<<<<<<
  *             if do_flat:
  *                 data /= cflat[idx]
  */
-            if (unlikely(!__pyx_v_cdark.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cdark"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L34;} }
-            __pyx_t_40 = __pyx_v_idx;
-            __pyx_v_data = (__pyx_v_data - (*((float *) ( /* dim=0 */ (__pyx_v_cdark.data + __pyx_t_40 * __pyx_v_cdark.strides[0]) ))));
-            goto __pyx_L40;
+            if (unlikely(!__pyx_v_cdark.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cdark"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L41;} }
+            __pyx_t_47 = __pyx_v_idx;
+            __pyx_v_data = (__pyx_v_data - (*((float *) ( /* dim=0 */ (__pyx_v_cdark.data + __pyx_t_47 * __pyx_v_cdark.strides[0]) ))));
+            goto __pyx_L47;
           }
-          __pyx_L40:;
+          __pyx_L47:;
 
-          /* "splitBBox.pyx":405
+          /* "splitBBox.pyx":441
  *             if do_dark:
  *                 data -= cdark[idx]
  *             if do_flat:             # <<<<<<<<<<<<<<
  *                 data /= cflat[idx]
  *             if do_polarization:
  */
-          if (__pyx_v_do_flat) {
+          __pyx_t_5 = (__pyx_v_do_flat != 0);
+          if (__pyx_t_5) {
 
-            /* "splitBBox.pyx":406
+            /* "splitBBox.pyx":442
  *                 data -= cdark[idx]
  *             if do_flat:
  *                 data /= cflat[idx]             # <<<<<<<<<<<<<<
  *             if do_polarization:
  *                 data /= cpolarization[idx]
  */
-            if (unlikely(!__pyx_v_cflat.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cflat"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L34;} }
-            __pyx_t_41 = __pyx_v_idx;
-            __pyx_v_data = (__pyx_v_data / (*((float *) ( /* dim=0 */ (__pyx_v_cflat.data + __pyx_t_41 * __pyx_v_cflat.strides[0]) ))));
-            goto __pyx_L41;
+            if (unlikely(!__pyx_v_cflat.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cflat"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L41;} }
+            __pyx_t_48 = __pyx_v_idx;
+            __pyx_v_data = (__pyx_v_data / (*((float *) ( /* dim=0 */ (__pyx_v_cflat.data + __pyx_t_48 * __pyx_v_cflat.strides[0]) ))));
+            goto __pyx_L48;
           }
-          __pyx_L41:;
+          __pyx_L48:;
 
-          /* "splitBBox.pyx":407
+          /* "splitBBox.pyx":443
  *             if do_flat:
  *                 data /= cflat[idx]
  *             if do_polarization:             # <<<<<<<<<<<<<<
  *                 data /= cpolarization[idx]
  *             if do_solidangle:
  */
-          if (__pyx_v_do_polarization) {
+          __pyx_t_5 = (__pyx_v_do_polarization != 0);
+          if (__pyx_t_5) {
 
-            /* "splitBBox.pyx":408
+            /* "splitBBox.pyx":444
  *                 data /= cflat[idx]
  *             if do_polarization:
  *                 data /= cpolarization[idx]             # <<<<<<<<<<<<<<
  *             if do_solidangle:
  *                 data /= csolidangle[idx]
  */
-            if (unlikely(!__pyx_v_cpolarization.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cpolarization"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L34;} }
-            __pyx_t_42 = __pyx_v_idx;
-            __pyx_v_data = (__pyx_v_data / (*((float *) ( /* dim=0 */ (__pyx_v_cpolarization.data + __pyx_t_42 * __pyx_v_cpolarization.strides[0]) ))));
-            goto __pyx_L42;
+            if (unlikely(!__pyx_v_cpolarization.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cpolarization"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L41;} }
+            __pyx_t_49 = __pyx_v_idx;
+            __pyx_v_data = (__pyx_v_data / (*((float *) ( /* dim=0 */ (__pyx_v_cpolarization.data + __pyx_t_49 * __pyx_v_cpolarization.strides[0]) ))));
+            goto __pyx_L49;
           }
-          __pyx_L42:;
+          __pyx_L49:;
 
-          /* "splitBBox.pyx":409
+          /* "splitBBox.pyx":445
  *             if do_polarization:
  *                 data /= cpolarization[idx]
  *             if do_solidangle:             # <<<<<<<<<<<<<<
  *                 data /= csolidangle[idx]
  * 
  */
-          if (__pyx_v_do_solidangle) {
+          __pyx_t_5 = (__pyx_v_do_solidangle != 0);
+          if (__pyx_t_5) {
 
-            /* "splitBBox.pyx":410
+            /* "splitBBox.pyx":446
  *                 data /= cpolarization[idx]
  *             if do_solidangle:
  *                 data /= csolidangle[idx]             # <<<<<<<<<<<<<<
  * 
  *             min0 = cpos0_lower[idx]
  */
-            if (unlikely(!__pyx_v_csolidangle.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("csolidangle"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L34;} }
-            __pyx_t_43 = __pyx_v_idx;
-            __pyx_v_data = (__pyx_v_data / (*((float *) ( /* dim=0 */ (__pyx_v_csolidangle.data + __pyx_t_43 * __pyx_v_csolidangle.strides[0]) ))));
-            goto __pyx_L43;
+            if (unlikely(!__pyx_v_csolidangle.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("csolidangle"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L41;} }
+            __pyx_t_50 = __pyx_v_idx;
+            __pyx_v_data = (__pyx_v_data / (*((float *) ( /* dim=0 */ (__pyx_v_csolidangle.data + __pyx_t_50 * __pyx_v_csolidangle.strides[0]) ))));
+            goto __pyx_L50;
           }
-          __pyx_L43:;
+          __pyx_L50:;
 
-          /* "splitBBox.pyx":412
+          /* "splitBBox.pyx":448
  *                 data /= csolidangle[idx]
  * 
  *             min0 = cpos0_lower[idx]             # <<<<<<<<<<<<<<
  *             max0 = cpos0_upper[idx]
  *             min1 = cpos1[idx] - dpos1[idx]
  */
-          __pyx_t_44 = __pyx_v_idx;
-          __pyx_v_min0 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cpos0_lower.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_cpos0_lower.diminfo[0].strides));
+          __pyx_t_51 = __pyx_v_idx;
+          __pyx_v_min0 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cpos0_lower.rcbuffer->pybuffer.buf, __pyx_t_51, __pyx_pybuffernd_cpos0_lower.diminfo[0].strides));
 
-          /* "splitBBox.pyx":413
+          /* "splitBBox.pyx":449
  * 
  *             min0 = cpos0_lower[idx]
  *             max0 = cpos0_upper[idx]             # <<<<<<<<<<<<<<
  *             min1 = cpos1[idx] - dpos1[idx]
  *             max1 = cpos1[idx] + dpos1[idx]
  */
-          __pyx_t_45 = __pyx_v_idx;
-          __pyx_v_max0 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cpos0_upper.rcbuffer->pybuffer.buf, __pyx_t_45, __pyx_pybuffernd_cpos0_upper.diminfo[0].strides));
+          __pyx_t_52 = __pyx_v_idx;
+          __pyx_v_max0 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cpos0_upper.rcbuffer->pybuffer.buf, __pyx_t_52, __pyx_pybuffernd_cpos0_upper.diminfo[0].strides));
 
-          /* "splitBBox.pyx":414
+          /* "splitBBox.pyx":450
  *             min0 = cpos0_lower[idx]
  *             max0 = cpos0_upper[idx]
  *             min1 = cpos1[idx] - dpos1[idx]             # <<<<<<<<<<<<<<
  *             max1 = cpos1[idx] + dpos1[idx]
  * 
  */
-          __pyx_t_46 = __pyx_v_idx;
-          __pyx_t_47 = __pyx_v_idx;
-          __pyx_v_min1 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cpos1.rcbuffer->pybuffer.buf, __pyx_t_46, __pyx_pybuffernd_cpos1.diminfo[0].strides)) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_dpos1.rcbuffer->pybuffer.buf, __pyx_t_47, __pyx_pybuffernd_dpos1.diminfo[0].strides)));
+          __pyx_t_53 = __pyx_v_idx;
+          __pyx_t_54 = __pyx_v_idx;
+          __pyx_v_min1 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cpos1.rcbuffer->pybuffer.buf, __pyx_t_53, __pyx_pybuffernd_cpos1.diminfo[0].strides)) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_dpos1.rcbuffer->pybuffer.buf, __pyx_t_54, __pyx_pybuffernd_dpos1.diminfo[0].strides)));
 
-          /* "splitBBox.pyx":415
+          /* "splitBBox.pyx":451
  *             max0 = cpos0_upper[idx]
  *             min1 = cpos1[idx] - dpos1[idx]
  *             max1 = cpos1[idx] + dpos1[idx]             # <<<<<<<<<<<<<<
  * 
  *             if (max0 < pos0_min) or (max1 < pos1_min) or (min0 > pos0_maxin) or (min1 > pos1_maxin) :
  */
-          __pyx_t_48 = __pyx_v_idx;
-          __pyx_t_49 = __pyx_v_idx;
-          __pyx_v_max1 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cpos1.rcbuffer->pybuffer.buf, __pyx_t_48, __pyx_pybuffernd_cpos1.diminfo[0].strides)) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_dpos1.rcbuffer->pybuffer.buf, __pyx_t_49, __pyx_pybuffernd_dpos1.diminfo[0].strides)));
+          __pyx_t_55 = __pyx_v_idx;
+          __pyx_t_56 = __pyx_v_idx;
+          __pyx_v_max1 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cpos1.rcbuffer->pybuffer.buf, __pyx_t_55, __pyx_pybuffernd_cpos1.diminfo[0].strides)) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_dpos1.rcbuffer->pybuffer.buf, __pyx_t_56, __pyx_pybuffernd_dpos1.diminfo[0].strides)));
 
-          /* "splitBBox.pyx":417
+          /* "splitBBox.pyx":453
  *             max1 = cpos1[idx] + dpos1[idx]
  * 
  *             if (max0 < pos0_min) or (max1 < pos1_min) or (min0 > pos0_maxin) or (min1 > pos1_maxin) :             # <<<<<<<<<<<<<<
  *                 continue
  * 
  */
-          __pyx_t_5 = (__pyx_v_max0 < __pyx_v_pos0_min);
+          __pyx_t_5 = ((__pyx_v_max0 < __pyx_v_pos0_min) != 0);
           if (!__pyx_t_5) {
-            __pyx_t_25 = (__pyx_v_max1 < __pyx_v_pos1_min);
-            if (!__pyx_t_25) {
-              __pyx_t_26 = (__pyx_v_min0 > __pyx_v_pos0_maxin);
+            __pyx_t_28 = ((__pyx_v_max1 < __pyx_v_pos1_min) != 0);
+            if (!__pyx_t_28) {
+              __pyx_t_26 = ((__pyx_v_min0 > __pyx_v_pos0_maxin) != 0);
               if (!__pyx_t_26) {
-                __pyx_t_50 = (__pyx_v_min1 > __pyx_v_pos1_maxin);
-                __pyx_t_51 = __pyx_t_50;
+                __pyx_t_57 = ((__pyx_v_min1 > __pyx_v_pos1_maxin) != 0);
+                __pyx_t_58 = __pyx_t_57;
               } else {
-                __pyx_t_51 = __pyx_t_26;
+                __pyx_t_58 = __pyx_t_26;
               }
-              __pyx_t_26 = __pyx_t_51;
+              __pyx_t_26 = __pyx_t_58;
             } else {
-              __pyx_t_26 = __pyx_t_25;
+              __pyx_t_26 = __pyx_t_28;
             }
-            __pyx_t_25 = __pyx_t_26;
+            __pyx_t_28 = __pyx_t_26;
           } else {
-            __pyx_t_25 = __pyx_t_5;
+            __pyx_t_28 = __pyx_t_5;
           }
-          if (__pyx_t_25) {
+          if (__pyx_t_28) {
 
-            /* "splitBBox.pyx":418
+            /* "splitBBox.pyx":454
  * 
  *             if (max0 < pos0_min) or (max1 < pos1_min) or (min0 > pos0_maxin) or (min1 > pos1_maxin) :
  *                 continue             # <<<<<<<<<<<<<<
  * 
  *             if min0 < pos0_min:
  */
-            goto __pyx_L36_continue;
-            goto __pyx_L44;
+            goto __pyx_L43_continue;
+            goto __pyx_L51;
           }
-          __pyx_L44:;
+          __pyx_L51:;
 
-          /* "splitBBox.pyx":420
+          /* "splitBBox.pyx":456
  *                 continue
  * 
  *             if min0 < pos0_min:             # <<<<<<<<<<<<<<
  *                 min0 = pos0_min
  *             if min1 < pos1_min:
  */
-          __pyx_t_25 = (__pyx_v_min0 < __pyx_v_pos0_min);
-          if (__pyx_t_25) {
+          __pyx_t_28 = ((__pyx_v_min0 < __pyx_v_pos0_min) != 0);
+          if (__pyx_t_28) {
 
-            /* "splitBBox.pyx":421
+            /* "splitBBox.pyx":457
  * 
  *             if min0 < pos0_min:
  *                 min0 = pos0_min             # <<<<<<<<<<<<<<
@@ -7258,21 +7860,21 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
  *                 min1 = pos1_min
  */
             __pyx_v_min0 = __pyx_v_pos0_min;
-            goto __pyx_L45;
+            goto __pyx_L52;
           }
-          __pyx_L45:;
+          __pyx_L52:;
 
-          /* "splitBBox.pyx":422
+          /* "splitBBox.pyx":458
  *             if min0 < pos0_min:
  *                 min0 = pos0_min
  *             if min1 < pos1_min:             # <<<<<<<<<<<<<<
  *                 min1 = pos1_min
  *             if max0 > pos0_maxin:
  */
-          __pyx_t_25 = (__pyx_v_min1 < __pyx_v_pos1_min);
-          if (__pyx_t_25) {
+          __pyx_t_28 = ((__pyx_v_min1 < __pyx_v_pos1_min) != 0);
+          if (__pyx_t_28) {
 
-            /* "splitBBox.pyx":423
+            /* "splitBBox.pyx":459
  *                 min0 = pos0_min
  *             if min1 < pos1_min:
  *                 min1 = pos1_min             # <<<<<<<<<<<<<<
@@ -7280,21 +7882,21 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
  *                 max0 = pos0_maxin
  */
             __pyx_v_min1 = __pyx_v_pos1_min;
-            goto __pyx_L46;
+            goto __pyx_L53;
           }
-          __pyx_L46:;
+          __pyx_L53:;
 
-          /* "splitBBox.pyx":424
+          /* "splitBBox.pyx":460
  *             if min1 < pos1_min:
  *                 min1 = pos1_min
  *             if max0 > pos0_maxin:             # <<<<<<<<<<<<<<
  *                 max0 = pos0_maxin
  *             if max1 > pos1_maxin:
  */
-          __pyx_t_25 = (__pyx_v_max0 > __pyx_v_pos0_maxin);
-          if (__pyx_t_25) {
+          __pyx_t_28 = ((__pyx_v_max0 > __pyx_v_pos0_maxin) != 0);
+          if (__pyx_t_28) {
 
-            /* "splitBBox.pyx":425
+            /* "splitBBox.pyx":461
  *                 min1 = pos1_min
  *             if max0 > pos0_maxin:
  *                 max0 = pos0_maxin             # <<<<<<<<<<<<<<
@@ -7302,21 +7904,21 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
  *                 max1 = pos1_maxin
  */
             __pyx_v_max0 = __pyx_v_pos0_maxin;
-            goto __pyx_L47;
+            goto __pyx_L54;
           }
-          __pyx_L47:;
+          __pyx_L54:;
 
-          /* "splitBBox.pyx":426
+          /* "splitBBox.pyx":462
  *             if max0 > pos0_maxin:
  *                 max0 = pos0_maxin
  *             if max1 > pos1_maxin:             # <<<<<<<<<<<<<<
  *                 max1 = pos1_maxin
  * 
  */
-          __pyx_t_25 = (__pyx_v_max1 > __pyx_v_pos1_maxin);
-          if (__pyx_t_25) {
+          __pyx_t_28 = ((__pyx_v_max1 > __pyx_v_pos1_maxin) != 0);
+          if (__pyx_t_28) {
 
-            /* "splitBBox.pyx":427
+            /* "splitBBox.pyx":463
  *                 max0 = pos0_maxin
  *             if max1 > pos1_maxin:
  *                 max1 = pos1_maxin             # <<<<<<<<<<<<<<
@@ -7324,11 +7926,11 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
  * 
  */
             __pyx_v_max1 = __pyx_v_pos1_maxin;
-            goto __pyx_L48;
+            goto __pyx_L55;
           }
-          __pyx_L48:;
+          __pyx_L55:;
 
-          /* "splitBBox.pyx":430
+          /* "splitBBox.pyx":466
  * 
  * 
  *             fbin0_min = getBinNr(min0, pos0_min, delta0)             # <<<<<<<<<<<<<<
@@ -7337,7 +7939,7 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
  */
           __pyx_v_fbin0_min = __pyx_f_9splitBBox_getBinNr(__pyx_v_min0, __pyx_v_pos0_min, __pyx_v_delta0);
 
-          /* "splitBBox.pyx":431
+          /* "splitBBox.pyx":467
  * 
  *             fbin0_min = getBinNr(min0, pos0_min, delta0)
  *             fbin0_max = getBinNr(max0, pos0_min, delta0)             # <<<<<<<<<<<<<<
@@ -7346,7 +7948,7 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
  */
           __pyx_v_fbin0_max = __pyx_f_9splitBBox_getBinNr(__pyx_v_max0, __pyx_v_pos0_min, __pyx_v_delta0);
 
-          /* "splitBBox.pyx":432
+          /* "splitBBox.pyx":468
  *             fbin0_min = getBinNr(min0, pos0_min, delta0)
  *             fbin0_max = getBinNr(max0, pos0_min, delta0)
  *             fbin1_min = getBinNr(min1, pos1_min, delta1)             # <<<<<<<<<<<<<<
@@ -7355,7 +7957,7 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
  */
           __pyx_v_fbin1_min = __pyx_f_9splitBBox_getBinNr(__pyx_v_min1, __pyx_v_pos1_min, __pyx_v_delta1);
 
-          /* "splitBBox.pyx":433
+          /* "splitBBox.pyx":469
  *             fbin0_max = getBinNr(max0, pos0_min, delta0)
  *             fbin1_min = getBinNr(min1, pos1_min, delta1)
  *             fbin1_max = getBinNr(max1, pos1_min, delta1)             # <<<<<<<<<<<<<<
@@ -7364,7 +7966,7 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
  */
           __pyx_v_fbin1_max = __pyx_f_9splitBBox_getBinNr(__pyx_v_max1, __pyx_v_pos1_min, __pyx_v_delta1);
 
-          /* "splitBBox.pyx":435
+          /* "splitBBox.pyx":471
  *             fbin1_max = getBinNr(max1, pos1_min, delta1)
  * 
  *             bin0_min = <ssize_t> fbin0_min             # <<<<<<<<<<<<<<
@@ -7373,7 +7975,7 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
  */
           __pyx_v_bin0_min = ((Py_ssize_t)__pyx_v_fbin0_min);
 
-          /* "splitBBox.pyx":436
+          /* "splitBBox.pyx":472
  * 
  *             bin0_min = <ssize_t> fbin0_min
  *             bin0_max = <ssize_t> fbin0_max             # <<<<<<<<<<<<<<
@@ -7382,7 +7984,7 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
  */
           __pyx_v_bin0_max = ((Py_ssize_t)__pyx_v_fbin0_max);
 
-          /* "splitBBox.pyx":437
+          /* "splitBBox.pyx":473
  *             bin0_min = <ssize_t> fbin0_min
  *             bin0_max = <ssize_t> fbin0_max
  *             bin1_min = <ssize_t> fbin1_min             # <<<<<<<<<<<<<<
@@ -7391,7 +7993,7 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
  */
           __pyx_v_bin1_min = ((Py_ssize_t)__pyx_v_fbin1_min);
 
-          /* "splitBBox.pyx":438
+          /* "splitBBox.pyx":474
  *             bin0_max = <ssize_t> fbin0_max
  *             bin1_min = <ssize_t> fbin1_min
  *             bin1_max = <ssize_t> fbin1_max             # <<<<<<<<<<<<<<
@@ -7400,52 +8002,52 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
  */
           __pyx_v_bin1_max = ((Py_ssize_t)__pyx_v_fbin1_max);
 
-          /* "splitBBox.pyx":441
+          /* "splitBBox.pyx":477
  * 
  * 
  *             if bin0_min == bin0_max:             # <<<<<<<<<<<<<<
  *                 if bin1_min == bin1_max:
  *                     #All pixel is within a single bin
  */
-          __pyx_t_25 = (__pyx_v_bin0_min == __pyx_v_bin0_max);
-          if (__pyx_t_25) {
+          __pyx_t_28 = ((__pyx_v_bin0_min == __pyx_v_bin0_max) != 0);
+          if (__pyx_t_28) {
 
-            /* "splitBBox.pyx":442
+            /* "splitBBox.pyx":478
  * 
  *             if bin0_min == bin0_max:
  *                 if bin1_min == bin1_max:             # <<<<<<<<<<<<<<
  *                     #All pixel is within a single bin
  *                     outCount[bin0_min, bin1_min] += 1.0
  */
-            __pyx_t_25 = (__pyx_v_bin1_min == __pyx_v_bin1_max);
-            if (__pyx_t_25) {
+            __pyx_t_28 = ((__pyx_v_bin1_min == __pyx_v_bin1_max) != 0);
+            if (__pyx_t_28) {
 
-              /* "splitBBox.pyx":444
+              /* "splitBBox.pyx":480
  *                 if bin1_min == bin1_max:
  *                     #All pixel is within a single bin
  *                     outCount[bin0_min, bin1_min] += 1.0             # <<<<<<<<<<<<<<
  *                     outData[bin0_min, bin1_min] += data
  *                 else:
  */
-              __pyx_t_52 = __pyx_v_bin0_min;
-              __pyx_t_53 = __pyx_v_bin1_min;
-              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_52, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_53, __pyx_pybuffernd_outCount.diminfo[1].strides) += 1.0;
+              __pyx_t_59 = __pyx_v_bin0_min;
+              __pyx_t_60 = __pyx_v_bin1_min;
+              *__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) += 1.0;
 
-              /* "splitBBox.pyx":445
+              /* "splitBBox.pyx":481
  *                     #All pixel is within a single bin
  *                     outCount[bin0_min, bin1_min] += 1.0
  *                     outData[bin0_min, bin1_min] += data             # <<<<<<<<<<<<<<
  *                 else:
  *                     #spread on more than 2 bins
  */
-              __pyx_t_54 = __pyx_v_bin0_min;
-              __pyx_t_55 = __pyx_v_bin1_min;
-              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_54, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_55, __pyx_pybuffernd_outData.diminfo[1].strides) += __pyx_v_data;
-              goto __pyx_L50;
+              __pyx_t_61 = __pyx_v_bin0_min;
+              __pyx_t_62 = __pyx_v_bin1_min;
+              *__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_data;
+              goto __pyx_L57;
             }
             /*else*/ {
 
-              /* "splitBBox.pyx":448
+              /* "splitBBox.pyx":484
  *                 else:
  *                     #spread on more than 2 bins
  *                     deltaD = (< float > (bin1_min + 1)) - fbin1_min             # <<<<<<<<<<<<<<
@@ -7454,7 +8056,7 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
  */
               __pyx_v_deltaD = (((float)(__pyx_v_bin1_min + 1)) - __pyx_v_fbin1_min);
 
-              /* "splitBBox.pyx":449
+              /* "splitBBox.pyx":485
  *                     #spread on more than 2 bins
  *                     deltaD = (< float > (bin1_min + 1)) - fbin1_min
  *                     deltaU = fbin1_max - ( bin1_max)             # <<<<<<<<<<<<<<
@@ -7463,7 +8065,7 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
  */
               __pyx_v_deltaU = (__pyx_v_fbin1_max - __pyx_v_bin1_max);
 
-              /* "splitBBox.pyx":450
+              /* "splitBBox.pyx":486
  *                     deltaD = (< float > (bin1_min + 1)) - fbin1_min
  *                     deltaU = fbin1_max - ( bin1_max)
  *                     deltaA = 1.0 / (fbin1_max - fbin1_min)             # <<<<<<<<<<<<<<
@@ -7472,100 +8074,100 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
  */
               __pyx_v_deltaA = (1.0 / (__pyx_v_fbin1_max - __pyx_v_fbin1_min));
 
-              /* "splitBBox.pyx":452
+              /* "splitBBox.pyx":488
  *                     deltaA = 1.0 / (fbin1_max - fbin1_min)
  * 
  *                     outCount[bin0_min, bin1_min] +=  deltaA * deltaD             # <<<<<<<<<<<<<<
  *                     outData[bin0_min, bin1_min] += data * deltaA * deltaD
  * 
  */
-              __pyx_t_56 = __pyx_v_bin0_min;
-              __pyx_t_57 = __pyx_v_bin1_min;
-              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_56, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_57, __pyx_pybuffernd_outCount.diminfo[1].strides) += (__pyx_v_deltaA * __pyx_v_deltaD);
+              __pyx_t_63 = __pyx_v_bin0_min;
+              __pyx_t_64 = __pyx_v_bin1_min;
+              *__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_deltaA * __pyx_v_deltaD);
 
-              /* "splitBBox.pyx":453
+              /* "splitBBox.pyx":489
  * 
  *                     outCount[bin0_min, bin1_min] +=  deltaA * deltaD
  *                     outData[bin0_min, bin1_min] += data * deltaA * deltaD             # <<<<<<<<<<<<<<
  * 
  *                     outCount[bin0_min, bin1_max] +=  deltaA * deltaU
  */
-              __pyx_t_58 = __pyx_v_bin0_min;
-              __pyx_t_59 = __pyx_v_bin1_min;
-              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_58, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_59, __pyx_pybuffernd_outData.diminfo[1].strides) += ((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaD);
+              __pyx_t_65 = __pyx_v_bin0_min;
+              __pyx_t_66 = __pyx_v_bin1_min;
+              *__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_data * __pyx_v_deltaA) * __pyx_v_deltaD);
 
-              /* "splitBBox.pyx":455
+              /* "splitBBox.pyx":491
  *                     outData[bin0_min, bin1_min] += data * deltaA * deltaD
  * 
  *                     outCount[bin0_min, bin1_max] +=  deltaA * deltaU             # <<<<<<<<<<<<<<
  *                     outData[bin0_min, bin1_max] += data * deltaA * deltaU
  *                     for j in range(bin1_min + 1, bin1_max):
  */
-              __pyx_t_60 = __pyx_v_bin0_min;
-              __pyx_t_61 = __pyx_v_bin1_max;
-              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_60, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_61, __pyx_pybuffernd_outCount.diminfo[1].strides) += (__pyx_v_deltaA * __pyx_v_deltaU);
+              __pyx_t_67 = __pyx_v_bin0_min;
+              __pyx_t_68 = __pyx_v_bin1_max;
+              *__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_deltaA * __pyx_v_deltaU);
 
-              /* "splitBBox.pyx":456
+              /* "splitBBox.pyx":492
  * 
  *                     outCount[bin0_min, bin1_max] +=  deltaA * deltaU
  *                     outData[bin0_min, bin1_max] += data * deltaA * deltaU             # <<<<<<<<<<<<<<
  *                     for j in range(bin1_min + 1, bin1_max):
  *                         outCount[bin0_min, j] +=  deltaA
  */
-              __pyx_t_62 = __pyx_v_bin0_min;
-              __pyx_t_63 = __pyx_v_bin1_max;
-              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_62, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_63, __pyx_pybuffernd_outData.diminfo[1].strides) += ((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaU);
+              __pyx_t_69 = __pyx_v_bin0_min;
+              __pyx_t_70 = __pyx_v_bin1_max;
+              *__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_data * __pyx_v_deltaA) * __pyx_v_deltaU);
 
-              /* "splitBBox.pyx":457
+              /* "splitBBox.pyx":493
  *                     outCount[bin0_min, bin1_max] +=  deltaA * deltaU
  *                     outData[bin0_min, bin1_max] += data * deltaA * deltaU
  *                     for j in range(bin1_min + 1, bin1_max):             # <<<<<<<<<<<<<<
  *                         outCount[bin0_min, j] +=  deltaA
  *                         outData[bin0_min, j] += data * deltaA
  */
-              __pyx_t_64 = __pyx_v_bin1_max;
-              for (__pyx_t_65 = (__pyx_v_bin1_min + 1); __pyx_t_65 < __pyx_t_64; __pyx_t_65+=1) {
-                __pyx_v_j = __pyx_t_65;
+              __pyx_t_71 = __pyx_v_bin1_max;
+              for (__pyx_t_72 = (__pyx_v_bin1_min + 1); __pyx_t_72 < __pyx_t_71; __pyx_t_72+=1) {
+                __pyx_v_j = __pyx_t_72;
 
-                /* "splitBBox.pyx":458
+                /* "splitBBox.pyx":494
  *                     outData[bin0_min, bin1_max] += data * deltaA * deltaU
  *                     for j in range(bin1_min + 1, bin1_max):
  *                         outCount[bin0_min, j] +=  deltaA             # <<<<<<<<<<<<<<
  *                         outData[bin0_min, j] += data * deltaA
  * 
  */
-                __pyx_t_66 = __pyx_v_bin0_min;
-                __pyx_t_67 = __pyx_v_j;
-                *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_66, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_67, __pyx_pybuffernd_outCount.diminfo[1].strides) += __pyx_v_deltaA;
+                __pyx_t_73 = __pyx_v_bin0_min;
+                __pyx_t_74 = __pyx_v_j;
+                *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_73, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_74, __pyx_pybuffernd_outCount.diminfo[1].strides) += __pyx_v_deltaA;
 
-                /* "splitBBox.pyx":459
+                /* "splitBBox.pyx":495
  *                     for j in range(bin1_min + 1, bin1_max):
  *                         outCount[bin0_min, j] +=  deltaA
  *                         outData[bin0_min, j] += data * deltaA             # <<<<<<<<<<<<<<
  * 
  *             else: #spread on more than 2 bins in dim 0
  */
-                __pyx_t_68 = __pyx_v_bin0_min;
-                __pyx_t_69 = __pyx_v_j;
-                *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_68, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_69, __pyx_pybuffernd_outData.diminfo[1].strides) += (__pyx_v_data * __pyx_v_deltaA);
+                __pyx_t_75 = __pyx_v_bin0_min;
+                __pyx_t_76 = __pyx_v_j;
+                *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_75, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_76, __pyx_pybuffernd_outData.diminfo[1].strides) += (__pyx_v_data * __pyx_v_deltaA);
               }
             }
-            __pyx_L50:;
-            goto __pyx_L49;
+            __pyx_L57:;
+            goto __pyx_L56;
           }
           /*else*/ {
 
-            /* "splitBBox.pyx":462
+            /* "splitBBox.pyx":498
  * 
  *             else: #spread on more than 2 bins in dim 0
  *                 if bin1_min == bin1_max:             # <<<<<<<<<<<<<<
  *                     #All pixel fall on 1 bins in dim 1
  *                     deltaA = 1.0 / (fbin0_max - fbin0_min)
  */
-            __pyx_t_25 = (__pyx_v_bin1_min == __pyx_v_bin1_max);
-            if (__pyx_t_25) {
+            __pyx_t_28 = ((__pyx_v_bin1_min == __pyx_v_bin1_max) != 0);
+            if (__pyx_t_28) {
 
-              /* "splitBBox.pyx":464
+              /* "splitBBox.pyx":500
  *                 if bin1_min == bin1_max:
  *                     #All pixel fall on 1 bins in dim 1
  *                     deltaA = 1.0 / (fbin0_max - fbin0_min)             # <<<<<<<<<<<<<<
@@ -7574,7 +8176,7 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
  */
               __pyx_v_deltaA = (1.0 / (__pyx_v_fbin0_max - __pyx_v_fbin0_min));
 
-              /* "splitBBox.pyx":465
+              /* "splitBBox.pyx":501
  *                     #All pixel fall on 1 bins in dim 1
  *                     deltaA = 1.0 / (fbin0_max - fbin0_min)
  *                     deltaL = (< float > (bin0_min + 1)) - fbin0_min             # <<<<<<<<<<<<<<
@@ -7583,29 +8185,29 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
  */
               __pyx_v_deltaL = (((float)(__pyx_v_bin0_min + 1)) - __pyx_v_fbin0_min);
 
-              /* "splitBBox.pyx":466
+              /* "splitBBox.pyx":502
  *                     deltaA = 1.0 / (fbin0_max - fbin0_min)
  *                     deltaL = (< float > (bin0_min + 1)) - fbin0_min
  *                     outCount[bin0_min, bin1_min] +=  deltaA * deltaL             # <<<<<<<<<<<<<<
  *                     outData[bin0_min, bin1_min] +=  data * deltaA * deltaL
  *                     deltaR = fbin0_max - (< float > bin0_max)
  */
-              __pyx_t_64 = __pyx_v_bin0_min;
-              __pyx_t_65 = __pyx_v_bin1_min;
-              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_64, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_65, __pyx_pybuffernd_outCount.diminfo[1].strides) += (__pyx_v_deltaA * __pyx_v_deltaL);
+              __pyx_t_71 = __pyx_v_bin0_min;
+              __pyx_t_72 = __pyx_v_bin1_min;
+              *__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_deltaA * __pyx_v_deltaL);
 
-              /* "splitBBox.pyx":467
+              /* "splitBBox.pyx":503
  *                     deltaL = (< float > (bin0_min + 1)) - fbin0_min
  *                     outCount[bin0_min, bin1_min] +=  deltaA * deltaL
  *                     outData[bin0_min, bin1_min] +=  data * deltaA * deltaL             # <<<<<<<<<<<<<<
  *                     deltaR = fbin0_max - (< float > bin0_max)
  *                     outCount[bin0_max, bin1_min] +=  deltaA * deltaR
  */
-              __pyx_t_70 = __pyx_v_bin0_min;
-              __pyx_t_71 = __pyx_v_bin1_min;
-              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_70, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_71, __pyx_pybuffernd_outData.diminfo[1].strides) += ((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaL);
+              __pyx_t_77 = __pyx_v_bin0_min;
+              __pyx_t_78 = __pyx_v_bin1_min;
+              *__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_data * __pyx_v_deltaA) * __pyx_v_deltaL);
 
-              /* "splitBBox.pyx":468
+              /* "splitBBox.pyx":504
  *                     outCount[bin0_min, bin1_min] +=  deltaA * deltaL
  *                     outData[bin0_min, bin1_min] +=  data * deltaA * deltaL
  *                     deltaR = fbin0_max - (< float > bin0_max)             # <<<<<<<<<<<<<<
@@ -7614,66 +8216,66 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
  */
               __pyx_v_deltaR = (__pyx_v_fbin0_max - ((float)__pyx_v_bin0_max));
 
-              /* "splitBBox.pyx":469
+              /* "splitBBox.pyx":505
  *                     outData[bin0_min, bin1_min] +=  data * deltaA * deltaL
  *                     deltaR = fbin0_max - (< float > bin0_max)
  *                     outCount[bin0_max, bin1_min] +=  deltaA * deltaR             # <<<<<<<<<<<<<<
  *                     outData[bin0_max, bin1_min] +=  data * deltaA * deltaR
  *                     for i in range(bin0_min + 1, bin0_max):
  */
-              __pyx_t_72 = __pyx_v_bin0_max;
-              __pyx_t_73 = __pyx_v_bin1_min;
-              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_72, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_73, __pyx_pybuffernd_outCount.diminfo[1].strides) += (__pyx_v_deltaA * __pyx_v_deltaR);
+              __pyx_t_79 = __pyx_v_bin0_max;
+              __pyx_t_80 = __pyx_v_bin1_min;
+              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_79, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_80, __pyx_pybuffernd_outCount.diminfo[1].strides) += (__pyx_v_deltaA * __pyx_v_deltaR);
 
-              /* "splitBBox.pyx":470
+              /* "splitBBox.pyx":506
  *                     deltaR = fbin0_max - (< float > bin0_max)
  *                     outCount[bin0_max, bin1_min] +=  deltaA * deltaR
  *                     outData[bin0_max, bin1_min] +=  data * deltaA * deltaR             # <<<<<<<<<<<<<<
  *                     for i in range(bin0_min + 1, bin0_max):
  *                             outCount[i, bin1_min] +=  deltaA
  */
-              __pyx_t_74 = __pyx_v_bin0_max;
-              __pyx_t_75 = __pyx_v_bin1_min;
-              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_74, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_75, __pyx_pybuffernd_outData.diminfo[1].strides) += ((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaR);
+              __pyx_t_81 = __pyx_v_bin0_max;
+              __pyx_t_82 = __pyx_v_bin1_min;
+              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_81, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_82, __pyx_pybuffernd_outData.diminfo[1].strides) += ((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaR);
 
-              /* "splitBBox.pyx":471
+              /* "splitBBox.pyx":507
  *                     outCount[bin0_max, bin1_min] +=  deltaA * deltaR
  *                     outData[bin0_max, bin1_min] +=  data * deltaA * deltaR
  *                     for i in range(bin0_min + 1, bin0_max):             # <<<<<<<<<<<<<<
  *                             outCount[i, bin1_min] +=  deltaA
  *                             outData[i, bin1_min] +=  data * deltaA
  */
-              __pyx_t_76 = __pyx_v_bin0_max;
-              for (__pyx_t_77 = (__pyx_v_bin0_min + 1); __pyx_t_77 < __pyx_t_76; __pyx_t_77+=1) {
-                __pyx_v_i = __pyx_t_77;
+              __pyx_t_83 = __pyx_v_bin0_max;
+              for (__pyx_t_84 = (__pyx_v_bin0_min + 1); __pyx_t_84 < __pyx_t_83; __pyx_t_84+=1) {
+                __pyx_v_i = __pyx_t_84;
 
-                /* "splitBBox.pyx":472
+                /* "splitBBox.pyx":508
  *                     outData[bin0_max, bin1_min] +=  data * deltaA * deltaR
  *                     for i in range(bin0_min + 1, bin0_max):
  *                             outCount[i, bin1_min] +=  deltaA             # <<<<<<<<<<<<<<
  *                             outData[i, bin1_min] +=  data * deltaA
  *                 else:
  */
-                __pyx_t_78 = __pyx_v_i;
-                __pyx_t_79 = __pyx_v_bin1_min;
-                *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_78, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_79, __pyx_pybuffernd_outCount.diminfo[1].strides) += __pyx_v_deltaA;
+                __pyx_t_85 = __pyx_v_i;
+                __pyx_t_86 = __pyx_v_bin1_min;
+                *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_85, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_86, __pyx_pybuffernd_outCount.diminfo[1].strides) += __pyx_v_deltaA;
 
-                /* "splitBBox.pyx":473
+                /* "splitBBox.pyx":509
  *                     for i in range(bin0_min + 1, bin0_max):
  *                             outCount[i, bin1_min] +=  deltaA
  *                             outData[i, bin1_min] +=  data * deltaA             # <<<<<<<<<<<<<<
  *                 else:
  *                     #spread on n pix in dim0 and m pixel in dim1:
  */
-                __pyx_t_80 = __pyx_v_i;
-                __pyx_t_81 = __pyx_v_bin1_min;
-                *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_80, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_81, __pyx_pybuffernd_outData.diminfo[1].strides) += (__pyx_v_data * __pyx_v_deltaA);
+                __pyx_t_87 = __pyx_v_i;
+                __pyx_t_88 = __pyx_v_bin1_min;
+                *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_87, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_88, __pyx_pybuffernd_outData.diminfo[1].strides) += (__pyx_v_data * __pyx_v_deltaA);
               }
-              goto __pyx_L53;
+              goto __pyx_L60;
             }
             /*else*/ {
 
-              /* "splitBBox.pyx":476
+              /* "splitBBox.pyx":512
  *                 else:
  *                     #spread on n pix in dim0 and m pixel in dim1:
  *                     deltaL = (< float > (bin0_min + 1)) - fbin0_min             # <<<<<<<<<<<<<<
@@ -7682,7 +8284,7 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
  */
               __pyx_v_deltaL = (((float)(__pyx_v_bin0_min + 1)) - __pyx_v_fbin0_min);
 
-              /* "splitBBox.pyx":477
+              /* "splitBBox.pyx":513
  *                     #spread on n pix in dim0 and m pixel in dim1:
  *                     deltaL = (< float > (bin0_min + 1)) - fbin0_min
  *                     deltaR = fbin0_max - (< float > bin0_max)             # <<<<<<<<<<<<<<
@@ -7691,7 +8293,7 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
  */
               __pyx_v_deltaR = (__pyx_v_fbin0_max - ((float)__pyx_v_bin0_max));
 
-              /* "splitBBox.pyx":478
+              /* "splitBBox.pyx":514
  *                     deltaL = (< float > (bin0_min + 1)) - fbin0_min
  *                     deltaR = fbin0_max - (< float > bin0_max)
  *                     deltaD = (< float > (bin1_min + 1)) - fbin1_min             # <<<<<<<<<<<<<<
@@ -7700,7 +8302,7 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
  */
               __pyx_v_deltaD = (((float)(__pyx_v_bin1_min + 1)) - __pyx_v_fbin1_min);
 
-              /* "splitBBox.pyx":479
+              /* "splitBBox.pyx":515
  *                     deltaR = fbin0_max - (< float > bin0_max)
  *                     deltaD = (< float > (bin1_min + 1)) - fbin1_min
  *                     deltaU = fbin1_max - (< float > bin1_max)             # <<<<<<<<<<<<<<
@@ -7709,7 +8311,7 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
  */
               __pyx_v_deltaU = (__pyx_v_fbin1_max - ((float)__pyx_v_bin1_max));
 
-              /* "splitBBox.pyx":480
+              /* "splitBBox.pyx":516
  *                     deltaD = (< float > (bin1_min + 1)) - fbin1_min
  *                     deltaU = fbin1_max - (< float > bin1_max)
  *                     deltaA = 1.0 / ((fbin0_max - fbin0_min) * (fbin1_max - fbin1_min))             # <<<<<<<<<<<<<<
@@ -7718,247 +8320,247 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
  */
               __pyx_v_deltaA = (1.0 / ((__pyx_v_fbin0_max - __pyx_v_fbin0_min) * (__pyx_v_fbin1_max - __pyx_v_fbin1_min)));
 
-              /* "splitBBox.pyx":482
+              /* "splitBBox.pyx":518
  *                     deltaA = 1.0 / ((fbin0_max - fbin0_min) * (fbin1_max - fbin1_min))
  * 
  *                     outCount[bin0_min, bin1_min] +=  deltaA * deltaL * deltaD             # <<<<<<<<<<<<<<
  *                     outData[bin0_min, bin1_min] +=  data * deltaA * deltaL * deltaD
  * 
  */
-              __pyx_t_76 = __pyx_v_bin0_min;
-              __pyx_t_77 = __pyx_v_bin1_min;
-              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_76, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_77, __pyx_pybuffernd_outCount.diminfo[1].strides) += ((__pyx_v_deltaA * __pyx_v_deltaL) * __pyx_v_deltaD);
+              __pyx_t_83 = __pyx_v_bin0_min;
+              __pyx_t_84 = __pyx_v_bin1_min;
+              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_83, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_84, __pyx_pybuffernd_outCount.diminfo[1].strides) += ((__pyx_v_deltaA * __pyx_v_deltaL) * __pyx_v_deltaD);
 
-              /* "splitBBox.pyx":483
+              /* "splitBBox.pyx":519
  * 
  *                     outCount[bin0_min, bin1_min] +=  deltaA * deltaL * deltaD
  *                     outData[bin0_min, bin1_min] +=  data * deltaA * deltaL * deltaD             # <<<<<<<<<<<<<<
  * 
  *                     outCount[bin0_min, bin1_max] +=  deltaA * deltaL * deltaU
  */
-              __pyx_t_82 = __pyx_v_bin0_min;
-              __pyx_t_83 = __pyx_v_bin1_min;
-              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_82, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_83, __pyx_pybuffernd_outData.diminfo[1].strides) += (((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaL) * __pyx_v_deltaD);
+              __pyx_t_89 = __pyx_v_bin0_min;
+              __pyx_t_90 = __pyx_v_bin1_min;
+              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_89, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_90, __pyx_pybuffernd_outData.diminfo[1].strides) += (((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaL) * __pyx_v_deltaD);
 
-              /* "splitBBox.pyx":485
+              /* "splitBBox.pyx":521
  *                     outData[bin0_min, bin1_min] +=  data * deltaA * deltaL * deltaD
  * 
  *                     outCount[bin0_min, bin1_max] +=  deltaA * deltaL * deltaU             # <<<<<<<<<<<<<<
  *                     outData[bin0_min, bin1_max] +=  data * deltaA * deltaL * deltaU
  * 
  */
-              __pyx_t_84 = __pyx_v_bin0_min;
-              __pyx_t_85 = __pyx_v_bin1_max;
-              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_84, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_85, __pyx_pybuffernd_outCount.diminfo[1].strides) += ((__pyx_v_deltaA * __pyx_v_deltaL) * __pyx_v_deltaU);
+              __pyx_t_91 = __pyx_v_bin0_min;
+              __pyx_t_92 = __pyx_v_bin1_max;
+              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_91, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_92, __pyx_pybuffernd_outCount.diminfo[1].strides) += ((__pyx_v_deltaA * __pyx_v_deltaL) * __pyx_v_deltaU);
 
-              /* "splitBBox.pyx":486
+              /* "splitBBox.pyx":522
  * 
  *                     outCount[bin0_min, bin1_max] +=  deltaA * deltaL * deltaU
  *                     outData[bin0_min, bin1_max] +=  data * deltaA * deltaL * deltaU             # <<<<<<<<<<<<<<
  * 
  *                     outCount[bin0_max, bin1_min] +=  deltaA * deltaR * deltaD
  */
-              __pyx_t_86 = __pyx_v_bin0_min;
-              __pyx_t_87 = __pyx_v_bin1_max;
-              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_86, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_87, __pyx_pybuffernd_outData.diminfo[1].strides) += (((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaL) * __pyx_v_deltaU);
+              __pyx_t_93 = __pyx_v_bin0_min;
+              __pyx_t_94 = __pyx_v_bin1_max;
+              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_93, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_94, __pyx_pybuffernd_outData.diminfo[1].strides) += (((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaL) * __pyx_v_deltaU);
 
-              /* "splitBBox.pyx":488
+              /* "splitBBox.pyx":524
  *                     outData[bin0_min, bin1_max] +=  data * deltaA * deltaL * deltaU
  * 
  *                     outCount[bin0_max, bin1_min] +=  deltaA * deltaR * deltaD             # <<<<<<<<<<<<<<
  *                     outData[bin0_max, bin1_min] +=  data * deltaA * deltaR * deltaD
  * 
  */
-              __pyx_t_88 = __pyx_v_bin0_max;
-              __pyx_t_89 = __pyx_v_bin1_min;
-              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_88, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_89, __pyx_pybuffernd_outCount.diminfo[1].strides) += ((__pyx_v_deltaA * __pyx_v_deltaR) * __pyx_v_deltaD);
+              __pyx_t_95 = __pyx_v_bin0_max;
+              __pyx_t_96 = __pyx_v_bin1_min;
+              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_95, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_96, __pyx_pybuffernd_outCount.diminfo[1].strides) += ((__pyx_v_deltaA * __pyx_v_deltaR) * __pyx_v_deltaD);
 
-              /* "splitBBox.pyx":489
+              /* "splitBBox.pyx":525
  * 
  *                     outCount[bin0_max, bin1_min] +=  deltaA * deltaR * deltaD
  *                     outData[bin0_max, bin1_min] +=  data * deltaA * deltaR * deltaD             # <<<<<<<<<<<<<<
  * 
  *                     outCount[bin0_max, bin1_max] +=  deltaA * deltaR * deltaU
  */
-              __pyx_t_90 = __pyx_v_bin0_max;
-              __pyx_t_91 = __pyx_v_bin1_min;
-              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_90, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_91, __pyx_pybuffernd_outData.diminfo[1].strides) += (((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaR) * __pyx_v_deltaD);
+              __pyx_t_97 = __pyx_v_bin0_max;
+              __pyx_t_98 = __pyx_v_bin1_min;
+              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_97, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_98, __pyx_pybuffernd_outData.diminfo[1].strides) += (((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaR) * __pyx_v_deltaD);
 
-              /* "splitBBox.pyx":491
+              /* "splitBBox.pyx":527
  *                     outData[bin0_max, bin1_min] +=  data * deltaA * deltaR * deltaD
  * 
  *                     outCount[bin0_max, bin1_max] +=  deltaA * deltaR * deltaU             # <<<<<<<<<<<<<<
  *                     outData[bin0_max, bin1_max] +=  data * deltaA * deltaR * deltaU
  *                     for i in range(bin0_min + 1, bin0_max):
  */
-              __pyx_t_92 = __pyx_v_bin0_max;
-              __pyx_t_93 = __pyx_v_bin1_max;
-              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_92, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_93, __pyx_pybuffernd_outCount.diminfo[1].strides) += ((__pyx_v_deltaA * __pyx_v_deltaR) * __pyx_v_deltaU);
+              __pyx_t_99 = __pyx_v_bin0_max;
+              __pyx_t_100 = __pyx_v_bin1_max;
+              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_99, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_100, __pyx_pybuffernd_outCount.diminfo[1].strides) += ((__pyx_v_deltaA * __pyx_v_deltaR) * __pyx_v_deltaU);
 
-              /* "splitBBox.pyx":492
+              /* "splitBBox.pyx":528
  * 
  *                     outCount[bin0_max, bin1_max] +=  deltaA * deltaR * deltaU
  *                     outData[bin0_max, bin1_max] +=  data * deltaA * deltaR * deltaU             # <<<<<<<<<<<<<<
  *                     for i in range(bin0_min + 1, bin0_max):
  *                             outCount[i, bin1_min] +=  deltaA * deltaD
  */
-              __pyx_t_94 = __pyx_v_bin0_max;
-              __pyx_t_95 = __pyx_v_bin1_max;
-              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_94, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_95, __pyx_pybuffernd_outData.diminfo[1].strides) += (((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaR) * __pyx_v_deltaU);
+              __pyx_t_101 = __pyx_v_bin0_max;
+              __pyx_t_102 = __pyx_v_bin1_max;
+              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_101, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_102, __pyx_pybuffernd_outData.diminfo[1].strides) += (((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaR) * __pyx_v_deltaU);
 
-              /* "splitBBox.pyx":493
+              /* "splitBBox.pyx":529
  *                     outCount[bin0_max, bin1_max] +=  deltaA * deltaR * deltaU
  *                     outData[bin0_max, bin1_max] +=  data * deltaA * deltaR * deltaU
  *                     for i in range(bin0_min + 1, bin0_max):             # <<<<<<<<<<<<<<
  *                             outCount[i, bin1_min] +=  deltaA * deltaD
  *                             outData[i, bin1_min] +=  data * deltaA * deltaD
  */
-              __pyx_t_96 = __pyx_v_bin0_max;
-              for (__pyx_t_97 = (__pyx_v_bin0_min + 1); __pyx_t_97 < __pyx_t_96; __pyx_t_97+=1) {
-                __pyx_v_i = __pyx_t_97;
+              __pyx_t_103 = __pyx_v_bin0_max;
+              for (__pyx_t_104 = (__pyx_v_bin0_min + 1); __pyx_t_104 < __pyx_t_103; __pyx_t_104+=1) {
+                __pyx_v_i = __pyx_t_104;
 
-                /* "splitBBox.pyx":494
+                /* "splitBBox.pyx":530
  *                     outData[bin0_max, bin1_max] +=  data * deltaA * deltaR * deltaU
  *                     for i in range(bin0_min + 1, bin0_max):
  *                             outCount[i, bin1_min] +=  deltaA * deltaD             # <<<<<<<<<<<<<<
  *                             outData[i, bin1_min] +=  data * deltaA * deltaD
  *                             for j in range(bin1_min + 1, bin1_max):
  */
-                __pyx_t_98 = __pyx_v_i;
-                __pyx_t_99 = __pyx_v_bin1_min;
-                *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_98, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_99, __pyx_pybuffernd_outCount.diminfo[1].strides) += (__pyx_v_deltaA * __pyx_v_deltaD);
+                __pyx_t_105 = __pyx_v_i;
+                __pyx_t_106 = __pyx_v_bin1_min;
+                *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_105, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_106, __pyx_pybuffernd_outCount.diminfo[1].strides) += (__pyx_v_deltaA * __pyx_v_deltaD);
 
-                /* "splitBBox.pyx":495
+                /* "splitBBox.pyx":531
  *                     for i in range(bin0_min + 1, bin0_max):
  *                             outCount[i, bin1_min] +=  deltaA * deltaD
  *                             outData[i, bin1_min] +=  data * deltaA * deltaD             # <<<<<<<<<<<<<<
  *                             for j in range(bin1_min + 1, bin1_max):
  *                                 outCount[i, j] +=  deltaA
  */
-                __pyx_t_100 = __pyx_v_i;
-                __pyx_t_101 = __pyx_v_bin1_min;
-                *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_100, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_101, __pyx_pybuffernd_outData.diminfo[1].strides) += ((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaD);
+                __pyx_t_107 = __pyx_v_i;
+                __pyx_t_108 = __pyx_v_bin1_min;
+                *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_107, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_108, __pyx_pybuffernd_outData.diminfo[1].strides) += ((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaD);
 
-                /* "splitBBox.pyx":496
+                /* "splitBBox.pyx":532
  *                             outCount[i, bin1_min] +=  deltaA * deltaD
  *                             outData[i, bin1_min] +=  data * deltaA * deltaD
  *                             for j in range(bin1_min + 1, bin1_max):             # <<<<<<<<<<<<<<
  *                                 outCount[i, j] +=  deltaA
  *                                 outData[i, j] +=  data * deltaA
  */
-                __pyx_t_102 = __pyx_v_bin1_max;
-                for (__pyx_t_103 = (__pyx_v_bin1_min + 1); __pyx_t_103 < __pyx_t_102; __pyx_t_103+=1) {
-                  __pyx_v_j = __pyx_t_103;
+                __pyx_t_109 = __pyx_v_bin1_max;
+                for (__pyx_t_110 = (__pyx_v_bin1_min + 1); __pyx_t_110 < __pyx_t_109; __pyx_t_110+=1) {
+                  __pyx_v_j = __pyx_t_110;
 
-                  /* "splitBBox.pyx":497
+                  /* "splitBBox.pyx":533
  *                             outData[i, bin1_min] +=  data * deltaA * deltaD
  *                             for j in range(bin1_min + 1, bin1_max):
  *                                 outCount[i, j] +=  deltaA             # <<<<<<<<<<<<<<
  *                                 outData[i, j] +=  data * deltaA
  *                             outCount[i, bin1_max] +=  deltaA * deltaU
  */
-                  __pyx_t_104 = __pyx_v_i;
-                  __pyx_t_105 = __pyx_v_j;
-                  *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_104, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_105, __pyx_pybuffernd_outCount.diminfo[1].strides) += __pyx_v_deltaA;
+                  __pyx_t_111 = __pyx_v_i;
+                  __pyx_t_112 = __pyx_v_j;
+                  *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_111, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_112, __pyx_pybuffernd_outCount.diminfo[1].strides) += __pyx_v_deltaA;
 
-                  /* "splitBBox.pyx":498
+                  /* "splitBBox.pyx":534
  *                             for j in range(bin1_min + 1, bin1_max):
  *                                 outCount[i, j] +=  deltaA
  *                                 outData[i, j] +=  data * deltaA             # <<<<<<<<<<<<<<
  *                             outCount[i, bin1_max] +=  deltaA * deltaU
  *                             outData[i, bin1_max] +=  data * deltaA * deltaU
  */
-                  __pyx_t_106 = __pyx_v_i;
-                  __pyx_t_107 = __pyx_v_j;
-                  *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_106, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_107, __pyx_pybuffernd_outData.diminfo[1].strides) += (__pyx_v_data * __pyx_v_deltaA);
+                  __pyx_t_113 = __pyx_v_i;
+                  __pyx_t_114 = __pyx_v_j;
+                  *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_113, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_114, __pyx_pybuffernd_outData.diminfo[1].strides) += (__pyx_v_data * __pyx_v_deltaA);
                 }
 
-                /* "splitBBox.pyx":499
+                /* "splitBBox.pyx":535
  *                                 outCount[i, j] +=  deltaA
  *                                 outData[i, j] +=  data * deltaA
  *                             outCount[i, bin1_max] +=  deltaA * deltaU             # <<<<<<<<<<<<<<
  *                             outData[i, bin1_max] +=  data * deltaA * deltaU
  *                     for j in range(bin1_min + 1, bin1_max):
  */
-                __pyx_t_102 = __pyx_v_i;
-                __pyx_t_103 = __pyx_v_bin1_max;
-                *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_102, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_103, __pyx_pybuffernd_outCount.diminfo[1].strides) += (__pyx_v_deltaA * __pyx_v_deltaU);
+                __pyx_t_109 = __pyx_v_i;
+                __pyx_t_110 = __pyx_v_bin1_max;
+                *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_109, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_110, __pyx_pybuffernd_outCount.diminfo[1].strides) += (__pyx_v_deltaA * __pyx_v_deltaU);
 
-                /* "splitBBox.pyx":500
+                /* "splitBBox.pyx":536
  *                                 outData[i, j] +=  data * deltaA
  *                             outCount[i, bin1_max] +=  deltaA * deltaU
  *                             outData[i, bin1_max] +=  data * deltaA * deltaU             # <<<<<<<<<<<<<<
  *                     for j in range(bin1_min + 1, bin1_max):
  *                             outCount[bin0_min, j] +=  deltaA * deltaL
  */
-                __pyx_t_108 = __pyx_v_i;
-                __pyx_t_109 = __pyx_v_bin1_max;
-                *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_108, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_109, __pyx_pybuffernd_outData.diminfo[1].strides) += ((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaU);
+                __pyx_t_115 = __pyx_v_i;
+                __pyx_t_116 = __pyx_v_bin1_max;
+                *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_115, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_116, __pyx_pybuffernd_outData.diminfo[1].strides) += ((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaU);
               }
 
-              /* "splitBBox.pyx":501
+              /* "splitBBox.pyx":537
  *                             outCount[i, bin1_max] +=  deltaA * deltaU
  *                             outData[i, bin1_max] +=  data * deltaA * deltaU
  *                     for j in range(bin1_min + 1, bin1_max):             # <<<<<<<<<<<<<<
  *                             outCount[bin0_min, j] +=  deltaA * deltaL
  *                             outData[bin0_min, j] +=  data * deltaA * deltaL
  */
-              __pyx_t_96 = __pyx_v_bin1_max;
-              for (__pyx_t_97 = (__pyx_v_bin1_min + 1); __pyx_t_97 < __pyx_t_96; __pyx_t_97+=1) {
-                __pyx_v_j = __pyx_t_97;
+              __pyx_t_103 = __pyx_v_bin1_max;
+              for (__pyx_t_104 = (__pyx_v_bin1_min + 1); __pyx_t_104 < __pyx_t_103; __pyx_t_104+=1) {
+                __pyx_v_j = __pyx_t_104;
 
-                /* "splitBBox.pyx":502
+                /* "splitBBox.pyx":538
  *                             outData[i, bin1_max] +=  data * deltaA * deltaU
  *                     for j in range(bin1_min + 1, bin1_max):
  *                             outCount[bin0_min, j] +=  deltaA * deltaL             # <<<<<<<<<<<<<<
  *                             outData[bin0_min, j] +=  data * deltaA * deltaL
  * 
  */
-                __pyx_t_110 = __pyx_v_bin0_min;
-                __pyx_t_111 = __pyx_v_j;
-                *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_110, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_111, __pyx_pybuffernd_outCount.diminfo[1].strides) += (__pyx_v_deltaA * __pyx_v_deltaL);
+                __pyx_t_117 = __pyx_v_bin0_min;
+                __pyx_t_118 = __pyx_v_j;
+                *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_117, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_118, __pyx_pybuffernd_outCount.diminfo[1].strides) += (__pyx_v_deltaA * __pyx_v_deltaL);
 
-                /* "splitBBox.pyx":503
+                /* "splitBBox.pyx":539
  *                     for j in range(bin1_min + 1, bin1_max):
  *                             outCount[bin0_min, j] +=  deltaA * deltaL
  *                             outData[bin0_min, j] +=  data * deltaA * deltaL             # <<<<<<<<<<<<<<
  * 
  *                             outCount[bin0_max, j] +=  deltaA * deltaR
  */
-                __pyx_t_112 = __pyx_v_bin0_min;
-                __pyx_t_113 = __pyx_v_j;
-                *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_112, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_113, __pyx_pybuffernd_outData.diminfo[1].strides) += ((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaL);
+                __pyx_t_119 = __pyx_v_bin0_min;
+                __pyx_t_120 = __pyx_v_j;
+                *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_119, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_120, __pyx_pybuffernd_outData.diminfo[1].strides) += ((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaL);
 
-                /* "splitBBox.pyx":505
+                /* "splitBBox.pyx":541
  *                             outData[bin0_min, j] +=  data * deltaA * deltaL
  * 
  *                             outCount[bin0_max, j] +=  deltaA * deltaR             # <<<<<<<<<<<<<<
  *                             outData[bin0_max, j] +=  data * deltaA * deltaR
  * 
  */
-                __pyx_t_114 = __pyx_v_bin0_max;
-                __pyx_t_115 = __pyx_v_j;
-                *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_114, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_115, __pyx_pybuffernd_outCount.diminfo[1].strides) += (__pyx_v_deltaA * __pyx_v_deltaR);
+                __pyx_t_121 = __pyx_v_bin0_max;
+                __pyx_t_122 = __pyx_v_j;
+                *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_121, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_122, __pyx_pybuffernd_outCount.diminfo[1].strides) += (__pyx_v_deltaA * __pyx_v_deltaR);
 
-                /* "splitBBox.pyx":506
+                /* "splitBBox.pyx":542
  * 
  *                             outCount[bin0_max, j] +=  deltaA * deltaR
  *                             outData[bin0_max, j] +=  data * deltaA * deltaR             # <<<<<<<<<<<<<<
  * 
  *         for i in range(bins0):
  */
-                __pyx_t_116 = __pyx_v_bin0_max;
-                __pyx_t_117 = __pyx_v_j;
-                *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_116, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_117, __pyx_pybuffernd_outData.diminfo[1].strides) += ((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaR);
+                __pyx_t_123 = __pyx_v_bin0_max;
+                __pyx_t_124 = __pyx_v_j;
+                *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_123, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_124, __pyx_pybuffernd_outData.diminfo[1].strides) += ((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaR);
               }
             }
-            __pyx_L53:;
+            __pyx_L60:;
           }
-          __pyx_L49:;
-          __pyx_L36_continue:;
+          __pyx_L56:;
+          __pyx_L43_continue:;
         }
 
-        /* "splitBBox.pyx":508
+        /* "splitBBox.pyx":544
  *                             outData[bin0_max, j] +=  data * deltaA * deltaR
  * 
  *         for i in range(bins0):             # <<<<<<<<<<<<<<
@@ -7966,117 +8568,119 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
  *                 if outCount[i, j] > epsilon:
  */
         __pyx_t_12 = __pyx_v_bins0;
-        for (__pyx_t_96 = 0; __pyx_t_96 < __pyx_t_12; __pyx_t_96+=1) {
-          __pyx_v_i = __pyx_t_96;
+        for (__pyx_t_103 = 0; __pyx_t_103 < __pyx_t_12; __pyx_t_103+=1) {
+          __pyx_v_i = __pyx_t_103;
 
-          /* "splitBBox.pyx":509
+          /* "splitBBox.pyx":545
  * 
  *         for i in range(bins0):
  *             for j in range(bins1):             # <<<<<<<<<<<<<<
  *                 if outCount[i, j] > epsilon:
  *                     outMerge[i, j] = <float> (outData[i, j] / outCount[i, j])
  */
-          __pyx_t_97 = __pyx_v_bins1;
-          for (__pyx_t_118 = 0; __pyx_t_118 < __pyx_t_97; __pyx_t_118+=1) {
-            __pyx_v_j = __pyx_t_118;
+          __pyx_t_104 = __pyx_v_bins1;
+          for (__pyx_t_125 = 0; __pyx_t_125 < __pyx_t_104; __pyx_t_125+=1) {
+            __pyx_v_j = __pyx_t_125;
 
-            /* "splitBBox.pyx":510
+            /* "splitBBox.pyx":546
  *         for i in range(bins0):
  *             for j in range(bins1):
  *                 if outCount[i, j] > epsilon:             # <<<<<<<<<<<<<<
  *                     outMerge[i, j] = <float> (outData[i, j] / outCount[i, j])
  *                 else:
  */
-            __pyx_t_119 = __pyx_v_i;
-            __pyx_t_120 = __pyx_v_j;
-            __pyx_t_25 = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_119, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_120, __pyx_pybuffernd_outCount.diminfo[1].strides)) > __pyx_v_epsilon);
-            if (__pyx_t_25) {
+            __pyx_t_126 = __pyx_v_i;
+            __pyx_t_127 = __pyx_v_j;
+            __pyx_t_28 = (((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_126, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_127, __pyx_pybuffernd_outCount.diminfo[1].strides)) > __pyx_v_epsilon) != 0);
+            if (__pyx_t_28) {
 
-              /* "splitBBox.pyx":511
+              /* "splitBBox.pyx":547
  *             for j in range(bins1):
  *                 if outCount[i, j] > epsilon:
  *                     outMerge[i, j] = <float> (outData[i, j] / outCount[i, j])             # <<<<<<<<<<<<<<
  *                 else:
  *                     outMerge[i, j] = cdummy
  */
-              __pyx_t_121 = __pyx_v_i;
-              __pyx_t_122 = __pyx_v_j;
-              __pyx_t_123 = __pyx_v_i;
-              __pyx_t_124 = __pyx_v_j;
-              __pyx_t_125 = __pyx_v_i;
-              __pyx_t_126 = __pyx_v_j;
-              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.buf, __pyx_t_125, __pyx_pybuffernd_outMerge.diminfo[0].strides, __pyx_t_126, __pyx_pybuffernd_outMerge.diminfo[1].strides) = ((float)((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_121, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_122, __pyx_pybuffernd_outData.diminfo[1].strides)) / (*__Pyx_BufPtrStrided2d(__py [...]
-              goto __pyx_L66;
+              __pyx_t_128 = __pyx_v_i;
+              __pyx_t_129 = __pyx_v_j;
+              __pyx_t_130 = __pyx_v_i;
+              __pyx_t_131 = __pyx_v_j;
+              __pyx_t_132 = __pyx_v_i;
+              __pyx_t_133 = __pyx_v_j;
+              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.buf, __pyx_t_132, __pyx_pybuffernd_outMerge.diminfo[0].strides, __pyx_t_133, __pyx_pybuffernd_outMerge.diminfo[1].strides) = ((float)((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_128, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_129, __pyx_pybuffernd_outData.diminfo[1].strides)) / (*__Pyx_BufPtrStrided2d(__py [...]
+              goto __pyx_L73;
             }
             /*else*/ {
 
-              /* "splitBBox.pyx":513
+              /* "splitBBox.pyx":549
  *                     outMerge[i, j] = <float> (outData[i, j] / outCount[i, j])
  *                 else:
  *                     outMerge[i, j] = cdummy             # <<<<<<<<<<<<<<
  *     return outMerge.T, edges0, edges1, outData.T, outCount.T
  * 
  */
-              __pyx_t_127 = __pyx_v_i;
-              __pyx_t_128 = __pyx_v_j;
-              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.buf, __pyx_t_127, __pyx_pybuffernd_outMerge.diminfo[0].strides, __pyx_t_128, __pyx_pybuffernd_outMerge.diminfo[1].strides) = __pyx_v_cdummy;
+              __pyx_t_134 = __pyx_v_i;
+              __pyx_t_135 = __pyx_v_j;
+              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.buf, __pyx_t_134, __pyx_pybuffernd_outMerge.diminfo[0].strides, __pyx_t_135, __pyx_pybuffernd_outMerge.diminfo[1].strides) = __pyx_v_cdummy;
             }
-            __pyx_L66:;
+            __pyx_L73:;
           }
         }
       }
 
-      /* "splitBBox.pyx":394
- *     edges0 = numpy.linspace(pos0_min+0.5*delta0, pos0_maxin-0.5*delta0, bins0)
- *     edges1 = numpy.linspace(pos1_min+0.5*delta1, pos1_maxin-0.5*delta1, bins1)
+      /* "splitBBox.pyx":430
+ * 
+ * 
  *     with nogil:             # <<<<<<<<<<<<<<
  *         for idx in range(size):
  *             if (check_mask) and cmask[idx]:
  */
       /*finally:*/ {
         int __pyx_why;
-        __pyx_why = 0; goto __pyx_L35;
-        __pyx_L34: __pyx_why = 4; goto __pyx_L35;
-        __pyx_L35:;
+        __pyx_why = 0; goto __pyx_L42;
+        __pyx_L41: __pyx_why = 4; goto __pyx_L42;
+        __pyx_L42:;
+        #ifdef WITH_THREAD
         Py_BLOCK_THREADS
+        #endif
         switch (__pyx_why) {
           case 4: goto __pyx_L1_error;
         }
       }
   }
 
-  /* "splitBBox.pyx":514
+  /* "splitBBox.pyx":550
  *                 else:
  *                     outMerge[i, j] = cdummy
  *     return outMerge.T, edges0, edges1, outData.T, outCount.T             # <<<<<<<<<<<<<<
  * 
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_outMerge), __pyx_n_s__T); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_outMerge), __pyx_n_s__T); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_9 = PyObject_GetAttr(((PyObject *)__pyx_v_outData), __pyx_n_s__T); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
-  __pyx_t_13 = PyObject_GetAttr(((PyObject *)__pyx_v_outCount), __pyx_n_s__T); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_13);
-  __pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_outData), __pyx_n_s__T); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_outCount), __pyx_n_s__T); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
+  __pyx_t_13 = PyTuple_New(5); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __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);
   __Pyx_INCREF(__pyx_v_edges0);
-  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_edges0);
+  PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_v_edges0);
   __Pyx_GIVEREF(__pyx_v_edges0);
   __Pyx_INCREF(__pyx_v_edges1);
-  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_edges1);
+  PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_v_edges1);
   __Pyx_GIVEREF(__pyx_v_edges1);
-  PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_9);
-  __Pyx_GIVEREF(__pyx_t_9);
-  PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_t_13);
-  __Pyx_GIVEREF(__pyx_t_13);
+  PyTuple_SET_ITEM(__pyx_t_13, 3, __pyx_t_1);
+  __Pyx_GIVEREF(__pyx_t_1);
+  PyTuple_SET_ITEM(__pyx_t_13, 4, __pyx_t_4);
+  __Pyx_GIVEREF(__pyx_t_4);
   __pyx_t_3 = 0;
-  __pyx_t_9 = 0;
-  __pyx_t_13 = 0;
-  __pyx_r = ((PyObject *)__pyx_t_4);
+  __pyx_t_1 = 0;
   __pyx_t_4 = 0;
+  __pyx_r = ((PyObject *)__pyx_t_13);
+  __pyx_t_13 = 0;
   goto __pyx_L0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -8087,8 +8691,8 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
   __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_9);
   __Pyx_XDECREF(__pyx_t_13);
-  __PYX_XDEC_MEMVIEW(&__pyx_t_24, 1);
-  __PYX_XDEC_MEMVIEW(&__pyx_t_28, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_t_27, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_t_30, 1);
   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cdata.rcbuffer->pybuffer);
@@ -8096,6 +8700,8 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos0_lower.rcbuffer->pybuffer);
     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos0_upper.rcbuffer->pybuffer);
     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos1.rcbuffer->pybuffer);
+    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos1_lower.rcbuffer->pybuffer);
+    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos1_upper.rcbuffer->pybuffer);
     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dpos0.rcbuffer->pybuffer);
     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dpos1.rcbuffer->pybuffer);
     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outCount.rcbuffer->pybuffer);
@@ -8111,6 +8717,8 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos0_lower.rcbuffer->pybuffer);
   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos0_upper.rcbuffer->pybuffer);
   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos1.rcbuffer->pybuffer);
+  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos1_lower.rcbuffer->pybuffer);
+  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos1_upper.rcbuffer->pybuffer);
   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dpos0.rcbuffer->pybuffer);
   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dpos1.rcbuffer->pybuffer);
   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outCount.rcbuffer->pybuffer);
@@ -8124,6 +8732,8 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
   __Pyx_XDECREF((PyObject *)__pyx_v_dpos1);
   __Pyx_XDECREF((PyObject *)__pyx_v_cpos0_upper);
   __Pyx_XDECREF((PyObject *)__pyx_v_cpos0_lower);
+  __Pyx_XDECREF((PyObject *)__pyx_v_cpos1_upper);
+  __Pyx_XDECREF((PyObject *)__pyx_v_cpos1_lower);
   __Pyx_XDECREF((PyObject *)__pyx_v_outData);
   __Pyx_XDECREF((PyObject *)__pyx_v_outCount);
   __Pyx_XDECREF((PyObject *)__pyx_v_outMerge);
@@ -8140,8 +8750,8 @@ static PyObject *__pyx_pf_9splitBBox_2histoBBox2d(CYTHON_UNUSED PyObject *__pyx_
 }
 
 /* Python wrapper */
-static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
-static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
+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);
@@ -8196,7 +8806,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  * 
  *             cdef int copy_shape, i, ndim
  */
-  __pyx_t_1 = (__pyx_v_info == NULL);
+  __pyx_t_1 = ((__pyx_v_info == NULL) != 0);
   if (__pyx_t_1) {
     __pyx_r = 0;
     goto __pyx_L0;
@@ -8238,7 +8848,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 copy_shape = 1
  *             else:
  */
-  __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t)));
+  __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":209
@@ -8271,7 +8881,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
  *                 raise ValueError(u"ndarray is not C contiguous")
  */
-  __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS);
+  __pyx_t_1 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":214
@@ -8281,7 +8891,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 raise ValueError(u"ndarray is not C contiguous")
  * 
  */
-    __pyx_t_2 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS));
+    __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS) != 0)) != 0);
     __pyx_t_3 = __pyx_t_2;
   } else {
     __pyx_t_3 = __pyx_t_1;
@@ -8311,7 +8921,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
  *                 raise ValueError(u"ndarray is not Fortran contiguous")
  */
-  __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS);
+  __pyx_t_3 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0);
   if (__pyx_t_3) {
 
     /* "numpy.pxd":218
@@ -8321,7 +8931,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 raise ValueError(u"ndarray is not Fortran contiguous")
  * 
  */
-    __pyx_t_1 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS));
+    __pyx_t_1 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS) != 0)) != 0);
     __pyx_t_2 = __pyx_t_1;
   } else {
     __pyx_t_2 = __pyx_t_3;
@@ -8369,7 +8979,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 # Allocate new buffer for strides and shape info.
  *                 # This is allocated as one block, strides first.
  */
-  if (__pyx_v_copy_shape) {
+  __pyx_t_2 = (__pyx_v_copy_shape != 0);
+  if (__pyx_t_2) {
 
     /* "numpy.pxd":226
  *                 # Allocate new buffer for strides and shape info.
@@ -8467,7 +9078,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  * 
  *             cdef int t
  */
-  __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self));
+  __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0));
 
   /* "numpy.pxd":239
  * 
@@ -8485,8 +9096,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *             cdef list stack
  *             cdef int offset
  */
-  __Pyx_INCREF(((PyObject *)__pyx_v_self->descr));
-  __pyx_v_descr = __pyx_v_self->descr;
+  __pyx_t_4 = ((PyObject *)__pyx_v_self->descr);
+  __Pyx_INCREF(__pyx_t_4);
+  __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4);
+  __pyx_t_4 = 0;
 
   /* "numpy.pxd":244
  *             cdef int offset
@@ -8504,9 +9117,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 # do not call releasebuffer
  *                 info.obj = None
  */
-  __pyx_t_2 = (!__pyx_v_hasfields);
+  __pyx_t_2 = ((!(__pyx_v_hasfields != 0)) != 0);
   if (__pyx_t_2) {
-    __pyx_t_3 = (!__pyx_v_copy_shape);
+    __pyx_t_3 = ((!(__pyx_v_copy_shape != 0)) != 0);
     __pyx_t_1 = __pyx_t_3;
   } else {
     __pyx_t_1 = __pyx_t_2;
@@ -8551,7 +9164,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 t = descr.type_num
  *                 if ((descr.byteorder == c'>' and little_endian) or
  */
-  __pyx_t_1 = (!__pyx_v_hasfields);
+  __pyx_t_1 = ((!(__pyx_v_hasfields != 0)) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":254
@@ -8561,7 +9174,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 if ((descr.byteorder == c'>' and little_endian) or
  *                     (descr.byteorder == c'<' and not little_endian)):
  */
-    __pyx_v_t = __pyx_v_descr->type_num;
+    __pyx_t_5 = __pyx_v_descr->type_num;
+    __pyx_v_t = __pyx_t_5;
 
     /* "numpy.pxd":255
  *             if not hasfields:
@@ -8570,9 +9184,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                     (descr.byteorder == c'<' and not little_endian)):
  *                     raise ValueError(u"Non-native byte order not supported")
  */
-    __pyx_t_1 = (__pyx_v_descr->byteorder == '>');
+    __pyx_t_1 = ((__pyx_v_descr->byteorder == '>') != 0);
     if (__pyx_t_1) {
-      __pyx_t_2 = __pyx_v_little_endian;
+      __pyx_t_2 = (__pyx_v_little_endian != 0);
     } else {
       __pyx_t_2 = __pyx_t_1;
     }
@@ -8585,9 +9199,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                     raise ValueError(u"Non-native byte order not supported")
  *                 if   t == NPY_BYTE:        f = "b"
  */
-      __pyx_t_1 = (__pyx_v_descr->byteorder == '<');
+      __pyx_t_1 = ((__pyx_v_descr->byteorder == '<') != 0);
       if (__pyx_t_1) {
-        __pyx_t_3 = (!__pyx_v_little_endian);
+        __pyx_t_3 = ((!(__pyx_v_little_endian != 0)) != 0);
         __pyx_t_7 = __pyx_t_3;
       } else {
         __pyx_t_7 = __pyx_t_1;
@@ -8614,227 +9228,202 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
     }
     __pyx_L12:;
 
-    /* "numpy.pxd":258
+    /* "numpy.pxd":274
+ *                 elif t == NPY_CDOUBLE:     f = "Zd"
+ *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
+ *                 elif t == NPY_OBJECT:      f = "O"             # <<<<<<<<<<<<<<
+ *                 else:
+ *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
+ */
+    switch (__pyx_v_t) {
+
+      /* "numpy.pxd":258
  *                     (descr.byteorder == c'<' and not little_endian)):
  *                     raise ValueError(u"Non-native byte order not supported")
  *                 if   t == NPY_BYTE:        f = "b"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_UBYTE:       f = "B"
  *                 elif t == NPY_SHORT:       f = "h"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_BYTE);
-    if (__pyx_t_1) {
+      case NPY_BYTE:
       __pyx_v_f = __pyx_k__b;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":259
+      /* "numpy.pxd":259
  *                     raise ValueError(u"Non-native byte order not supported")
  *                 if   t == NPY_BYTE:        f = "b"
  *                 elif t == NPY_UBYTE:       f = "B"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_SHORT:       f = "h"
  *                 elif t == NPY_USHORT:      f = "H"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_UBYTE);
-    if (__pyx_t_1) {
+      case NPY_UBYTE:
       __pyx_v_f = __pyx_k__B;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":260
+      /* "numpy.pxd":260
  *                 if   t == NPY_BYTE:        f = "b"
  *                 elif t == NPY_UBYTE:       f = "B"
  *                 elif t == NPY_SHORT:       f = "h"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_USHORT:      f = "H"
  *                 elif t == NPY_INT:         f = "i"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_SHORT);
-    if (__pyx_t_1) {
+      case NPY_SHORT:
       __pyx_v_f = __pyx_k__h;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":261
+      /* "numpy.pxd":261
  *                 elif t == NPY_UBYTE:       f = "B"
  *                 elif t == NPY_SHORT:       f = "h"
  *                 elif t == NPY_USHORT:      f = "H"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_INT:         f = "i"
  *                 elif t == NPY_UINT:        f = "I"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_USHORT);
-    if (__pyx_t_1) {
+      case NPY_USHORT:
       __pyx_v_f = __pyx_k__H;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":262
+      /* "numpy.pxd":262
  *                 elif t == NPY_SHORT:       f = "h"
  *                 elif t == NPY_USHORT:      f = "H"
  *                 elif t == NPY_INT:         f = "i"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_UINT:        f = "I"
  *                 elif t == NPY_LONG:        f = "l"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_INT);
-    if (__pyx_t_1) {
+      case NPY_INT:
       __pyx_v_f = __pyx_k__i;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":263
+      /* "numpy.pxd":263
  *                 elif t == NPY_USHORT:      f = "H"
  *                 elif t == NPY_INT:         f = "i"
  *                 elif t == NPY_UINT:        f = "I"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_LONG:        f = "l"
  *                 elif t == NPY_ULONG:       f = "L"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_UINT);
-    if (__pyx_t_1) {
+      case NPY_UINT:
       __pyx_v_f = __pyx_k__I;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":264
+      /* "numpy.pxd":264
  *                 elif t == NPY_INT:         f = "i"
  *                 elif t == NPY_UINT:        f = "I"
  *                 elif t == NPY_LONG:        f = "l"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_ULONG:       f = "L"
  *                 elif t == NPY_LONGLONG:    f = "q"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_LONG);
-    if (__pyx_t_1) {
+      case NPY_LONG:
       __pyx_v_f = __pyx_k__l;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":265
+      /* "numpy.pxd":265
  *                 elif t == NPY_UINT:        f = "I"
  *                 elif t == NPY_LONG:        f = "l"
  *                 elif t == NPY_ULONG:       f = "L"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_LONGLONG:    f = "q"
  *                 elif t == NPY_ULONGLONG:   f = "Q"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_ULONG);
-    if (__pyx_t_1) {
+      case NPY_ULONG:
       __pyx_v_f = __pyx_k__L;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":266
+      /* "numpy.pxd":266
  *                 elif t == NPY_LONG:        f = "l"
  *                 elif t == NPY_ULONG:       f = "L"
  *                 elif t == NPY_LONGLONG:    f = "q"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_ULONGLONG:   f = "Q"
  *                 elif t == NPY_FLOAT:       f = "f"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG);
-    if (__pyx_t_1) {
+      case NPY_LONGLONG:
       __pyx_v_f = __pyx_k__q;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":267
+      /* "numpy.pxd":267
  *                 elif t == NPY_ULONG:       f = "L"
  *                 elif t == NPY_LONGLONG:    f = "q"
  *                 elif t == NPY_ULONGLONG:   f = "Q"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_FLOAT:       f = "f"
  *                 elif t == NPY_DOUBLE:      f = "d"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG);
-    if (__pyx_t_1) {
+      case NPY_ULONGLONG:
       __pyx_v_f = __pyx_k__Q;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":268
+      /* "numpy.pxd":268
  *                 elif t == NPY_LONGLONG:    f = "q"
  *                 elif t == NPY_ULONGLONG:   f = "Q"
  *                 elif t == NPY_FLOAT:       f = "f"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_DOUBLE:      f = "d"
  *                 elif t == NPY_LONGDOUBLE:  f = "g"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_FLOAT);
-    if (__pyx_t_1) {
+      case NPY_FLOAT:
       __pyx_v_f = __pyx_k__f;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":269
+      /* "numpy.pxd":269
  *                 elif t == NPY_ULONGLONG:   f = "Q"
  *                 elif t == NPY_FLOAT:       f = "f"
  *                 elif t == NPY_DOUBLE:      f = "d"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_LONGDOUBLE:  f = "g"
  *                 elif t == NPY_CFLOAT:      f = "Zf"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE);
-    if (__pyx_t_1) {
+      case NPY_DOUBLE:
       __pyx_v_f = __pyx_k__d;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":270
+      /* "numpy.pxd":270
  *                 elif t == NPY_FLOAT:       f = "f"
  *                 elif t == NPY_DOUBLE:      f = "d"
  *                 elif t == NPY_LONGDOUBLE:  f = "g"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_CFLOAT:      f = "Zf"
  *                 elif t == NPY_CDOUBLE:     f = "Zd"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE);
-    if (__pyx_t_1) {
+      case NPY_LONGDOUBLE:
       __pyx_v_f = __pyx_k__g;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":271
+      /* "numpy.pxd":271
  *                 elif t == NPY_DOUBLE:      f = "d"
  *                 elif t == NPY_LONGDOUBLE:  f = "g"
  *                 elif t == NPY_CFLOAT:      f = "Zf"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_CDOUBLE:     f = "Zd"
  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT);
-    if (__pyx_t_1) {
+      case NPY_CFLOAT:
       __pyx_v_f = __pyx_k__Zf;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":272
+      /* "numpy.pxd":272
  *                 elif t == NPY_LONGDOUBLE:  f = "g"
  *                 elif t == NPY_CFLOAT:      f = "Zf"
  *                 elif t == NPY_CDOUBLE:     f = "Zd"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
  *                 elif t == NPY_OBJECT:      f = "O"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE);
-    if (__pyx_t_1) {
+      case NPY_CDOUBLE:
       __pyx_v_f = __pyx_k__Zd;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":273
+      /* "numpy.pxd":273
  *                 elif t == NPY_CFLOAT:      f = "Zf"
  *                 elif t == NPY_CDOUBLE:     f = "Zd"
  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_OBJECT:      f = "O"
  *                 else:
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE);
-    if (__pyx_t_1) {
+      case NPY_CLONGDOUBLE:
       __pyx_v_f = __pyx_k__Zg;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":274
+      /* "numpy.pxd":274
  *                 elif t == NPY_CDOUBLE:     f = "Zd"
  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
  *                 elif t == NPY_OBJECT:      f = "O"             # <<<<<<<<<<<<<<
  *                 else:
  *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_OBJECT);
-    if (__pyx_t_1) {
+      case NPY_OBJECT:
       __pyx_v_f = __pyx_k__O;
-      goto __pyx_L13;
-    }
-    /*else*/ {
+      break;
+      default:
 
       /* "numpy.pxd":276
  *                 elif t == NPY_OBJECT:      f = "O"
@@ -8859,8 +9448,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
       {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      break;
     }
-    __pyx_L13:;
 
     /* "numpy.pxd":277
  *                 else:
@@ -8956,8 +9545,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
 }
 
 /* Python wrapper */
-static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
-static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
+static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
+static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
   __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));
@@ -8984,7 +9573,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s
  *                 stdlib.free(info.format)
  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
  */
-  __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self);
+  __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":290
@@ -9006,7 +9595,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s
  *                 stdlib.free(info.strides)
  *                 # info.shape was stored after info.strides in the same block
  */
-  __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t)));
+  __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":292
@@ -9311,8 +9900,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
     #else
     __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     #endif
-    __Pyx_XDECREF(__pyx_v_childname);
-    __pyx_v_childname = __pyx_t_3;
+    __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3);
     __pyx_t_3 = 0;
 
     /* "numpy.pxd":795
@@ -9325,8 +9913,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
     __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_XDECREF(((PyObject *)__pyx_v_fields));
-    __pyx_v_fields = ((PyObject*)__pyx_t_3);
+    __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3));
     __pyx_t_3 = 0;
 
     /* "numpy.pxd":796
@@ -9355,7 +9942,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
       __Pyx_INCREF(__pyx_t_4);
       #else
       __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
       __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_4);
       #endif
     } else if (1) {
       __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -9381,11 +9970,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
       __pyx_L6_unpacking_done:;
     }
     if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_XDECREF(((PyObject *)__pyx_v_child));
-    __pyx_v_child = ((PyArray_Descr *)__pyx_t_3);
+    __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3));
     __pyx_t_3 = 0;
-    __Pyx_XDECREF(__pyx_v_new_offset);
-    __pyx_v_new_offset = __pyx_t_4;
+    __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4);
     __pyx_t_4 = 0;
 
     /* "numpy.pxd":798
@@ -9435,9 +10022,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  *             (child.byteorder == c'<' and not little_endian)):
  *             raise ValueError(u"Non-native byte order not supported")
  */
-    __pyx_t_7 = (__pyx_v_child->byteorder == '>');
+    __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0);
     if (__pyx_t_7) {
-      __pyx_t_8 = __pyx_v_little_endian;
+      __pyx_t_8 = (__pyx_v_little_endian != 0);
     } else {
       __pyx_t_8 = __pyx_t_7;
     }
@@ -9450,9 +10037,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  *             raise ValueError(u"Non-native byte order not supported")
  *             # One could encode it in the format string and have Cython
  */
-      __pyx_t_7 = (__pyx_v_child->byteorder == '<');
+      __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0);
       if (__pyx_t_7) {
-        __pyx_t_9 = (!__pyx_v_little_endian);
+        __pyx_t_9 = ((!(__pyx_v_little_endian != 0)) != 0);
         __pyx_t_10 = __pyx_t_9;
       } else {
         __pyx_t_10 = __pyx_t_7;
@@ -9541,7 +10128,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  *             t = child.type_num
  *             if end - f < 5:
  */
-    __pyx_t_7 = (!PyDataType_HASFIELDS(__pyx_v_child));
+    __pyx_t_7 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0);
     if (__pyx_t_7) {
 
       /* "numpy.pxd":821
@@ -9553,8 +10140,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  */
       __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
-      __Pyx_XDECREF(__pyx_v_t);
-      __pyx_v_t = __pyx_t_3;
+      __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_3);
       __pyx_t_3 = 0;
 
       /* "numpy.pxd":822
@@ -9564,7 +10150,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  *                 raise RuntimeError(u"Format string allocated too short.")
  * 
  */
-      __pyx_t_7 = ((__pyx_v_end - __pyx_v_f) < 5);
+      __pyx_t_7 = (((__pyx_v_end - __pyx_v_f) < 5) != 0);
       if (__pyx_t_7) {
 
         /* "numpy.pxd":823
@@ -9986,6 +10572,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a
   PyObject *__pyx_v_baseptr;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
+  int __pyx_t_2;
   __Pyx_RefNannySetupContext("set_array_base", 0);
 
   /* "numpy.pxd":967
@@ -9996,7 +10583,8 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a
  *      else:
  */
   __pyx_t_1 = (__pyx_v_base == Py_None);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
     /* "numpy.pxd":968
  *      cdef PyObject* baseptr
@@ -10072,7 +10660,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py
  *         return None
  *     else:
  */
-  __pyx_t_1 = (__pyx_v_arr->base == NULL);
+  __pyx_t_1 = ((__pyx_v_arr->base == NULL) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":977
@@ -10117,6 +10705,9 @@ static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, P
   PyObject *__pyx_v_format = 0;
   PyObject *__pyx_v_mode = 0;
   int __pyx_v_allocate_buffer;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
@@ -10236,12 +10827,12 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
   Py_ssize_t __pyx_t_1;
   int __pyx_t_2;
   PyObject *__pyx_t_3 = NULL;
-  PyObject *__pyx_t_4 = NULL;
-  PyObject *__pyx_t_5 = NULL;
-  char *__pyx_t_6;
+  char *__pyx_t_4;
+  int __pyx_t_5;
+  int __pyx_t_6;
   int __pyx_t_7;
-  int __pyx_t_8;
-  int __pyx_t_9;
+  PyObject *__pyx_t_8 = NULL;
+  PyObject *__pyx_t_9 = NULL;
   Py_ssize_t __pyx_t_10;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
@@ -10253,7 +10844,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
   /* "View.MemoryView":120
  *         cdef PyObject **p
  * 
- *         self.ndim = len(shape)             # <<<<<<<<<<<<<<
+ *         self.ndim = <int> len(shape)             # <<<<<<<<<<<<<<
  *         self.itemsize = itemsize
  * 
  */
@@ -10262,11 +10853,11 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   __pyx_t_1 = PyTuple_GET_SIZE(((PyObject *)__pyx_v_shape)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_self->ndim = __pyx_t_1;
+  __pyx_v_self->ndim = ((int)__pyx_t_1);
 
   /* "View.MemoryView":121
  * 
- *         self.ndim = len(shape)
+ *         self.ndim = <int> len(shape)
  *         self.itemsize = itemsize             # <<<<<<<<<<<<<<
  * 
  *         if not self.ndim:
@@ -10280,7 +10871,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             raise ValueError("Empty shape tuple for cython.array")
  * 
  */
-  __pyx_t_2 = (!__pyx_v_self->ndim);
+  __pyx_t_2 = ((!(__pyx_v_self->ndim != 0)) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":124
@@ -10306,7 +10897,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             raise ValueError("itemsize <= 0 for cython.array")
  * 
  */
-  __pyx_t_2 = (__pyx_v_self->itemsize <= 0);
+  __pyx_t_2 = ((__pyx_v_self->itemsize <= 0) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":127
@@ -10332,16 +10923,10 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *         if encode:
  *             format = encode('ASCII')
  */
-  __pyx_t_3 = ((PyObject *)__pyx_n_s__encode);
-  __Pyx_INCREF(__pyx_t_3);
-  __pyx_t_4 = Py_None;
-  __Pyx_INCREF(__pyx_t_4);
-  __pyx_t_5 = __Pyx_GetAttr3(__pyx_v_format, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_v_encode = __pyx_t_5;
-  __pyx_t_5 = 0;
+  __pyx_t_3 = __Pyx_GetAttr3(__pyx_v_format, ((PyObject *)__pyx_n_s__encode), Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_v_encode = __pyx_t_3;
+  __pyx_t_3 = 0;
 
   /* "View.MemoryView":130
  * 
@@ -10360,11 +10945,10 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *         self._format = format
  *         self.format = self._format
  */
-    __pyx_t_5 = PyObject_Call(__pyx_v_encode, ((PyObject *)__pyx_k_tuple_18), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_v_format);
-    __pyx_v_format = __pyx_t_5;
-    __pyx_t_5 = 0;
+    __pyx_t_3 = PyObject_Call(__pyx_v_encode, ((PyObject *)__pyx_k_tuple_18), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_3);
+    __pyx_t_3 = 0;
     goto __pyx_L5;
   }
   __pyx_L5:;
@@ -10390,8 +10974,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  *         self._shape = <Py_ssize_t *> malloc(sizeof(Py_ssize_t)*self.ndim)
  */
-  __pyx_t_6 = PyBytes_AsString(((PyObject *)__pyx_v_self->_format)); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_self->format = __pyx_t_6;
+  __pyx_t_4 = __Pyx_PyObject_AsString(((PyObject *)__pyx_v_self->_format)); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_v_self->format = __pyx_t_4;
 
   /* "View.MemoryView":135
  *         self.format = self._format
@@ -10418,14 +11002,14 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             free(self._shape)
  *             free(self._strides)
  */
-  __pyx_t_2 = (!(__pyx_v_self->_shape != 0));
+  __pyx_t_2 = ((!(__pyx_v_self->_shape != 0)) != 0);
   if (!__pyx_t_2) {
-    __pyx_t_7 = (!(__pyx_v_self->_strides != 0));
-    __pyx_t_8 = __pyx_t_7;
+    __pyx_t_5 = ((!(__pyx_v_self->_strides != 0)) != 0);
+    __pyx_t_6 = __pyx_t_5;
   } else {
-    __pyx_t_8 = __pyx_t_2;
+    __pyx_t_6 = __pyx_t_2;
   }
-  if (__pyx_t_8) {
+  if (__pyx_t_6) {
 
     /* "View.MemoryView":139
  * 
@@ -10452,10 +11036,10 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  * 
  */
-    __pyx_t_5 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_20), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_20), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L6;
   }
@@ -10477,20 +11061,19 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             if dim <= 0:
  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
  */
-  __pyx_t_9 = 0;
-  __pyx_t_5 = ((PyObject *)__pyx_v_shape); __Pyx_INCREF(__pyx_t_5); __pyx_t_1 = 0;
+  __pyx_t_7 = 0;
+  __pyx_t_3 = ((PyObject *)__pyx_v_shape); __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
   for (;;) {
-    if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
+    if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
     #if CYTHON_COMPILING_IN_CPYTHON
-    __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_1); __Pyx_INCREF(__pyx_t_4); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_8); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     #else
-    __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_8 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     #endif
-    __Pyx_XDECREF(__pyx_v_dim);
-    __pyx_v_dim = __pyx_t_4;
-    __pyx_t_4 = 0;
-    __pyx_v_idx = __pyx_t_9;
-    __pyx_t_9 = (__pyx_t_9 + 1);
+    __Pyx_XDECREF_SET(__pyx_v_dim, __pyx_t_8);
+    __pyx_t_8 = 0;
+    __pyx_v_idx = __pyx_t_7;
+    __pyx_t_7 = (__pyx_t_7 + 1);
 
     /* "View.MemoryView":146
  *         idx = 0
@@ -10499,10 +11082,10 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
  * 
  */
-    __pyx_t_4 = PyObject_RichCompare(__pyx_v_dim, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    if (__pyx_t_8) {
+    __pyx_t_8 = PyObject_RichCompare(__pyx_v_dim, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    if (__pyx_t_6) {
 
       /* "View.MemoryView":147
  *         for idx, dim in enumerate(shape):
@@ -10511,29 +11094,29 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  *             self._shape[idx] = dim
  */
-      __pyx_t_4 = PyInt_FromLong(__pyx_v_idx); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
-      __Pyx_GIVEREF(__pyx_t_4);
+      __pyx_t_8 = PyInt_FromLong(__pyx_v_idx); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_8);
+      __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
+      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8);
+      __Pyx_GIVEREF(__pyx_t_8);
       __Pyx_INCREF(__pyx_v_dim);
-      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_dim);
+      PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_dim);
       __Pyx_GIVEREF(__pyx_v_dim);
-      __pyx_t_4 = 0;
-      __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_21), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
-      __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
-      __pyx_t_4 = 0;
-      __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+      __pyx_t_8 = 0;
+      __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_21), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_8));
+      __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
+      __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
+      PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_t_8));
+      __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
+      __pyx_t_8 = 0;
+      __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_8);
+      __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
+      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
+      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
       {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L9;
     }
@@ -10558,7 +11141,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  */
     __pyx_v_idx = (__pyx_v_idx + 1);
   }
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
   /* "View.MemoryView":152
  *             idx += 1
@@ -10568,21 +11151,21 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  */
   __Pyx_INCREF(__pyx_v_mode);
-  __pyx_t_5 = __pyx_v_mode;
-  __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, ((PyObject *)__pyx_n_s__fortran), Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (((int)__pyx_t_8)) {
-    __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, ((PyObject *)__pyx_n_s__c), Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_7 = ((int)__pyx_t_2);
+  __pyx_t_3 = __pyx_v_mode;
+  __pyx_t_8 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__fortran), Py_NE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+  if (((int)__pyx_t_6)) {
+    __pyx_t_8 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__c), Py_NE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    __pyx_t_5 = ((int)__pyx_t_2);
   } else {
-    __pyx_t_7 = ((int)__pyx_t_8);
+    __pyx_t_5 = ((int)__pyx_t_6);
   }
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __pyx_t_8 = __pyx_t_7;
-  if (__pyx_t_8) {
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_6 = (__pyx_t_5 != 0);
+  if (__pyx_t_6) {
 
     /* "View.MemoryView":153
  * 
@@ -10591,18 +11174,18 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  *         cdef char order
  */
-    __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_22), __pyx_v_mode); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
-    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_5));
-    __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
-    __pyx_t_5 = 0;
-    __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_22), __pyx_v_mode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+    __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_8);
+    PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_3));
+    __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
+    __pyx_t_3 = 0;
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
+    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L10;
   }
@@ -10615,10 +11198,10 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             order = 'F'
  *         else:
  */
-  __pyx_t_5 = PyObject_RichCompare(__pyx_v_mode, ((PyObject *)__pyx_n_s__fortran), Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  if (__pyx_t_8) {
+  __pyx_t_3 = PyObject_RichCompare(__pyx_v_mode, ((PyObject *)__pyx_n_s__fortran), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  if (__pyx_t_6) {
 
     /* "View.MemoryView":157
  *         cdef char order
@@ -10659,14 +11242,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *         if decode:
  *             mode = decode('ASCII')
  */
-  __pyx_t_5 = ((PyObject *)__pyx_n_s__decode);
-  __Pyx_INCREF(__pyx_t_5);
-  __pyx_t_4 = Py_None;
-  __Pyx_INCREF(__pyx_t_4);
-  __pyx_t_3 = __Pyx_GetAttr3(__pyx_v_mode, __pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_GetAttr3(__pyx_v_mode, ((PyObject *)__pyx_n_s__decode), Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   __pyx_v_decode = __pyx_t_3;
   __pyx_t_3 = 0;
 
@@ -10677,8 +11254,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             mode = decode('ASCII')
  *         self.mode = mode
  */
-  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_decode); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__pyx_t_8) {
+  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_decode); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__pyx_t_6) {
 
     /* "View.MemoryView":166
  *         decode = getattr(mode, 'decode', None)
@@ -10689,8 +11266,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  */
     __pyx_t_3 = PyObject_Call(__pyx_v_decode, ((PyObject *)__pyx_k_tuple_23), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_v_mode);
-    __pyx_v_mode = __pyx_t_3;
+    __Pyx_DECREF_SET(__pyx_v_mode, __pyx_t_3);
     __pyx_t_3 = 0;
     goto __pyx_L12;
   }
@@ -10727,9 +11303,9 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             self.data = <char *>malloc(self.len)
  */
   __pyx_t_3 = PyObject_RichCompare(__pyx_v_format, ((PyObject *)__pyx_n_b__O), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_v_self->dtype_is_object = __pyx_t_8;
+  __pyx_v_self->dtype_is_object = __pyx_t_6;
 
   /* "View.MemoryView":171
  *         self.free_data = allocate_buffer
@@ -10738,7 +11314,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             self.data = <char *>malloc(self.len)
  *             if not self.data:
  */
-  if (__pyx_v_allocate_buffer) {
+  __pyx_t_6 = (__pyx_v_allocate_buffer != 0);
+  if (__pyx_t_6) {
 
     /* "View.MemoryView":172
  *         self.dtype_is_object = format == b'O'
@@ -10756,8 +11333,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *                 raise MemoryError("unable to allocate array data.")
  * 
  */
-    __pyx_t_8 = (!(__pyx_v_self->data != 0));
-    if (__pyx_t_8) {
+    __pyx_t_6 = ((!(__pyx_v_self->data != 0)) != 0);
+    if (__pyx_t_6) {
 
       /* "View.MemoryView":174
  *             self.data = <char *>malloc(self.len)
@@ -10782,7 +11359,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *                 p = <PyObject **> self.data
  *                 for i in range(self.len / itemsize):
  */
-    if (__pyx_v_self->dtype_is_object) {
+    __pyx_t_6 = (__pyx_v_self->dtype_is_object != 0);
+    if (__pyx_t_6) {
 
       /* "View.MemoryView":177
  * 
@@ -10801,11 +11379,23 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *                     Py_INCREF(Py_None)
  */
       if (unlikely(__pyx_v_itemsize == 0)) {
+        #ifdef WITH_THREAD
+        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+        #endif
         PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero");
+        #ifdef WITH_THREAD
+        PyGILState_Release(__pyx_gilstate_save);
+        #endif
         {__pyx_filename = __pyx_f[2]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       }
       else if (sizeof(Py_ssize_t) == sizeof(long) && unlikely(__pyx_v_itemsize == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) {
+        #ifdef WITH_THREAD
+        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+        #endif
         PyErr_Format(PyExc_OverflowError, "value too large to perform division");
+        #ifdef WITH_THREAD
+        PyGILState_Release(__pyx_gilstate_save);
+        #endif
         {__pyx_filename = __pyx_f[2]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       }
       __pyx_t_1 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_itemsize);
@@ -10841,8 +11431,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_XDECREF(__pyx_t_4);
-  __Pyx_XDECREF(__pyx_t_5);
+  __Pyx_XDECREF(__pyx_t_8);
+  __Pyx_XDECREF(__pyx_t_9);
   __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
@@ -10856,8 +11446,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
 }
 
 /* Python wrapper */
-static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
-static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
+static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
+static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
@@ -10879,8 +11469,12 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
-  PyObject *__pyx_t_2 = NULL;
-  int __pyx_t_3;
+  int __pyx_t_2;
+  PyObject *__pyx_t_3 = NULL;
+  char *__pyx_t_4;
+  Py_ssize_t __pyx_t_5;
+  int __pyx_t_6;
+  Py_ssize_t *__pyx_t_7;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -10907,7 +11501,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         elif self.mode == b"fortran":
  */
   __pyx_t_1 = (__Pyx_PyUnicode_Equals(((PyObject *)__pyx_v_self->mode), ((PyObject *)__pyx_n_b__c), Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":186
  *         cdef int bufmode = -1
@@ -10927,7 +11522,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
  *         if not (flags & bufmode):
  */
-  __pyx_t_1 = (__Pyx_PyUnicode_Equals(((PyObject *)__pyx_v_self->mode), ((PyObject *)__pyx_n_b__fortran), Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = (__Pyx_PyUnicode_Equals(((PyObject *)__pyx_v_self->mode), ((PyObject *)__pyx_n_b__fortran), Py_EQ)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = (__pyx_t_2 != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":188
@@ -10949,7 +11545,7 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
  *         info.buf = self.data
  */
-  __pyx_t_1 = (!(__pyx_v_flags & __pyx_v_bufmode));
+  __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":190
@@ -10959,10 +11555,10 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.buf = self.data
  *         info.len = self.len
  */
-    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_27), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_27), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L4;
   }
@@ -10975,7 +11571,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.len = self.len
  *         info.ndim = self.ndim
  */
-  __pyx_v_info->buf = __pyx_v_self->data;
+  __pyx_t_4 = __pyx_v_self->data;
+  __pyx_v_info->buf = __pyx_t_4;
 
   /* "View.MemoryView":192
  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
@@ -10984,7 +11581,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.ndim = self.ndim
  *         info.shape = self._shape
  */
-  __pyx_v_info->len = __pyx_v_self->len;
+  __pyx_t_5 = __pyx_v_self->len;
+  __pyx_v_info->len = __pyx_t_5;
 
   /* "View.MemoryView":193
  *         info.buf = self.data
@@ -10993,7 +11591,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.shape = self._shape
  *         info.strides = self._strides
  */
-  __pyx_v_info->ndim = __pyx_v_self->ndim;
+  __pyx_t_6 = __pyx_v_self->ndim;
+  __pyx_v_info->ndim = __pyx_t_6;
 
   /* "View.MemoryView":194
  *         info.len = self.len
@@ -11002,7 +11601,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.strides = self._strides
  *         info.suboffsets = NULL
  */
-  __pyx_v_info->shape = __pyx_v_self->_shape;
+  __pyx_t_7 = __pyx_v_self->_shape;
+  __pyx_v_info->shape = __pyx_t_7;
 
   /* "View.MemoryView":195
  *         info.ndim = self.ndim
@@ -11011,7 +11611,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.suboffsets = NULL
  *         info.itemsize = self.itemsize
  */
-  __pyx_v_info->strides = __pyx_v_self->_strides;
+  __pyx_t_7 = __pyx_v_self->_strides;
+  __pyx_v_info->strides = __pyx_t_7;
 
   /* "View.MemoryView":196
  *         info.shape = self._shape
@@ -11029,7 +11630,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.readonly = 0
  * 
  */
-  __pyx_v_info->itemsize = __pyx_v_self->itemsize;
+  __pyx_t_5 = __pyx_v_self->itemsize;
+  __pyx_v_info->itemsize = __pyx_t_5;
 
   /* "View.MemoryView":198
  *         info.suboffsets = NULL
@@ -11047,8 +11649,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *             info.format = self.format
  *         else:
  */
-  __pyx_t_3 = (__pyx_v_flags & PyBUF_FORMAT);
-  if (__pyx_t_3) {
+  __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
+  if (__pyx_t_1) {
 
     /* "View.MemoryView":201
  * 
@@ -11057,7 +11659,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         else:
  *             info.format = NULL
  */
-    __pyx_v_info->format = __pyx_v_self->format;
+    __pyx_t_4 = __pyx_v_self->format;
+    __pyx_v_info->format = __pyx_t_4;
     goto __pyx_L5;
   }
   /*else*/ {
@@ -11089,7 +11692,7 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
   __pyx_r = 0;
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_2);
+  __Pyx_XDECREF(__pyx_t_3);
   __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) {
@@ -11136,7 +11739,7 @@ static void __pyx_array_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *_
  *             self.callback_free_data(self.data)
  *         elif self.free_data:
  */
-  __pyx_t_1 = (__pyx_v_self->callback_free_data != NULL);
+  __pyx_t_1 = ((__pyx_v_self->callback_free_data != NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":211
@@ -11157,7 +11760,8 @@ static void __pyx_array_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *_
  *             if self.dtype_is_object:
  *                 refcount_objects_in_slice(self.data, self._shape,
  */
-  if (__pyx_v_self->free_data) {
+  __pyx_t_1 = (__pyx_v_self->free_data != 0);
+  if (__pyx_t_1) {
 
     /* "View.MemoryView":213
  *             self.callback_free_data(self.data)
@@ -11166,7 +11770,8 @@ static void __pyx_array_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *_
  *                 refcount_objects_in_slice(self.data, self._shape,
  *                                           self._strides, self.ndim, False)
  */
-    if (__pyx_v_self->dtype_is_object) {
+    __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
+    if (__pyx_t_1) {
 
       /* "View.MemoryView":215
  *             if self.dtype_is_object:
@@ -11334,9 +11939,9 @@ static PyObject *__pyx_array_MemoryView_5array_6__getattr__(struct __pyx_array_o
  *     def __getitem__(self, item):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __pyx_r = __pyx_t_2;
@@ -11393,7 +11998,7 @@ static PyObject *__pyx_array_MemoryView_5array_8__getitem__(struct __pyx_array_o
  *     def __setitem__(self, item, value):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (!__pyx_t_2) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
@@ -11450,7 +12055,7 @@ static int __pyx_array_MemoryView_5array_10__setitem__(struct __pyx_array_obj *_
  * 
  * 
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   if (PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -11495,7 +12100,7 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize
  *         result = array(shape, itemsize, format, mode.decode('ASCII'))
  *     else:
  */
-  __pyx_t_1 = (__pyx_v_buf == NULL);
+  __pyx_t_1 = ((__pyx_v_buf == NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":245
@@ -11507,7 +12112,7 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize
  */
     __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_3 = PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_3));
     __pyx_t_4 = ((PyObject *)__Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_4));
@@ -11543,7 +12148,7 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize
  */
     __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_5 = PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_5));
     __pyx_t_3 = ((PyObject *)__Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_3));
@@ -11625,6 +12230,9 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize
 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_name = 0;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
@@ -11781,7 +12389,7 @@ static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment)
  *         aligned_p += alignment - offset
  * 
  */
-  __pyx_t_1 = (__pyx_v_offset > 0);
+  __pyx_t_1 = ((__pyx_v_offset > 0) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":303
@@ -11817,6 +12425,9 @@ static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_ar
   PyObject *__pyx_v_obj = 0;
   int __pyx_v_flags;
   int __pyx_v_dtype_is_object;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
@@ -11934,11 +12545,11 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor
  *             if <PyObject *> self.view.obj == NULL:
  */
   __pyx_t_1 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)((PyObject *)__pyx_memoryview_type)));
-  if (!__pyx_t_1) {
+  if (!(__pyx_t_1 != 0)) {
     __pyx_t_2 = (__pyx_v_obj != Py_None);
-    __pyx_t_3 = __pyx_t_2;
+    __pyx_t_3 = (__pyx_t_2 != 0);
   } else {
-    __pyx_t_3 = __pyx_t_1;
+    __pyx_t_3 = (__pyx_t_1 != 0);
   }
   if (__pyx_t_3) {
 
@@ -11958,7 +12569,7 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor
  *                 (<__pyx_buffer *> &self.view).obj = Py_None
  *                 Py_INCREF(Py_None)
  */
-    __pyx_t_3 = (((PyObject *)__pyx_v_self->view.obj) == NULL);
+    __pyx_t_3 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0);
     if (__pyx_t_3) {
 
       /* "View.MemoryView":329
@@ -12001,7 +12612,7 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor
  *             raise MemoryError
  * 
  */
-  __pyx_t_3 = (__pyx_v_self->lock == NULL);
+  __pyx_t_3 = ((__pyx_v_self->lock == NULL) != 0);
   if (__pyx_t_3) {
 
     /* "View.MemoryView":334
@@ -12023,8 +12634,8 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor
  *             self.dtype_is_object = self.view.format == b'O'
  *         else:
  */
-  __pyx_t_4 = (__pyx_v_flags & PyBUF_FORMAT);
-  if (__pyx_t_4) {
+  __pyx_t_3 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
+  if (__pyx_t_3) {
 
     /* "View.MemoryView":337
  * 
@@ -12033,7 +12644,7 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor
  *         else:
  *             self.dtype_is_object = dtype_is_object
  */
-    __pyx_t_5 = PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_5));
     __pyx_t_6 = PyObject_RichCompare(((PyObject *)__pyx_t_5), ((PyObject *)__pyx_n_b__O), Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
@@ -12105,6 +12716,7 @@ static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) {
 static void __pyx_memoryview_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) {
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
+  int __pyx_t_2;
   __Pyx_RefNannySetupContext("__dealloc__", 0);
 
   /* "View.MemoryView":346
@@ -12115,7 +12727,8 @@ static void __pyx_memoryview_MemoryView_10memoryview_2__dealloc__(struct __pyx_m
  * 
  */
   __pyx_t_1 = (__pyx_v_self->obj != Py_None);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":347
  *     def __dealloc__(memoryview self):
@@ -12136,8 +12749,8 @@ static void __pyx_memoryview_MemoryView_10memoryview_2__dealloc__(struct __pyx_m
  *             PyThread_free_lock(self.lock)
  * 
  */
-  __pyx_t_1 = (__pyx_v_self->lock != NULL);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((__pyx_v_self->lock != NULL) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":350
  * 
@@ -12231,8 +12844,7 @@ static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__py
       }
       __Pyx_GOTREF(__pyx_t_5);
     }
-    __Pyx_XDECREF(__pyx_v_idx);
-    __pyx_v_idx = __pyx_t_5;
+    __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5);
     __pyx_t_5 = 0;
     __pyx_v_dim = __pyx_t_1;
     __pyx_t_1 = (__pyx_t_1 + 1);
@@ -12299,12 +12911,13 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
-  PyObject *__pyx_t_2 = NULL;
+  int __pyx_t_2;
   PyObject *__pyx_t_3 = NULL;
   PyObject *__pyx_t_4 = NULL;
   PyObject *__pyx_t_5 = NULL;
-  PyObject *(*__pyx_t_6)(PyObject *);
-  char *__pyx_t_7;
+  PyObject *__pyx_t_6 = NULL;
+  PyObject *(*__pyx_t_7)(PyObject *);
+  char *__pyx_t_8;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -12318,7 +12931,8 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  * 
  */
   __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":364
  *     def __getitem__(memoryview self, object index):
@@ -12342,10 +12956,10 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  * 
  *         cdef char *itemp
  */
-  __pyx_t_2 = ((PyObject *)_unellipsify(__pyx_v_index, __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  if (likely(PyTuple_CheckExact(__pyx_t_2))) {
-    PyObject* sequence = __pyx_t_2;
+  __pyx_t_3 = ((PyObject *)_unellipsify(__pyx_v_index, __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  if (likely(PyTuple_CheckExact(__pyx_t_3))) {
+    PyObject* sequence = __pyx_t_3;
     #if CYTHON_COMPILING_IN_CPYTHON
     Py_ssize_t size = Py_SIZE(sequence);
     #else
@@ -12357,43 +12971,45 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
       {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     #if CYTHON_COMPILING_IN_CPYTHON
-    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
-    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
-    __Pyx_INCREF(__pyx_t_3);
+    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
+    __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
     __Pyx_INCREF(__pyx_t_4);
+    __Pyx_INCREF(__pyx_t_5);
     #else
-    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
     #endif
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   } else if (1) {
     __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   } else
   {
     Py_ssize_t index = -1;
-    __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
-    index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L4_unpacking_failed;
-    __Pyx_GOTREF(__pyx_t_3);
-    index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed;
+    __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
+    index = 0; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed;
     __Pyx_GOTREF(__pyx_t_4);
-    if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_6 = NULL;
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L4_unpacking_failed;
+    __Pyx_GOTREF(__pyx_t_5);
+    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = NULL;
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
     goto __pyx_L5_unpacking_done;
     __pyx_L4_unpacking_failed:;
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_6 = NULL;
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __pyx_t_7 = NULL;
     if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_L5_unpacking_done:;
   }
-  __pyx_v_have_slices = __pyx_t_3;
-  __pyx_t_3 = 0;
-  __pyx_v_indices = __pyx_t_4;
+  __pyx_v_have_slices = __pyx_t_4;
   __pyx_t_4 = 0;
+  __pyx_v_indices = __pyx_t_5;
+  __pyx_t_5 = 0;
 
   /* "View.MemoryView":369
  * 
@@ -12402,8 +13018,8 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  *             return memview_slice(self, indices)
  *         else:
  */
-  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__pyx_t_1) {
+  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":370
  *         cdef char *itemp
@@ -12413,10 +13029,10 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  *             itemp = self.get_item_pointer(indices)
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_2 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_r = __pyx_t_2;
-    __pyx_t_2 = 0;
+    __pyx_t_3 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_r = __pyx_t_3;
+    __pyx_t_3 = 0;
     goto __pyx_L0;
     goto __pyx_L6;
   }
@@ -12429,8 +13045,8 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  *             return self.convert_item_to_object(itemp)
  * 
  */
-    __pyx_t_7 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_v_itemp = __pyx_t_7;
+    __pyx_t_8 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_8 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_v_itemp = __pyx_t_8;
 
     /* "View.MemoryView":373
  *         else:
@@ -12440,10 +13056,10 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  *     def __setitem__(memoryview self, object index, object value):
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_r = __pyx_t_2;
-    __pyx_t_2 = 0;
+    __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_r = __pyx_t_3;
+    __pyx_t_3 = 0;
     goto __pyx_L0;
   }
   __pyx_L6:;
@@ -12451,10 +13067,10 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_5);
+  __Pyx_XDECREF(__pyx_t_6);
   __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
@@ -12529,7 +13145,9 @@ static int __pyx_memoryview_MemoryView_10memoryview_6__setitem__(struct __pyx_me
     __Pyx_INCREF(__pyx_t_3);
     #else
     __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
     __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
     #endif
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   } else if (1) {
@@ -12558,8 +13176,7 @@ static int __pyx_memoryview_MemoryView_10memoryview_6__setitem__(struct __pyx_me
   }
   __pyx_v_have_slices = __pyx_t_2;
   __pyx_t_2 = 0;
-  __Pyx_DECREF(__pyx_v_index);
-  __pyx_v_index = __pyx_t_3;
+  __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_3);
   __pyx_t_3 = 0;
 
   /* "View.MemoryView":378
@@ -12672,9 +13289,9 @@ static int __pyx_memoryview_MemoryView_10memoryview_6__setitem__(struct __pyx_me
 static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
+  int __pyx_t_1;
   int __pyx_t_2;
-  int __pyx_t_3;
+  PyObject *__pyx_t_3 = NULL;
   PyObject *__pyx_t_4 = NULL;
   PyObject *__pyx_t_5 = NULL;
   PyObject *__pyx_t_6 = NULL;
@@ -12694,12 +13311,9 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
  *             try:
  *                 obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS,
  */
-  __pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryview_type));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = (!__pyx_t_2);
-  if (__pyx_t_3) {
+  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, ((PyObject *)__pyx_memoryview_type)); 
+  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":389
  *     cdef is_slice(self, obj):
@@ -12709,10 +13323,10 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
  *                                  self.dtype_is_object)
  */
     {
-      __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
+      __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
+      __Pyx_XGOTREF(__pyx_t_3);
       __Pyx_XGOTREF(__pyx_t_4);
       __Pyx_XGOTREF(__pyx_t_5);
-      __Pyx_XGOTREF(__pyx_t_6);
       /*try:*/ {
 
         /* "View.MemoryView":390
@@ -12722,8 +13336,8 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
  *                                  self.dtype_is_object)
  *             except TypeError:
  */
-        __pyx_t_1 = PyInt_FromLong((__pyx_v_self->flags | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
-        __Pyx_GOTREF(__pyx_t_1);
+        __pyx_t_6 = PyInt_FromLong((__pyx_v_self->flags | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+        __Pyx_GOTREF(__pyx_t_6);
 
         /* "View.MemoryView":391
  *             try:
@@ -12739,25 +13353,24 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
         __Pyx_INCREF(__pyx_v_obj);
         PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj);
         __Pyx_GIVEREF(__pyx_v_obj);
-        PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_1);
-        __Pyx_GIVEREF(__pyx_t_1);
+        PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
+        __Pyx_GIVEREF(__pyx_t_6);
         PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
         __Pyx_GIVEREF(__pyx_t_7);
-        __pyx_t_1 = 0;
+        __pyx_t_6 = 0;
         __pyx_t_7 = 0;
         __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject *)__pyx_memoryview_type)), ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
         __Pyx_GOTREF(__pyx_t_7);
         __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
-        __Pyx_DECREF(__pyx_v_obj);
-        __pyx_v_obj = __pyx_t_7;
+        __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7);
         __pyx_t_7 = 0;
       }
+      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
       goto __pyx_L11_try_end;
       __pyx_L4_error:;
-      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
       __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
 
@@ -12771,10 +13384,10 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
       __pyx_t_9 = PyErr_ExceptionMatches(__pyx_builtin_TypeError);
       if (__pyx_t_9) {
         __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
-        if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
+        if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
         __Pyx_GOTREF(__pyx_t_7);
         __Pyx_GOTREF(__pyx_t_8);
-        __Pyx_GOTREF(__pyx_t_1);
+        __Pyx_GOTREF(__pyx_t_6);
 
         /* "View.MemoryView":393
  *                                  self.dtype_is_object)
@@ -12786,32 +13399,32 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
         __Pyx_XDECREF(__pyx_r);
         __Pyx_INCREF(Py_None);
         __pyx_r = Py_None;
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
         goto __pyx_L7_except_return;
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
         goto __pyx_L5_exception_handled;
       }
       __pyx_L6_except_error:;
+      __Pyx_XGIVEREF(__pyx_t_3);
       __Pyx_XGIVEREF(__pyx_t_4);
       __Pyx_XGIVEREF(__pyx_t_5);
-      __Pyx_XGIVEREF(__pyx_t_6);
-      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
+      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
       goto __pyx_L1_error;
       __pyx_L7_except_return:;
+      __Pyx_XGIVEREF(__pyx_t_3);
       __Pyx_XGIVEREF(__pyx_t_4);
       __Pyx_XGIVEREF(__pyx_t_5);
-      __Pyx_XGIVEREF(__pyx_t_6);
-      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
+      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
       goto __pyx_L0;
       __pyx_L5_exception_handled:;
+      __Pyx_XGIVEREF(__pyx_t_3);
       __Pyx_XGIVEREF(__pyx_t_4);
       __Pyx_XGIVEREF(__pyx_t_5);
-      __Pyx_XGIVEREF(__pyx_t_6);
-      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
+      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
       __pyx_L11_try_end:;
     }
     goto __pyx_L3;
@@ -12833,7 +13446,7 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_XDECREF(__pyx_t_6);
   __Pyx_XDECREF(__pyx_t_7);
   __Pyx_XDECREF(__pyx_t_8);
   __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -12859,11 +13472,9 @@ static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryvi
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
-  PyObject *__pyx_t_2 = NULL;
-  PyObject *__pyx_t_3 = NULL;
+  int __pyx_t_2;
+  int __pyx_t_3;
   int __pyx_t_4;
-  int __pyx_t_5;
-  int __pyx_t_6;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -12877,8 +13488,6 @@ static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryvi
  *                                  src.ndim, dst.ndim, self.dtype_is_object)
  */
   if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_1 = __pyx_v_src;
-  __Pyx_INCREF(__pyx_t_1);
 
   /* "View.MemoryView":402
  * 
@@ -12888,8 +13497,6 @@ static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryvi
  * 
  */
   if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_2 = __pyx_v_dst;
-  __Pyx_INCREF(__pyx_t_2);
 
   /* "View.MemoryView":403
  *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
@@ -12898,24 +13505,20 @@ static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryvi
  * 
  *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):
  */
-  __pyx_t_3 = PyObject_GetAttr(__pyx_v_src, __pyx_n_s__ndim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = PyObject_GetAttr(__pyx_v_dst, __pyx_n_s__ndim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_6 = __pyx_memoryview_copy_contents((__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_t_1), (&__pyx_v_src_slice))[0]), (__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_t_2), (&__pyx_v_dst_slice))[0]), __pyx_t_4, __pyx_t_5, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s__ndim); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __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_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s__ndim); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_4 = __pyx_memoryview_copy_contents((__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice))[0]), (__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice))[0]), __pyx_t_2, __pyx_t_3, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_XDECREF(__pyx_t_3);
   __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
@@ -12977,7 +13580,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor
  *             tmp = malloc(self.view.itemsize)
  *             if tmp == NULL:
  */
-  __pyx_t_1 = (((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array)));
+  __pyx_t_1 = ((((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":414
@@ -12996,7 +13599,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor
  *                 raise MemoryError
  *             item = tmp
  */
-    __pyx_t_1 = (__pyx_v_tmp == NULL);
+    __pyx_t_1 = ((__pyx_v_tmp == NULL) != 0);
     if (__pyx_t_1) {
 
       /* "View.MemoryView":416
@@ -13041,7 +13644,8 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor
  *             (<PyObject **> item)[0] = <PyObject *> value
  *         else:
  */
-  if (__pyx_v_self->dtype_is_object) {
+  __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
+  if (__pyx_t_1) {
 
     /* "View.MemoryView":422
  * 
@@ -13151,7 +13755,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor
  *             assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
  *         slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
  */
-  __pyx_t_1 = (__pyx_v_self->view.suboffsets != NULL);
+  __pyx_t_1 = ((__pyx_v_self->view.suboffsets != NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":433
@@ -13300,9 +13904,9 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview
  *         try:
  *             result = struct.unpack(self.view.format, bytesitem)
  */
-  __pyx_t_1 = PyBytes_FromStringAndSize(((const char*)__pyx_v_itemp) + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  __pyx_v_bytesitem = __pyx_t_1;
+  __pyx_v_bytesitem = ((PyObject*)__pyx_t_1);
   __pyx_t_1 = 0;
 
   /* "View.MemoryView":449
@@ -13326,9 +13930,9 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview
  *         except struct.error:
  *             raise ValueError("Unable to convert item to object")
  */
-      __pyx_t_1 = PyObject_GetAttr(__pyx_v_struct, __pyx_n_s__unpack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s__unpack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_5 = PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_5));
       __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       __Pyx_GOTREF(__pyx_t_6);
@@ -13355,7 +13959,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview
  *             return result
  */
       __pyx_t_7 = strlen(__pyx_v_self->view.format); 
-      __pyx_t_8 = (__pyx_t_7 == 1);
+      __pyx_t_8 = ((__pyx_t_7 == 1) != 0);
       if (__pyx_t_8) {
 
         /* "View.MemoryView":455
@@ -13366,7 +13970,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview
  * 
  */
         __Pyx_XDECREF(__pyx_r);
-        __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_result, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
+        __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_result, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_5) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
         __Pyx_GOTREF(__pyx_t_5);
         __pyx_r = __pyx_t_5;
         __pyx_t_5 = 0;
@@ -13403,7 +14007,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview
  *             raise ValueError("Unable to convert item to object")
  *         else:
  */
-    __pyx_t_5 = PyObject_GetAttr(__pyx_v_struct, __pyx_n_s__error); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
+    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s__error); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __pyx_t_9 = PyErr_ExceptionMatches(__pyx_t_5);
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
@@ -13486,15 +14090,16 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
   int __pyx_t_2;
-  PyObject *__pyx_t_3 = NULL;
+  int __pyx_t_3;
   PyObject *__pyx_t_4 = NULL;
   PyObject *__pyx_t_5 = NULL;
-  Py_ssize_t __pyx_t_6;
-  PyObject *__pyx_t_7 = NULL;
-  char *__pyx_t_8;
+  PyObject *__pyx_t_6 = NULL;
+  Py_ssize_t __pyx_t_7;
+  PyObject *__pyx_t_8 = NULL;
   char *__pyx_t_9;
   char *__pyx_t_10;
   char *__pyx_t_11;
+  char *__pyx_t_12;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -13519,11 +14124,9 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  *             bytesvalue = struct.pack(self.view.format, *value)
  *         else:
  */
-  __pyx_t_1 = ((PyObject *)((PyObject*)(&PyTuple_Type)));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_value, __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (__pyx_t_2) {
+  __pyx_t_2 = PyTuple_Check(__pyx_v_value); 
+  __pyx_t_3 = (__pyx_t_2 != 0);
+  if (__pyx_t_3) {
 
     /* "View.MemoryView":467
  * 
@@ -13532,28 +14135,28 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  *         else:
  *             bytesvalue = struct.pack(self.view.format, value)
  */
-    __pyx_t_1 = PyObject_GetAttr(__pyx_v_struct, __pyx_n_s__pack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s__pack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_3 = PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
-    __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
-    __pyx_t_3 = 0;
-    __pyx_t_3 = PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-    __pyx_t_5 = PyNumber_Add(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+    __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4));
+    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
+    __pyx_t_4 = 0;
+    __pyx_t_4 = PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+    __pyx_t_6 = PyNumber_Add(((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
+    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-    __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
-    if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_v_bytesvalue = ((PyObject*)__pyx_t_3);
-    __pyx_t_3 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+    if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_4)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
+    __pyx_t_4 = 0;
     goto __pyx_L3;
   }
   /*else*/ {
@@ -13565,25 +14168,25 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  * 
  *         for i, c in enumerate(bytesvalue):
  */
-    __pyx_t_3 = PyObject_GetAttr(__pyx_v_struct, __pyx_n_s__pack); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_5 = PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s__pack); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
     __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_5));
-    __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
+    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_6));
+    __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
     __Pyx_INCREF(__pyx_v_value);
     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_value);
     __Pyx_GIVEREF(__pyx_v_value);
-    __pyx_t_5 = 0;
-    __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __pyx_t_6 = 0;
+    __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-    if (!(likely(PyBytes_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_5)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_v_bytesvalue = ((PyObject*)__pyx_t_5);
-    __pyx_t_5 = 0;
+    if (!(likely(PyBytes_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_6)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_v_bytesvalue = ((PyObject*)__pyx_t_6);
+    __pyx_t_6 = 0;
   }
   __pyx_L3:;
 
@@ -13594,18 +14197,18 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  *             itemp[i] = c
  * 
  */
-  __pyx_t_6 = 0;
+  __pyx_t_7 = 0;
   if (unlikely(((PyObject *)__pyx_v_bytesvalue) == Py_None)) {
     PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   __Pyx_INCREF(((PyObject *)__pyx_v_bytesvalue));
-  __pyx_t_7 = __pyx_v_bytesvalue;
-  __pyx_t_9 = PyBytes_AS_STRING(__pyx_t_7);
-  __pyx_t_10 = (__pyx_t_9 + PyBytes_GET_SIZE(__pyx_t_7));
-  for (__pyx_t_11 = __pyx_t_9; __pyx_t_11 < __pyx_t_10; __pyx_t_11++) {
-    __pyx_t_8 = __pyx_t_11;
-    __pyx_v_c = (__pyx_t_8[0]);
+  __pyx_t_8 = __pyx_v_bytesvalue;
+  __pyx_t_10 = PyBytes_AS_STRING(__pyx_t_8);
+  __pyx_t_11 = (__pyx_t_10 + PyBytes_GET_SIZE(__pyx_t_8));
+  for (__pyx_t_12 = __pyx_t_10; __pyx_t_12 < __pyx_t_11; __pyx_t_12++) {
+    __pyx_t_9 = __pyx_t_12;
+    __pyx_v_c = (__pyx_t_9[0]);
 
     /* "View.MemoryView":472
  * 
@@ -13614,7 +14217,7 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  * 
  *     @cname('getbuffer')
  */
-    __pyx_v_i = __pyx_t_6;
+    __pyx_v_i = __pyx_t_7;
 
     /* "View.MemoryView":471
  *             bytesvalue = struct.pack(self.view.format, value)
@@ -13623,7 +14226,7 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  *             itemp[i] = c
  * 
  */
-    __pyx_t_6 = (__pyx_t_6 + 1);
+    __pyx_t_7 = (__pyx_t_7 + 1);
 
     /* "View.MemoryView":472
  * 
@@ -13634,16 +14237,16 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  */
     (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c;
   }
-  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_5);
-  __Pyx_XDECREF(((PyObject *)__pyx_t_7));
+  __Pyx_XDECREF(__pyx_t_6);
+  __Pyx_XDECREF(((PyObject *)__pyx_t_8));
   __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
@@ -13655,8 +14258,8 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
 }
 
 /* Python wrapper */
-static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
-static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
+static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
+static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
@@ -13677,6 +14280,11 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
+  Py_ssize_t *__pyx_t_2;
+  char *__pyx_t_3;
+  void *__pyx_t_4;
+  int __pyx_t_5;
+  Py_ssize_t __pyx_t_6;
   __Pyx_RefNannySetupContext("__getbuffer__", 0);
   if (__pyx_v_info != NULL) {
     __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
@@ -13690,7 +14298,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *             info.shape = self.view.shape
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_flags & PyBUF_STRIDES);
+  __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":477
@@ -13700,7 +14308,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         else:
  *             info.shape = NULL
  */
-    __pyx_v_info->shape = __pyx_v_self->view.shape;
+    __pyx_t_2 = __pyx_v_self->view.shape;
+    __pyx_v_info->shape = __pyx_t_2;
     goto __pyx_L3;
   }
   /*else*/ {
@@ -13723,7 +14332,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *             info.strides = self.view.strides
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_flags & PyBUF_STRIDES);
+  __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":482
@@ -13733,7 +14342,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         else:
  *             info.strides = NULL
  */
-    __pyx_v_info->strides = __pyx_v_self->view.strides;
+    __pyx_t_2 = __pyx_v_self->view.strides;
+    __pyx_v_info->strides = __pyx_t_2;
     goto __pyx_L4;
   }
   /*else*/ {
@@ -13756,7 +14366,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *             info.suboffsets = self.view.suboffsets
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_flags & PyBUF_INDIRECT);
+  __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":487
@@ -13766,7 +14376,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         else:
  *             info.suboffsets = NULL
  */
-    __pyx_v_info->suboffsets = __pyx_v_self->view.suboffsets;
+    __pyx_t_2 = __pyx_v_self->view.suboffsets;
+    __pyx_v_info->suboffsets = __pyx_t_2;
     goto __pyx_L5;
   }
   /*else*/ {
@@ -13789,7 +14400,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *             info.format = self.view.format
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_flags & PyBUF_FORMAT);
+  __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":492
@@ -13799,7 +14410,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         else:
  *             info.format = NULL
  */
-    __pyx_v_info->format = __pyx_v_self->view.format;
+    __pyx_t_3 = __pyx_v_self->view.format;
+    __pyx_v_info->format = __pyx_t_3;
     goto __pyx_L6;
   }
   /*else*/ {
@@ -13822,7 +14434,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         info.ndim = self.view.ndim
  *         info.itemsize = self.view.itemsize
  */
-  __pyx_v_info->buf = __pyx_v_self->view.buf;
+  __pyx_t_4 = __pyx_v_self->view.buf;
+  __pyx_v_info->buf = __pyx_t_4;
 
   /* "View.MemoryView":497
  * 
@@ -13831,7 +14444,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         info.itemsize = self.view.itemsize
  *         info.len = self.view.len
  */
-  __pyx_v_info->ndim = __pyx_v_self->view.ndim;
+  __pyx_t_5 = __pyx_v_self->view.ndim;
+  __pyx_v_info->ndim = __pyx_t_5;
 
   /* "View.MemoryView":498
  *         info.buf = self.view.buf
@@ -13840,7 +14454,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         info.len = self.view.len
  *         info.readonly = 0
  */
-  __pyx_v_info->itemsize = __pyx_v_self->view.itemsize;
+  __pyx_t_6 = __pyx_v_self->view.itemsize;
+  __pyx_v_info->itemsize = __pyx_t_6;
 
   /* "View.MemoryView":499
  *         info.ndim = self.view.ndim
@@ -13849,7 +14464,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         info.readonly = 0
  *         info.obj = self
  */
-  __pyx_v_info->len = __pyx_v_self->view.len;
+  __pyx_t_6 = __pyx_v_self->view.len;
+  __pyx_v_info->len = __pyx_t_6;
 
   /* "View.MemoryView":500
  *         info.itemsize = self.view.itemsize
@@ -14049,10 +14665,10 @@ static PyObject *__pyx_memoryview_get_shape_MemoryView_10memoryview_5shape___get
     __pyx_v_i = __pyx_t_3;
     __pyx_t_4 = PyInt_FromSsize_t((__pyx_v_self->view.shape[__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    if (unlikely(__Pyx_PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   }
-  __pyx_t_4 = ((PyObject *)PyList_AsTuple(__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = ((PyObject *)PyList_AsTuple(((PyObject*)__pyx_t_1))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_4));
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   __pyx_r = ((PyObject *)__pyx_t_4);
@@ -14112,7 +14728,7 @@ static PyObject *__pyx_memoryview_get_strides_MemoryView_10memoryview_7strides__
  * 
  *                 raise ValueError("Buffer view does not expose strides")
  */
-  __pyx_t_1 = (__pyx_v_self->view.strides == NULL);
+  __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":528
@@ -14146,10 +14762,10 @@ static PyObject *__pyx_memoryview_get_strides_MemoryView_10memoryview_7strides__
     __pyx_v_i = __pyx_t_4;
     __pyx_t_5 = PyInt_FromSsize_t((__pyx_v_self->view.strides[__pyx_v_i])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    if (unlikely(__Pyx_PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
   }
-  __pyx_t_5 = ((PyObject *)PyList_AsTuple(__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = ((PyObject *)PyList_AsTuple(((PyObject*)__pyx_t_2))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_5));
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __pyx_r = ((PyObject *)__pyx_t_5);
@@ -14209,7 +14825,7 @@ static PyObject *__pyx_memoryview_get_suboffsets_MemoryView_10memoryview_10subof
  *                 return [-1] * self.view.ndim
  * 
  */
-  __pyx_t_1 = (__pyx_v_self->view.suboffsets == NULL);
+  __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":536
@@ -14251,10 +14867,10 @@ static PyObject *__pyx_memoryview_get_suboffsets_MemoryView_10memoryview_10subof
     __pyx_v_i = __pyx_t_4;
     __pyx_t_5 = PyInt_FromSsize_t((__pyx_v_self->view.suboffsets[__pyx_v_i])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    if (unlikely(__Pyx_PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
   }
-  __pyx_t_5 = ((PyObject *)PyList_AsTuple(__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = ((PyObject *)PyList_AsTuple(((PyObject*)__pyx_t_2))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_5));
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __pyx_r = ((PyObject *)__pyx_t_5);
@@ -14420,7 +15036,7 @@ static PyObject *__pyx_memoryview_get_nbytes_MemoryView_10memoryview_6nbytes___g
  *     property size:
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
@@ -14471,10 +15087,11 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
-  PyObject *__pyx_t_2 = NULL;
+  int __pyx_t_2;
   PyObject *__pyx_t_3 = NULL;
-  Py_ssize_t __pyx_t_4;
-  PyObject *(*__pyx_t_5)(PyObject *);
+  PyObject *__pyx_t_4 = NULL;
+  Py_ssize_t __pyx_t_5;
+  PyObject *(*__pyx_t_6)(PyObject *);
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -14488,7 +15105,8 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__
  * 
  */
   __pyx_t_1 = (__pyx_v_self->_size == Py_None);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":559
  *         def __get__(self):
@@ -14507,46 +15125,45 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__
  *                     result *= length
  * 
  */
-    __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
-      __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
-      __pyx_t_5 = NULL;
+    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) {
+      __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
+      __pyx_t_6 = NULL;
     } else {
-      __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext;
+      __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_4);
+      __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext;
     }
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     for (;;) {
-      if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_3)) {
-        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
+      if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_4)) {
+        if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
         #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         #else
-        __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         #endif
-      } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_3)) {
-        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
+      } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_4)) {
+        if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
         #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         #else
-        __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         #endif
       } else {
-        __pyx_t_2 = __pyx_t_5(__pyx_t_3);
-        if (unlikely(!__pyx_t_2)) {
+        __pyx_t_3 = __pyx_t_6(__pyx_t_4);
+        if (unlikely(!__pyx_t_3)) {
           if (PyErr_Occurred()) {
             if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
             else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           }
           break;
         }
-        __Pyx_GOTREF(__pyx_t_2);
+        __Pyx_GOTREF(__pyx_t_3);
       }
-      __Pyx_XDECREF(__pyx_v_length);
-      __pyx_v_length = __pyx_t_2;
-      __pyx_t_2 = 0;
+      __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_3);
+      __pyx_t_3 = 0;
 
       /* "View.MemoryView":562
  * 
@@ -14555,13 +15172,12 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__
  * 
  *                 self._size = result
  */
-      __pyx_t_2 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(__pyx_v_result);
-      __pyx_v_result = __pyx_t_2;
-      __pyx_t_2 = 0;
+      __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_3);
+      __pyx_t_3 = 0;
     }
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
     /* "View.MemoryView":564
  *                     result *= length
@@ -14594,8 +15210,8 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
+  __Pyx_XDECREF(__pyx_t_4);
   __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
@@ -14638,7 +15254,7 @@ static Py_ssize_t __pyx_memoryview_MemoryView_10memoryview_10__len__(struct __py
  *             return self.view.shape[0]
  * 
  */
-  __pyx_t_1 = (__pyx_v_self->view.ndim >= 1);
+  __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":570
@@ -14708,12 +15324,12 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_12__repr__(struct __py
  * 
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__base); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__base); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____name__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s____name__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
@@ -14798,12 +15414,12 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_14__str__(struct __pyx
  * 
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__base); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__base); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____name__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s____name__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -15219,30 +15835,26 @@ static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, in
 /* "View.MemoryView":624
  * 
  * @cname('__pyx_memoryview_check')
- * cdef bint memoryview_check(object o):             # <<<<<<<<<<<<<<
+ * cdef inline bint memoryview_check(object o):             # <<<<<<<<<<<<<<
  *     return isinstance(o, memoryview)
  * 
  */
 
-static int __pyx_memoryview_check(PyObject *__pyx_v_o) {
+static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
-  int __pyx_t_2;
+  int __pyx_t_1;
   __Pyx_RefNannySetupContext("memoryview_check", 0);
 
   /* "View.MemoryView":625
  * @cname('__pyx_memoryview_check')
- * cdef bint memoryview_check(object o):
+ * cdef inline bint memoryview_check(object o):
  *     return isinstance(o, memoryview)             # <<<<<<<<<<<<<<
  * 
  * cdef tuple _unellipsify(object index, int ndim):
  */
-  __pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryview_type));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_o, __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_r = __pyx_t_2;
+  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, ((PyObject *)__pyx_memoryview_type)); 
+  __pyx_r = __pyx_t_1;
   goto __pyx_L0;
 
   __pyx_r = 0;
@@ -15269,9 +15881,9 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
   PyObject *__pyx_v_nslices = NULL;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
+  int __pyx_t_1;
   int __pyx_t_2;
-  int __pyx_t_3;
+  PyObject *__pyx_t_3 = NULL;
   PyObject *__pyx_t_4 = NULL;
   Py_ssize_t __pyx_t_5;
   PyObject *(*__pyx_t_6)(PyObject *);
@@ -15293,12 +15905,9 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *         tup = (index,)
  *     else:
  */
-  __pyx_t_1 = ((PyObject *)((PyObject*)(&PyTuple_Type)));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_index, __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = (!__pyx_t_2);
-  if (__pyx_t_3) {
+  __pyx_t_1 = PyTuple_Check(__pyx_v_index); 
+  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":633
  *     """
@@ -15307,13 +15916,13 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *     else:
  *         tup = index
  */
-    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
     __Pyx_INCREF(__pyx_v_index);
-    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_index);
+    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index);
     __Pyx_GIVEREF(__pyx_v_index);
-    __pyx_v_tup = ((PyObject *)__pyx_t_1);
-    __pyx_t_1 = 0;
+    __pyx_v_tup = ((PyObject *)__pyx_t_3);
+    __pyx_t_3 = 0;
     goto __pyx_L3;
   }
   /*else*/ {
@@ -15337,10 +15946,10 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *     have_slices = False
  *     seen_ellipsis = False
  */
-  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_v_result = __pyx_t_1;
-  __pyx_t_1 = 0;
+  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_v_result = ((PyObject*)__pyx_t_3);
+  __pyx_t_3 = 0;
 
   /* "View.MemoryView":638
  * 
@@ -15349,12 +15958,12 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *     seen_ellipsis = False
  *     for idx, item in enumerate(tup):
  */
-  __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_v_have_slices = __pyx_t_1;
-  __pyx_t_1 = 0;
-
-  /* "View.MemoryView":639
+  __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_v_have_slices = __pyx_t_3;
+  __pyx_t_3 = 0;
+
+  /* "View.MemoryView":639
  *     result = []
  *     have_slices = False
  *     seen_ellipsis = False             # <<<<<<<<<<<<<<
@@ -15371,7 +15980,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *             if not seen_ellipsis:
  */
   __Pyx_INCREF(__pyx_int_0);
-  __pyx_t_1 = __pyx_int_0;
+  __pyx_t_3 = __pyx_int_0;
   if (PyList_CheckExact(__pyx_v_tup) || PyTuple_CheckExact(__pyx_v_tup)) {
     __pyx_t_4 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
     __pyx_t_6 = NULL;
@@ -15406,16 +16015,14 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
       }
       __Pyx_GOTREF(__pyx_t_7);
     }
-    __Pyx_XDECREF(__pyx_v_item);
-    __pyx_v_item = __pyx_t_7;
+    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7);
     __pyx_t_7 = 0;
-    __Pyx_INCREF(__pyx_t_1);
-    __Pyx_XDECREF(__pyx_v_idx);
-    __pyx_v_idx = __pyx_t_1;
-    __pyx_t_7 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_INCREF(__pyx_t_3);
+    __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3);
+    __pyx_t_7 = PyNumber_Add(__pyx_t_3, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
-    __Pyx_DECREF(__pyx_t_1);
-    __pyx_t_1 = __pyx_t_7;
+    __Pyx_DECREF(__pyx_t_3);
+    __pyx_t_3 = __pyx_t_7;
     __pyx_t_7 = 0;
 
     /* "View.MemoryView":641
@@ -15425,8 +16032,9 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *             if not seen_ellipsis:
  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
  */
-    __pyx_t_3 = (__pyx_v_item == __pyx_builtin_Ellipsis);
-    if (__pyx_t_3) {
+    __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis);
+    __pyx_t_1 = (__pyx_t_2 != 0);
+    if (__pyx_t_1) {
 
       /* "View.MemoryView":642
  *     for idx, item in enumerate(tup):
@@ -15435,8 +16043,8 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
  *                 seen_ellipsis = True
  */
-      __pyx_t_3 = (!__pyx_v_seen_ellipsis);
-      if (__pyx_t_3) {
+      __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0);
+      if (__pyx_t_1) {
 
         /* "View.MemoryView":643
  *         if item is Ellipsis:
@@ -15445,7 +16053,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *                 seen_ellipsis = True
  *             else:
  */
-        __pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_v_result), __pyx_n_s__extend); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_result), __pyx_n_s__extend); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_7);
         __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_34), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_8);
@@ -15492,7 +16100,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  */
         __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_35), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_10);
-        __pyx_t_11 = PyList_Append(__pyx_v_result, __pyx_t_10); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_10); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
       }
       __pyx_L7:;
@@ -15506,8 +16114,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  */
       __pyx_t_10 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_10);
-      __Pyx_DECREF(__pyx_v_have_slices);
-      __pyx_v_have_slices = __pyx_t_10;
+      __Pyx_DECREF_SET(__pyx_v_have_slices, __pyx_t_10);
       __pyx_t_10 = 0;
       goto __pyx_L6;
     }
@@ -15520,14 +16127,11 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *                 raise TypeError("Cannot index with type '%s'" % type(item))
  * 
  */
-      __pyx_t_10 = ((PyObject *)((PyObject*)(&PySlice_Type)));
-      __Pyx_INCREF(__pyx_t_10);
-      __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_item, __pyx_t_10); 
-      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-      __pyx_t_2 = (!__pyx_t_3);
+      __pyx_t_1 = PySlice_Check(__pyx_v_item); 
+      __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
       if (__pyx_t_2) {
-        __pyx_t_3 = (!PyIndex_Check(__pyx_v_item));
-        __pyx_t_12 = __pyx_t_3;
+        __pyx_t_1 = ((!(__Pyx_PyIndex_Check(__pyx_v_item) != 0)) != 0);
+        __pyx_t_12 = __pyx_t_1;
       } else {
         __pyx_t_12 = __pyx_t_2;
       }
@@ -15566,10 +16170,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  */
       __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       if (!__pyx_t_12) {
-        __pyx_t_10 = ((PyObject *)((PyObject*)(&PySlice_Type)));
-        __Pyx_INCREF(__pyx_t_10);
-        __pyx_t_12 = __Pyx_TypeCheck(__pyx_v_item, __pyx_t_10); 
-        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+        __pyx_t_12 = PySlice_Check(__pyx_v_item); 
         __pyx_t_10 = __Pyx_PyBool_FromLong(__pyx_t_12); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_10);
         __pyx_t_8 = __pyx_t_10;
@@ -15578,8 +16179,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
         __Pyx_INCREF(__pyx_v_have_slices);
         __pyx_t_8 = __pyx_v_have_slices;
       }
-      __Pyx_DECREF(__pyx_v_have_slices);
-      __pyx_v_have_slices = __pyx_t_8;
+      __Pyx_DECREF_SET(__pyx_v_have_slices, __pyx_t_8);
       __pyx_t_8 = 0;
 
       /* "View.MemoryView":653
@@ -15589,12 +16189,12 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  * 
  *     nslices = ndim - len(result)
  */
-      __pyx_t_11 = PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     __pyx_L6:;
   }
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
   /* "View.MemoryView":655
  *             result.append(item)
@@ -15604,10 +16204,10 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *         result.extend([slice(None)] * nslices)
  */
   __pyx_t_5 = PyList_GET_SIZE(((PyObject *)__pyx_v_result)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_1 = PyInt_FromSsize_t((__pyx_v_ndim - __pyx_t_5)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_v_nslices = __pyx_t_1;
-  __pyx_t_1 = 0;
+  __pyx_t_3 = PyInt_FromSsize_t((__pyx_v_ndim - __pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_v_nslices = __pyx_t_3;
+  __pyx_t_3 = 0;
 
   /* "View.MemoryView":656
  * 
@@ -15626,8 +16226,8 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  * 
  *     return have_slices or nslices, tuple(result)
  */
-    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_result), __pyx_n_s__extend); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_result), __pyx_n_s__extend); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
     __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_37), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -15645,9 +16245,9 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
     PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
     __pyx_t_8 = 0;
-    __pyx_t_8 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_8 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_8);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
     goto __pyx_L9;
@@ -15672,22 +16272,22 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
   }
   __pyx_t_4 = ((PyObject *)PyList_AsTuple(__pyx_v_result)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8);
+  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_8);
   __Pyx_GIVEREF(__pyx_t_8);
-  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_t_4));
+  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_t_4));
   __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
   __pyx_t_8 = 0;
   __pyx_t_4 = 0;
-  __pyx_r = __pyx_t_1;
-  __pyx_t_1 = 0;
+  __pyx_r = ((PyObject*)__pyx_t_3);
+  __pyx_t_3 = 0;
   goto __pyx_L0;
 
   __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_7);
   __Pyx_XDECREF(__pyx_t_8);
@@ -15745,7 +16345,7 @@ static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __
  *             raise ValueError("Indirect dimensions not supported")
  * 
  */
-    __pyx_t_3 = ((__pyx_v_suboffsets[__pyx_v_i]) >= 0);
+    __pyx_t_3 = (((__pyx_v_suboffsets[__pyx_v_i]) >= 0) != 0);
     if (__pyx_t_3) {
 
       /* "View.MemoryView":665
@@ -15804,15 +16404,18 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
   PyObject *__pyx_v_index = NULL;
   struct __pyx_memoryview_obj *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
+  int __pyx_t_1;
   int __pyx_t_2;
-  int __pyx_t_3;
-  Py_ssize_t __pyx_t_4;
-  PyObject *(*__pyx_t_5)(PyObject *);
+  struct __pyx_memoryview_obj *__pyx_t_3;
+  char *__pyx_t_4;
+  int __pyx_t_5;
   PyObject *__pyx_t_6 = NULL;
-  int __pyx_t_7;
-  Py_ssize_t __pyx_t_8;
+  Py_ssize_t __pyx_t_7;
+  PyObject *(*__pyx_t_8)(PyObject *);
   PyObject *__pyx_t_9 = NULL;
+  Py_ssize_t __pyx_t_10;
+  int __pyx_t_11;
+  PyObject *__pyx_t_12 = NULL;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -15845,7 +16448,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *     if isinstance(memview, _memoryviewslice):
  */
   #ifndef CYTHON_WITHOUT_ASSERTIONS
-  if (unlikely(!(__pyx_v_memview->view.ndim > 0))) {
+  if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) {
     PyErr_SetNone(PyExc_AssertionError);
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
@@ -15858,10 +16461,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *         memviewsliceobj = memview
  *         p_src = &memviewsliceobj.from_slice
  */
-  __pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryviewslice_type));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), ((PyObject *)__pyx_memoryviewslice_type)); 
+  __pyx_t_2 = (__pyx_t_1 != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":687
@@ -15914,7 +16515,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *     dst.data = p_src.data
  * 
  */
-  __pyx_v_dst.memview = __pyx_v_p_src->memview;
+  __pyx_t_3 = __pyx_v_p_src->memview;
+  __pyx_v_dst.memview = __pyx_t_3;
 
   /* "View.MemoryView":698
  * 
@@ -15923,7 +16525,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  * 
  * 
  */
-  __pyx_v_dst.data = __pyx_v_p_src->data;
+  __pyx_t_4 = __pyx_v_p_src->data;
+  __pyx_v_dst.data = __pyx_t_4;
 
   /* "View.MemoryView":703
  * 
@@ -15950,46 +16553,45 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *         if PyIndex_Check(index):
  *             slice_memviewslice(
  */
-  __pyx_t_3 = 0;
+  __pyx_t_5 = 0;
   if (PyList_CheckExact(__pyx_v_indices) || PyTuple_CheckExact(__pyx_v_indices)) {
-    __pyx_t_1 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0;
-    __pyx_t_5 = NULL;
+    __pyx_t_6 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_6); __pyx_t_7 = 0;
+    __pyx_t_8 = NULL;
   } else {
-    __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext;
+    __pyx_t_7 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __pyx_t_8 = Py_TYPE(__pyx_t_6)->tp_iternext;
   }
   for (;;) {
-    if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_1)) {
-      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
+    if (!__pyx_t_8 && PyList_CheckExact(__pyx_t_6)) {
+      if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_6)) break;
       #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       #else
-      __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       #endif
-    } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_1)) {
-      if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+    } else if (!__pyx_t_8 && PyTuple_CheckExact(__pyx_t_6)) {
+      if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
       #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       #else
-      __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       #endif
     } else {
-      __pyx_t_6 = __pyx_t_5(__pyx_t_1);
-      if (unlikely(!__pyx_t_6)) {
+      __pyx_t_9 = __pyx_t_8(__pyx_t_6);
+      if (unlikely(!__pyx_t_9)) {
         if (PyErr_Occurred()) {
           if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
           else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         }
         break;
       }
-      __Pyx_GOTREF(__pyx_t_6);
+      __Pyx_GOTREF(__pyx_t_9);
     }
-    __Pyx_XDECREF(__pyx_v_index);
-    __pyx_v_index = __pyx_t_6;
-    __pyx_t_6 = 0;
-    __pyx_v_dim = __pyx_t_3;
-    __pyx_t_3 = (__pyx_t_3 + 1);
+    __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9);
+    __pyx_t_9 = 0;
+    __pyx_v_dim = __pyx_t_5;
+    __pyx_t_5 = (__pyx_t_5 + 1);
 
     /* "View.MemoryView":709
  * 
@@ -15998,8 +16600,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             slice_memviewslice(
  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
  */
-    __pyx_t_7 = PyIndex_Check(__pyx_v_index);
-    if (__pyx_t_7) {
+    __pyx_t_2 = (__Pyx_PyIndex_Check(__pyx_v_index) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":713
  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
@@ -16008,7 +16610,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *                 0, 0, 0, # have_{start,stop,step}
  *                 False)
  */
-      __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
       /* "View.MemoryView":715
  *                 index, 0, 0, # start, stop, step
@@ -16017,7 +16619,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *         elif index is None:
  *             p_dst.shape[new_ndim] = 1
  */
-      __pyx_t_7 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_8, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_10, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L6;
     }
 
@@ -16029,7 +16631,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             p_dst.strides[new_ndim] = 0
  */
     __pyx_t_2 = (__pyx_v_index == Py_None);
-    if (__pyx_t_2) {
+    __pyx_t_1 = (__pyx_t_2 != 0);
+    if (__pyx_t_1) {
 
       /* "View.MemoryView":717
  *                 False)
@@ -16077,20 +16680,20 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             stop = index.stop or 0
  *             step = index.step or 0
  */
-      __pyx_t_6 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_6);
-      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      if (!__pyx_t_2) {
-        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
+      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      if (!__pyx_t_1) {
+        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
         __Pyx_INCREF(__pyx_int_0);
-        __pyx_t_9 = __pyx_int_0;
+        __pyx_t_12 = __pyx_int_0;
       } else {
-        __pyx_t_9 = __pyx_t_6;
-        __pyx_t_6 = 0;
+        __pyx_t_12 = __pyx_t_9;
+        __pyx_t_9 = 0;
       }
-      __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_v_start = __pyx_t_8;
+      __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_12); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+      __pyx_v_start = __pyx_t_10;
 
       /* "View.MemoryView":723
  *         else:
@@ -16099,20 +16702,20 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             step = index.step or 0
  * 
  */
-      __pyx_t_9 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__stop); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      if (!__pyx_t_2) {
-        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__stop); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_12);
+      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      if (!__pyx_t_1) {
+        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
         __Pyx_INCREF(__pyx_int_0);
-        __pyx_t_6 = __pyx_int_0;
+        __pyx_t_9 = __pyx_int_0;
       } else {
-        __pyx_t_6 = __pyx_t_9;
-        __pyx_t_9 = 0;
+        __pyx_t_9 = __pyx_t_12;
+        __pyx_t_12 = 0;
       }
-      __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-      __pyx_v_stop = __pyx_t_8;
+      __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_v_stop = __pyx_t_10;
 
       /* "View.MemoryView":724
  *             start = index.start or 0
@@ -16121,20 +16724,20 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  * 
  *             have_start = index.start is not None
  */
-      __pyx_t_6 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_6);
-      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      if (!__pyx_t_2) {
-        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
+      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      if (!__pyx_t_1) {
+        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
         __Pyx_INCREF(__pyx_int_0);
-        __pyx_t_9 = __pyx_int_0;
+        __pyx_t_12 = __pyx_int_0;
       } else {
-        __pyx_t_9 = __pyx_t_6;
-        __pyx_t_6 = 0;
+        __pyx_t_12 = __pyx_t_9;
+        __pyx_t_9 = 0;
       }
-      __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_v_step = __pyx_t_8;
+      __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_12); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+      __pyx_v_step = __pyx_t_10;
 
       /* "View.MemoryView":726
  *             step = index.step or 0
@@ -16143,11 +16746,11 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             have_stop = index.stop is not None
  *             have_step = index.step is not None
  */
-      __pyx_t_9 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_2 = (__pyx_t_9 != Py_None);
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_v_have_start = __pyx_t_2;
+      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_12);
+      __pyx_t_1 = (__pyx_t_12 != Py_None);
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+      __pyx_v_have_start = __pyx_t_1;
 
       /* "View.MemoryView":727
  * 
@@ -16156,11 +16759,11 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             have_step = index.step is not None
  * 
  */
-      __pyx_t_9 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__stop); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_2 = (__pyx_t_9 != Py_None);
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_v_have_stop = __pyx_t_2;
+      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__stop); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_12);
+      __pyx_t_1 = (__pyx_t_12 != Py_None);
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+      __pyx_v_have_stop = __pyx_t_1;
 
       /* "View.MemoryView":728
  *             have_start = index.start is not None
@@ -16169,11 +16772,11 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  * 
  *             slice_memviewslice(
  */
-      __pyx_t_9 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_2 = (__pyx_t_9 != Py_None);
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_v_have_step = __pyx_t_2;
+      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_12);
+      __pyx_t_1 = (__pyx_t_12 != Py_None);
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+      __pyx_v_have_step = __pyx_t_1;
 
       /* "View.MemoryView":735
  *                 start, stop, step,
@@ -16182,7 +16785,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             new_ndim += 1
  * 
  */
-      __pyx_t_7 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
       /* "View.MemoryView":736
  *                 have_start, have_stop, have_step,
@@ -16195,7 +16798,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
     }
     __pyx_L6:;
   }
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
 
   /* "View.MemoryView":738
  *             new_ndim += 1
@@ -16204,10 +16807,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *         return memoryview_fromslice(dst, new_ndim,
  *                                     memviewsliceobj.to_object_func,
  */
-  __pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryviewslice_type));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), ((PyObject *)__pyx_memoryviewslice_type)); 
+  __pyx_t_2 = (__pyx_t_1 != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":739
@@ -16235,11 +16836,11 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *     else:
  *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,
  */
-    __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_1);
-    __pyx_t_1 = 0;
+    __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_6);
+    __pyx_t_6 = 0;
     goto __pyx_L0;
     goto __pyx_L7;
   }
@@ -16261,11 +16862,11 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  * 
  * 
  */
-    __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_1);
-    __pyx_t_1 = 0;
+    __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_6);
+    __pyx_t_6 = 0;
     goto __pyx_L0;
   }
   __pyx_L7:;
@@ -16273,9 +16874,9 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
   __pyx_r = ((struct __pyx_memoryview_obj *)Py_None); __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_6);
   __Pyx_XDECREF(__pyx_t_9);
+  __Pyx_XDECREF(__pyx_t_12);
   __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
@@ -16302,7 +16903,6 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
   int __pyx_t_2;
   int __pyx_t_3;
   int __pyx_t_4;
-  Py_ssize_t __pyx_t_5;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -16314,7 +16914,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  * 
  *         if start < 0:
  */
-  __pyx_t_1 = (!__pyx_v_is_slice);
+  __pyx_t_1 = ((!(__pyx_v_is_slice != 0)) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":791
@@ -16324,7 +16924,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             start += shape
  *         if not 0 <= start < shape:
  */
-    __pyx_t_1 = (__pyx_v_start < 0);
+    __pyx_t_1 = ((__pyx_v_start < 0) != 0);
     if (__pyx_t_1) {
 
       /* "View.MemoryView":792
@@ -16350,7 +16950,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
     if (__pyx_t_1) {
       __pyx_t_1 = (__pyx_v_start < __pyx_v_shape);
     }
-    __pyx_t_2 = (!__pyx_t_1);
+    __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":794
@@ -16391,11 +16991,11 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
  * 
  */
-    if (__pyx_v_have_step) {
+    if ((__pyx_v_have_step != 0)) {
       __pyx_t_4 = (__pyx_v_step == 0);
       __pyx_t_2 = __pyx_t_4;
     } else {
-      __pyx_t_2 = __pyx_v_have_step;
+      __pyx_t_2 = (__pyx_v_have_step != 0);
     }
     if (__pyx_t_2) {
 
@@ -16418,7 +17018,8 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             if start < 0:
  *                 start += shape
  */
-    if (__pyx_v_have_start) {
+    __pyx_t_2 = (__pyx_v_have_start != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":804
  * 
@@ -16427,7 +17028,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 start += shape
  *                 if start < 0:
  */
-      __pyx_t_2 = (__pyx_v_start < 0);
+      __pyx_t_2 = ((__pyx_v_start < 0) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":805
@@ -16446,7 +17047,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                     start = 0
  *             elif start >= shape:
  */
-        __pyx_t_2 = (__pyx_v_start < 0);
+        __pyx_t_2 = ((__pyx_v_start < 0) != 0);
         if (__pyx_t_2) {
 
           /* "View.MemoryView":807
@@ -16470,7 +17071,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 if negative_step:
  *                     start = shape - 1
  */
-      __pyx_t_2 = (__pyx_v_start >= __pyx_v_shape);
+      __pyx_t_2 = ((__pyx_v_start >= __pyx_v_shape) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":809
@@ -16480,7 +17081,8 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                     start = shape - 1
  *                 else:
  */
-        if (__pyx_v_negative_step) {
+        __pyx_t_2 = (__pyx_v_negative_step != 0);
+        if (__pyx_t_2) {
 
           /* "View.MemoryView":810
  *             elif start >= shape:
@@ -16518,7 +17120,8 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 start = shape - 1
  *             else:
  */
-      if (__pyx_v_negative_step) {
+      __pyx_t_2 = (__pyx_v_negative_step != 0);
+      if (__pyx_t_2) {
 
         /* "View.MemoryView":815
  *         else:
@@ -16552,7 +17155,8 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             if stop < 0:
  *                 stop += shape
  */
-    if (__pyx_v_have_stop) {
+    __pyx_t_2 = (__pyx_v_have_stop != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":820
  * 
@@ -16561,7 +17165,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 stop += shape
  *                 if stop < 0:
  */
-      __pyx_t_2 = (__pyx_v_stop < 0);
+      __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":821
@@ -16580,7 +17184,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                     stop = 0
  *             elif stop > shape:
  */
-        __pyx_t_2 = (__pyx_v_stop < 0);
+        __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
         if (__pyx_t_2) {
 
           /* "View.MemoryView":823
@@ -16604,7 +17208,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 stop = shape
  *         else:
  */
-      __pyx_t_2 = (__pyx_v_stop > __pyx_v_shape);
+      __pyx_t_2 = ((__pyx_v_stop > __pyx_v_shape) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":825
@@ -16629,7 +17233,8 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 stop = -1
  *             else:
  */
-      if (__pyx_v_negative_step) {
+      __pyx_t_2 = (__pyx_v_negative_step != 0);
+      if (__pyx_t_2) {
 
         /* "View.MemoryView":828
  *         else:
@@ -16663,7 +17268,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             step = 1
  * 
  */
-    __pyx_t_2 = (!__pyx_v_have_step);
+    __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":833
@@ -16683,23 +17288,23 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *         with cython.cdivision(True):
  *             new_shape = (stop - start) // step             # <<<<<<<<<<<<<<
  * 
- *             if (stop - start) % step:
+ *             if (stop - start) - step * new_shape:
  */
     __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step);
 
     /* "View.MemoryView":839
  *             new_shape = (stop - start) // step
  * 
- *             if (stop - start) % step:             # <<<<<<<<<<<<<<
+ *             if (stop - start) - step * new_shape:             # <<<<<<<<<<<<<<
  *                 new_shape += 1
  * 
  */
-    __pyx_t_5 = ((__pyx_v_stop - __pyx_v_start) % __pyx_v_step);
-    if (__pyx_t_5) {
+    __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":840
  * 
- *             if (stop - start) % step:
+ *             if (stop - start) - step * new_shape:
  *                 new_shape += 1             # <<<<<<<<<<<<<<
  * 
  *         if new_shape < 0:
@@ -16716,7 +17321,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             new_shape = 0
  * 
  */
-    __pyx_t_2 = (__pyx_v_new_shape < 0);
+    __pyx_t_2 = ((__pyx_v_new_shape < 0) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":843
@@ -16767,7 +17372,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *         dst.data += start * stride
  *     else:
  */
-  __pyx_t_2 = ((__pyx_v_suboffset_dim[0]) < 0);
+  __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":852
@@ -16801,7 +17406,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *         if not is_slice:
  *             if new_ndim == 0:
  */
-  __pyx_t_2 = (__pyx_v_suboffset >= 0);
+  __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":857
@@ -16811,7 +17416,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             if new_ndim == 0:
  *                 dst.data = (<char **> dst.data)[0] + suboffset
  */
-    __pyx_t_2 = (!__pyx_v_is_slice);
+    __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":858
@@ -16821,7 +17426,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 dst.data = (<char **> dst.data)[0] + suboffset
  *             else:
  */
-      __pyx_t_2 = (__pyx_v_new_ndim == 0);
+      __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":859
@@ -16895,11 +17500,11 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  * 
  * @cname('__pyx_pybuffer_index')
  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,             # <<<<<<<<<<<<<<
- *                           int dim) except NULL:
+ *                           Py_ssize_t dim) except NULL:
  *     cdef Py_ssize_t shape, stride, suboffset = -1
  */
 
-static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, int __pyx_v_dim) {
+static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) {
   Py_ssize_t __pyx_v_shape;
   Py_ssize_t __pyx_v_stride;
   Py_ssize_t __pyx_v_suboffset;
@@ -16907,9 +17512,10 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
   char *__pyx_v_resultp;
   char *__pyx_r;
   __Pyx_RefNannyDeclarations
-  int __pyx_t_1;
-  PyObject *__pyx_t_2 = NULL;
+  Py_ssize_t __pyx_t_1;
+  int __pyx_t_2;
   PyObject *__pyx_t_3 = NULL;
+  PyObject *__pyx_t_4 = NULL;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -16917,7 +17523,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
 
   /* "View.MemoryView":874
  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,
- *                           int dim) except NULL:
+ *                           Py_ssize_t dim) except NULL:
  *     cdef Py_ssize_t shape, stride, suboffset = -1             # <<<<<<<<<<<<<<
  *     cdef Py_ssize_t itemsize = view.itemsize
  *     cdef char *resultp
@@ -16925,13 +17531,14 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
   __pyx_v_suboffset = -1;
 
   /* "View.MemoryView":875
- *                           int dim) except NULL:
+ *                           Py_ssize_t dim) except NULL:
  *     cdef Py_ssize_t shape, stride, suboffset = -1
  *     cdef Py_ssize_t itemsize = view.itemsize             # <<<<<<<<<<<<<<
  *     cdef char *resultp
  * 
  */
-  __pyx_v_itemsize = __pyx_v_view->itemsize;
+  __pyx_t_1 = __pyx_v_view->itemsize;
+  __pyx_v_itemsize = __pyx_t_1;
 
   /* "View.MemoryView":878
  *     cdef char *resultp
@@ -16940,8 +17547,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *         shape = view.len / itemsize
  *         stride = itemsize
  */
-  __pyx_t_1 = (__pyx_v_view->ndim == 0);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":879
  * 
@@ -16951,11 +17558,23 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *     else:
  */
     if (unlikely(__pyx_v_itemsize == 0)) {
+      #ifdef WITH_THREAD
+      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+      #endif
       PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero");
+      #ifdef WITH_THREAD
+      PyGILState_Release(__pyx_gilstate_save);
+      #endif
       {__pyx_filename = __pyx_f[2]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     else if (sizeof(Py_ssize_t) == sizeof(long) && unlikely(__pyx_v_itemsize == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) {
+      #ifdef WITH_THREAD
+      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+      #endif
       PyErr_Format(PyExc_OverflowError, "value too large to perform division");
+      #ifdef WITH_THREAD
+      PyGILState_Release(__pyx_gilstate_save);
+      #endif
       {__pyx_filename = __pyx_f[2]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize);
@@ -16997,8 +17616,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *             suboffset = view.suboffsets[dim]
  * 
  */
-    __pyx_t_1 = (__pyx_v_view->suboffsets != NULL);
-    if (__pyx_t_1) {
+    __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":885
  *         stride = view.strides[dim]
@@ -17021,8 +17640,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *         index += view.shape[dim]
  *         if index < 0:
  */
-  __pyx_t_1 = (__pyx_v_index < 0);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((__pyx_v_index < 0) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":888
  * 
@@ -17040,8 +17659,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
  * 
  */
-    __pyx_t_1 = (__pyx_v_index < 0);
-    if (__pyx_t_1) {
+    __pyx_t_2 = ((__pyx_v_index < 0) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":890
  *         index += view.shape[dim]
@@ -17050,21 +17669,21 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  * 
  *     if index >= shape:
  */
-      __pyx_t_2 = PyInt_FromLong(__pyx_v_dim); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_43), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3));
-      __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
-      __pyx_t_3 = 0;
-      __pyx_t_3 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
-      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+      __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_43), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
+      __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
+      __pyx_t_4 = 0;
+      __pyx_t_4 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_4);
+      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
+      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
       {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L6;
     }
@@ -17080,8 +17699,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
  * 
  */
-  __pyx_t_1 = (__pyx_v_index >= __pyx_v_shape);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":893
  * 
@@ -17090,21 +17709,21 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  * 
  *     resultp = bufp + index * stride
  */
-    __pyx_t_3 = PyInt_FromLong(__pyx_v_dim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_43), __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
+    __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
+    __pyx_t_3 = 0;
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_43), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
-    __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
-    __pyx_t_2 = 0;
-    __pyx_t_2 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L7;
   }
@@ -17126,8 +17745,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *         resultp = (<char **> resultp)[0] + suboffset
  * 
  */
-  __pyx_t_1 = (__pyx_v_suboffset >= 0);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":897
  *     resultp = bufp + index * stride
@@ -17154,8 +17773,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
   __pyx_r = 0;
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
+  __Pyx_XDECREF(__pyx_t_4);
   __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
@@ -17178,14 +17797,15 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
   int __pyx_v_i;
   int __pyx_v_j;
   int __pyx_r;
-  long __pyx_t_1;
-  int __pyx_t_2;
-  Py_ssize_t __pyx_t_3;
+  int __pyx_t_1;
+  Py_ssize_t *__pyx_t_2;
+  long __pyx_t_3;
   Py_ssize_t __pyx_t_4;
-  int __pyx_t_5;
+  Py_ssize_t __pyx_t_5;
   int __pyx_t_6;
   int __pyx_t_7;
   int __pyx_t_8;
+  int __pyx_t_9;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -17197,7 +17817,8 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  * 
  *     cdef Py_ssize_t *shape = memslice.shape
  */
-  __pyx_v_ndim = __pyx_v_memslice->memview->view.ndim;
+  __pyx_t_1 = __pyx_v_memslice->memview->view.ndim;
+  __pyx_v_ndim = __pyx_t_1;
 
   /* "View.MemoryView":908
  *     cdef int ndim = memslice.memview.view.ndim
@@ -17206,7 +17827,8 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  *     cdef Py_ssize_t *strides = memslice.strides
  * 
  */
-  __pyx_v_shape = __pyx_v_memslice->shape;
+  __pyx_t_2 = __pyx_v_memslice->shape;
+  __pyx_v_shape = __pyx_t_2;
 
   /* "View.MemoryView":909
  * 
@@ -17215,7 +17837,8 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  * 
  * 
  */
-  __pyx_v_strides = __pyx_v_memslice->strides;
+  __pyx_t_2 = __pyx_v_memslice->strides;
+  __pyx_v_strides = __pyx_t_2;
 
   /* "View.MemoryView":913
  * 
@@ -17224,9 +17847,9 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  *         j = ndim - 1 - i
  *         strides[i], strides[j] = strides[j], strides[i]
  */
-  __pyx_t_1 = __Pyx_div_long(__pyx_v_ndim, 2);
-  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
-    __pyx_v_i = __pyx_t_2;
+  __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2);
+  for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_3; __pyx_t_1+=1) {
+    __pyx_v_i = __pyx_t_1;
 
     /* "View.MemoryView":914
  *     cdef int i, j
@@ -17244,10 +17867,10 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  *         shape[i], shape[j] = shape[j], shape[i]
  * 
  */
-    __pyx_t_3 = (__pyx_v_strides[__pyx_v_j]);
-    __pyx_t_4 = (__pyx_v_strides[__pyx_v_i]);
-    (__pyx_v_strides[__pyx_v_i]) = __pyx_t_3;
-    (__pyx_v_strides[__pyx_v_j]) = __pyx_t_4;
+    __pyx_t_4 = (__pyx_v_strides[__pyx_v_j]);
+    __pyx_t_5 = (__pyx_v_strides[__pyx_v_i]);
+    (__pyx_v_strides[__pyx_v_i]) = __pyx_t_4;
+    (__pyx_v_strides[__pyx_v_j]) = __pyx_t_5;
 
     /* "View.MemoryView":916
  *         j = ndim - 1 - i
@@ -17256,10 +17879,10 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  * 
  *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
  */
-    __pyx_t_4 = (__pyx_v_shape[__pyx_v_j]);
-    __pyx_t_3 = (__pyx_v_shape[__pyx_v_i]);
-    (__pyx_v_shape[__pyx_v_i]) = __pyx_t_4;
-    (__pyx_v_shape[__pyx_v_j]) = __pyx_t_3;
+    __pyx_t_5 = (__pyx_v_shape[__pyx_v_j]);
+    __pyx_t_4 = (__pyx_v_shape[__pyx_v_i]);
+    (__pyx_v_shape[__pyx_v_i]) = __pyx_t_5;
+    (__pyx_v_shape[__pyx_v_j]) = __pyx_t_4;
 
     /* "View.MemoryView":918
  *         shape[i], shape[j] = shape[j], shape[i]
@@ -17268,14 +17891,14 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
  * 
  */
-    __pyx_t_5 = ((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0);
-    if (!__pyx_t_5) {
-      __pyx_t_6 = ((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0);
-      __pyx_t_7 = __pyx_t_6;
+    __pyx_t_6 = (((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0) != 0);
+    if (!__pyx_t_6) {
+      __pyx_t_7 = (((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0) != 0);
+      __pyx_t_8 = __pyx_t_7;
     } else {
-      __pyx_t_7 = __pyx_t_5;
+      __pyx_t_8 = __pyx_t_6;
     }
-    if (__pyx_t_7) {
+    if (__pyx_t_8) {
 
       /* "View.MemoryView":919
  * 
@@ -17284,7 +17907,7 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  * 
  *     return 1
  */
-      __pyx_t_8 = __pyx_memoryview_err(__pyx_builtin_ValueError, __pyx_k_44); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = __pyx_memoryview_err(__pyx_builtin_ValueError, __pyx_k_44); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L5;
     }
     __pyx_L5:;
@@ -17375,7 +17998,7 @@ static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memor
  *             return self.to_object_func(itemp)
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_self->to_object_func != NULL);
+  __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":943
@@ -17449,7 +18072,7 @@ static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memo
  *             self.to_dtype_func(itemp, value)
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_self->to_dtype_func != NULL);
+  __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":949
@@ -17548,8 +18171,11 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
   int __pyx_t_1;
   PyObject *__pyx_t_2 = NULL;
   PyObject *__pyx_t_3 = NULL;
-  int __pyx_t_4;
-  int __pyx_t_5;
+  __Pyx_TypeInfo *__pyx_t_4;
+  Py_buffer __pyx_t_5;
+  Py_ssize_t __pyx_t_6;
+  int __pyx_t_7;
+  int __pyx_t_8;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -17562,7 +18188,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
  *         return None
  * 
  */
-  __pyx_t_1 = (((PyObject *)__pyx_v_memviewslice.memview) == Py_None);
+  __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":972
@@ -17631,7 +18257,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
  *     result.typeinfo = memviewslice.memview.typeinfo
  * 
  */
-  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s__base); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s__base); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_GIVEREF(__pyx_t_2);
   __Pyx_GOTREF(__pyx_v_result->from_object);
@@ -17646,7 +18272,8 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
  * 
  *     result.view = memviewslice.memview.view
  */
-  __pyx_v_result->__pyx_base.typeinfo = __pyx_v_memviewslice.memview->typeinfo;
+  __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo;
+  __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4;
 
   /* "View.MemoryView":985
  *     result.typeinfo = memviewslice.memview.typeinfo
@@ -17655,7 +18282,8 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
  *     result.view.buf = <void *> memviewslice.data
  *     result.view.ndim = ndim
  */
-  __pyx_v_result->__pyx_base.view = __pyx_v_memviewslice.memview->view;
+  __pyx_t_5 = __pyx_v_memviewslice.memview->view;
+  __pyx_v_result->__pyx_base.view = __pyx_t_5;
 
   /* "View.MemoryView":986
  * 
@@ -17736,7 +18364,8 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
  *     for i in range(ndim):
  *         result.view.len *= result.view.shape[i]
  */
-  __pyx_v_result->__pyx_base.view.len = __pyx_v_result->__pyx_base.view.itemsize;
+  __pyx_t_6 = __pyx_v_result->__pyx_base.view.itemsize;
+  __pyx_v_result->__pyx_base.view.len = __pyx_t_6;
 
   /* "View.MemoryView":998
  * 
@@ -17745,9 +18374,9 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
  *         result.view.len *= result.view.shape[i]
  * 
  */
-  __pyx_t_4 = __pyx_v_ndim;
-  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
-    __pyx_v_i = __pyx_t_5;
+  __pyx_t_7 = __pyx_v_ndim;
+  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
+    __pyx_v_i = __pyx_t_8;
 
     /* "View.MemoryView":999
  *     result.view.len = result.view.itemsize
@@ -17815,7 +18444,7 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p
   struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0;
   __Pyx_memviewslice *__pyx_r;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
+  int __pyx_t_1;
   int __pyx_t_2;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
@@ -17829,10 +18458,8 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p
  *         obj = memview
  *         return &obj.from_slice
  */
-  __pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryviewslice_type));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), ((PyObject *)__pyx_memoryviewslice_type)); 
+  __pyx_t_2 = (__pyx_t_1 != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":1011
@@ -17883,7 +18510,6 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p
   __pyx_r = 0;
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
   __Pyx_WriteUnraisable("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
@@ -17906,9 +18532,10 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem
   Py_ssize_t *__pyx_v_strides;
   Py_ssize_t *__pyx_v_suboffsets;
   __Pyx_RefNannyDeclarations
-  int __pyx_t_1;
+  Py_ssize_t *__pyx_t_1;
   int __pyx_t_2;
   int __pyx_t_3;
+  int __pyx_t_4;
   __Pyx_RefNannySetupContext("slice_copy", 0);
 
   /* "View.MemoryView":1022
@@ -17918,7 +18545,8 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem
  *     strides = memview.view.strides
  *     suboffsets = memview.view.suboffsets
  */
-  __pyx_v_shape = __pyx_v_memview->view.shape;
+  __pyx_t_1 = __pyx_v_memview->view.shape;
+  __pyx_v_shape = __pyx_t_1;
 
   /* "View.MemoryView":1023
  * 
@@ -17927,7 +18555,8 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem
  *     suboffsets = memview.view.suboffsets
  * 
  */
-  __pyx_v_strides = __pyx_v_memview->view.strides;
+  __pyx_t_1 = __pyx_v_memview->view.strides;
+  __pyx_v_strides = __pyx_t_1;
 
   /* "View.MemoryView":1024
  *     shape = memview.view.shape
@@ -17936,7 +18565,8 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem
  * 
  *     dst.memview = <__pyx_memoryview *> memview
  */
-  __pyx_v_suboffsets = __pyx_v_memview->view.suboffsets;
+  __pyx_t_1 = __pyx_v_memview->view.suboffsets;
+  __pyx_v_suboffsets = __pyx_t_1;
 
   /* "View.MemoryView":1026
  *     suboffsets = memview.view.suboffsets
@@ -17963,9 +18593,9 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem
  *         dst.shape[dim] = shape[dim]
  *         dst.strides[dim] = strides[dim]
  */
-  __pyx_t_1 = __pyx_v_memview->view.ndim;
-  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
-    __pyx_v_dim = __pyx_t_2;
+  __pyx_t_2 = __pyx_v_memview->view.ndim;
+  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
+    __pyx_v_dim = __pyx_t_3;
 
     /* "View.MemoryView":1030
  * 
@@ -17992,8 +18622,8 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem
  *             dst.suboffsets[dim] = -1
  *         else:
  */
-    __pyx_t_3 = (__pyx_v_suboffsets == NULL);
-    if (__pyx_t_3) {
+    __pyx_t_4 = ((__pyx_v_suboffsets == NULL) != 0);
+    if (__pyx_t_4) {
 
       /* "View.MemoryView":1033
  *         dst.strides[dim] = strides[dim]
@@ -18088,8 +18718,11 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview
   int (*__pyx_v_to_dtype_func)(char *, PyObject *);
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
+  int __pyx_t_1;
   int __pyx_t_2;
+  PyObject *(*__pyx_t_3)(char *);
+  int (*__pyx_t_4)(char *, PyObject *);
+  PyObject *__pyx_t_5 = NULL;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -18102,10 +18735,8 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview
  *         to_object_func = (<_memoryviewslice> memview).to_object_func
  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
  */
-  __pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryviewslice_type));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), ((PyObject *)__pyx_memoryviewslice_type)); 
+  __pyx_t_2 = (__pyx_t_1 != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":1053
@@ -18115,7 +18746,8 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview
  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
  *     else:
  */
-    __pyx_v_to_object_func = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
+    __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
+    __pyx_v_to_object_func = __pyx_t_3;
 
     /* "View.MemoryView":1054
  *     if isinstance(memview, _memoryviewslice):
@@ -18124,7 +18756,8 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview
  *     else:
  *         to_object_func = NULL
  */
-    __pyx_v_to_dtype_func = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
+    __pyx_t_4 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
+    __pyx_v_to_dtype_func = __pyx_t_4;
     goto __pyx_L3;
   }
   /*else*/ {
@@ -18165,16 +18798,16 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview
  * 
  * 
  */
-  __pyx_t_1 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_r = __pyx_t_1;
-  __pyx_t_1 = 0;
+  __pyx_t_5 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
+  __pyx_r = __pyx_t_5;
+  __pyx_t_5 = 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_5);
   __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
@@ -18202,7 +18835,7 @@ static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) {
  *         return -arg
  *     else:
  */
-  __pyx_t_1 = (__pyx_v_arg < 0);
+  __pyx_t_1 = ((__pyx_v_arg < 0) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":1069
@@ -18287,7 +18920,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _
  *             c_stride = mslice.strides[i]
  *             break
  */
-    __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1);
+    __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":1084
@@ -18331,7 +18964,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _
  *             f_stride = mslice.strides[i]
  *             break
  */
-    __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1);
+    __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":1089
@@ -18364,7 +18997,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _
  *         return 'C'
  *     else:
  */
-  __pyx_t_2 = (abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride));
+  __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":1093
@@ -18461,7 +19094,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v
  *        if (src_stride > 0 and dst_stride > 0 and
  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
  */
-  __pyx_t_1 = (__pyx_v_ndim == 1);
+  __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":1111
@@ -18471,9 +19104,9 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v
  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
  *            memcpy(dst_data, src_data, itemsize * dst_extent)
  */
-    __pyx_t_1 = (__pyx_v_src_stride > 0);
+    __pyx_t_1 = ((__pyx_v_src_stride > 0) != 0);
     if (__pyx_t_1) {
-      __pyx_t_2 = (__pyx_v_dst_stride > 0);
+      __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":1112
@@ -18487,7 +19120,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v
         if (__pyx_t_3) {
           __pyx_t_3 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride));
         }
-        __pyx_t_4 = __pyx_t_3;
+        __pyx_t_4 = (__pyx_t_3 != 0);
       } else {
         __pyx_t_4 = __pyx_t_2;
       }
@@ -18629,8 +19262,9 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_sr
   int __pyx_v_i;
   Py_ssize_t __pyx_v_size;
   Py_ssize_t __pyx_r;
-  int __pyx_t_1;
+  Py_ssize_t __pyx_t_1;
   int __pyx_t_2;
+  int __pyx_t_3;
 
   /* "View.MemoryView":1138
  *     "Return the size of the memory occupied by the slice in number of bytes"
@@ -18639,7 +19273,8 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_sr
  * 
  *     for i in range(ndim):
  */
-  __pyx_v_size = __pyx_v_src->memview->view.itemsize;
+  __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
+  __pyx_v_size = __pyx_t_1;
 
   /* "View.MemoryView":1140
  *     cdef Py_ssize_t size = src.memview.view.itemsize
@@ -18648,9 +19283,9 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_sr
  *         size *= src.shape[i]
  * 
  */
-  __pyx_t_1 = __pyx_v_ndim;
-  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
-    __pyx_v_i = __pyx_t_2;
+  __pyx_t_2 = __pyx_v_ndim;
+  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
+    __pyx_v_i = __pyx_t_3;
 
     /* "View.MemoryView":1141
  * 
@@ -18699,7 +19334,7 @@ static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_
  *         for idx in range(ndim):
  *             strides[idx] = stride
  */
-  __pyx_t_1 = (__pyx_v_order == 'F');
+  __pyx_t_1 = ((__pyx_v_order == 'F') != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":1156
@@ -18795,9 +19430,11 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
   size_t __pyx_v_itemsize;
   size_t __pyx_v_size;
   void *__pyx_r;
-  int __pyx_t_1;
+  Py_ssize_t __pyx_t_1;
   int __pyx_t_2;
   int __pyx_t_3;
+  struct __pyx_memoryview_obj *__pyx_t_4;
+  int __pyx_t_5;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -18809,7 +19446,8 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *     cdef size_t size = slice_get_size(src, ndim)
  * 
  */
-  __pyx_v_itemsize = __pyx_v_src->memview->view.itemsize;
+  __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
+  __pyx_v_itemsize = __pyx_t_1;
 
   /* "View.MemoryView":1179
  * 
@@ -18836,8 +19474,8 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *         _err(MemoryError, NULL)
  * 
  */
-  __pyx_t_1 = (!(__pyx_v_result != 0));
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":1183
  *     result = malloc(size)
@@ -18846,7 +19484,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  * 
  * 
  */
-    __pyx_t_2 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L3;
   }
   __pyx_L3:;
@@ -18867,7 +19505,8 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *     for i in range(ndim):
  *         tmpslice.shape[i] = src.shape[i]
  */
-  __pyx_v_tmpslice->memview = __pyx_v_src->memview;
+  __pyx_t_4 = __pyx_v_src->memview;
+  __pyx_v_tmpslice->memview = __pyx_t_4;
 
   /* "View.MemoryView":1188
  *     tmpslice.data = <char *> result
@@ -18876,9 +19515,9 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *         tmpslice.shape[i] = src.shape[i]
  *         tmpslice.suboffsets[i] = -1
  */
-  __pyx_t_2 = __pyx_v_ndim;
-  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
-    __pyx_v_i = __pyx_t_3;
+  __pyx_t_3 = __pyx_v_ndim;
+  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_3; __pyx_t_5+=1) {
+    __pyx_v_i = __pyx_t_5;
 
     /* "View.MemoryView":1189
  *     tmpslice.memview = src.memview
@@ -18915,9 +19554,9 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *         if tmpslice.shape[i] == 1:
  *             tmpslice.strides[i] = 0
  */
-  __pyx_t_2 = __pyx_v_ndim;
-  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
-    __pyx_v_i = __pyx_t_3;
+  __pyx_t_3 = __pyx_v_ndim;
+  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_3; __pyx_t_5+=1) {
+    __pyx_v_i = __pyx_t_5;
 
     /* "View.MemoryView":1197
  * 
@@ -18926,8 +19565,8 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *             tmpslice.strides[i] = 0
  * 
  */
-    __pyx_t_1 = ((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1);
-    if (__pyx_t_1) {
+    __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1198
  *     for i in range(ndim):
@@ -18949,8 +19588,8 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *         memcpy(result, src.data, size)
  *     else:
  */
-  __pyx_t_1 = __pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":1201
  * 
@@ -19178,7 +19817,7 @@ static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) {
  *         raise error(msg.decode('ascii'))
  *     else:
  */
-  __pyx_t_1 = (__pyx_v_msg != NULL);
+  __pyx_t_1 = ((__pyx_v_msg != NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":1222
@@ -19251,11 +19890,13 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
   __Pyx_memviewslice __pyx_v_tmp;
   int __pyx_v_ndim;
   int __pyx_r;
-  int __pyx_t_1;
+  Py_ssize_t __pyx_t_1;
   int __pyx_t_2;
   int __pyx_t_3;
   int __pyx_t_4;
-  void *__pyx_t_5;
+  int __pyx_t_5;
+  void *__pyx_t_6;
+  int __pyx_t_7;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -19276,7 +19917,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *     cdef int i
  *     cdef char order = get_best_order(&src, src_ndim)
  */
-  __pyx_v_itemsize = __pyx_v_src.memview->view.itemsize;
+  __pyx_t_1 = __pyx_v_src.memview->view.itemsize;
+  __pyx_v_itemsize = __pyx_t_1;
 
   /* "View.MemoryView":1238
  *     cdef size_t itemsize = src.memview.view.itemsize
@@ -19312,8 +19954,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *         broadcast_leading(&src, src_ndim, dst_ndim)
  *     elif dst_ndim < src_ndim:
  */
-  __pyx_t_1 = (__pyx_v_src_ndim < __pyx_v_dst_ndim);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":1244
  * 
@@ -19333,8 +19975,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *         broadcast_leading(&dst, dst_ndim, src_ndim)
  * 
  */
-  __pyx_t_1 = (__pyx_v_dst_ndim < __pyx_v_src_ndim);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":1246
  *         broadcast_leading(&src, src_ndim, dst_ndim)
@@ -19355,14 +19997,14 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  *     for i in range(ndim):
  */
-  __pyx_t_2 = __pyx_v_dst_ndim;
-  __pyx_t_3 = __pyx_v_src_ndim;
-  if ((__pyx_t_2 > __pyx_t_3)) {
-    __pyx_t_4 = __pyx_t_2;
+  __pyx_t_3 = __pyx_v_dst_ndim;
+  __pyx_t_4 = __pyx_v_src_ndim;
+  if (((__pyx_t_3 > __pyx_t_4) != 0)) {
+    __pyx_t_5 = __pyx_t_3;
   } else {
-    __pyx_t_4 = __pyx_t_3;
+    __pyx_t_5 = __pyx_t_4;
   }
-  __pyx_v_ndim = __pyx_t_4;
+  __pyx_v_ndim = __pyx_t_5;
 
   /* "View.MemoryView":1250
  *     cdef int ndim = max(src_ndim, dst_ndim)
@@ -19371,9 +20013,9 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *         if src.shape[i] != dst.shape[i]:
  *             if src.shape[i] == 1:
  */
-  __pyx_t_4 = __pyx_v_ndim;
-  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_4; __pyx_t_2+=1) {
-    __pyx_v_i = __pyx_t_2;
+  __pyx_t_5 = __pyx_v_ndim;
+  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_5; __pyx_t_3+=1) {
+    __pyx_v_i = __pyx_t_3;
 
     /* "View.MemoryView":1251
  * 
@@ -19382,8 +20024,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *             if src.shape[i] == 1:
  *                 broadcasting = True
  */
-    __pyx_t_1 = ((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i]));
-    if (__pyx_t_1) {
+    __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1252
  *     for i in range(ndim):
@@ -19392,8 +20034,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *                 broadcasting = True
  *                 src.strides[i] = 0
  */
-      __pyx_t_1 = ((__pyx_v_src.shape[__pyx_v_i]) == 1);
-      if (__pyx_t_1) {
+      __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0);
+      if (__pyx_t_2) {
 
         /* "View.MemoryView":1253
  *         if src.shape[i] != dst.shape[i]:
@@ -19423,7 +20065,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  *         if src.suboffsets[i] >= 0:
  */
-        __pyx_t_3 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_4 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       }
       __pyx_L7:;
       goto __pyx_L6;
@@ -19437,8 +20079,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *             _err_dim(ValueError, "Dimension %d is not direct", i)
  * 
  */
-    __pyx_t_1 = ((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0);
-    if (__pyx_t_1) {
+    __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1259
  * 
@@ -19447,7 +20089,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  *     if slices_overlap(&src, &dst, ndim, itemsize):
  */
-      __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, __pyx_k_46, __pyx_v_i); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, __pyx_k_46, __pyx_v_i); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L8;
     }
     __pyx_L8:;
@@ -19460,8 +20102,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  *         if not slice_is_contig(&src, order, ndim):
  */
-  __pyx_t_1 = __pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":1263
  *     if slices_overlap(&src, &dst, ndim, itemsize):
@@ -19470,8 +20112,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *             order = get_best_order(&dst, ndim)
  * 
  */
-    __pyx_t_1 = (!__pyx_memviewslice_is_contig((&__pyx_v_src), __pyx_v_order, __pyx_v_ndim));
-    if (__pyx_t_1) {
+    __pyx_t_2 = ((!(__pyx_memviewslice_is_contig((&__pyx_v_src), __pyx_v_order, __pyx_v_ndim) != 0)) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1264
  * 
@@ -19492,8 +20134,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *         src = tmp
  * 
  */
-    __pyx_t_5 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_v_tmpdata = __pyx_t_5;
+    __pyx_t_6 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_v_tmpdata = __pyx_t_6;
 
     /* "View.MemoryView":1267
  * 
@@ -19514,8 +20156,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  * 
  */
-  __pyx_t_1 = (!__pyx_v_broadcasting);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":1272
  * 
@@ -19524,8 +20166,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *             direct_copy = slice_is_contig(&dst, 'C', ndim)
  *         elif slice_is_contig(&src, 'F', ndim):
  */
-    __pyx_t_1 = __pyx_memviewslice_is_contig((&__pyx_v_src), 'C', __pyx_v_ndim);
-    if (__pyx_t_1) {
+    __pyx_t_2 = (__pyx_memviewslice_is_contig((&__pyx_v_src), 'C', __pyx_v_ndim) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1273
  * 
@@ -19545,8 +20187,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *             direct_copy = slice_is_contig(&dst, 'F', ndim)
  * 
  */
-    __pyx_t_1 = __pyx_memviewslice_is_contig((&__pyx_v_src), 'F', __pyx_v_ndim);
-    if (__pyx_t_1) {
+    __pyx_t_2 = (__pyx_memviewslice_is_contig((&__pyx_v_src), 'F', __pyx_v_ndim) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1275
  *             direct_copy = slice_is_contig(&dst, 'C', ndim)
@@ -19567,7 +20209,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  *             refcount_copying(&dst, dtype_is_object, ndim, False)
  */
-    if (__pyx_v_direct_copy) {
+    __pyx_t_2 = (__pyx_v_direct_copy != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1279
  *         if direct_copy:
@@ -19619,11 +20262,12 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  * 
  */
-  __pyx_t_1 = (__pyx_v_order == 'F');
-  if (__pyx_t_1) {
-    __pyx_t_1 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
+  __pyx_t_2 = (__pyx_v_order == 'F');
+  if (__pyx_t_2) {
+    __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
   }
-  if (__pyx_t_1) {
+  __pyx_t_7 = (__pyx_t_2 != 0);
+  if (__pyx_t_7) {
 
     /* "View.MemoryView":1287
  * 
@@ -19632,7 +20276,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *         transpose_memslice(&dst)
  * 
  */
-    __pyx_t_4 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_4 == 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
     /* "View.MemoryView":1288
  * 
@@ -19641,7 +20285,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  *     refcount_copying(&dst, dtype_is_object, ndim, False)
  */
-    __pyx_t_4 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_4 == 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L14;
   }
   __pyx_L14:;
@@ -19820,6 +20464,7 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_slice
  */
 
 static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) {
+  int __pyx_t_1;
 
   /* "View.MemoryView":1324
  * 
@@ -19828,7 +20473,8 @@ static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, i
  *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,
  *                                            dst.strides, ndim, inc)
  */
-  if (__pyx_v_dtype_is_object) {
+  __pyx_t_1 = (__pyx_v_dtype_is_object != 0);
+  if (__pyx_t_1) {
 
     /* "View.MemoryView":1326
  *     if dtype_is_object:
@@ -19908,7 +20554,7 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss
  *             if inc:
  *                 Py_INCREF((<PyObject **> data)[0])
  */
-    __pyx_t_3 = (__pyx_v_ndim == 1);
+    __pyx_t_3 = ((__pyx_v_ndim == 1) != 0);
     if (__pyx_t_3) {
 
       /* "View.MemoryView":1341
@@ -19918,7 +20564,8 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss
  *                 Py_INCREF((<PyObject **> data)[0])
  *             else:
  */
-      if (__pyx_v_inc) {
+      __pyx_t_3 = (__pyx_v_inc != 0);
+      if (__pyx_t_3) {
 
         /* "View.MemoryView":1342
  *         if ndim == 1:
@@ -20050,7 +20697,7 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t
  *         for i in range(extent):
  *             memcpy(data, item, itemsize)
  */
-  __pyx_t_1 = (__pyx_v_ndim == 1);
+  __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":1373
@@ -20119,60 +20766,77 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t
   __pyx_L3:;
 
 }
+static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;
 
-static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
-  struct __pyx_array_obj *p;
-  PyObject *o = (*t->tp_alloc)(t, 0);
-  if (!o) return 0;
-  p = ((struct __pyx_array_obj *)o);
-  p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
-  p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
-  if (__pyx_array___cinit__(o, a, k) < 0) {
+static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
+  struct __pyx_memoryview_obj *p;
+  PyObject *o;
+  o = (*t->tp_alloc)(t, 0);
+  if (unlikely(!o)) return 0;
+  p = ((struct __pyx_memoryview_obj *)o);
+  p->__pyx_vtab = __pyx_vtabptr_memoryview;
+  p->obj = Py_None; Py_INCREF(Py_None);
+  p->_size = Py_None; Py_INCREF(Py_None);
+  p->_array_interface = Py_None; Py_INCREF(Py_None);
+  p->view.obj = NULL;
+  if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) {
     Py_DECREF(o); o = 0;
   }
   return o;
 }
 
-static void __pyx_tp_dealloc_array(PyObject *o) {
-  struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
+static void __pyx_tp_dealloc_memoryview(PyObject *o) {
+  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
+  PyObject_GC_UnTrack(o);
   {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
     ++Py_REFCNT(o);
-    __pyx_array___dealloc__(o);
+    __pyx_memoryview___dealloc__(o);
     if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
     --Py_REFCNT(o);
     PyErr_Restore(etype, eval, etb);
   }
-  Py_CLEAR(p->mode);
-  Py_CLEAR(p->_format);
+  Py_CLEAR(p->obj);
+  Py_CLEAR(p->_size);
+  Py_CLEAR(p->_array_interface);
   (*Py_TYPE(o)->tp_free)(o);
 }
 
-static int __pyx_tp_traverse_array(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) {
   int e;
-  struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
-  if (p->mode) {
-    e = (*v)(p->mode, a); if (e) return e;
+  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
+  if (p->obj) {
+    e = (*v)(p->obj, a); if (e) return e;
   }
-  if (p->_format) {
-    e = (*v)(p->_format, a); if (e) return e;
+  if (p->_size) {
+    e = (*v)(p->_size, a); if (e) return e;
+  }
+  if (p->_array_interface) {
+    e = (*v)(p->_array_interface, a); if (e) return e;
+  }
+  if (p->view.obj) {
+    e = (*v)(p->view.obj, a); if (e) return e;
   }
   return 0;
 }
 
-static int __pyx_tp_clear_array(PyObject *o) {
-  struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
+static int __pyx_tp_clear_memoryview(PyObject *o) {
+  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
   PyObject* tmp;
-  tmp = ((PyObject*)p->mode);
-  p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
+  tmp = ((PyObject*)p->obj);
+  p->obj = Py_None; Py_INCREF(Py_None);
   Py_XDECREF(tmp);
-  tmp = ((PyObject*)p->_format);
-  p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
+  tmp = ((PyObject*)p->_size);
+  p->_size = Py_None; Py_INCREF(Py_None);
+  Py_XDECREF(tmp);
+  tmp = ((PyObject*)p->_array_interface);
+  p->_array_interface = Py_None; Py_INCREF(Py_None);
   Py_XDECREF(tmp);
+  Py_CLEAR(p->view.obj);
   return 0;
 }
-static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
+static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
   PyObject *r;
   PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
   r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
@@ -20180,9 +20844,9 @@ static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
   return r;
 }
 
-static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) {
+static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) {
   if (v) {
-    return __pyx_array___setitem__(o, i, v);
+    return __pyx_memoryview___setitem__(o, i, v);
   }
   else {
     PyErr_Format(PyExc_NotImplementedError,
@@ -20191,283 +20855,68 @@ static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) {
   }
 }
 
-static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) {
-  PyObject *v = PyObject_GenericGetAttr(o, n);
-  if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
-    PyErr_Clear();
-    v = __pyx_array___getattr__(o, n);
-  }
-  return v;
+static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_transpose(o);
 }
 
-static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) {
-  return get_memview(o);
+static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview__get__base(o);
 }
 
-static PyMethodDef __pyx_methods_array[] = {
-  {__Pyx_NAMESTR("__getattr__"), (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, __Pyx_DOCSTR(0)},
-  {0, 0, 0, 0}
-};
-
-static struct PyGetSetDef __pyx_getsets_array[] = {
-  {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, 0, 0},
-  {0, 0, 0, 0, 0}
-};
-
-static PyNumberMethods __pyx_tp_as_number_array = {
-  0, /*nb_add*/
-  0, /*nb_subtract*/
-  0, /*nb_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_divide*/
-  #endif
-  0, /*nb_remainder*/
-  0, /*nb_divmod*/
-  0, /*nb_power*/
-  0, /*nb_negative*/
-  0, /*nb_positive*/
-  0, /*nb_absolute*/
-  0, /*nb_nonzero*/
-  0, /*nb_invert*/
-  0, /*nb_lshift*/
-  0, /*nb_rshift*/
-  0, /*nb_and*/
-  0, /*nb_xor*/
-  0, /*nb_or*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_coerce*/
-  #endif
-  0, /*nb_int*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_long*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*nb_float*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_oct*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_hex*/
-  #endif
-  0, /*nb_inplace_add*/
-  0, /*nb_inplace_subtract*/
-  0, /*nb_inplace_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_inplace_divide*/
-  #endif
-  0, /*nb_inplace_remainder*/
-  0, /*nb_inplace_power*/
-  0, /*nb_inplace_lshift*/
-  0, /*nb_inplace_rshift*/
-  0, /*nb_inplace_and*/
-  0, /*nb_inplace_xor*/
-  0, /*nb_inplace_or*/
-  0, /*nb_floor_divide*/
-  0, /*nb_true_divide*/
-  0, /*nb_inplace_floor_divide*/
-  0, /*nb_inplace_true_divide*/
-  #if PY_VERSION_HEX >= 0x02050000
-  0, /*nb_index*/
-  #endif
-};
-
-static PySequenceMethods __pyx_tp_as_sequence_array = {
-  0, /*sq_length*/
-  0, /*sq_concat*/
-  0, /*sq_repeat*/
-  __pyx_sq_item_array, /*sq_item*/
-  0, /*sq_slice*/
-  0, /*sq_ass_item*/
-  0, /*sq_ass_slice*/
-  0, /*sq_contains*/
-  0, /*sq_inplace_concat*/
-  0, /*sq_inplace_repeat*/
-};
-
-static PyMappingMethods __pyx_tp_as_mapping_array = {
-  0, /*mp_length*/
-  __pyx_array___getitem__, /*mp_subscript*/
-  __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/
-};
+static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_shape(o);
+}
 
-static PyBufferProcs __pyx_tp_as_buffer_array = {
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getreadbuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getwritebuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getsegcount*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getcharbuffer*/
-  #endif
-  #if PY_VERSION_HEX >= 0x02060000
-  __pyx_array_getbuffer, /*bf_getbuffer*/
-  #endif
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_releasebuffer*/
-  #endif
-};
+static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_strides(o);
+}
 
-static PyTypeObject __pyx_type___pyx_array = {
-  PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("splitBBox.array"), /*tp_name*/
-  sizeof(struct __pyx_array_obj), /*tp_basicsize*/
-  0, /*tp_itemsize*/
-  __pyx_tp_dealloc_array, /*tp_dealloc*/
-  0, /*tp_print*/
-  0, /*tp_getattr*/
-  0, /*tp_setattr*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*tp_compare*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*tp_repr*/
-  &__pyx_tp_as_number_array, /*tp_as_number*/
-  &__pyx_tp_as_sequence_array, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping_array, /*tp_as_mapping*/
-  0, /*tp_hash*/
-  0, /*tp_call*/
-  0, /*tp_str*/
-  __pyx_tp_getattro_array, /*tp_getattro*/
-  0, /*tp_setattro*/
-  &__pyx_tp_as_buffer_array, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
-  0, /*tp_doc*/
-  __pyx_tp_traverse_array, /*tp_traverse*/
-  __pyx_tp_clear_array, /*tp_clear*/
-  0, /*tp_richcompare*/
-  0, /*tp_weaklistoffset*/
-  0, /*tp_iter*/
-  0, /*tp_iternext*/
-  __pyx_methods_array, /*tp_methods*/
-  0, /*tp_members*/
-  __pyx_getsets_array, /*tp_getset*/
-  0, /*tp_base*/
-  0, /*tp_dict*/
-  0, /*tp_descr_get*/
-  0, /*tp_descr_set*/
-  0, /*tp_dictoffset*/
-  0, /*tp_init*/
-  0, /*tp_alloc*/
-  __pyx_tp_new_array, /*tp_new*/
-  0, /*tp_free*/
-  0, /*tp_is_gc*/
-  0, /*tp_bases*/
-  0, /*tp_mro*/
-  0, /*tp_cache*/
-  0, /*tp_subclasses*/
-  0, /*tp_weaklist*/
-  0, /*tp_del*/
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*tp_version_tag*/
-  #endif
-};
+static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_suboffsets(o);
+}
 
-static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
-  struct __pyx_MemviewEnum_obj *p;
-  PyObject *o = (*t->tp_alloc)(t, 0);
-  if (!o) return 0;
-  p = ((struct __pyx_MemviewEnum_obj *)o);
-  p->name = Py_None; Py_INCREF(Py_None);
-  return o;
+static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_ndim(o);
 }
 
-static void __pyx_tp_dealloc_Enum(PyObject *o) {
-  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
-  Py_CLEAR(p->name);
-  (*Py_TYPE(o)->tp_free)(o);
+static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_itemsize(o);
 }
 
-static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) {
-  int e;
-  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
-  if (p->name) {
-    e = (*v)(p->name, a); if (e) return e;
-  }
-  return 0;
+static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_nbytes(o);
 }
 
-static int __pyx_tp_clear_Enum(PyObject *o) {
-  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
-  PyObject* tmp;
-  tmp = ((PyObject*)p->name);
-  p->name = Py_None; Py_INCREF(Py_None);
-  Py_XDECREF(tmp);
-  return 0;
+static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_size(o);
 }
 
-static PyMethodDef __pyx_methods_Enum[] = {
+static PyMethodDef __pyx_methods_memoryview[] = {
+  {__Pyx_NAMESTR("is_c_contig"), (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, __Pyx_DOCSTR(0)},
+  {__Pyx_NAMESTR("is_f_contig"), (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, __Pyx_DOCSTR(0)},
+  {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, __Pyx_DOCSTR(0)},
+  {__Pyx_NAMESTR("copy_fortran"), (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, __Pyx_DOCSTR(0)},
   {0, 0, 0, 0}
 };
 
-static PyNumberMethods __pyx_tp_as_number_Enum = {
-  0, /*nb_add*/
-  0, /*nb_subtract*/
-  0, /*nb_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_divide*/
-  #endif
-  0, /*nb_remainder*/
-  0, /*nb_divmod*/
-  0, /*nb_power*/
-  0, /*nb_negative*/
-  0, /*nb_positive*/
-  0, /*nb_absolute*/
-  0, /*nb_nonzero*/
-  0, /*nb_invert*/
-  0, /*nb_lshift*/
-  0, /*nb_rshift*/
-  0, /*nb_and*/
-  0, /*nb_xor*/
-  0, /*nb_or*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_coerce*/
-  #endif
-  0, /*nb_int*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_long*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*nb_float*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_oct*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_hex*/
-  #endif
-  0, /*nb_inplace_add*/
-  0, /*nb_inplace_subtract*/
-  0, /*nb_inplace_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_inplace_divide*/
-  #endif
-  0, /*nb_inplace_remainder*/
-  0, /*nb_inplace_power*/
-  0, /*nb_inplace_lshift*/
-  0, /*nb_inplace_rshift*/
-  0, /*nb_inplace_and*/
-  0, /*nb_inplace_xor*/
-  0, /*nb_inplace_or*/
-  0, /*nb_floor_divide*/
-  0, /*nb_true_divide*/
-  0, /*nb_inplace_floor_divide*/
-  0, /*nb_inplace_true_divide*/
-  #if PY_VERSION_HEX >= 0x02050000
-  0, /*nb_index*/
-  #endif
+static struct PyGetSetDef __pyx_getsets_memoryview[] = {
+  {(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, 0, 0},
+  {(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, 0, 0},
+  {(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, 0, 0},
+  {(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, 0, 0},
+  {(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, 0, 0},
+  {(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, 0, 0},
+  {(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, 0, 0},
+  {(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, 0, 0},
+  {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, 0, 0},
+  {0, 0, 0, 0, 0}
 };
 
-static PySequenceMethods __pyx_tp_as_sequence_Enum = {
-  0, /*sq_length*/
+static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
+  __pyx_memoryview___len__, /*sq_length*/
   0, /*sq_concat*/
   0, /*sq_repeat*/
-  0, /*sq_item*/
+  __pyx_sq_item_memoryview, /*sq_item*/
   0, /*sq_slice*/
   0, /*sq_ass_item*/
   0, /*sq_ass_slice*/
@@ -20476,13 +20925,13 @@ static PySequenceMethods __pyx_tp_as_sequence_Enum = {
   0, /*sq_inplace_repeat*/
 };
 
-static PyMappingMethods __pyx_tp_as_mapping_Enum = {
-  0, /*mp_length*/
-  0, /*mp_subscript*/
-  0, /*mp_ass_subscript*/
+static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
+  __pyx_memoryview___len__, /*mp_length*/
+  __pyx_memoryview___getitem__, /*mp_subscript*/
+  __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/
 };
 
-static PyBufferProcs __pyx_tp_as_buffer_Enum = {
+static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
   #if PY_MAJOR_VERSION < 3
   0, /*bf_getreadbuffer*/
   #endif
@@ -20496,19 +20945,19 @@ static PyBufferProcs __pyx_tp_as_buffer_Enum = {
   0, /*bf_getcharbuffer*/
   #endif
   #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_getbuffer*/
+  __pyx_memoryview_getbuffer, /*bf_getbuffer*/
   #endif
   #if PY_VERSION_HEX >= 0x02060000
   0, /*bf_releasebuffer*/
   #endif
 };
 
-static PyTypeObject __pyx_type___pyx_MemviewEnum = {
+static PyTypeObject __pyx_type___pyx_memoryview = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("splitBBox.Enum"), /*tp_name*/
-  sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/
+  __Pyx_NAMESTR("splitBBox.memoryview"), /*tp_name*/
+  sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_Enum, /*tp_dealloc*/
+  __pyx_tp_dealloc_memoryview, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -20517,35 +20966,35 @@ static PyTypeObject __pyx_type___pyx_MemviewEnum = {
   #else
   0, /*reserved*/
   #endif
-  __pyx_MemviewEnum___repr__, /*tp_repr*/
-  &__pyx_tp_as_number_Enum, /*tp_as_number*/
-  &__pyx_tp_as_sequence_Enum, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping_Enum, /*tp_as_mapping*/
+  __pyx_memoryview___repr__, /*tp_repr*/
+  0, /*tp_as_number*/
+  &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/
+  &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/
   0, /*tp_hash*/
   0, /*tp_call*/
-  0, /*tp_str*/
+  __pyx_memoryview___str__, /*tp_str*/
   0, /*tp_getattro*/
   0, /*tp_setattro*/
-  &__pyx_tp_as_buffer_Enum, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+  &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
   0, /*tp_doc*/
-  __pyx_tp_traverse_Enum, /*tp_traverse*/
-  __pyx_tp_clear_Enum, /*tp_clear*/
+  __pyx_tp_traverse_memoryview, /*tp_traverse*/
+  __pyx_tp_clear_memoryview, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
   0, /*tp_iter*/
   0, /*tp_iternext*/
-  __pyx_methods_Enum, /*tp_methods*/
+  __pyx_methods_memoryview, /*tp_methods*/
   0, /*tp_members*/
-  0, /*tp_getset*/
+  __pyx_getsets_memoryview, /*tp_getset*/
   0, /*tp_base*/
   0, /*tp_dict*/
   0, /*tp_descr_get*/
   0, /*tp_descr_set*/
   0, /*tp_dictoffset*/
-  __pyx_MemviewEnum___init__, /*tp_init*/
+  0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_Enum, /*tp_new*/
+  __pyx_tp_new_memoryview, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -20557,76 +21006,66 @@ static PyTypeObject __pyx_type___pyx_MemviewEnum = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
-static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;
 
-static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
-  struct __pyx_memoryview_obj *p;
-  PyObject *o = (*t->tp_alloc)(t, 0);
-  if (!o) return 0;
-  p = ((struct __pyx_memoryview_obj *)o);
-  p->__pyx_vtab = __pyx_vtabptr_memoryview;
-  p->obj = Py_None; Py_INCREF(Py_None);
-  p->_size = Py_None; Py_INCREF(Py_None);
-  p->_array_interface = Py_None; Py_INCREF(Py_None);
-  p->view.obj = NULL;
-  if (__pyx_memoryview___cinit__(o, a, k) < 0) {
+static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
+  struct __pyx_array_obj *p;
+  PyObject *o;
+  o = (*t->tp_alloc)(t, 0);
+  if (unlikely(!o)) return 0;
+  p = ((struct __pyx_array_obj *)o);
+  p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
+  p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
+  if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) {
     Py_DECREF(o); o = 0;
   }
   return o;
 }
 
-static void __pyx_tp_dealloc_memoryview(PyObject *o) {
-  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
+static void __pyx_tp_dealloc_array(PyObject *o) {
+  struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
+  PyObject_GC_UnTrack(o);
   {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
     ++Py_REFCNT(o);
-    __pyx_memoryview___dealloc__(o);
+    __pyx_array___dealloc__(o);
     if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
     --Py_REFCNT(o);
     PyErr_Restore(etype, eval, etb);
   }
-  Py_CLEAR(p->obj);
-  Py_CLEAR(p->_size);
-  Py_CLEAR(p->_array_interface);
+  Py_CLEAR(p->mode);
+  Py_CLEAR(p->_format);
   (*Py_TYPE(o)->tp_free)(o);
 }
 
-static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_array(PyObject *o, visitproc v, void *a) {
   int e;
-  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
-  if (p->obj) {
-    e = (*v)(p->obj, a); if (e) return e;
-  }
-  if (p->_size) {
-    e = (*v)(p->_size, a); if (e) return e;
-  }
-  if (p->_array_interface) {
-    e = (*v)(p->_array_interface, a); if (e) return e;
+  struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
+  if (p->mode) {
+    e = (*v)(p->mode, a); if (e) return e;
   }
-  if (p->view.obj) {
-    e = (*v)(p->view.obj, a); if (e) return e;
+  if (p->_format) {
+    e = (*v)(p->_format, a); if (e) return e;
   }
   return 0;
 }
 
-static int __pyx_tp_clear_memoryview(PyObject *o) {
-  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
+static int __pyx_tp_clear_array(PyObject *o) {
+  struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
   PyObject* tmp;
-  tmp = ((PyObject*)p->obj);
-  p->obj = Py_None; Py_INCREF(Py_None);
-  Py_XDECREF(tmp);
-  tmp = ((PyObject*)p->_size);
-  p->_size = Py_None; Py_INCREF(Py_None);
+  tmp = ((PyObject*)p->mode);
+  p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
   Py_XDECREF(tmp);
-  tmp = ((PyObject*)p->_array_interface);
-  p->_array_interface = Py_None; Py_INCREF(Py_None);
+  tmp = ((PyObject*)p->_format);
+  p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
   Py_XDECREF(tmp);
-  Py_CLEAR(p->view.obj);
   return 0;
 }
-static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
+static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
   PyObject *r;
   PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
   r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
@@ -20634,9 +21073,9 @@ static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
   return r;
 }
 
-static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) {
+static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) {
   if (v) {
-    return __pyx_memoryview___setitem__(o, i, v);
+    return __pyx_array___setitem__(o, i, v);
   }
   else {
     PyErr_Format(PyExc_NotImplementedError,
@@ -20645,126 +21084,34 @@ static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject
   }
 }
 
-static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_transpose(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview__get__base(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_shape(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_strides(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_suboffsets(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_ndim(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_itemsize(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_nbytes(o);
+static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) {
+  PyObject *v = PyObject_GenericGetAttr(o, n);
+  if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
+    PyErr_Clear();
+    v = __pyx_array___getattr__(o, n);
+  }
+  return v;
 }
 
-static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_size(o);
+static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) {
+  return get_memview(o);
 }
 
-static PyMethodDef __pyx_methods_memoryview[] = {
-  {__Pyx_NAMESTR("is_c_contig"), (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, __Pyx_DOCSTR(0)},
-  {__Pyx_NAMESTR("is_f_contig"), (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, __Pyx_DOCSTR(0)},
-  {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, __Pyx_DOCSTR(0)},
-  {__Pyx_NAMESTR("copy_fortran"), (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, __Pyx_DOCSTR(0)},
+static PyMethodDef __pyx_methods_array[] = {
+  {__Pyx_NAMESTR("__getattr__"), (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, __Pyx_DOCSTR(0)},
   {0, 0, 0, 0}
 };
 
-static struct PyGetSetDef __pyx_getsets_memoryview[] = {
-  {(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, 0, 0},
-  {(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, 0, 0},
-  {(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, 0, 0},
-  {(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, 0, 0},
-  {(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, 0, 0},
-  {(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, 0, 0},
-  {(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, 0, 0},
-  {(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, 0, 0},
-  {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, 0, 0},
+static struct PyGetSetDef __pyx_getsets_array[] = {
+  {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, 0, 0},
   {0, 0, 0, 0, 0}
 };
 
-static PyNumberMethods __pyx_tp_as_number_memoryview = {
-  0, /*nb_add*/
-  0, /*nb_subtract*/
-  0, /*nb_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_divide*/
-  #endif
-  0, /*nb_remainder*/
-  0, /*nb_divmod*/
-  0, /*nb_power*/
-  0, /*nb_negative*/
-  0, /*nb_positive*/
-  0, /*nb_absolute*/
-  0, /*nb_nonzero*/
-  0, /*nb_invert*/
-  0, /*nb_lshift*/
-  0, /*nb_rshift*/
-  0, /*nb_and*/
-  0, /*nb_xor*/
-  0, /*nb_or*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_coerce*/
-  #endif
-  0, /*nb_int*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_long*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*nb_float*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_oct*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_hex*/
-  #endif
-  0, /*nb_inplace_add*/
-  0, /*nb_inplace_subtract*/
-  0, /*nb_inplace_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_inplace_divide*/
-  #endif
-  0, /*nb_inplace_remainder*/
-  0, /*nb_inplace_power*/
-  0, /*nb_inplace_lshift*/
-  0, /*nb_inplace_rshift*/
-  0, /*nb_inplace_and*/
-  0, /*nb_inplace_xor*/
-  0, /*nb_inplace_or*/
-  0, /*nb_floor_divide*/
-  0, /*nb_true_divide*/
-  0, /*nb_inplace_floor_divide*/
-  0, /*nb_inplace_true_divide*/
-  #if PY_VERSION_HEX >= 0x02050000
-  0, /*nb_index*/
-  #endif
-};
-
-static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
-  __pyx_memoryview___len__, /*sq_length*/
+static PySequenceMethods __pyx_tp_as_sequence_array = {
+  0, /*sq_length*/
   0, /*sq_concat*/
   0, /*sq_repeat*/
-  __pyx_sq_item_memoryview, /*sq_item*/
+  __pyx_sq_item_array, /*sq_item*/
   0, /*sq_slice*/
   0, /*sq_ass_item*/
   0, /*sq_ass_slice*/
@@ -20773,13 +21120,13 @@ static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
   0, /*sq_inplace_repeat*/
 };
 
-static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
-  __pyx_memoryview___len__, /*mp_length*/
-  __pyx_memoryview___getitem__, /*mp_subscript*/
-  __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/
+static PyMappingMethods __pyx_tp_as_mapping_array = {
+  0, /*mp_length*/
+  __pyx_array___getitem__, /*mp_subscript*/
+  __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/
 };
 
-static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
+static PyBufferProcs __pyx_tp_as_buffer_array = {
   #if PY_MAJOR_VERSION < 3
   0, /*bf_getreadbuffer*/
   #endif
@@ -20793,19 +21140,19 @@ static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
   0, /*bf_getcharbuffer*/
   #endif
   #if PY_VERSION_HEX >= 0x02060000
-  __pyx_memoryview_getbuffer, /*bf_getbuffer*/
+  __pyx_array_getbuffer, /*bf_getbuffer*/
   #endif
   #if PY_VERSION_HEX >= 0x02060000
   0, /*bf_releasebuffer*/
   #endif
 };
 
-static PyTypeObject __pyx_type___pyx_memoryview = {
+static PyTypeObject __pyx_type___pyx_array = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("splitBBox.memoryview"), /*tp_name*/
-  sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/
+  __Pyx_NAMESTR("splitBBox.array"), /*tp_name*/
+  sizeof(struct __pyx_array_obj), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_memoryview, /*tp_dealloc*/
+  __pyx_tp_dealloc_array, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -20814,27 +21161,27 @@ static PyTypeObject __pyx_type___pyx_memoryview = {
   #else
   0, /*reserved*/
   #endif
-  __pyx_memoryview___repr__, /*tp_repr*/
-  &__pyx_tp_as_number_memoryview, /*tp_as_number*/
-  &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/
+  0, /*tp_repr*/
+  0, /*tp_as_number*/
+  &__pyx_tp_as_sequence_array, /*tp_as_sequence*/
+  &__pyx_tp_as_mapping_array, /*tp_as_mapping*/
   0, /*tp_hash*/
   0, /*tp_call*/
-  __pyx_memoryview___str__, /*tp_str*/
-  0, /*tp_getattro*/
+  0, /*tp_str*/
+  __pyx_tp_getattro_array, /*tp_getattro*/
   0, /*tp_setattro*/
-  &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+  &__pyx_tp_as_buffer_array, /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
   0, /*tp_doc*/
-  __pyx_tp_traverse_memoryview, /*tp_traverse*/
-  __pyx_tp_clear_memoryview, /*tp_clear*/
+  __pyx_tp_traverse_array, /*tp_traverse*/
+  __pyx_tp_clear_array, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
   0, /*tp_iter*/
   0, /*tp_iternext*/
-  __pyx_methods_memoryview, /*tp_methods*/
+  __pyx_methods_array, /*tp_methods*/
   0, /*tp_members*/
-  __pyx_getsets_memoryview, /*tp_getset*/
+  __pyx_getsets_array, /*tp_getset*/
   0, /*tp_base*/
   0, /*tp_dict*/
   0, /*tp_descr_get*/
@@ -20842,7 +21189,105 @@ static PyTypeObject __pyx_type___pyx_memoryview = {
   0, /*tp_dictoffset*/
   0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_memoryview, /*tp_new*/
+  __pyx_tp_new_array, /*tp_new*/
+  0, /*tp_free*/
+  0, /*tp_is_gc*/
+  0, /*tp_bases*/
+  0, /*tp_mro*/
+  0, /*tp_cache*/
+  0, /*tp_subclasses*/
+  0, /*tp_weaklist*/
+  0, /*tp_del*/
+  #if PY_VERSION_HEX >= 0x02060000
+  0, /*tp_version_tag*/
+  #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
+};
+
+static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+  struct __pyx_MemviewEnum_obj *p;
+  PyObject *o;
+  o = (*t->tp_alloc)(t, 0);
+  if (unlikely(!o)) return 0;
+  p = ((struct __pyx_MemviewEnum_obj *)o);
+  p->name = Py_None; Py_INCREF(Py_None);
+  return o;
+}
+
+static void __pyx_tp_dealloc_Enum(PyObject *o) {
+  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
+  PyObject_GC_UnTrack(o);
+  Py_CLEAR(p->name);
+  (*Py_TYPE(o)->tp_free)(o);
+}
+
+static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) {
+  int e;
+  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
+  if (p->name) {
+    e = (*v)(p->name, a); if (e) return e;
+  }
+  return 0;
+}
+
+static int __pyx_tp_clear_Enum(PyObject *o) {
+  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
+  PyObject* tmp;
+  tmp = ((PyObject*)p->name);
+  p->name = Py_None; Py_INCREF(Py_None);
+  Py_XDECREF(tmp);
+  return 0;
+}
+
+static PyMethodDef __pyx_methods_Enum[] = {
+  {0, 0, 0, 0}
+};
+
+static PyTypeObject __pyx_type___pyx_MemviewEnum = {
+  PyVarObject_HEAD_INIT(0, 0)
+  __Pyx_NAMESTR("splitBBox.Enum"), /*tp_name*/
+  sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/
+  0, /*tp_itemsize*/
+  __pyx_tp_dealloc_Enum, /*tp_dealloc*/
+  0, /*tp_print*/
+  0, /*tp_getattr*/
+  0, /*tp_setattr*/
+  #if PY_MAJOR_VERSION < 3
+  0, /*tp_compare*/
+  #else
+  0, /*reserved*/
+  #endif
+  __pyx_MemviewEnum___repr__, /*tp_repr*/
+  0, /*tp_as_number*/
+  0, /*tp_as_sequence*/
+  0, /*tp_as_mapping*/
+  0, /*tp_hash*/
+  0, /*tp_call*/
+  0, /*tp_str*/
+  0, /*tp_getattro*/
+  0, /*tp_setattro*/
+  0, /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+  0, /*tp_doc*/
+  __pyx_tp_traverse_Enum, /*tp_traverse*/
+  __pyx_tp_clear_Enum, /*tp_clear*/
+  0, /*tp_richcompare*/
+  0, /*tp_weaklistoffset*/
+  0, /*tp_iter*/
+  0, /*tp_iternext*/
+  __pyx_methods_Enum, /*tp_methods*/
+  0, /*tp_members*/
+  0, /*tp_getset*/
+  0, /*tp_base*/
+  0, /*tp_dict*/
+  0, /*tp_descr_get*/
+  0, /*tp_descr_set*/
+  0, /*tp_dictoffset*/
+  __pyx_MemviewEnum___init__, /*tp_init*/
+  0, /*tp_alloc*/
+  __pyx_tp_new_Enum, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -20854,13 +21299,16 @@ static PyTypeObject __pyx_type___pyx_memoryview = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice;
 
 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) {
   struct __pyx_memoryviewslice_obj *p;
   PyObject *o = __pyx_tp_new_memoryview(t, a, k);
-  if (!o) return 0;
+  if (unlikely(!o)) return 0;
   p = ((struct __pyx_memoryviewslice_obj *)o);
   p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice;
   p->from_object = Py_None; Py_INCREF(Py_None);
@@ -20870,6 +21318,7 @@ static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyO
 
 static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) {
   struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
+  PyObject_GC_UnTrack(o);
   {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
@@ -20880,6 +21329,7 @@ static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) {
     PyErr_Restore(etype, eval, etb);
   }
   Py_CLEAR(p->from_object);
+  PyObject_GC_Track(o);
   __pyx_tp_dealloc_memoryview(o);
 }
 
@@ -20908,127 +21358,13 @@ static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UN
   return __pyx_memoryviewslice__get__base(o);
 }
 
-static PyMethodDef __pyx_methods__memoryviewslice[] = {
-  {0, 0, 0, 0}
-};
-
-static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = {
-  {(char *)"base", __pyx_getprop___pyx_memoryviewslice_base, 0, 0, 0},
-  {0, 0, 0, 0, 0}
-};
-
-static PyNumberMethods __pyx_tp_as_number__memoryviewslice = {
-  0, /*nb_add*/
-  0, /*nb_subtract*/
-  0, /*nb_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_divide*/
-  #endif
-  0, /*nb_remainder*/
-  0, /*nb_divmod*/
-  0, /*nb_power*/
-  0, /*nb_negative*/
-  0, /*nb_positive*/
-  0, /*nb_absolute*/
-  0, /*nb_nonzero*/
-  0, /*nb_invert*/
-  0, /*nb_lshift*/
-  0, /*nb_rshift*/
-  0, /*nb_and*/
-  0, /*nb_xor*/
-  0, /*nb_or*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_coerce*/
-  #endif
-  0, /*nb_int*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_long*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*nb_float*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_oct*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_hex*/
-  #endif
-  0, /*nb_inplace_add*/
-  0, /*nb_inplace_subtract*/
-  0, /*nb_inplace_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_inplace_divide*/
-  #endif
-  0, /*nb_inplace_remainder*/
-  0, /*nb_inplace_power*/
-  0, /*nb_inplace_lshift*/
-  0, /*nb_inplace_rshift*/
-  0, /*nb_inplace_and*/
-  0, /*nb_inplace_xor*/
-  0, /*nb_inplace_or*/
-  0, /*nb_floor_divide*/
-  0, /*nb_true_divide*/
-  0, /*nb_inplace_floor_divide*/
-  0, /*nb_inplace_true_divide*/
-  #if PY_VERSION_HEX >= 0x02050000
-  0, /*nb_index*/
-  #endif
-};
-
-static PySequenceMethods __pyx_tp_as_sequence__memoryviewslice = {
-  #if CYTHON_COMPILING_IN_PYPY
-  __pyx_memoryview___len__, /*sq_length*/
-  #else
-  0, /*sq_length*/
-  #endif
-  0, /*sq_concat*/
-  0, /*sq_repeat*/
-  0, /*sq_item*/
-  0, /*sq_slice*/
-  0, /*sq_ass_item*/
-  0, /*sq_ass_slice*/
-  0, /*sq_contains*/
-  0, /*sq_inplace_concat*/
-  0, /*sq_inplace_repeat*/
-};
-
-static PyMappingMethods __pyx_tp_as_mapping__memoryviewslice = {
-  #if CYTHON_COMPILING_IN_PYPY
-  __pyx_memoryview___len__, /*mp_length*/
-  #else
-  0, /*mp_length*/
-  #endif
-  #if CYTHON_COMPILING_IN_PYPY
-  __pyx_memoryview___getitem__, /*mp_subscript*/
-  #else
-  0, /*mp_subscript*/
-  #endif
-  0, /*mp_ass_subscript*/
+static PyMethodDef __pyx_methods__memoryviewslice[] = {
+  {0, 0, 0, 0}
 };
 
-static PyBufferProcs __pyx_tp_as_buffer__memoryviewslice = {
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getreadbuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getwritebuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getsegcount*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getcharbuffer*/
-  #endif
-  #if CYTHON_COMPILING_IN_PYPY
-  __pyx_memoryview_getbuffer, /*bf_getbuffer*/
-  #else
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_getbuffer*/
-  #endif
-  #endif
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_releasebuffer*/
-  #endif
+static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = {
+  {(char *)"base", __pyx_getprop___pyx_memoryviewslice_base, 0, 0, 0},
+  {0, 0, 0, 0, 0}
 };
 
 static PyTypeObject __pyx_type___pyx_memoryviewslice = {
@@ -21050,9 +21386,9 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = {
   #else
   0, /*tp_repr*/
   #endif
-  &__pyx_tp_as_number__memoryviewslice, /*tp_as_number*/
-  &__pyx_tp_as_sequence__memoryviewslice, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping__memoryviewslice, /*tp_as_mapping*/
+  0, /*tp_as_number*/
+  0, /*tp_as_sequence*/
+  0, /*tp_as_mapping*/
   0, /*tp_hash*/
   0, /*tp_call*/
   #if CYTHON_COMPILING_IN_PYPY
@@ -21062,8 +21398,8 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = {
   #endif
   0, /*tp_getattro*/
   0, /*tp_setattro*/
-  &__pyx_tp_as_buffer__memoryviewslice, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+  0, /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
   __Pyx_DOCSTR("Internal class for passing memoryview slices to Python"), /*tp_doc*/
   __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/
   __pyx_tp_clear__memoryviewslice, /*tp_clear*/
@@ -21093,6 +21429,9 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
 static PyMethodDef __pyx_methods[] = {
@@ -21101,7 +21440,11 @@ static PyMethodDef __pyx_methods[] = {
 
 #if PY_MAJOR_VERSION >= 3
 static struct PyModuleDef __pyx_moduledef = {
+  #if PY_VERSION_HEX < 0x03020000
+    { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
+  #else
     PyModuleDef_HEAD_INIT,
+  #endif
     __Pyx_NAMESTR("splitBBox"),
     0, /* m_doc */
     -1, /* m_size */
@@ -21152,11 +21495,15 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s__TypeError, __pyx_k__TypeError, sizeof(__pyx_k__TypeError), 0, 0, 1, 1},
   {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1},
   {&__pyx_n_s____class__, __pyx_k____class__, sizeof(__pyx_k____class__), 0, 0, 1, 1},
+  {&__pyx_n_s____import__, __pyx_k____import__, sizeof(__pyx_k____import__), 0, 0, 1, 1},
   {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
   {&__pyx_n_s____name__, __pyx_k____name__, sizeof(__pyx_k____name__), 0, 0, 1, 1},
   {&__pyx_n_s____pyx_getbuffer, __pyx_k____pyx_getbuffer, sizeof(__pyx_k____pyx_getbuffer), 0, 0, 1, 1},
+  {&__pyx_n_s____pyx_releasebuffer, __pyx_k____pyx_releasebuffer, sizeof(__pyx_k____pyx_releasebuffer), 0, 0, 1, 1},
+  {&__pyx_n_s____pyx_vtable__, __pyx_k____pyx_vtable__, sizeof(__pyx_k____pyx_vtable__), 0, 0, 1, 1},
   {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
   {&__pyx_n_s__allocate_buffer, __pyx_k__allocate_buffer, sizeof(__pyx_k__allocate_buffer), 0, 0, 1, 1},
+  {&__pyx_n_s__allow_pos0_neg, __pyx_k__allow_pos0_neg, sizeof(__pyx_k__allow_pos0_neg), 0, 0, 1, 1},
   {&__pyx_n_s__ascontiguousarray, __pyx_k__ascontiguousarray, sizeof(__pyx_k__ascontiguousarray), 0, 0, 1, 1},
   {&__pyx_n_s__base, __pyx_k__base, sizeof(__pyx_k__base), 0, 0, 1, 1},
   {&__pyx_n_s__bin, __pyx_k__bin, sizeof(__pyx_k__bin), 0, 0, 1, 1},
@@ -21170,6 +21517,8 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_b__c, __pyx_k__c, sizeof(__pyx_k__c), 0, 0, 0, 1},
   {&__pyx_n_s__c, __pyx_k__c, sizeof(__pyx_k__c), 0, 0, 1, 1},
   {&__pyx_n_u__c, __pyx_k__c, sizeof(__pyx_k__c), 0, 1, 0, 1},
+  {&__pyx_n_s__c0, __pyx_k__c0, sizeof(__pyx_k__c0), 0, 0, 1, 1},
+  {&__pyx_n_s__c1, __pyx_k__c1, sizeof(__pyx_k__c1), 0, 0, 1, 1},
   {&__pyx_n_s__cdark, __pyx_k__cdark, sizeof(__pyx_k__cdark), 0, 0, 1, 1},
   {&__pyx_n_s__cdata, __pyx_k__cdata, sizeof(__pyx_k__cdata), 0, 0, 1, 1},
   {&__pyx_n_s__cdummy, __pyx_k__cdummy, sizeof(__pyx_k__cdummy), 0, 0, 1, 1},
@@ -21177,13 +21526,18 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s__check_dummy, __pyx_k__check_dummy, sizeof(__pyx_k__check_dummy), 0, 0, 1, 1},
   {&__pyx_n_s__check_mask, __pyx_k__check_mask, sizeof(__pyx_k__check_mask), 0, 0, 1, 1},
   {&__pyx_n_s__check_pos1, __pyx_k__check_pos1, sizeof(__pyx_k__check_pos1), 0, 0, 1, 1},
+  {&__pyx_n_s__chiDiscAtPi, __pyx_k__chiDiscAtPi, sizeof(__pyx_k__chiDiscAtPi), 0, 0, 1, 1},
   {&__pyx_n_s__cmask, __pyx_k__cmask, sizeof(__pyx_k__cmask), 0, 0, 1, 1},
   {&__pyx_n_s__cpolarization, __pyx_k__cpolarization, sizeof(__pyx_k__cpolarization), 0, 0, 1, 1},
   {&__pyx_n_s__cpos0, __pyx_k__cpos0, sizeof(__pyx_k__cpos0), 0, 0, 1, 1},
   {&__pyx_n_s__cpos0_lower, __pyx_k__cpos0_lower, sizeof(__pyx_k__cpos0_lower), 0, 0, 1, 1},
   {&__pyx_n_s__cpos0_upper, __pyx_k__cpos0_upper, sizeof(__pyx_k__cpos0_upper), 0, 0, 1, 1},
   {&__pyx_n_s__cpos1, __pyx_k__cpos1, sizeof(__pyx_k__cpos1), 0, 0, 1, 1},
+  {&__pyx_n_s__cpos1_lower, __pyx_k__cpos1_lower, sizeof(__pyx_k__cpos1_lower), 0, 0, 1, 1},
+  {&__pyx_n_s__cpos1_upper, __pyx_k__cpos1_upper, sizeof(__pyx_k__cpos1_upper), 0, 0, 1, 1},
   {&__pyx_n_s__csolidangle, __pyx_k__csolidangle, sizeof(__pyx_k__csolidangle), 0, 0, 1, 1},
+  {&__pyx_n_s__d0, __pyx_k__d0, sizeof(__pyx_k__d0), 0, 0, 1, 1},
+  {&__pyx_n_s__d1, __pyx_k__d1, sizeof(__pyx_k__d1), 0, 0, 1, 1},
   {&__pyx_n_s__dark, __pyx_k__dark, sizeof(__pyx_k__dark), 0, 0, 1, 1},
   {&__pyx_n_s__data, __pyx_k__data, sizeof(__pyx_k__data), 0, 0, 1, 1},
   {&__pyx_n_s__ddummy, __pyx_k__ddummy, sizeof(__pyx_k__ddummy), 0, 0, 1, 1},
@@ -21238,6 +21592,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s__itemsize, __pyx_k__itemsize, sizeof(__pyx_k__itemsize), 0, 0, 1, 1},
   {&__pyx_n_s__j, __pyx_k__j, sizeof(__pyx_k__j), 0, 0, 1, 1},
   {&__pyx_n_s__linspace, __pyx_k__linspace, sizeof(__pyx_k__linspace), 0, 0, 1, 1},
+  {&__pyx_n_s__lower0, __pyx_k__lower0, sizeof(__pyx_k__lower0), 0, 0, 1, 1},
   {&__pyx_n_s__mask, __pyx_k__mask, sizeof(__pyx_k__mask), 0, 0, 1, 1},
   {&__pyx_n_s__max, __pyx_k__max, sizeof(__pyx_k__max), 0, 0, 1, 1},
   {&__pyx_n_s__max0, __pyx_k__max0, sizeof(__pyx_k__max0), 0, 0, 1, 1},
@@ -21286,22 +21641,22 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {0, 0, 0, 0, 0, 0, 0}
 };
 static int __Pyx_InitCachedBuiltins(void) {
-  __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_min = __Pyx_GetName(__pyx_b, __pyx_n_s__min); if (!__pyx_builtin_min) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_max = __Pyx_GetName(__pyx_b, __pyx_n_s__max); if (!__pyx_builtin_max) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_MemoryError = __Pyx_GetName(__pyx_b, __pyx_n_s__MemoryError); if (!__pyx_builtin_MemoryError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_enumerate = __Pyx_GetName(__pyx_b, __pyx_n_s__enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_Ellipsis = __Pyx_GetName(__pyx_b, __pyx_n_s__Ellipsis); if (!__pyx_builtin_Ellipsis) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_min = __Pyx_GetBuiltinName(__pyx_n_s__min); if (!__pyx_builtin_min) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_max = __Pyx_GetBuiltinName(__pyx_n_s__max); if (!__pyx_builtin_max) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s__MemoryError); if (!__pyx_builtin_MemoryError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s__enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s__Ellipsis); if (!__pyx_builtin_Ellipsis) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   #if PY_MAJOR_VERSION >= 3
-  __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   #else
-  __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__xrange); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s__xrange); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   #endif
-  __pyx_builtin_id = __Pyx_GetName(__pyx_b, __pyx_n_s__id); if (!__pyx_builtin_id) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_IndexError = __Pyx_GetName(__pyx_b, __pyx_n_s__IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s__id); if (!__pyx_builtin_id) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s__IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   return 0;
   __pyx_L1_error:;
   return -1;
@@ -21311,21 +21666,15 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
 
-  /* "splitBBox.pyx":258
+  /* "splitBBox.pyx":261
  *                 numpy.ndarray pos1 not None,
  *                 numpy.ndarray delta_pos1 not None,
  *                 bins=(100, 36),             # <<<<<<<<<<<<<<
  *                 pos0Range=None,
  *                 pos1Range=None,
  */
-  __pyx_k_tuple_1 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_1 = PyTuple_Pack(2, __pyx_int_100, __pyx_int_36); if (unlikely(!__pyx_k_tuple_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_1);
-  __Pyx_INCREF(__pyx_int_100);
-  PyTuple_SET_ITEM(__pyx_k_tuple_1, 0, __pyx_int_100);
-  __Pyx_GIVEREF(__pyx_int_100);
-  __Pyx_INCREF(__pyx_int_36);
-  PyTuple_SET_ITEM(__pyx_k_tuple_1, 1, __pyx_int_36);
-  __Pyx_GIVEREF(__pyx_int_36);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_1));
 
   /* "numpy.pxd":215
@@ -21335,11 +21684,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
  */
-  __pyx_k_tuple_3 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_3 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_2)); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_3);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_2));
-  PyTuple_SET_ITEM(__pyx_k_tuple_3, 0, ((PyObject *)__pyx_kp_u_2));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_2));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_3));
 
   /* "numpy.pxd":219
@@ -21349,11 +21695,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *             info.buf = PyArray_DATA(self)
  */
-  __pyx_k_tuple_5 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_5 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_4)); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_5);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_4));
-  PyTuple_SET_ITEM(__pyx_k_tuple_5, 0, ((PyObject *)__pyx_kp_u_4));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_4));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5));
 
   /* "numpy.pxd":257
@@ -21363,11 +21706,8 @@ static int __Pyx_InitCachedConstants(void) {
  *                 if   t == NPY_BYTE:        f = "b"
  *                 elif t == NPY_UBYTE:       f = "B"
  */
-  __pyx_k_tuple_7 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_7 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_6)); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_7);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_6));
-  PyTuple_SET_ITEM(__pyx_k_tuple_7, 0, ((PyObject *)__pyx_kp_u_6));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_6));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_7));
 
   /* "numpy.pxd":799
@@ -21377,11 +21717,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *         if ((child.byteorder == c'>' and little_endian) or
  */
-  __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_10 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_9)); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_10);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_9));
-  PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_kp_u_9));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_9));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10));
 
   /* "numpy.pxd":803
@@ -21391,11 +21728,8 @@ static int __Pyx_InitCachedConstants(void) {
  *             # One could encode it in the format string and have Cython
  *             # complain instead, BUT: < and > in format strings also imply
  */
-  __pyx_k_tuple_11 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_11 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_6)); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_11);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_6));
-  PyTuple_SET_ITEM(__pyx_k_tuple_11, 0, ((PyObject *)__pyx_kp_u_6));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_6));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11));
 
   /* "numpy.pxd":823
@@ -21405,11 +21739,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *             # Until ticket #99 is fixed, use integers to avoid warnings
  */
-  __pyx_k_tuple_13 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_13 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_12)); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_13);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_12));
-  PyTuple_SET_ITEM(__pyx_k_tuple_13, 0, ((PyObject *)__pyx_kp_u_12));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_12));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_13));
 
   /* "View.MemoryView":124
@@ -21419,11 +21750,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *         if self.itemsize <= 0:
  */
-  __pyx_k_tuple_15 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_15 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_14)); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_15);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_14));
-  PyTuple_SET_ITEM(__pyx_k_tuple_15, 0, ((PyObject *)__pyx_kp_s_14));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15));
 
   /* "View.MemoryView":127
@@ -21433,11 +21761,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *         encode = getattr(format, 'encode', None)
  */
-  __pyx_k_tuple_17 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_17 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_17);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_16));
-  PyTuple_SET_ITEM(__pyx_k_tuple_17, 0, ((PyObject *)__pyx_kp_s_16));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_16));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17));
 
   /* "View.MemoryView":131
@@ -21447,11 +21772,8 @@ static int __Pyx_InitCachedConstants(void) {
  *         self._format = format
  *         self.format = self._format
  */
-  __pyx_k_tuple_18 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_18 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__ASCII)); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_18);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__ASCII));
-  PyTuple_SET_ITEM(__pyx_k_tuple_18, 0, ((PyObject *)__pyx_n_s__ASCII));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ASCII));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18));
 
   /* "View.MemoryView":141
@@ -21461,11 +21783,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  * 
  */
-  __pyx_k_tuple_20 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_20)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_20 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_19)); if (unlikely(!__pyx_k_tuple_20)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_20);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_19));
-  PyTuple_SET_ITEM(__pyx_k_tuple_20, 0, ((PyObject *)__pyx_kp_s_19));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_19));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_20));
 
   /* "View.MemoryView":166
@@ -21475,11 +21794,8 @@ static int __Pyx_InitCachedConstants(void) {
  *         self.mode = mode
  * 
  */
-  __pyx_k_tuple_23 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_23)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_23 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__ASCII)); if (unlikely(!__pyx_k_tuple_23)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_23);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__ASCII));
-  PyTuple_SET_ITEM(__pyx_k_tuple_23, 0, ((PyObject *)__pyx_n_s__ASCII));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ASCII));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_23));
 
   /* "View.MemoryView":174
@@ -21489,11 +21805,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *             if self.dtype_is_object:
  */
-  __pyx_k_tuple_25 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_25)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_25 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_24)); if (unlikely(!__pyx_k_tuple_25)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_25);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_24));
-  PyTuple_SET_ITEM(__pyx_k_tuple_25, 0, ((PyObject *)__pyx_kp_s_24));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_24));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_25));
 
   /* "View.MemoryView":190
@@ -21503,11 +21816,8 @@ static int __Pyx_InitCachedConstants(void) {
  *         info.buf = self.data
  *         info.len = self.len
  */
-  __pyx_k_tuple_27 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_27)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_27 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_26)); if (unlikely(!__pyx_k_tuple_27)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_27);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_26));
-  PyTuple_SET_ITEM(__pyx_k_tuple_27, 0, ((PyObject *)__pyx_kp_s_26));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_26));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_27));
 
   /* "View.MemoryView":452
@@ -21517,11 +21827,8 @@ static int __Pyx_InitCachedConstants(void) {
  *         else:
  *             if len(self.view.format) == 1:
  */
-  __pyx_k_tuple_29 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_29)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_29 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_28)); if (unlikely(!__pyx_k_tuple_29)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_29);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_28));
-  PyTuple_SET_ITEM(__pyx_k_tuple_29, 0, ((PyObject *)__pyx_kp_s_28));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_28));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_29));
 
   /* "View.MemoryView":528
@@ -21531,11 +21838,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *             return tuple([self.view.strides[i] for i in xrange(self.view.ndim)])
  */
-  __pyx_k_tuple_31 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_31)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_31 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_30)); if (unlikely(!__pyx_k_tuple_31)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_31);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_30));
-  PyTuple_SET_ITEM(__pyx_k_tuple_31, 0, ((PyObject *)__pyx_kp_s_30));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_30));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_31));
 
   /* "View.MemoryView":643
@@ -21545,11 +21849,8 @@ static int __Pyx_InitCachedConstants(void) {
  *                 seen_ellipsis = True
  *             else:
  */
-  __pyx_k_tuple_34 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_34)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_34 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_k_tuple_34)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_34);
-  __Pyx_INCREF(Py_None);
-  PyTuple_SET_ITEM(__pyx_k_tuple_34, 0, Py_None);
-  __Pyx_GIVEREF(Py_None);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_34));
 
   /* "View.MemoryView":646
@@ -21559,11 +21860,8 @@ static int __Pyx_InitCachedConstants(void) {
  *             have_slices = True
  *         else:
  */
-  __pyx_k_tuple_35 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_35)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_35 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_k_tuple_35)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_35);
-  __Pyx_INCREF(Py_None);
-  PyTuple_SET_ITEM(__pyx_k_tuple_35, 0, Py_None);
-  __Pyx_GIVEREF(Py_None);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_35));
 
   /* "View.MemoryView":657
@@ -21573,11 +21871,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *     return have_slices or nslices, tuple(result)
  */
-  __pyx_k_tuple_37 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_37)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_37 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_k_tuple_37)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_37);
-  __Pyx_INCREF(Py_None);
-  PyTuple_SET_ITEM(__pyx_k_tuple_37, 0, Py_None);
-  __Pyx_GIVEREF(Py_None);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_37));
 
   /* "View.MemoryView":665
@@ -21587,447 +21882,33 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  * 
  */
-  __pyx_k_tuple_39 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_39)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_39 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_38)); if (unlikely(!__pyx_k_tuple_39)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_39);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_38));
-  PyTuple_SET_ITEM(__pyx_k_tuple_39, 0, ((PyObject *)__pyx_kp_s_38));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_38));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_39));
 
-  /* "splitBBox.pyx":49
+  /* "splitBBox.pyx":50
  * @cython.boundscheck(False)
  * @cython.wraparound(False)
  * def histoBBox1d(numpy.ndarray weights not None,             # <<<<<<<<<<<<<<
  *                 numpy.ndarray pos0 not None,
  *                 numpy.ndarray delta_pos0 not None,
  */
-  __pyx_k_tuple_47 = PyTuple_New(63); if (unlikely(!__pyx_k_tuple_47)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_47 = PyTuple_Pack(63, ((PyObject *)__pyx_n_s__weights), ((PyObject *)__pyx_n_s__pos0), ((PyObject *)__pyx_n_s__delta_pos0), ((PyObject *)__pyx_n_s__pos1), ((PyObject *)__pyx_n_s__delta_pos1), ((PyObject *)__pyx_n_s__bins), ((PyObject *)__pyx_n_s__pos0Range), ((PyObject *)__pyx_n_s__pos1Range), ((PyObject *)__pyx_n_s__dummy), ((PyObject *)__pyx_n_s__delta_dummy), ((PyObject *)__pyx_n_s__mask), ((PyObject *)__pyx_n_s__dark), ((PyObject *)__pyx_n_s__flat), ((PyObject *)__pyx [...]
   __Pyx_GOTREF(__pyx_k_tuple_47);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__weights));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 0, ((PyObject *)__pyx_n_s__weights));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__weights));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 1, ((PyObject *)__pyx_n_s__pos0));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__delta_pos0));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 2, ((PyObject *)__pyx_n_s__delta_pos0));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__delta_pos0));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 3, ((PyObject *)__pyx_n_s__pos1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__delta_pos1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 4, ((PyObject *)__pyx_n_s__delta_pos1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__delta_pos1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__bins));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 5, ((PyObject *)__pyx_n_s__bins));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bins));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0Range));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 6, ((PyObject *)__pyx_n_s__pos0Range));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0Range));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1Range));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 7, ((PyObject *)__pyx_n_s__pos1Range));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1Range));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__dummy));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 8, ((PyObject *)__pyx_n_s__dummy));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dummy));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__delta_dummy));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 9, ((PyObject *)__pyx_n_s__delta_dummy));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__delta_dummy));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__mask));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 10, ((PyObject *)__pyx_n_s__mask));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mask));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__dark));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 11, ((PyObject *)__pyx_n_s__dark));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dark));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__flat));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 12, ((PyObject *)__pyx_n_s__flat));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__flat));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__solidangle));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 13, ((PyObject *)__pyx_n_s__solidangle));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__solidangle));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__polarization));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 14, ((PyObject *)__pyx_n_s__polarization));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__polarization));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__size));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 15, ((PyObject *)__pyx_n_s__size));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__size));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__bin0_max));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 16, ((PyObject *)__pyx_n_s__bin0_max));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin0_max));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__bin0_min));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 17, ((PyObject *)__pyx_n_s__bin0_min));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin0_min));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__bin));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 18, ((PyObject *)__pyx_n_s__bin));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__data));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 19, ((PyObject *)__pyx_n_s__data));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__data));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__deltaR));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 20, ((PyObject *)__pyx_n_s__deltaR));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__deltaR));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__deltaL));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 21, ((PyObject *)__pyx_n_s__deltaL));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__deltaL));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__deltaA));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 22, ((PyObject *)__pyx_n_s__deltaA));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__deltaA));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__p1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 23, ((PyObject *)__pyx_n_s__p1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__p1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__epsilon));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 24, ((PyObject *)__pyx_n_s__epsilon));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__epsilon));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cdummy));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 25, ((PyObject *)__pyx_n_s__cdummy));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cdummy));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__ddummy));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 26, ((PyObject *)__pyx_n_s__ddummy));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ddummy));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0_min));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 27, ((PyObject *)__pyx_n_s__pos0_min));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0_min));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0_max));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 28, ((PyObject *)__pyx_n_s__pos0_max));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0_max));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0_maxin));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 29, ((PyObject *)__pyx_n_s__pos0_maxin));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0_maxin));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1_min));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 30, ((PyObject *)__pyx_n_s__pos1_min));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1_min));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1_max));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 31, ((PyObject *)__pyx_n_s__pos1_max));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1_max));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1_maxin));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 32, ((PyObject *)__pyx_n_s__pos1_maxin));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1_maxin));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__min0));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 33, ((PyObject *)__pyx_n_s__min0));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__min0));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__max0));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 34, ((PyObject *)__pyx_n_s__max0));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__max0));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__fbin0_min));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 35, ((PyObject *)__pyx_n_s__fbin0_min));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fbin0_min));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__fbin0_max));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 36, ((PyObject *)__pyx_n_s__fbin0_max));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fbin0_max));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__check_pos1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 37, ((PyObject *)__pyx_n_s__check_pos1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__check_pos1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__check_mask));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 38, ((PyObject *)__pyx_n_s__check_mask));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__check_mask));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__check_dummy));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 39, ((PyObject *)__pyx_n_s__check_dummy));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__check_dummy));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__do_dark));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 40, ((PyObject *)__pyx_n_s__do_dark));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__do_dark));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__do_flat));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 41, ((PyObject *)__pyx_n_s__do_flat));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__do_flat));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__do_polarization));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 42, ((PyObject *)__pyx_n_s__do_polarization));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__do_polarization));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__do_solidangle));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 43, ((PyObject *)__pyx_n_s__do_solidangle));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__do_solidangle));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cdata));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 44, ((PyObject *)__pyx_n_s__cdata));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cdata));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cpos0));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 45, ((PyObject *)__pyx_n_s__cpos0));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cpos0));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__dpos0));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 46, ((PyObject *)__pyx_n_s__dpos0));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dpos0));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cpos1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 47, ((PyObject *)__pyx_n_s__cpos1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cpos1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__dpos1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 48, ((PyObject *)__pyx_n_s__dpos1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dpos1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cpos0_lower));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 49, ((PyObject *)__pyx_n_s__cpos0_lower));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cpos0_lower));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cpos0_upper));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 50, ((PyObject *)__pyx_n_s__cpos0_upper));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cpos0_upper));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cmask));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 51, ((PyObject *)__pyx_n_s__cmask));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cmask));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cflat));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 52, ((PyObject *)__pyx_n_s__cflat));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cflat));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cdark));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 53, ((PyObject *)__pyx_n_s__cdark));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cdark));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cpolarization));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 54, ((PyObject *)__pyx_n_s__cpolarization));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cpolarization));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__csolidangle));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 55, ((PyObject *)__pyx_n_s__csolidangle));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__csolidangle));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__outData));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 56, ((PyObject *)__pyx_n_s__outData));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outData));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__outCount));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 57, ((PyObject *)__pyx_n_s__outCount));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outCount));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__outMerge));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 58, ((PyObject *)__pyx_n_s__outMerge));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outMerge));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 59, ((PyObject *)__pyx_n_s__idx));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__delta));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 60, ((PyObject *)__pyx_n_s__delta));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__delta));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__outPos));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 61, ((PyObject *)__pyx_n_s__outPos));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outPos));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 62, ((PyObject *)__pyx_n_s__i));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_47));
-  __pyx_k_codeobj_48 = (PyObject*)__Pyx_PyCode_New(15, 0, 63, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_47, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_49, __pyx_n_s__histoBBox1d, 49, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_48)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_codeobj_48 = (PyObject*)__Pyx_PyCode_New(15, 0, 63, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_47, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_49, __pyx_n_s__histoBBox1d, 50, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_48)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "splitBBox.pyx":253
+  /* "splitBBox.pyx":256
  * @cython.boundscheck(False)
  * @cython.wraparound(False)
  * def histoBBox2d(numpy.ndarray weights not None,             # <<<<<<<<<<<<<<
  *                 numpy.ndarray pos0 not None,
  *                 numpy.ndarray delta_pos0 not None,
  */
-  __pyx_k_tuple_50 = PyTuple_New(74); if (unlikely(!__pyx_k_tuple_50)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_50 = PyTuple_Pack(83, ((PyObject *)__pyx_n_s__weights), ((PyObject *)__pyx_n_s__pos0), ((PyObject *)__pyx_n_s__delta_pos0), ((PyObject *)__pyx_n_s__pos1), ((PyObject *)__pyx_n_s__delta_pos1), ((PyObject *)__pyx_n_s__bins), ((PyObject *)__pyx_n_s__pos0Range), ((PyObject *)__pyx_n_s__pos1Range), ((PyObject *)__pyx_n_s__dummy), ((PyObject *)__pyx_n_s__delta_dummy), ((PyObject *)__pyx_n_s__mask), ((PyObject *)__pyx_n_s__dark), ((PyObject *)__pyx_n_s__flat), ((PyObject *)__pyx [...]
   __Pyx_GOTREF(__pyx_k_tuple_50);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__weights));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 0, ((PyObject *)__pyx_n_s__weights));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__weights));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 1, ((PyObject *)__pyx_n_s__pos0));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__delta_pos0));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 2, ((PyObject *)__pyx_n_s__delta_pos0));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__delta_pos0));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 3, ((PyObject *)__pyx_n_s__pos1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__delta_pos1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 4, ((PyObject *)__pyx_n_s__delta_pos1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__delta_pos1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__bins));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 5, ((PyObject *)__pyx_n_s__bins));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bins));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0Range));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 6, ((PyObject *)__pyx_n_s__pos0Range));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0Range));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1Range));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 7, ((PyObject *)__pyx_n_s__pos1Range));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1Range));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__dummy));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 8, ((PyObject *)__pyx_n_s__dummy));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dummy));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__delta_dummy));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 9, ((PyObject *)__pyx_n_s__delta_dummy));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__delta_dummy));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__mask));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 10, ((PyObject *)__pyx_n_s__mask));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mask));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__dark));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 11, ((PyObject *)__pyx_n_s__dark));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dark));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__flat));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 12, ((PyObject *)__pyx_n_s__flat));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__flat));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__solidangle));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 13, ((PyObject *)__pyx_n_s__solidangle));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__solidangle));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__polarization));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 14, ((PyObject *)__pyx_n_s__polarization));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__polarization));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__bins0));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 15, ((PyObject *)__pyx_n_s__bins0));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bins0));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__bins1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 16, ((PyObject *)__pyx_n_s__bins1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bins1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 17, ((PyObject *)__pyx_n_s__i));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 18, ((PyObject *)__pyx_n_s__j));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 19, ((PyObject *)__pyx_n_s__idx));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__size));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 20, ((PyObject *)__pyx_n_s__size));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__size));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cdata));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 21, ((PyObject *)__pyx_n_s__cdata));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cdata));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cpos0));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 22, ((PyObject *)__pyx_n_s__cpos0));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cpos0));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__dpos0));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 23, ((PyObject *)__pyx_n_s__dpos0));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dpos0));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cpos1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 24, ((PyObject *)__pyx_n_s__cpos1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cpos1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__dpos1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 25, ((PyObject *)__pyx_n_s__dpos1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dpos1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cpos0_upper));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 26, ((PyObject *)__pyx_n_s__cpos0_upper));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cpos0_upper));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cpos0_lower));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 27, ((PyObject *)__pyx_n_s__cpos0_lower));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cpos0_lower));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__outData));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 28, ((PyObject *)__pyx_n_s__outData));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outData));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__outCount));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 29, ((PyObject *)__pyx_n_s__outCount));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outCount));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__outMerge));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 30, ((PyObject *)__pyx_n_s__outMerge));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outMerge));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__min0));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 31, ((PyObject *)__pyx_n_s__min0));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__min0));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__max0));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 32, ((PyObject *)__pyx_n_s__max0));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__max0));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__min1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 33, ((PyObject *)__pyx_n_s__min1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__min1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__max1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 34, ((PyObject *)__pyx_n_s__max1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__max1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__deltaR));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 35, ((PyObject *)__pyx_n_s__deltaR));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__deltaR));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__deltaL));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 36, ((PyObject *)__pyx_n_s__deltaL));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__deltaL));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__deltaU));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 37, ((PyObject *)__pyx_n_s__deltaU));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__deltaU));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__deltaD));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 38, ((PyObject *)__pyx_n_s__deltaD));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__deltaD));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__deltaA));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 39, ((PyObject *)__pyx_n_s__deltaA));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__deltaA));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__tmp));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 40, ((PyObject *)__pyx_n_s__tmp));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tmp));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__delta0));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 41, ((PyObject *)__pyx_n_s__delta0));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__delta0));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__delta1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 42, ((PyObject *)__pyx_n_s__delta1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__delta1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0_min));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 43, ((PyObject *)__pyx_n_s__pos0_min));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0_min));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0_max));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 44, ((PyObject *)__pyx_n_s__pos0_max));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0_max));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1_min));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 45, ((PyObject *)__pyx_n_s__pos1_min));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1_min));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1_max));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 46, ((PyObject *)__pyx_n_s__pos1_max));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1_max));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0_maxin));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 47, ((PyObject *)__pyx_n_s__pos0_maxin));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0_maxin));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1_maxin));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 48, ((PyObject *)__pyx_n_s__pos1_maxin));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1_maxin));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__fbin0_min));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 49, ((PyObject *)__pyx_n_s__fbin0_min));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fbin0_min));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__fbin0_max));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 50, ((PyObject *)__pyx_n_s__fbin0_max));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fbin0_max));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__fbin1_min));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 51, ((PyObject *)__pyx_n_s__fbin1_min));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fbin1_min));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__fbin1_max));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 52, ((PyObject *)__pyx_n_s__fbin1_max));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fbin1_max));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__data));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 53, ((PyObject *)__pyx_n_s__data));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__data));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__epsilon));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 54, ((PyObject *)__pyx_n_s__epsilon));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__epsilon));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cdummy));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 55, ((PyObject *)__pyx_n_s__cdummy));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cdummy));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__ddummy));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 56, ((PyObject *)__pyx_n_s__ddummy));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ddummy));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__bin0_max));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 57, ((PyObject *)__pyx_n_s__bin0_max));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin0_max));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__bin0_min));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 58, ((PyObject *)__pyx_n_s__bin0_min));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin0_min));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__bin1_max));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 59, ((PyObject *)__pyx_n_s__bin1_max));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin1_max));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__bin1_min));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 60, ((PyObject *)__pyx_n_s__bin1_min));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin1_min));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__check_mask));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 61, ((PyObject *)__pyx_n_s__check_mask));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__check_mask));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__check_dummy));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 62, ((PyObject *)__pyx_n_s__check_dummy));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__check_dummy));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__do_dark));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 63, ((PyObject *)__pyx_n_s__do_dark));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__do_dark));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__do_flat));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 64, ((PyObject *)__pyx_n_s__do_flat));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__do_flat));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__do_polarization));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 65, ((PyObject *)__pyx_n_s__do_polarization));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__do_polarization));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__do_solidangle));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 66, ((PyObject *)__pyx_n_s__do_solidangle));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__do_solidangle));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cmask));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 67, ((PyObject *)__pyx_n_s__cmask));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cmask));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cflat));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 68, ((PyObject *)__pyx_n_s__cflat));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cflat));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cdark));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 69, ((PyObject *)__pyx_n_s__cdark));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cdark));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cpolarization));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 70, ((PyObject *)__pyx_n_s__cpolarization));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cpolarization));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__csolidangle));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 71, ((PyObject *)__pyx_n_s__csolidangle));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__csolidangle));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__edges0));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 72, ((PyObject *)__pyx_n_s__edges0));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__edges0));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__edges1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 73, ((PyObject *)__pyx_n_s__edges1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__edges1));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_50));
-  __pyx_k_codeobj_51 = (PyObject*)__Pyx_PyCode_New(15, 0, 74, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_50, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_49, __pyx_n_s__histoBBox2d, 253, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_51)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_codeobj_51 = (PyObject*)__Pyx_PyCode_New(17, 0, 83, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_50, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_49, __pyx_n_s__histoBBox2d, 256, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_51)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   /* "View.MemoryView":282
  *         return self.name
@@ -22036,11 +21917,8 @@ static int __Pyx_InitCachedConstants(void) {
  * cdef strided = Enum("<strided and direct>") # default
  * cdef indirect = Enum("<strided and indirect>")
  */
-  __pyx_k_tuple_54 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_54)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_54 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_53)); if (unlikely(!__pyx_k_tuple_54)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_54);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_53));
-  PyTuple_SET_ITEM(__pyx_k_tuple_54, 0, ((PyObject *)__pyx_kp_s_53));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_53));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_54));
 
   /* "View.MemoryView":283
@@ -22050,11 +21928,8 @@ static int __Pyx_InitCachedConstants(void) {
  * cdef indirect = Enum("<strided and indirect>")
  * 
  */
-  __pyx_k_tuple_56 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_56)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_56 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_55)); if (unlikely(!__pyx_k_tuple_56)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_56);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_55));
-  PyTuple_SET_ITEM(__pyx_k_tuple_56, 0, ((PyObject *)__pyx_kp_s_55));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_55));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_56));
 
   /* "View.MemoryView":284
@@ -22064,11 +21939,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  * 
  */
-  __pyx_k_tuple_58 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_58)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_58 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_57)); if (unlikely(!__pyx_k_tuple_58)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_58);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_57));
-  PyTuple_SET_ITEM(__pyx_k_tuple_58, 0, ((PyObject *)__pyx_kp_s_57));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_57));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_58));
 
   /* "View.MemoryView":287
@@ -22078,11 +21950,8 @@ static int __Pyx_InitCachedConstants(void) {
  * cdef indirect_contiguous = Enum("<contiguous and indirect>")
  * 
  */
-  __pyx_k_tuple_60 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_60)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_60 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_59)); if (unlikely(!__pyx_k_tuple_60)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_60);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_59));
-  PyTuple_SET_ITEM(__pyx_k_tuple_60, 0, ((PyObject *)__pyx_kp_s_59));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_59));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_60));
 
   /* "View.MemoryView":288
@@ -22092,11 +21961,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  * 
  */
-  __pyx_k_tuple_62 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_62)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_62 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_61)); if (unlikely(!__pyx_k_tuple_62)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_62);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_61));
-  PyTuple_SET_ITEM(__pyx_k_tuple_62, 0, ((PyObject *)__pyx_kp_s_61));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_61));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_62));
   __Pyx_RefNannyFinishContext();
   return 0;
@@ -22129,6 +21995,9 @@ PyMODINIT_FUNC PyInit_splitBBox(void)
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
   PyObject *__pyx_t_3 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannyDeclarations
   #if CYTHON_REFNANNY
   __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
@@ -22166,6 +22035,16 @@ PyMODINIT_FUNC PyInit_splitBBox(void)
   __pyx_m = PyModule_Create(&__pyx_moduledef);
   #endif
   if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  Py_INCREF(__pyx_d);
+  #if PY_MAJOR_VERSION >= 3
+  {
+    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (!PyDict_GetItemString(modules, "splitBBox")) {
+      if (unlikely(PyDict_SetItemString(modules, "splitBBox", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    }
+  }
+  #endif
   __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   #if CYTHON_COMPILING_IN_PYPY
   Py_INCREF(__pyx_b);
@@ -22173,6 +22052,9 @@ PyMODINIT_FUNC PyInit_splitBBox(void)
   if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
   /*--- Initialize various global constants etc. ---*/
   if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
+  if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  #endif
   if (__pyx_module_is_main_splitBBox) {
     if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
   }
@@ -22189,12 +22071,6 @@ PyMODINIT_FUNC PyInit_splitBBox(void)
   /*--- Variable export code ---*/
   /*--- Function export code ---*/
   /*--- Type init code ---*/
-  if (PyType_Ready(&__pyx_type___pyx_array) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "array", (PyObject *)&__pyx_type___pyx_array) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_array_type = &__pyx_type___pyx_array;
-  if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "Enum", (PyObject *)&__pyx_type___pyx_MemviewEnum) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
   __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview;
   __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer;
   __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice;
@@ -22205,8 +22081,11 @@ PyMODINIT_FUNC PyInit_splitBBox(void)
   __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object;
   if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "memoryview", (PyObject *)&__pyx_type___pyx_memoryview) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_memoryview_type = &__pyx_type___pyx_memoryview;
+  if (PyType_Ready(&__pyx_type___pyx_array) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_array_type = &__pyx_type___pyx_array;
+  if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
   __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice;
   __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview;
   __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object;
@@ -22214,7 +22093,6 @@ PyMODINIT_FUNC PyInit_splitBBox(void)
   __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type;
   if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "_memoryviewslice", (PyObject *)&__pyx_type___pyx_memoryviewslice) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice;
   /*--- Type import code ---*/
   __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", 
@@ -22237,71 +22115,80 @@ PyMODINIT_FUNC PyInit_splitBBox(void)
  * import cython
  * cimport numpy
  * import numpy             # <<<<<<<<<<<<<<
- * from libc.math cimport fabs
- * 
+ * from libc.math cimport fabs, M_PI
+ * cdef float pi=<float> M_PI
  */
   __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__numpy, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s__numpy, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "splitBBox.pyx":33
- * from libc.math cimport fabs
+  /* "splitBBox.pyx":32
+ * import numpy
+ * from libc.math cimport fabs, M_PI
+ * cdef float pi=<float> M_PI             # <<<<<<<<<<<<<<
+ * 
+ * EPS32 = (1 + numpy.finfo(numpy.float32).eps)
+ */
+  __pyx_v_9splitBBox_pi = ((float)M_PI);
+
+  /* "splitBBox.pyx":34
+ * cdef float pi=<float> M_PI
  * 
  * EPS32 = (1 + numpy.finfo(numpy.float32).eps)             # <<<<<<<<<<<<<<
  * 
  * @cython.cdivision(True)
  */
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__finfo); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__finfo); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__float32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyTuple_New(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);
   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
   __Pyx_GIVEREF(__pyx_t_3);
   __pyx_t_3 = 0;
-  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__eps); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__eps); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = PyNumber_Add(__pyx_int_1, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyNumber_Add(__pyx_int_1, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__EPS32, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s__EPS32, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
-  /* "splitBBox.pyx":49
+  /* "splitBBox.pyx":50
  * @cython.boundscheck(False)
  * @cython.wraparound(False)
  * def histoBBox1d(numpy.ndarray weights not None,             # <<<<<<<<<<<<<<
  *                 numpy.ndarray pos0 not None,
  *                 numpy.ndarray delta_pos0 not None,
  */
-  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_9splitBBox_1histoBBox1d, NULL, __pyx_n_s__splitBBox); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_9splitBBox_1histoBBox1d, NULL, __pyx_n_s__splitBBox); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__histoBBox1d, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s__histoBBox1d, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
-  /* "splitBBox.pyx":253
+  /* "splitBBox.pyx":256
  * @cython.boundscheck(False)
  * @cython.wraparound(False)
  * def histoBBox2d(numpy.ndarray weights not None,             # <<<<<<<<<<<<<<
  *                 numpy.ndarray pos0 not None,
  *                 numpy.ndarray delta_pos0 not None,
  */
-  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_9splitBBox_3histoBBox2d, NULL, __pyx_n_s__splitBBox); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_9splitBBox_3histoBBox2d, NULL, __pyx_n_s__splitBBox); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__histoBBox2d, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s__histoBBox2d, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
   /* "splitBBox.pyx":1
@@ -22311,7 +22198,7 @@ PyMODINIT_FUNC PyInit_splitBBox(void)
  */
   __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s____test__, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
 
   /* "View.MemoryView":207
@@ -22337,9 +22224,8 @@ PyMODINIT_FUNC PyInit_splitBBox(void)
   __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_54), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_XGOTREF(generic);
-  __Pyx_DECREF(generic);
+  __Pyx_DECREF_SET(generic, __pyx_t_3);
   __Pyx_GIVEREF(__pyx_t_3);
-  generic = __pyx_t_3;
   __pyx_t_3 = 0;
 
   /* "View.MemoryView":283
@@ -22352,9 +22238,8 @@ PyMODINIT_FUNC PyInit_splitBBox(void)
   __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_56), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_XGOTREF(strided);
-  __Pyx_DECREF(strided);
+  __Pyx_DECREF_SET(strided, __pyx_t_3);
   __Pyx_GIVEREF(__pyx_t_3);
-  strided = __pyx_t_3;
   __pyx_t_3 = 0;
 
   /* "View.MemoryView":284
@@ -22367,9 +22252,8 @@ PyMODINIT_FUNC PyInit_splitBBox(void)
   __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_58), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_XGOTREF(indirect);
-  __Pyx_DECREF(indirect);
+  __Pyx_DECREF_SET(indirect, __pyx_t_3);
   __Pyx_GIVEREF(__pyx_t_3);
-  indirect = __pyx_t_3;
   __pyx_t_3 = 0;
 
   /* "View.MemoryView":287
@@ -22382,9 +22266,8 @@ PyMODINIT_FUNC PyInit_splitBBox(void)
   __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_60), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_XGOTREF(contiguous);
-  __Pyx_DECREF(contiguous);
+  __Pyx_DECREF_SET(contiguous, __pyx_t_3);
   __Pyx_GIVEREF(__pyx_t_3);
-  contiguous = __pyx_t_3;
   __pyx_t_3 = 0;
 
   /* "View.MemoryView":288
@@ -22397,9 +22280,8 @@ PyMODINIT_FUNC PyInit_splitBBox(void)
   __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_62), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_XGOTREF(indirect_contiguous);
-  __Pyx_DECREF(indirect_contiguous);
+  __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_3);
   __Pyx_GIVEREF(__pyx_t_3);
-  indirect_contiguous = __pyx_t_3;
   __pyx_t_3 = 0;
 
   /* "View.MemoryView":503
@@ -22472,17 +22354,15 @@ end:
 }
 #endif /* CYTHON_REFNANNY */
 
-static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
-    PyObject *result;
-    result = PyObject_GetAttr(dict, name);
-    if (!result) {
-        if (dict != __pyx_b) {
-            PyErr_Clear();
-            result = PyObject_GetAttr(__pyx_b, name);
-        }
-        if (!result) {
-            PyErr_SetObject(PyExc_NameError, name);
-        }
+static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
+    PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
+    if (unlikely(!result)) {
+        PyErr_Format(PyExc_NameError,
+#if PY_MAJOR_VERSION >= 3
+            "name '%U' is not defined", name);
+#else
+            "name '%s' is not defined", PyString_AS_STRING(name));
+#endif
     }
     return result;
 }
@@ -22646,6 +22526,23 @@ static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed
     return 0;
 }
 
+static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
+    PyObject *result;
+#if CYTHON_COMPILING_IN_CPYTHON
+    result = PyDict_GetItem(__pyx_d, name);
+    if (result) {
+        Py_INCREF(result);
+    } else {
+#else
+    result = PyObject_GetItem(__pyx_d, name);
+    if (!result) {
+        PyErr_Clear();
+#endif
+        result = __Pyx_GetBuiltinName(name);
+    }
+    return result;
+}
+
 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
     if (unlikely(!type)) {
         PyErr_Format(PyExc_SystemError, "Missing type object");
@@ -23211,217 +23108,54 @@ static double __Pyx__PyObject_AsDouble(PyObject* obj) {
 #if CYTHON_COMPILING_IN_PYPY
     float_value = PyNumber_Float(obj);
 #else
-    if (Py_TYPE(obj)->tp_as_number && Py_TYPE(obj)->tp_as_number->nb_float) {
-        return PyFloat_AsDouble(obj);
+    PyNumberMethods *nb = Py_TYPE(obj)->tp_as_number;
+    if (likely(nb) && likely(nb->nb_float)) {
+        float_value = nb->nb_float(obj);
+        if (likely(float_value) && unlikely(!PyFloat_Check(float_value))) {
+            PyErr_Format(PyExc_TypeError,
+                "__float__ returned non-float (type %.200s)",
+                Py_TYPE(float_value)->tp_name);
+            Py_DECREF(float_value);
+            goto bad;
+        }
     } else if (PyUnicode_CheckExact(obj) || PyBytes_CheckExact(obj)) {
 #if PY_MAJOR_VERSION >= 3
-        float_value = PyFloat_FromString(obj);
-#else
-        float_value = PyFloat_FromString(obj, 0);
-#endif
-    } else {
-        PyObject* args = PyTuple_New(1);
-        if (unlikely(!args)) goto bad;
-        PyTuple_SET_ITEM(args, 0, obj);
-        float_value = PyObject_Call((PyObject*)&PyFloat_Type, args, 0);
-        PyTuple_SET_ITEM(args, 0, 0);
-        Py_DECREF(args);
-    }
-#endif
-    if (likely(float_value)) {
-        double value = PyFloat_AS_DOUBLE(float_value);
-        Py_DECREF(float_value);
-        return value;
-    }
-bad:
-    return (double)-1;
-}
-
-static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
-    PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
-}
-
-static void __Pyx_RaiseUnboundMemoryviewSliceNogil(const char *varname) {
-    #ifdef WITH_THREAD
-    PyGILState_STATE gilstate = PyGILState_Ensure();
-    #endif
-    __Pyx_RaiseUnboundLocalError(varname);
-    #ifdef WITH_THREAD
-    PyGILState_Release(gilstate);
-    #endif
-}
-
-static int
-__pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b)
-{
-    int i;
-    if (!a || !b)
-        return 0;
-    if (a == b)
-        return 1;
-    if (a->size != b->size || a->typegroup != b->typegroup ||
-            a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) {
-        if (a->typegroup == 'H' || b->typegroup == 'H') {
-            return a->size == b->size;
-        } else {
-            return 0;
-        }
-    }
-    if (a->ndim) {
-        for (i = 0; i < a->ndim; i++)
-            if (a->arraysize[i] != b->arraysize[i])
-                return 0;
-    }
-    if (a->typegroup == 'S') {
-        if (a->flags != b->flags)
-            return 0;
-        if (a->fields || b->fields) {
-            if (!(a->fields && b->fields))
-                return 0;
-            for (i = 0; a->fields[i].type && b->fields[i].type; i++) {
-                __Pyx_StructField *field_a = a->fields + i;
-                __Pyx_StructField *field_b = b->fields + i;
-                if (field_a->offset != field_b->offset ||
-                    !__pyx_typeinfo_cmp(field_a->type, field_b->type))
-                    return 0;
-            }
-            return !a->fields[i].type && !b->fields[i].type;
-        }
-    }
-    return 1;
-}
-
-static int __Pyx_ValidateAndInit_memviewslice(
-                int *axes_specs,
-                int c_or_f_flag,
-                int buf_flags,
-                int ndim,
-                __Pyx_TypeInfo *dtype,
-                __Pyx_BufFmt_StackElem stack[],
-                __Pyx_memviewslice *memviewslice,
-                PyObject *original_obj)
-{
-    struct __pyx_memoryview_obj *memview, *new_memview;
-    __Pyx_RefNannyDeclarations
-    Py_buffer *buf;
-    int i, spec = 0, retval = -1;
-    __Pyx_BufFmt_Context ctx;
-    int from_memoryview = __pyx_memoryview_check(original_obj);
-    __Pyx_RefNannySetupContext("ValidateAndInit_memviewslice", 0);
-    if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((struct __pyx_memoryview_obj *)
-                                                            original_obj)->typeinfo)) {
-        memview = (struct __pyx_memoryview_obj *) original_obj;
-        new_memview = NULL;
-    } else {
-        memview = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
-                                            original_obj, buf_flags, 0, dtype);
-        new_memview = memview;
-        if (unlikely(!memview))
-            goto fail;
-    }
-    buf = &memview->view;
-    if (buf->ndim != ndim) {
-        PyErr_Format(PyExc_ValueError,
-                "Buffer has wrong number of dimensions (expected %d, got %d)",
-                ndim, buf->ndim);
-        goto fail;
-    }
-    if (new_memview) {
-        __Pyx_BufFmt_Init(&ctx, stack, dtype);
-        if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
-    }
-    if ((unsigned)buf->itemsize != dtype->size) {
-        PyErr_Format(PyExc_ValueError,
-                     "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "u byte%s) "
-                     "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "u byte%s)",
-                     buf->itemsize,
-                     (buf->itemsize > 1) ? "s" : "",
-                     dtype->name,
-                     dtype->size,
-                     (dtype->size > 1) ? "s" : "");
-        goto fail;
-    }
-    if (!buf->strides) {
-        PyErr_SetString(PyExc_ValueError,
-            "buffer does not supply strides necessary for memoryview.");
-        goto fail;
-    }
-    for(i=0; i<ndim; i++) {
-        spec = axes_specs[i];
-        if (spec & __Pyx_MEMVIEW_CONTIG) {
-            if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) {
-                if (buf->strides[i] != sizeof(void *)) {
-                    PyErr_Format(PyExc_ValueError,
-                        "Buffer is not indirectly contiguous in dimension %d.", i);
-                    goto fail;
-                }
-            } else if (buf->strides[i] != buf->itemsize) {
-                PyErr_SetString(PyExc_ValueError,
-                    "Buffer and memoryview are not contiguous in the same dimension.");
-                goto fail;
-            }
-        }
-        if (spec & __Pyx_MEMVIEW_FOLLOW) {
-            Py_ssize_t stride = buf->strides[i];
-            if (stride < 0)
-                stride = -stride;
-            if (stride < buf->itemsize) {
-                PyErr_SetString(PyExc_ValueError,
-                    "Buffer and memoryview are not contiguous in the same dimension.");
-                goto fail;
-            }
-        }
-        /* Todo: without PyBUF_INDIRECT we may not have suboffset information, i.e., the
-           ptr may not be set to NULL but may be uninitialized? */
-        if (spec & __Pyx_MEMVIEW_DIRECT) {
-            if (buf->suboffsets && buf->suboffsets[i] >= 0) {
-                PyErr_Format(PyExc_ValueError,
-                    "Buffer not compatible with direct access in dimension %d.", i);
-                goto fail;
-            }
-        }
-        if (spec & __Pyx_MEMVIEW_PTR) {
-            if (!buf->suboffsets || (buf->suboffsets && buf->suboffsets[i] < 0)) {
-                PyErr_Format(PyExc_ValueError,
-                    "Buffer is not indirectly accessisble in dimension %d.", i);
-                goto fail;
-            }
-        }
-    }
-    if (c_or_f_flag & __Pyx_IS_F_CONTIG) {
-        Py_ssize_t stride = 1;
-        for(i=0; i<ndim; i++) {
-            if(stride * buf->itemsize != buf->strides[i]) {
-                PyErr_SetString(PyExc_ValueError,
-                    "Buffer not fortran contiguous.");
-                goto fail;
-            }
-            stride = stride * buf->shape[i];
-        }
-    } else if (c_or_f_flag & __Pyx_IS_C_CONTIG) {
-        Py_ssize_t stride = 1;
-        for(i=ndim-1; i>-1; i--) {
-            if(stride * buf->itemsize != buf->strides[i]) {
-                PyErr_SetString(PyExc_ValueError,
-                    "Buffer not C contiguous.");
-                goto fail;
-            }
-            stride = stride * buf->shape[i];
-        }
+        float_value = PyFloat_FromString(obj);
+#else
+        float_value = PyFloat_FromString(obj, 0);
+#endif
+    } else {
+        PyObject* args = PyTuple_New(1);
+        if (unlikely(!args)) goto bad;
+        PyTuple_SET_ITEM(args, 0, obj);
+        float_value = PyObject_Call((PyObject*)&PyFloat_Type, args, 0);
+        PyTuple_SET_ITEM(args, 0, 0);
+        Py_DECREF(args);
     }
-    if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice,
-                                         new_memview != NULL) == -1)) {
-        goto fail;
+#endif
+    if (likely(float_value)) {
+        double value = PyFloat_AS_DOUBLE(float_value);
+        Py_DECREF(float_value);
+        return value;
     }
-    retval = 0;
-    goto no_fail;
-fail:
-    Py_XDECREF(new_memview);
-    retval = -1;
-no_fail:
-    __Pyx_RefNannyFinishContext();
-    return retval;
+bad:
+    return (double)-1;
+}
+
+static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
+    PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
+}
+
+static void __Pyx_RaiseUnboundMemoryviewSliceNogil(const char *varname) {
+    #ifdef WITH_THREAD
+    PyGILState_STATE gilstate = PyGILState_Ensure();
+    #endif
+    __Pyx_RaiseUnboundLocalError(varname);
+    #ifdef WITH_THREAD
+    PyGILState_Release(gilstate);
+    #endif
 }
+
 static int
 __Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview,
                         int ndim,
@@ -23441,8 +23175,18 @@ __Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview,
             "memviewslice is already initialized!");
         goto fail;
     }
+    if (buf->strides) {
+        for (i = 0; i < ndim; i++) {
+            memviewslice->strides[i] = buf->strides[i];
+        }
+    } else {
+        Py_ssize_t stride = buf->itemsize;
+        for (i = ndim - 1; i >= 0; i--) {
+            memviewslice->strides[i] = stride;
+            stride *= buf->shape[i];
+        }
+    }
     for (i = 0; i < ndim; i++) {
-        memviewslice->strides[i] = buf->strides[i];
         memviewslice->shape[i]   = buf->shape[i];
         if (buf->suboffsets) {
             memviewslice->suboffsets[i] = buf->suboffsets[i];
@@ -23733,24 +23477,23 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
         }
         value = type;
         #if PY_VERSION_HEX < 0x02050000
-            if (PyInstance_Check(type)) {
-                type = (PyObject*) ((PyInstanceObject*)type)->in_class;
-                Py_INCREF(type);
-            }
-            else {
-                type = 0;
-                PyErr_SetString(PyExc_TypeError,
-                    "raise: exception must be an old-style class or instance");
-                goto raise_error;
-            }
-        #else
-            type = (PyObject*) Py_TYPE(type);
+        if (PyInstance_Check(type)) {
+            type = (PyObject*) ((PyInstanceObject*)type)->in_class;
             Py_INCREF(type);
-            if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
-                PyErr_SetString(PyExc_TypeError,
-                    "raise: exception class must be a subclass of BaseException");
-                goto raise_error;
-            }
+        } else {
+            type = 0;
+            PyErr_SetString(PyExc_TypeError,
+                "raise: exception must be an old-style class or instance");
+            goto raise_error;
+        }
+        #else
+        type = (PyObject*) Py_TYPE(type);
+        Py_INCREF(type);
+        if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
+            PyErr_SetString(PyExc_TypeError,
+                "raise: exception class must be a subclass of BaseException");
+            goto raise_error;
+        }
         #endif
     }
     __Pyx_ErrRestore(type, value, tb);
@@ -23782,46 +23525,62 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject
         value = type;
         type = (PyObject*) Py_TYPE(value);
     } else if (PyExceptionClass_Check(type)) {
-        PyObject *args;
-        if (!value)
-            args = PyTuple_New(0);
-        else if (PyTuple_Check(value)) {
-            Py_INCREF(value);
-            args = value;
+        PyObject *instance_class = NULL;
+        if (value && PyExceptionInstance_Check(value)) {
+            instance_class = (PyObject*) Py_TYPE(value);
+            if (instance_class != type) {
+                if (PyObject_IsSubclass(instance_class, type)) {
+                    type = instance_class;
+                } else {
+                    instance_class = NULL;
+                }
+            }
         }
-        else
-            args = PyTuple_Pack(1, value);
-        if (!args)
-            goto bad;
-        owned_instance = PyEval_CallObject(type, args);
-        Py_DECREF(args);
-        if (!owned_instance)
-            goto bad;
-        value = owned_instance;
-        if (!PyExceptionInstance_Check(value)) {
-            PyErr_Format(PyExc_TypeError,
-                         "calling %R should have returned an instance of "
-                         "BaseException, not %R",
-                         type, Py_TYPE(value));
-            goto bad;
+        if (!instance_class) {
+            PyObject *args;
+            if (!value)
+                args = PyTuple_New(0);
+            else if (PyTuple_Check(value)) {
+                Py_INCREF(value);
+                args = value;
+            } else
+                args = PyTuple_Pack(1, value);
+            if (!args)
+                goto bad;
+            owned_instance = PyObject_Call(type, args, NULL);
+            Py_DECREF(args);
+            if (!owned_instance)
+                goto bad;
+            value = owned_instance;
+            if (!PyExceptionInstance_Check(value)) {
+                PyErr_Format(PyExc_TypeError,
+                             "calling %R should have returned an instance of "
+                             "BaseException, not %R",
+                             type, Py_TYPE(value));
+                goto bad;
+            }
         }
     } else {
         PyErr_SetString(PyExc_TypeError,
             "raise: exception class must be a subclass of BaseException");
         goto bad;
     }
+#if PY_VERSION_HEX >= 0x03030000
+    if (cause) {
+#else
     if (cause && cause != Py_None) {
+#endif
         PyObject *fixed_cause;
-        if (PyExceptionClass_Check(cause)) {
+        if (cause == Py_None) {
+            fixed_cause = NULL;
+        } else if (PyExceptionClass_Check(cause)) {
             fixed_cause = PyObject_CallObject(cause, NULL);
             if (fixed_cause == NULL)
                 goto bad;
-        }
-        else if (PyExceptionInstance_Check(cause)) {
+        } else if (PyExceptionInstance_Check(cause)) {
             fixed_cause = cause;
             Py_INCREF(fixed_cause);
-        }
-        else {
+        } else {
             PyErr_SetString(PyExc_TypeError,
                             "exception causes must derive from "
                             "BaseException");
@@ -23845,8 +23604,20 @@ bad:
 }
 #endif
 
+static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
+#if CYTHON_COMPILING_IN_CPYTHON
+#if PY_MAJOR_VERSION >= 3
+    if (likely(PyUnicode_Check(n)))
+#else
+    if (likely(PyString_Check(n)))
+#endif
+        return __Pyx_PyObject_GetAttrStr(o, n);
+#endif
+    return PyObject_GetAttr(o, n);
+}
+
 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
-    PyObject *r = PyObject_GetAttr(o, n);
+    PyObject *r = __Pyx_GetAttr(o, n);
     if (!r) {
         if (!PyErr_ExceptionMatches(PyExc_AttributeError))
             goto bad;
@@ -23938,6 +23709,84 @@ static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
     }
 }
 
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
+    PyObject *r;
+    if (!j) return NULL;
+    r = PyObject_GetItem(o, j);
+    Py_DECREF(j);
+    return r;
+}
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
+                                                              int wraparound, int boundscheck) {
+#if CYTHON_COMPILING_IN_CPYTHON
+    if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o);
+    if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
+        PyObject *r = PyList_GET_ITEM(o, i);
+        Py_INCREF(r);
+        return r;
+    }
+    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+#else
+    return PySequence_GetItem(o, i);
+#endif
+}
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
+                                                              int wraparound, int boundscheck) {
+#if CYTHON_COMPILING_IN_CPYTHON
+    if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o);
+    if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
+        PyObject *r = PyTuple_GET_ITEM(o, i);
+        Py_INCREF(r);
+        return r;
+    }
+    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+#else
+    return PySequence_GetItem(o, i);
+#endif
+}
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
+                                                     int is_list, int wraparound, int boundscheck) {
+#if CYTHON_COMPILING_IN_CPYTHON
+    if (is_list || PyList_CheckExact(o)) {
+        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
+        if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) {
+            PyObject *r = PyList_GET_ITEM(o, n);
+            Py_INCREF(r);
+            return r;
+        }
+    }
+    else if (PyTuple_CheckExact(o)) {
+        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
+        if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
+            PyObject *r = PyTuple_GET_ITEM(o, n);
+            Py_INCREF(r);
+            return r;
+        }
+    } else {
+        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
+        if (likely(m && m->sq_item)) {
+            if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
+                Py_ssize_t l = m->sq_length(o);
+                if (likely(l >= 0)) {
+                    i += l;
+                } else {
+                    if (PyErr_ExceptionMatches(PyExc_OverflowError))
+                        PyErr_Clear();
+                    else
+                        return NULL;
+                }
+            }
+            return m->sq_item(o, i);
+        }
+    }
+#else
+    if (is_list || PySequence_Check(o)) {
+        return PySequence_GetItem(o, i);
+    }
+#endif
+    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+}
+
 static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
     long q = a / b;
     long r = a - q*b;
@@ -23945,6 +23794,42 @@ static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
     return q;
 }
 
+static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
+                                  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename) {
+    PyObject *old_exc, *old_val, *old_tb;
+    PyObject *ctx;
+    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
+    #if PY_MAJOR_VERSION < 3
+    ctx = PyString_FromString(name);
+    #else
+    ctx = PyUnicode_FromString(name);
+    #endif
+    __Pyx_ErrRestore(old_exc, old_val, old_tb);
+    if (!ctx) {
+        PyErr_WriteUnraisable(Py_None);
+    } else {
+        PyErr_WriteUnraisable(ctx);
+        Py_DECREF(ctx);
+    }
+}
+
+static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
+#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
+    PyObject *ob = PyCapsule_New(vtable, 0, 0);
+#else
+    PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
+#endif
+    if (!ob)
+        goto bad;
+    if (PyDict_SetItem(dict, __pyx_n_s____pyx_vtable__, ob) < 0)
+        goto bad;
+    Py_DECREF(ob);
+    return 0;
+bad:
+    Py_XDECREF(ob);
+    return -1;
+}
+
 static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
 #if CYTHON_COMPILING_IN_CPYTHON
     PyThreadState *tstate = PyThreadState_GET();
@@ -23978,7 +23863,6 @@ static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb)
 
 #if PY_MAJOR_VERSION < 3
 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
-    CYTHON_UNUSED PyObject *getbuffer_cobj;
   #if PY_VERSION_HEX >= 0x02060000
     if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
   #endif
@@ -23986,21 +23870,18 @@ static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
         if (PyObject_TypeCheck(obj, __pyx_array_type)) return __pyx_array_getbuffer(obj, view, flags);
         if (PyObject_TypeCheck(obj, __pyx_memoryview_type)) return __pyx_memoryview_getbuffer(obj, view, flags);
   #if PY_VERSION_HEX < 0x02060000
-    if (obj->ob_type->tp_dict &&
-        (getbuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict,
-                                             "__pyx_getbuffer"))) {
-        getbufferproc func;
-      #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0)
-        func = (getbufferproc) PyCapsule_GetPointer(getbuffer_cobj, "getbuffer(obj, view, flags)");
-      #else
-        func = (getbufferproc) PyCObject_AsVoidPtr(getbuffer_cobj);
-      #endif
-        Py_DECREF(getbuffer_cobj);
-        if (!func)
-            goto fail;
-        return func(obj, view, flags);
-    } else {
-        PyErr_Clear();
+    if (obj->ob_type->tp_dict) {
+        PyObject *getbuffer_cobj = PyObject_GetItem(
+            obj->ob_type->tp_dict, __pyx_n_s____pyx_getbuffer);
+        if (getbuffer_cobj) {
+            getbufferproc func = (getbufferproc) PyCObject_AsVoidPtr(getbuffer_cobj);
+            Py_DECREF(getbuffer_cobj);
+            if (!func)
+                goto fail;
+            return func(obj, view, flags);
+        } else {
+            PyErr_Clear();
+        }
     }
   #endif
     PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
@@ -24011,7 +23892,6 @@ fail:
 }
 static void __Pyx_ReleaseBuffer(Py_buffer *view) {
     PyObject *obj = view->obj;
-    CYTHON_UNUSED PyObject *releasebuffer_cobj;
     if (!obj) return;
   #if PY_VERSION_HEX >= 0x02060000
     if (PyObject_CheckBuffer(obj)) {
@@ -24021,22 +23901,19 @@ static void __Pyx_ReleaseBuffer(Py_buffer *view) {
   #endif
         if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) { __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view); return; }
   #if PY_VERSION_HEX < 0x02060000
-    if (obj->ob_type->tp_dict &&
-        (releasebuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict,
-                                                      "__pyx_releasebuffer"))) {
-        releasebufferproc func;
-      #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0)
-        func = (releasebufferproc) PyCapsule_GetPointer(releasebuffer_cobj, "releasebuffer(obj, view)");
-      #else
-        func = (releasebufferproc) PyCObject_AsVoidPtr(releasebuffer_cobj);
-      #endif
-        Py_DECREF(releasebuffer_cobj);
-        if (!func)
-            goto fail;
-        func(obj, view);
-        return;
-    } else {
-        PyErr_Clear();
+    if (obj->ob_type->tp_dict) {
+        PyObject *releasebuffer_cobj = PyObject_GetItem(
+            obj->ob_type->tp_dict, __pyx_n_s____pyx_releasebuffer);
+        if (releasebuffer_cobj) {
+            releasebufferproc func = (releasebufferproc) PyCObject_AsVoidPtr(releasebuffer_cobj);
+            Py_DECREF(releasebuffer_cobj);
+            if (!func)
+                goto fail;
+            func(obj, view);
+            return;
+        } else {
+            PyErr_Clear();
+        }
     }
   #endif
     goto nofail;
@@ -24051,16 +23928,18 @@ nofail:
 #endif /*  PY_MAJOR_VERSION < 3 */
 
 
-      static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) {
-    PyObject *py_import = 0;
+          static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
     PyObject *empty_list = 0;
     PyObject *module = 0;
     PyObject *global_dict = 0;
     PyObject *empty_dict = 0;
     PyObject *list;
-    py_import = __Pyx_GetAttrString(__pyx_b, "__import__");
+    #if PY_VERSION_HEX < 0x03030000
+    PyObject *py_import;
+    py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s____import__);
     if (!py_import)
         goto bad;
+    #endif
     if (from_list)
         list = from_list;
     else {
@@ -24080,13 +23959,17 @@ nofail:
         #if PY_MAJOR_VERSION >= 3
         if (level == -1) {
             if (strchr(__Pyx_MODULE_NAME, '.')) {
-                /* try package relative import first */
+                #if PY_VERSION_HEX < 0x03030000
                 PyObject *py_level = PyInt_FromLong(1);
                 if (!py_level)
                     goto bad;
                 module = PyObject_CallFunctionObjArgs(py_import,
                     name, global_dict, empty_dict, list, py_level, NULL);
                 Py_DECREF(py_level);
+                #else
+                module = PyImport_ImportModuleLevelObject(
+                    name, global_dict, empty_dict, list, 1);
+                #endif
                 if (!module) {
                     if (!PyErr_ExceptionMatches(PyExc_ImportError))
                         goto bad;
@@ -24097,12 +23980,17 @@ nofail:
         }
         #endif
         if (!module) {
+            #if PY_VERSION_HEX < 0x03030000
             PyObject *py_level = PyInt_FromLong(level);
             if (!py_level)
                 goto bad;
             module = PyObject_CallFunctionObjArgs(py_import,
                 name, global_dict, empty_dict, list, py_level, NULL);
             Py_DECREF(py_level);
+            #else
+            module = PyImport_ImportModuleLevelObject(
+                name, global_dict, empty_dict, list, level);
+            #endif
         }
     }
     #else
@@ -24114,8 +24002,10 @@ nofail:
         name, global_dict, empty_dict, list, NULL);
     #endif
 bad:
-    Py_XDECREF(empty_list);
+    #if PY_VERSION_HEX < 0x03030000
     Py_XDECREF(py_import);
+    #endif
+    Py_XDECREF(empty_list);
     Py_XDECREF(empty_dict);
     return module;
 }
@@ -24471,7 +24361,7 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
     }
     __Pyx_GOTREF(shape_tuple);
     for(i = 0; i < ndim; i++) {
-        temp_int = PyInt_FromLong(from_mvs->shape[i]);
+        temp_int = PyInt_FromSsize_t(from_mvs->shape[i]);
         if(unlikely(!temp_int)) {
             goto fail;
         } else {
@@ -24509,7 +24399,7 @@ no_fail:
 }
 
 static CYTHON_INLINE PyObject *
-__pyx_capsule_create(void *p, const char *sig)
+__pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig)
 {
     PyObject *cobj;
 #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0)
@@ -24710,10 +24600,15 @@ static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) {
     return (int)__Pyx_PyInt_AsLong(x);
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
     const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -24726,6 +24621,16 @@ static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(unsigned long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (unsigned long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to unsigned long");
@@ -24733,6 +24638,17 @@ static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
             }
             return (unsigned long)PyLong_AsUnsignedLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(unsigned long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(unsigned long) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(unsigned long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (unsigned long)PyLong_AsLong(x);
         }
     } else {
@@ -24745,10 +24661,15 @@ static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
     }
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
     const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -24761,6 +24682,16 @@ static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObje
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to unsigned PY_LONG_LONG");
@@ -24768,6 +24699,17 @@ static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObje
             }
             return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x);
         }
     } else {
@@ -24780,10 +24722,15 @@ static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObje
     }
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
     const long neg_one = (long)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -24796,6 +24743,16 @@ static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to long");
@@ -24803,6 +24760,17 @@ static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
             }
             return (long)PyLong_AsUnsignedLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(long) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (long)PyLong_AsLong(x);
         }
     } else {
@@ -24815,10 +24783,15 @@ static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
     }
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
     const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -24831,6 +24804,16 @@ static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to PY_LONG_LONG");
@@ -24838,6 +24821,17 @@ static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
             }
             return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (PY_LONG_LONG)PyLong_AsLongLong(x);
         }
     } else {
@@ -24850,10 +24844,15 @@ static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
     }
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
     const signed long neg_one = (signed long)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -24866,6 +24865,16 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(signed long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (signed long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to signed long");
@@ -24873,6 +24882,17 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
             }
             return (signed long)PyLong_AsUnsignedLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(signed long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(signed long) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(signed long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (signed long)PyLong_AsLong(x);
         }
     } else {
@@ -24885,10 +24905,15 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
     }
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
     const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -24901,6 +24926,16 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject*
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to signed PY_LONG_LONG");
@@ -24908,6 +24943,17 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject*
             }
             return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (signed PY_LONG_LONG)PyLong_AsLongLong(x);
         }
     } else {
@@ -24920,6 +24966,227 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject*
     }
 }
 
+static int
+__pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b)
+{
+    int i;
+    if (!a || !b)
+        return 0;
+    if (a == b)
+        return 1;
+    if (a->size != b->size || a->typegroup != b->typegroup ||
+            a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) {
+        if (a->typegroup == 'H' || b->typegroup == 'H') {
+            return a->size == b->size;
+        } else {
+            return 0;
+        }
+    }
+    if (a->ndim) {
+        for (i = 0; i < a->ndim; i++)
+            if (a->arraysize[i] != b->arraysize[i])
+                return 0;
+    }
+    if (a->typegroup == 'S') {
+        if (a->flags != b->flags)
+            return 0;
+        if (a->fields || b->fields) {
+            if (!(a->fields && b->fields))
+                return 0;
+            for (i = 0; a->fields[i].type && b->fields[i].type; i++) {
+                __Pyx_StructField *field_a = a->fields + i;
+                __Pyx_StructField *field_b = b->fields + i;
+                if (field_a->offset != field_b->offset ||
+                    !__pyx_typeinfo_cmp(field_a->type, field_b->type))
+                    return 0;
+            }
+            return !a->fields[i].type && !b->fields[i].type;
+        }
+    }
+    return 1;
+}
+
+static int
+__pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec)
+{
+    if (buf->shape[dim] <= 1)
+        return 1;
+    if (buf->strides) {
+        if (spec & __Pyx_MEMVIEW_CONTIG) {
+            if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) {
+                if (buf->strides[dim] != sizeof(void *)) {
+                    PyErr_Format(PyExc_ValueError,
+                                 "Buffer is not indirectly contiguous "
+                                 "in dimension %d.", dim);
+                    goto fail;
+                }
+            } else if (buf->strides[dim] != buf->itemsize) {
+                PyErr_SetString(PyExc_ValueError,
+                                "Buffer and memoryview are not contiguous "
+                                "in the same dimension.");
+                goto fail;
+            }
+        }
+        if (spec & __Pyx_MEMVIEW_FOLLOW) {
+            Py_ssize_t stride = buf->strides[dim];
+            if (stride < 0)
+                stride = -stride;
+            if (stride < buf->itemsize) {
+                PyErr_SetString(PyExc_ValueError,
+                                "Buffer and memoryview are not contiguous "
+                                "in the same dimension.");
+                goto fail;
+            }
+        }
+    } else {
+        if (spec & __Pyx_MEMVIEW_CONTIG && dim != ndim - 1) {
+            PyErr_Format(PyExc_ValueError,
+                         "C-contiguous buffer is not contiguous in "
+                         "dimension %d", dim);
+            goto fail;
+        } else if (spec & (__Pyx_MEMVIEW_PTR)) {
+            PyErr_Format(PyExc_ValueError,
+                         "C-contiguous buffer is not indirect in "
+                         "dimension %d", dim);
+            goto fail;
+        } else if (buf->suboffsets) {
+            PyErr_SetString(PyExc_ValueError,
+                            "Buffer exposes suboffsets but no strides");
+            goto fail;
+        }
+    }
+    return 1;
+fail:
+    return 0;
+}
+static int
+__pyx_check_suboffsets(Py_buffer *buf, int dim, CYTHON_UNUSED int ndim, int spec)
+{
+    if (spec & __Pyx_MEMVIEW_DIRECT) {
+        if (buf->suboffsets && buf->suboffsets[dim] >= 0) {
+            PyErr_Format(PyExc_ValueError,
+                         "Buffer not compatible with direct access "
+                         "in dimension %d.", dim);
+            goto fail;
+        }
+    }
+    if (spec & __Pyx_MEMVIEW_PTR) {
+        if (!buf->suboffsets || (buf->suboffsets && buf->suboffsets[dim] < 0)) {
+            PyErr_Format(PyExc_ValueError,
+                         "Buffer is not indirectly accessisble "
+                         "in dimension %d.", dim);
+            goto fail;
+        }
+    }
+    return 1;
+fail:
+    return 0;
+}
+static int
+__pyx_verify_contig(Py_buffer *buf, int ndim, int c_or_f_flag)
+{
+    int i;
+    if (c_or_f_flag & __Pyx_IS_F_CONTIG) {
+        Py_ssize_t stride = 1;
+        for (i = 0; i < ndim; i++) {
+            if (stride * buf->itemsize != buf->strides[i] &&
+                    buf->shape[i] > 1)
+            {
+                PyErr_SetString(PyExc_ValueError,
+                    "Buffer not fortran contiguous.");
+                goto fail;
+            }
+            stride = stride * buf->shape[i];
+        }
+    } else if (c_or_f_flag & __Pyx_IS_C_CONTIG) {
+        Py_ssize_t stride = 1;
+        for (i = ndim - 1; i >- 1; i--) {
+            if (stride * buf->itemsize != buf->strides[i] &&
+                    buf->shape[i] > 1) {
+                PyErr_SetString(PyExc_ValueError,
+                    "Buffer not C contiguous.");
+                goto fail;
+            }
+            stride = stride * buf->shape[i];
+        }
+    }
+    return 1;
+fail:
+    return 0;
+}
+static int __Pyx_ValidateAndInit_memviewslice(
+                int *axes_specs,
+                int c_or_f_flag,
+                int buf_flags,
+                int ndim,
+                __Pyx_TypeInfo *dtype,
+                __Pyx_BufFmt_StackElem stack[],
+                __Pyx_memviewslice *memviewslice,
+                PyObject *original_obj)
+{
+    struct __pyx_memoryview_obj *memview, *new_memview;
+    __Pyx_RefNannyDeclarations
+    Py_buffer *buf;
+    int i, spec = 0, retval = -1;
+    __Pyx_BufFmt_Context ctx;
+    int from_memoryview = __pyx_memoryview_check(original_obj);
+    __Pyx_RefNannySetupContext("ValidateAndInit_memviewslice", 0);
+    if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((struct __pyx_memoryview_obj *)
+                                                            original_obj)->typeinfo)) {
+        memview = (struct __pyx_memoryview_obj *) original_obj;
+        new_memview = NULL;
+    } else {
+        memview = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
+                                            original_obj, buf_flags, 0, dtype);
+        new_memview = memview;
+        if (unlikely(!memview))
+            goto fail;
+    }
+    buf = &memview->view;
+    if (buf->ndim != ndim) {
+        PyErr_Format(PyExc_ValueError,
+                "Buffer has wrong number of dimensions (expected %d, got %d)",
+                ndim, buf->ndim);
+        goto fail;
+    }
+    if (new_memview) {
+        __Pyx_BufFmt_Init(&ctx, stack, dtype);
+        if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
+    }
+    if ((unsigned) buf->itemsize != dtype->size) {
+        PyErr_Format(PyExc_ValueError,
+                     "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "u byte%s) "
+                     "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "u byte%s)",
+                     buf->itemsize,
+                     (buf->itemsize > 1) ? "s" : "",
+                     dtype->name,
+                     dtype->size,
+                     (dtype->size > 1) ? "s" : "");
+        goto fail;
+    }
+    for (i = 0; i < ndim; i++) {
+        spec = axes_specs[i];
+        if (!__pyx_check_strides(buf, i, ndim, spec))
+            goto fail;
+        if (!__pyx_check_suboffsets(buf, i, ndim, spec))
+            goto fail;
+    }
+    if (buf->strides && !__pyx_verify_contig(buf, ndim, c_or_f_flag))
+        goto fail;
+    if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice,
+                                         new_memview != NULL) == -1)) {
+        goto fail;
+    }
+    retval = 0;
+    goto no_fail;
+fail:
+    Py_XDECREF(new_memview);
+    retval = -1;
+no_fail:
+    __Pyx_RefNannyFinishContext();
+    return retval;
+}
+
 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int8_t(PyObject *obj) {
     __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
     __Pyx_BufFmt_StackElem stack[1];
@@ -24964,25 +25231,6 @@ __pyx_fail:
     return result;
 }
 
-static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
-                                  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename) {
-    PyObject *old_exc, *old_val, *old_tb;
-    PyObject *ctx;
-    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
-    #if PY_MAJOR_VERSION < 3
-    ctx = PyString_FromString(name);
-    #else
-    ctx = PyUnicode_FromString(name);
-    #endif
-    __Pyx_ErrRestore(old_exc, old_val, old_tb);
-    if (!ctx) {
-        PyErr_WriteUnraisable(Py_None);
-    } else {
-        PyErr_WriteUnraisable(ctx);
-        Py_DECREF(ctx);
-    }
-}
-
 static int __Pyx_check_binary_version(void) {
     char ctversion[4], rtversion[4];
     PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
@@ -25002,23 +25250,6 @@ static int __Pyx_check_binary_version(void) {
     return 0;
 }
 
-static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
-#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
-    PyObject *ob = PyCapsule_New(vtable, 0, 0);
-#else
-    PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
-#endif
-    if (!ob)
-        goto bad;
-    if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0)
-        goto bad;
-    Py_DECREF(ob);
-    return 0;
-bad:
-    Py_XDECREF(ob);
-    return -1;
-}
-
 #ifndef __PYX_HAVE_RT_ImportModule
 #define __PYX_HAVE_RT_ImportModule
 static PyObject *__Pyx_ImportModule(const char *name) {
@@ -25045,6 +25276,10 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class
     PyObject *result = 0;
     PyObject *py_name = 0;
     char warning[200];
+    Py_ssize_t basicsize;
+#ifdef Py_LIMITED_API
+    PyObject *py_basicsize;
+#endif
     py_module = __Pyx_ImportModule(module_name);
     if (!py_module)
         goto bad;
@@ -25064,7 +25299,19 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class
             module_name, class_name);
         goto bad;
     }
-    if (!strict && (size_t)((PyTypeObject *)result)->tp_basicsize > size) {
+#ifndef Py_LIMITED_API
+    basicsize = ((PyTypeObject *)result)->tp_basicsize;
+#else
+    py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
+    if (!py_basicsize)
+        goto bad;
+    basicsize = PyLong_AsSsize_t(py_basicsize);
+    Py_DECREF(py_basicsize);
+    py_basicsize = 0;
+    if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
+        goto bad;
+#endif
+    if (!strict && (size_t)basicsize > size) {
         PyOS_snprintf(warning, sizeof(warning),
             "%s.%s size changed, may indicate binary incompatibility",
             module_name, class_name);
@@ -25074,7 +25321,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class
         if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
         #endif
     }
-    else if ((size_t)((PyTypeObject *)result)->tp_basicsize != size) {
+    else if ((size_t)basicsize != size) {
         PyErr_Format(PyExc_ValueError,
             "%s.%s has the wrong size, try recompiling",
             module_name, class_name);
@@ -25280,27 +25527,82 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
     return 0;
 }
 
-
-/* Type Conversion Functions */
-
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char* c_str) {
+    return __Pyx_PyUnicode_FromStringAndSize(c_str, strlen(c_str));
+}
+static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
+    Py_ssize_t ignore;
+    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
+}
+static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
+    if (
+#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+            __Pyx_sys_getdefaultencoding_not_ascii &&
+#endif
+            PyUnicode_Check(o)) {
+#if PY_VERSION_HEX < 0x03030000
+        char* defenc_c;
+        PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
+        if (!defenc) return NULL;
+        defenc_c = PyBytes_AS_STRING(defenc);
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+        {
+            char* end = defenc_c + PyBytes_GET_SIZE(defenc);
+            char* c;
+            for (c = defenc_c; c < end; c++) {
+                if ((unsigned char) (*c) >= 128) {
+                    PyUnicode_AsASCIIString(o);
+                    return NULL;
+                }
+            }
+        }
+#endif /*__PYX_DEFAULT_STRING_ENCODING_IS_ASCII*/
+        *length = PyBytes_GET_SIZE(defenc);
+        return defenc_c;
+#else /* PY_VERSION_HEX < 0x03030000 */
+        if (PyUnicode_READY(o) == -1) return NULL;
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+        if (PyUnicode_IS_ASCII(o)) {
+            *length = PyUnicode_GET_DATA_SIZE(o);
+            return PyUnicode_AsUTF8(o);
+        } else {
+            PyUnicode_AsASCIIString(o);
+            return NULL;
+        }
+#else /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
+        return PyUnicode_AsUTF8AndSize(o, length);
+#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
+#endif /* PY_VERSION_HEX < 0x03030000 */
+    } else
+#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII  || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT */
+    {
+        char* result;
+        int r = PyBytes_AsStringAndSize(o, &result, length);
+        if (r < 0) {
+            return NULL;
+        } else {
+            return result;
+        }
+    }
+}
 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
    int is_true = x == Py_True;
    if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
    else return PyObject_IsTrue(x);
 }
-
 static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
   PyNumberMethods *m;
   const char *name = NULL;
   PyObject *res = NULL;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
   if (PyInt_Check(x) || PyLong_Check(x))
 #else
   if (PyLong_Check(x))
 #endif
     return Py_INCREF(x), x;
   m = Py_TYPE(x)->tp_as_number;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
   if (m && m->nb_int) {
     name = "int";
     res = PyNumber_Int(x);
@@ -25316,7 +25618,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
   }
 #endif
   if (res) {
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (!PyInt_Check(res) && !PyLong_Check(res)) {
 #else
     if (!PyLong_Check(res)) {
@@ -25334,7 +25636,6 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
   }
   return res;
 }
-
 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
   Py_ssize_t ival;
   PyObject* x = PyNumber_Index(b);
@@ -25343,7 +25644,6 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
   Py_DECREF(x);
   return ival;
 }
-
 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
 #if PY_VERSION_HEX < 0x02050000
    if (ival <= LONG_MAX)
@@ -25357,14 +25657,12 @@ static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
    return PyInt_FromSize_t(ival);
 #endif
 }
-
 static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
    unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
-   if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) {
-       return (size_t)-1;
-   } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
-       PyErr_SetString(PyExc_OverflowError,
-                       "value too large to convert to size_t");
+   if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
+       if ((val != (unsigned PY_LONG_LONG)-1) || !PyErr_Occurred())
+           PyErr_SetString(PyExc_OverflowError,
+                           "value too large to convert to size_t");
        return (size_t)-1;
    }
    return (size_t)val;
diff --git a/src/splitBBox.pyx b/src/splitBBox.pyx
index 574be3f..f2035ef 100644
--- a/src/splitBBox.pyx
+++ b/src/splitBBox.pyx
@@ -28,7 +28,8 @@
 import cython
 cimport numpy
 import numpy
-from libc.math cimport fabs
+from libc.math cimport fabs, M_PI
+cdef float pi=<float> M_PI 
 
 EPS32 = (1 + numpy.finfo(numpy.float32).eps)
 
@@ -147,6 +148,8 @@ def histoBBox1d(numpy.ndarray weights not None,
     pos0_max=cpos0[0]
     with nogil:
         for idx in range(size):
+            if (check_mask) and (cmask[idx]):
+                continue
             min0 = cpos0[idx] - dpos0[idx]
             max0 = cpos0[idx] + dpos0[idx]
             cpos0_upper[idx]=max0
@@ -264,7 +267,9 @@ def histoBBox2d(numpy.ndarray weights not None,
                 dark=None,
                 flat=None,
                 solidangle=None,
-                polarization=None):
+                polarization=None,
+                bint allow_pos0_neg=0,
+                bint chiDiscAtPi=1):
     """
     Calculate 2D histogram of pos0(tth),pos1(chi) weighted by weights
 
@@ -284,9 +289,10 @@ def histoBBox2d(numpy.ndarray weights not None,
     @param mask: array (of int8) with masked pixels with 1 (0=not masked)
     @param dark: array (of float32) with dark noise to be subtracted (or None)
     @param flat: array (of float32) with flat-field image
-    @param polarization: array (of float32) with polarization corrections
     @param solidangle: array (of float32) with solid angle corrections
-
+    @param polarization: array (of float32) with polarization corrections
+    @param chiDiscAtPi: boolean; by default the chi_range is in the range ]-pi,pi[ set to 0 to have the range ]0,2pi[  
+    
     @return  I, edges0, edges1, weighted histogram(2D), unweighted histogram (2D)
     """
 
@@ -311,10 +317,13 @@ def histoBBox2d(numpy.ndarray weights not None,
     cdef numpy.ndarray[numpy.float32_t, ndim = 1] dpos1 = numpy.ascontiguousarray(delta_pos1.ravel(),dtype=numpy.float32)
     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos0_upper = numpy.empty(size,dtype=numpy.float32)
     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos0_lower = numpy.empty(size,dtype=numpy.float32)
+    cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos1_upper = numpy.empty(size,dtype=numpy.float32)
+    cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos1_lower = numpy.empty(size,dtype=numpy.float32)
     cdef numpy.ndarray[numpy.float64_t, ndim = 2] outData = numpy.zeros((bins0, bins1), dtype=numpy.float64)
     cdef numpy.ndarray[numpy.float64_t, ndim = 2] outCount = numpy.zeros((bins0, bins1), dtype=numpy.float64)
     cdef numpy.ndarray[numpy.float32_t, ndim = 2] outMerge = numpy.zeros((bins0, bins1), dtype=numpy.float32)
 
+    cdef float c0, c1, d0, d1
     cdef float min0, max0, min1, max1, deltaR, deltaL, deltaU, deltaD, deltaA, tmp, delta0, delta1
     cdef float pos0_min, pos0_max, pos1_min, pos1_max, pos0_maxin, pos1_maxin
     cdef float fbin0_min, fbin0_max, fbin1_min, fbin1_max, data, epsilon = 1e-10, cdummy, ddummy
@@ -354,43 +363,70 @@ def histoBBox2d(numpy.ndarray weights not None,
         assert solidangle.size == size
         csolidangle = numpy.ascontiguousarray(solidangle.ravel(), dtype=numpy.float32)
 
-
     pos0_min=cpos0[0]
     pos0_max=cpos0[0]
+    pos1_min=cpos1[0]
+    pos1_max=cpos1[0]
 
     with nogil:
         for idx in range(size):
-            min0 = cpos0[idx] - dpos0[idx]
-            max0 = cpos0[idx] + dpos0[idx]
-            cpos0_upper[idx]=max0
-            cpos0_lower[idx]=min0
+            if (check_mask and cmask[idx]):
+                continue
+            c0 = cpos0[idx]
+            d0 = dpos0[idx]
+            min0 = c0 - d0
+            max0 = c0 + d0
+            c1 = cpos1[idx]
+            d1 = dpos1[idx]
+            min1 = c1 - d1
+            max1 = c1 + d1
+            if not allow_pos0_neg and lower0<0:
+                lower0=0
+            if max1 > (2-chiDiscAtPi)*pi:
+                max1 = (2-chiDiscAtPi)*pi
+            if min1 < (-chiDiscAtPi)*pi:
+                min1 = (-chiDiscAtPi)*pi
+            cpos0_upper[idx] = max0
+            cpos0_lower[idx] = min0
+            cpos1_upper[idx] = max1
+            cpos1_lower[idx] = min1
             if max0>pos0_max:
-                pos0_max=max0
+                pos0_max = max0
             if min0<pos0_min:
-                pos0_min=min0
+                pos0_min = min0
+            if max1>pos1_max:
+                pos1_max = max1
+            if min1<pos1_min:
+                pos1_min = min1
 
-    if (pos0Range is not None) and (len(pos0Range) == 2):
+    if pos0Range is not None and len(pos0Range) > 1:
         pos0_min = min(pos0Range)
         pos0_maxin = max(pos0Range)
     else:
-#        pos0_min = pos0_min
         pos0_maxin = pos0_max
-    if pos0_min<0:
-        pos0_min=0
-    pos0_max = pos0_maxin * EPS32
 
-    if (pos1Range is not None) and (len(pos1Range) == 2):
+
+    if pos1Range is not None and len(pos1Range) > 1:
         pos1_min = min(pos1Range)
         pos1_maxin = max(pos1Range)
     else:
-        pos1_min = cpos1.min()
-        pos1_maxin = cpos1.max()
+        pos1_maxin = pos1_max
+
+    if (not allow_pos0_neg) and pos0_min < 0:
+        pos0_min = 0
+
+    pos0_max = pos0_maxin * EPS32
     pos1_max = pos1_maxin * EPS32
 
     delta0 = (pos0_max - pos0_min) / (< float > (bins0))
     delta1 = (pos1_max - pos1_min) / (< float > (bins1))
+    
     edges0 = numpy.linspace(pos0_min+0.5*delta0, pos0_maxin-0.5*delta0, bins0)
     edges1 = numpy.linspace(pos1_min+0.5*delta1, pos1_maxin-0.5*delta1, bins1)
+
+    
+    
+    
     with nogil:
         for idx in range(size):
             if (check_mask) and cmask[idx]:
diff --git a/src/splitBBoxLUT.c b/src/splitBBoxLUT.c
index 8a0ad52..3766776 100644
--- a/src/splitBBoxLUT.c
+++ b/src/splitBBoxLUT.c
@@ -1,6 +1,18 @@
-/* Generated by Cython 0.18 on Wed Mar 13 18:08:06 2013 */
+/* Generated by Cython 0.19.2 on Mon Jan  6 15:25:40 2014 */
 
 #define PY_SSIZE_T_CLEAN
+#ifndef CYTHON_USE_PYLONG_INTERNALS
+#ifdef PYLONG_BITS_IN_DIGIT
+#define CYTHON_USE_PYLONG_INTERNALS 0
+#else
+#include "pyconfig.h"
+#ifdef PYLONG_BITS_IN_DIGIT
+#define CYTHON_USE_PYLONG_INTERNALS 1
+#else
+#define CYTHON_USE_PYLONG_INTERNALS 0
+#endif
+#endif
+#endif
 #include "Python.h"
 #ifndef Py_PYTHON_H
     #error Python headers needed to compile C extensions, please install development version of Python.
@@ -116,6 +128,9 @@
 #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
   #define Py_TPFLAGS_HAVE_NEWBUFFER 0
 #endif
+#if PY_VERSION_HEX < 0x02060000
+  #define Py_TPFLAGS_HAVE_VERSION_TAG 0
+#endif
 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
   #define CYTHON_PEP393_ENABLED 1
   #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ? \
@@ -155,6 +170,14 @@
   #define PyBytes_Concat               PyString_Concat
   #define PyBytes_ConcatAndDel         PyString_ConcatAndDel
 #endif
+#if PY_MAJOR_VERSION >= 3
+  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
+  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
+#else
+  #define __Pyx_PyBaseString_Check(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj) || \
+                                         PyString_Check(obj) || PyUnicode_Check(obj))
+  #define __Pyx_PyBaseString_CheckExact(obj) (Py_TYPE(obj) == &PyBaseString_Type)
+#endif
 #if PY_VERSION_HEX < 0x02060000
   #define PySet_Check(obj)             PyObject_TypeCheck(obj, &PySet_Type)
   #define PyFrozenSet_Check(obj)       PyObject_TypeCheck(obj, &PyFrozenSet_Type)
@@ -227,6 +250,40 @@
   #define __Pyx_NAMESTR(n) (n)
   #define __Pyx_DOCSTR(n)  (n)
 #endif
+#ifndef CYTHON_INLINE
+  #if defined(__GNUC__)
+    #define CYTHON_INLINE __inline__
+  #elif defined(_MSC_VER)
+    #define CYTHON_INLINE __inline
+  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+    #define CYTHON_INLINE inline
+  #else
+    #define CYTHON_INLINE
+  #endif
+#endif
+#ifndef CYTHON_RESTRICT
+  #if defined(__GNUC__)
+    #define CYTHON_RESTRICT __restrict__
+  #elif defined(_MSC_VER) && _MSC_VER >= 1400
+    #define CYTHON_RESTRICT __restrict
+  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+    #define CYTHON_RESTRICT restrict
+  #else
+    #define CYTHON_RESTRICT
+  #endif
+#endif
+#ifdef NAN
+#define __PYX_NAN() ((float) NAN)
+#else
+static CYTHON_INLINE float __PYX_NAN() {
+  /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and
+   a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is
+   a quiet NaN. */
+  float value;
+  memset(&value, 0xFF, sizeof(value));
+  return value;
+}
+#endif
 
 
 #if PY_MAJOR_VERSION >= 3
@@ -267,17 +324,6 @@
 #define CYTHON_WITHOUT_ASSERTIONS
 #endif
 
-#ifndef CYTHON_INLINE
-  #if defined(__GNUC__)
-    #define CYTHON_INLINE __inline__
-  #elif defined(_MSC_VER)
-    #define CYTHON_INLINE __inline
-  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
-    #define CYTHON_INLINE inline
-  #else
-    #define CYTHON_INLINE
-  #endif
-#endif
 #ifndef CYTHON_UNUSED
 # if defined(__GNUC__)
 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
@@ -291,10 +337,44 @@
 #   define CYTHON_UNUSED
 # endif
 #endif
-typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/
-
-#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
-#define __Pyx_PyBytes_AsUString(s)   ((unsigned char*) PyBytes_AsString(s))
+typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding;
+                const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/
+
+#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
+#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
+#define __PYX_DEFAULT_STRING_ENCODING ""
+#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
+#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
+static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
+static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
+#define __Pyx_PyBytes_FromString        PyBytes_FromString
+#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char*);
+#if PY_MAJOR_VERSION < 3
+    #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
+    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
+#else
+    #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
+    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
+#endif
+#define __Pyx_PyObject_AsUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
+#define __Pyx_PyObject_FromUString(s)  __Pyx_PyObject_FromString((char*)s)
+#define __Pyx_PyBytes_FromUString(s)   __Pyx_PyBytes_FromString((char*)s)
+#define __Pyx_PyStr_FromUString(s)     __Pyx_PyStr_FromString((char*)s)
+#define __Pyx_PyUnicode_FromUString(s) __Pyx_PyUnicode_FromString((char*)s)
+#if PY_MAJOR_VERSION < 3
+static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
+{
+    const Py_UNICODE *u_end = u;
+    while (*u_end++) ;
+    return u_end - u - 1;
+}
+#else
+#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
+#endif
+#define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
+#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
+#define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
 #define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
 #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
@@ -308,6 +388,78 @@ static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
 #endif
 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
+#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+static int __Pyx_sys_getdefaultencoding_not_ascii;
+static int __Pyx_init_sys_getdefaultencoding_params() {
+    PyObject* sys = NULL;
+    PyObject* default_encoding = NULL;
+    PyObject* ascii_chars_u = NULL;
+    PyObject* ascii_chars_b = NULL;
+    sys = PyImport_ImportModule("sys");
+    if (sys == NULL) goto bad;
+    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
+    if (default_encoding == NULL) goto bad;
+    if (strcmp(PyBytes_AsString(default_encoding), "ascii") == 0) {
+        __Pyx_sys_getdefaultencoding_not_ascii = 0;
+    } else {
+        const char* default_encoding_c = PyBytes_AS_STRING(default_encoding);
+        char ascii_chars[128];
+        int c;
+        for (c = 0; c < 128; c++) {
+            ascii_chars[c] = c;
+        }
+        __Pyx_sys_getdefaultencoding_not_ascii = 1;
+        ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
+        if (ascii_chars_u == NULL) goto bad;
+        ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
+        if (ascii_chars_b == NULL || strncmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
+            PyErr_Format(
+                PyExc_ValueError,
+                "This module compiled with c_string_encoding=ascii, but default encoding '%s' is not a superset of ascii.",
+                default_encoding_c);
+            goto bad;
+        }
+    }
+    Py_XDECREF(sys);
+    Py_XDECREF(default_encoding);
+    Py_XDECREF(ascii_chars_u);
+    Py_XDECREF(ascii_chars_b);
+    return 0;
+bad:
+    Py_XDECREF(sys);
+    Py_XDECREF(default_encoding);
+    Py_XDECREF(ascii_chars_u);
+    Py_XDECREF(ascii_chars_b);
+    return -1;
+}
+#endif
+#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
+#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
+#else
+#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
+#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
+static char* __PYX_DEFAULT_STRING_ENCODING;
+static int __Pyx_init_sys_getdefaultencoding_params() {
+    PyObject* sys = NULL;
+    PyObject* default_encoding = NULL;
+    char* default_encoding_c;
+    sys = PyImport_ImportModule("sys");
+    if (sys == NULL) goto bad;
+    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
+    if (default_encoding == NULL) goto bad;
+    default_encoding_c = PyBytes_AS_STRING(default_encoding);
+    __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
+    strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
+    Py_DECREF(sys);
+    Py_DECREF(default_encoding);
+    return 0;
+bad:
+    Py_XDECREF(sys);
+    Py_XDECREF(default_encoding);
+    return -1;
+}
+#endif
+#endif
 
 
 #ifdef __GNUC__
@@ -323,8 +475,9 @@ static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
   #define likely(x)   (x)
   #define unlikely(x) (x)
 #endif /* __GNUC__ */
-    
+
 static PyObject *__pyx_m;
+static PyObject *__pyx_d;
 static PyObject *__pyx_b;
 static PyObject *__pyx_empty_tuple;
 static PyObject *__pyx_empty_bytes;
@@ -361,6 +514,15 @@ static const char *__pyx_f[] = {
   "stringsource",
   "type.pxd",
 };
+struct __pyx_memoryview_obj;
+typedef struct {
+  struct __pyx_memoryview_obj *memview;
+  char *data;
+  Py_ssize_t shape[8];
+  Py_ssize_t strides[8];
+  Py_ssize_t suboffsets[8];
+} __Pyx_memviewslice;
+
 #define IS_UNSIGNED(type) (((type) -1) > 0)
 struct __Pyx_StructField_;
 #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
@@ -396,24 +558,14 @@ typedef struct {
   char is_valid_array;
 } __Pyx_BufFmt_Context;
 
-struct __pyx_memoryview_obj;
-typedef struct {
-  struct __pyx_memoryview_obj *memview;
-  char *data;
-  Py_ssize_t shape[8];
-  Py_ssize_t strides[8];
-  Py_ssize_t suboffsets[8];
-} __Pyx_memviewslice;
-
 #include <pythread.h>
 #ifndef CYTHON_ATOMICS
     #define CYTHON_ATOMICS 1
 #endif
 #define __pyx_atomic_int_type int
-/* todo: Portland pgcc, maybe OS X's OSAtomicIncrement32,
-   libatomic + autotools-like distutils support? Such a pain... */
-#if CYTHON_ATOMICS && __GNUC__ >= 4 && (__GNUC_MINOR__ > 1 || \
-                    (__GNUC_MINOR__ == 1 && __GNUC_PATHLEVEL >= 2))
+#if CYTHON_ATOMICS && __GNUC__ >= 4 && (__GNUC_MINOR__ > 1 ||           \
+                    (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL >= 2)) && \
+                    !defined(__i386__)
     #define __pyx_atomic_incr_aligned(value, lock) __sync_fetch_and_add(value, 1)
     #define __pyx_atomic_decr_aligned(value, lock) __sync_fetch_and_sub(value, 1)
     #ifdef __PYX_DEBUG_ATOMICS
@@ -710,9 +862,9 @@ typedef struct __pyx_defaults __pyx_defaults;
 struct __pyx_defaults1;
 typedef struct __pyx_defaults1 __pyx_defaults1;
 
-/* "splitBBoxLUT.pyx":35
- * cimport numpy
- * from libc.math cimport fabs
+/* "splitBBoxLUT.pyx":36
+ * from libc.math cimport fabs, M_PI
+ * cdef float pi=<float> M_PI
  * cdef struct lut_point:             # <<<<<<<<<<<<<<
  *     numpy.int32_t idx
  *     numpy.float32_t coef
@@ -726,6 +878,7 @@ struct __pyx_defaults {
 };
 struct __pyx_defaults1 {
   PyObject *__pyx_arg_allow_pos0_neg;
+  PyObject *__pyx_arg_chiDiscAtPi;
 };
 
 /* "View.MemoryView":308
@@ -889,10 +1042,33 @@ static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice;
   #define __Pyx_XGOTREF(r)
   #define __Pyx_XGIVEREF(r)
 #endif /* CYTHON_REFNANNY */
+#define __Pyx_XDECREF_SET(r, v) do {                            \
+        PyObject *tmp = (PyObject *) r;                         \
+        r = v; __Pyx_XDECREF(tmp);                              \
+    } while (0)
+#define __Pyx_DECREF_SET(r, v) do {                             \
+        PyObject *tmp = (PyObject *) r;                         \
+        r = v; __Pyx_DECREF(tmp);                               \
+    } while (0)
 #define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
 #define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
 
-static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
+    PyTypeObject* tp = Py_TYPE(obj);
+    if (likely(tp->tp_getattro))
+        return tp->tp_getattro(obj, attr_name);
+#if PY_MAJOR_VERSION < 3
+    if (likely(tp->tp_getattr))
+        return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
+#endif
+    return PyObject_GetAttr(obj, attr_name);
+}
+#else
+#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
+#endif
+
+static PyObject *__Pyx_GetBuiltinName(PyObject *name); /*proto*/
 
 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
     Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/
@@ -903,31 +1079,32 @@ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \
     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \
     const char* function_name); /*proto*/
 
-static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/
+#if CYTHON_COMPILING_IN_CPYTHON
+#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o,n,NULL)
+static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
+    PyTypeObject* tp = Py_TYPE(obj);
+    if (likely(tp->tp_setattro))
+        return tp->tp_setattro(obj, attr_name, value);
+#if PY_MAJOR_VERSION < 3
+    if (likely(tp->tp_setattr))
+        return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
+#endif
+    return PyObject_SetAttr(obj, attr_name, value);
+}
+#else
+#define __Pyx_PyObject_DelAttrStr(o,n)   PyObject_DelAttr(o,n)
+#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
+#endif
 
-static CYTHON_INLINE int  __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj,
-    __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack);
-static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);
+static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); /*proto*/
 
 static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
 
 static void __Pyx_RaiseUnboundMemoryviewSliceNogil(const char *varname);
 
-#define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0)
-static CYTHON_INLINE int __Pyx_PySequence_Contains(PyObject* item, PyObject* seq, int eq) {
-    int result = PySequence_Contains(seq, item);
-    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
-}
-
-static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
-static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
-
-static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/
-
-static void __Pyx_RaiseBufferFallbackError(void); /*proto*/
-
-#define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1)
-static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
+static CYTHON_INLINE int  __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj,
+    __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack);
+static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);
 
 #define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d
 #define __Pyx_MEMVIEW_DIRECT   1
@@ -938,24 +1115,15 @@ static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
 #define __Pyx_MEMVIEW_FOLLOW   32
 #define __Pyx_IS_C_CONTIG 1
 #define __Pyx_IS_F_CONTIG 2
-static int __Pyx_ValidateAndInit_memviewslice(
-                int *axes_specs,
-                int c_or_f_flag,
-                int buf_flags,
-                int ndim,
-                __Pyx_TypeInfo *dtype,
-                __Pyx_BufFmt_StackElem stack[],
-                __Pyx_memviewslice *memviewslice,
-                PyObject *original_obj);
 static int __Pyx_init_memviewslice(
                 struct __pyx_memoryview_obj *memview,
                 int ndim,
                 __Pyx_memviewslice *memviewslice,
                 int memview_is_new_reference);
-static CYTHON_INLINE int __pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
-                                                            PyThread_type_lock lock);
-static CYTHON_INLINE int __pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
-                                                            PyThread_type_lock lock);
+static CYTHON_INLINE int __pyx_add_acquisition_count_locked(
+    __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
+static CYTHON_INLINE int __pyx_sub_acquisition_count_locked(
+    __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
 #define __pyx_get_slice_count_pointer(memview) (memview->acquisition_count_aligned_p)
 #define __pyx_get_slice_count(memview) (*__pyx_get_slice_count_pointer(memview))
 #define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__)
@@ -963,6 +1131,22 @@ static CYTHON_INLINE int __pyx_sub_acquisition_count_locked(__pyx_atomic_int *ac
 static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int);
 static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *, int, int);
 
+static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/
+
+#define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0)
+static CYTHON_INLINE int __Pyx_PySequence_Contains(PyObject* item, PyObject* seq, int eq) {
+    int result = PySequence_Contains(seq, item);
+    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
+}
+
+static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
+static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
+
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/
+
+static void __Pyx_RaiseBufferFallbackError(void); /*proto*/
+
+#define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1)
 static double __Pyx__PyObject_AsDouble(PyObject* obj); /* proto */
 #if CYTHON_COMPILING_IN_PYPY
 #define __Pyx_PyObject_AsDouble(obj) \
@@ -975,10 +1159,6 @@ static double __Pyx__PyObject_AsDouble(PyObject* obj); /* proto */
  PyFloat_AS_DOUBLE(obj) : __Pyx__PyObject_AsDouble(obj))
 #endif
 
-#include <string.h>
-void __pyx_init_nan(void);
-static float __PYX_NAN;
-
 #ifndef __PYX_FORCE_INIT_THREADS
   #define __PYX_FORCE_INIT_THREADS 0
 #endif
@@ -995,96 +1175,32 @@ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
 
 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
 
-static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
-    PyObject *r;
-    if (!j) return NULL;
-    r = PyObject_GetItem(o, j);
-    Py_DECREF(j);
-    return r;
-}
-#define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
-                                                    __Pyx_GetItemInt_List_Fast(o, i) : \
-                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
-static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) {
-#if CYTHON_COMPILING_IN_CPYTHON
-    if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
-        PyObject *r = PyList_GET_ITEM(o, i);
-        Py_INCREF(r);
-        return r;
-    }
-    else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
-        PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
-        Py_INCREF(r);
-        return r;
-    }
-    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
-#else
-    return PySequence_GetItem(o, i);
-#endif
-}
-#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
-                                                    __Pyx_GetItemInt_Tuple_Fast(o, i) : \
-                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
-static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) {
-#if CYTHON_COMPILING_IN_CPYTHON
-    if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
-        PyObject *r = PyTuple_GET_ITEM(o, i);
-        Py_INCREF(r);
-        return r;
-    }
-    else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
-        PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
-        Py_INCREF(r);
-        return r;
-    }
-    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
-#else
-    return PySequence_GetItem(o, i);
-#endif
-}
-#define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
-                                                    __Pyx_GetItemInt_Fast(o, i) : \
-                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
-static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) {
-#if CYTHON_COMPILING_IN_CPYTHON
-    if (PyList_CheckExact(o)) {
-        Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
-        if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) {
-            PyObject *r = PyList_GET_ITEM(o, n);
-            Py_INCREF(r);
-            return r;
-        }
-    }
-    else if (PyTuple_CheckExact(o)) {
-        Py_ssize_t n = (likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
-        if (likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
-            PyObject *r = PyTuple_GET_ITEM(o, n);
-            Py_INCREF(r);
-            return r;
-        }
-    } else {  /* inlined PySequence_GetItem() */
-        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
-        if (likely(m && m->sq_item)) {
-            if (unlikely(i < 0) && likely(m->sq_length)) {
-                Py_ssize_t l = m->sq_length(o);
-                if (unlikely(l < 0)) return NULL;
-                i += l;
-            }
-            return m->sq_item(o, i);
-        }
-    }
-#else
-    if (PySequence_Check(o)) {
-        return PySequence_GetItem(o, i);
-    }
-#endif
-    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
-}
+#define __Pyx_GetItemInt(o, i, size, to_py_func, is_list, wraparound, boundscheck) \
+    (((size) <= sizeof(Py_ssize_t)) ? \
+    __Pyx_GetItemInt_Fast(o, i, is_list, wraparound, boundscheck) : \
+    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
+#define __Pyx_GetItemInt_List(o, i, size, to_py_func, is_list, wraparound, boundscheck) \
+    (((size) <= sizeof(Py_ssize_t)) ? \
+    __Pyx_GetItemInt_List_Fast(o, i, wraparound, boundscheck) : \
+    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
+                                                              int wraparound, int boundscheck);
+#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func, is_list, wraparound, boundscheck) \
+    (((size) <= sizeof(Py_ssize_t)) ? \
+    __Pyx_GetItemInt_Tuple_Fast(o, i, wraparound, boundscheck) : \
+    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
+                                                              int wraparound, int boundscheck);
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
+                                                     int is_list, int wraparound, int boundscheck);
 
 #define __Pyx_BufPtrStrided3d(type, buf, i0, s0, i1, s1, i2, s2) (type)((char*)buf + i0 * s0 + i1 * s1 + i2 * s2)
 static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
     const char *name, int exact); /*proto*/
 
+static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); /*proto*/
+
 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); /*proto*/
 
 static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t); /* proto */
@@ -1107,7 +1223,7 @@ static PyObject *__pyx_memoryview_transpose(PyObject *__pyx_v_self); /*proto*/
 static PyObject *__pyx_memoryview__get__base(PyObject *__pyx_v_self); /*proto*/
 static PyObject *__pyx_memoryview_get_shape(PyObject *__pyx_v_self); /*proto*/
 #if CYTHON_COMPILING_IN_CPYTHON
-static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
+static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
     PyListObject* L = (PyListObject*) list;
     Py_ssize_t len = Py_SIZE(list);
     if (likely(L->allocated > len)) {
@@ -1119,7 +1235,7 @@ static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
     return PyList_Append(list, x);
 }
 #else
-#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
+#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
 #endif
 
 static PyObject *__pyx_memoryview_get_strides(PyObject *__pyx_v_self); /*proto*/
@@ -1128,45 +1244,31 @@ static PyObject *__pyx_memoryview_get_ndim(PyObject *__pyx_v_self); /*proto*/
 static PyObject *__pyx_memoryview_get_itemsize(PyObject *__pyx_v_self); /*proto*/
 static PyObject *__pyx_memoryview_get_nbytes(PyObject *__pyx_v_self); /*proto*/
 static PyObject *__pyx_memoryview_get_size(PyObject *__pyx_v_self); /*proto*/
-static CYTHON_INLINE long __Pyx_div_long(long, long); /* proto */
-
-static PyObject *__pyx_memoryviewslice__get__base(PyObject *__pyx_v_self); /*proto*/
-static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
-static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
-
-typedef struct {
-  Py_ssize_t shape, strides, suboffsets;
-} __Pyx_Buf_DimInfo;
-typedef struct {
-  size_t refcount;
-  Py_buffer pybuffer;
-} __Pyx_Buffer;
-typedef struct {
-  __Pyx_Buffer *rcbuffer;
-  char *data;
-  __Pyx_Buf_DimInfo diminfo[8];
-} __Pyx_LocalBuf_ND;
-
-#if PY_MAJOR_VERSION < 3
-    static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
-    static void __Pyx_ReleaseBuffer(Py_buffer *view);
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
+    PyListObject* L = (PyListObject*) list;
+    Py_ssize_t len = Py_SIZE(list);
+    if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
+        Py_INCREF(x);
+        PyList_SET_ITEM(list, len, x);
+        Py_SIZE(list) = len+1;
+        return 0;
+    }
+    return PyList_Append(list, x);
+}
 #else
-    #define __Pyx_GetBuffer PyObject_GetBuffer
-    #define __Pyx_ReleaseBuffer PyBuffer_Release
+#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
 #endif
 
+static CYTHON_INLINE long __Pyx_div_long(long, long); /* proto */
 
-static Py_ssize_t __Pyx_zeros[] = {0, 0, 0, 0, 0, 0, 0, 0};
-static Py_ssize_t __Pyx_minusones[] = {-1, -1, -1, -1, -1, -1, -1, -1};
+static PyObject *__pyx_memoryviewslice__get__base(PyObject *__pyx_v_self); /*proto*/
+static void __Pyx_WriteUnraisable(const char *name, int clineno,
+                                  int lineno, const char *filename); /*proto*/
 
-static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /*proto*/
+static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
 
-static CYTHON_INLINE void __Pyx_RaiseImportError(PyObject *name);
-
-static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases); /*proto*/
-
-static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name,
-                                   PyObject *qualname, PyObject *modname); /*proto*/
+static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); /*proto*/
 
 #define __Pyx_CyFunction_USED 1
 #include <structmember.h>
@@ -1194,8 +1296,10 @@ typedef struct {
     PyObject *func_classobj; /* No-args super() class cell */
     void *defaults;
     int defaults_pyobjects;
-    PyObject *defaults_tuple; /* Const defaults tuple */
+    PyObject *defaults_tuple;   /* Const defaults tuple */
+    PyObject *defaults_kwdict;  /* Const kwonly defaults dict */
     PyObject *(*defaults_getter)(PyObject *);
+    PyObject *func_annotations; /* function annotations dict */
 } __pyx_CyFunctionObject;
 static PyTypeObject *__pyx_CyFunctionType = 0;
 #define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, code) \
@@ -1209,12 +1313,54 @@ static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
                                                          int pyobjects);
 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
                                                             PyObject *tuple);
+static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
+                                                             PyObject *dict);
+static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
+                                                              PyObject *dict);
 static int __Pyx_CyFunction_init(void);
 
-static CYTHON_INLINE npy_int32 __Pyx_PyInt_from_py_npy_int32(PyObject *);
+static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
+static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
+
+typedef struct {
+  Py_ssize_t shape, strides, suboffsets;
+} __Pyx_Buf_DimInfo;
+typedef struct {
+  size_t refcount;
+  Py_buffer pybuffer;
+} __Pyx_Buffer;
+typedef struct {
+  __Pyx_Buffer *rcbuffer;
+  char *data;
+  __Pyx_Buf_DimInfo diminfo[8];
+} __Pyx_LocalBuf_ND;
+
+#if PY_MAJOR_VERSION < 3
+    static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
+    static void __Pyx_ReleaseBuffer(Py_buffer *view);
+#else
+    #define __Pyx_GetBuffer PyObject_GetBuffer
+    #define __Pyx_ReleaseBuffer PyBuffer_Release
+#endif
+
+
+static Py_ssize_t __Pyx_zeros[] = {0, 0, 0, 0, 0, 0, 0, 0};
+static Py_ssize_t __Pyx_minusones[] = {-1, -1, -1, -1, -1, -1, -1, -1};
+
+static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /*proto*/
+
+static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases); /*proto*/
+
+static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name,
+                                   PyObject *qualname, PyObject *modname); /*proto*/
 
 static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_int8(npy_int8);
 
+static CYTHON_INLINE npy_int32 __Pyx_PyInt_from_py_npy_int32(PyObject *);
+
+static PyObject *__pyx_memview_get_float(const char *itemp); /* proto */
+static int __pyx_memview_set_float(const char *itemp, PyObject *obj); /* proto */
+
 static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_int32(npy_int32);
 
 #if CYTHON_CCOMPLEX
@@ -1362,19 +1508,26 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);
 
 static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);
 
+static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
+
+static int __Pyx_ValidateAndInit_memviewslice(
+                int *axes_specs,
+                int c_or_f_flag,
+                int buf_flags,
+                int ndim,
+                __Pyx_TypeInfo *dtype,
+                __Pyx_BufFmt_StackElem stack[],
+                __Pyx_memviewslice *memviewslice,
+                PyObject *original_obj);
+
 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_float(PyObject *);
 
 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int8_t(PyObject *);
 
 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_nn_struct___pyx_t_12splitBBoxLUT_lut_point(PyObject *);
 
-static void __Pyx_WriteUnraisable(const char *name, int clineno,
-                                  int lineno, const char *filename); /*proto*/
-
 static int __Pyx_check_binary_version(void);
 
-static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
-
 #if !defined(__Pyx_PyIdentifier_FromString)
 #if PY_MAJOR_VERSION < 3
   #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
@@ -1441,10 +1594,11 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, cha
 /* Module declarations from 'libc.math' */
 
 /* Module declarations from 'splitBBoxLUT' */
+static PyTypeObject *__pyx_memoryview_type = 0;
 static PyTypeObject *__pyx_array_type = 0;
 static PyTypeObject *__pyx_MemviewEnum_type = 0;
-static PyTypeObject *__pyx_memoryview_type = 0;
 static PyTypeObject *__pyx_memoryviewslice_type = 0;
+static float __pyx_v_12splitBBoxLUT_pi;
 static PyObject *generic = 0;
 static PyObject *strided = 0;
 static PyObject *indirect = 0;
@@ -1454,12 +1608,12 @@ static float __pyx_f_12splitBBoxLUT_getBinNr(float, float, float); /*proto*/
 static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/
 static void *__pyx_align_pointer(void *, size_t); /*proto*/
 static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo *); /*proto*/
-static int __pyx_memoryview_check(PyObject *); /*proto*/
+static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/
 static PyObject *_unellipsify(PyObject *, int); /*proto*/
 static PyObject *assert_direct_dimensions(Py_ssize_t *, int); /*proto*/
 static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/
 static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int, int); /*proto*/
-static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, int); /*proto*/
+static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/
 static int __pyx_memslice_transpose(__Pyx_memviewslice *); /*proto*/
 static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice, int, PyObject *(*)(char *), int (*)(char *, PyObject *), int); /*proto*/
 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
@@ -1511,16 +1665,16 @@ static PyObject *__pyx_builtin_TypeError;
 static PyObject *__pyx_builtin_xrange;
 static PyObject *__pyx_builtin_id;
 static PyObject *__pyx_builtin_IndexError;
-static PyObject *__pyx_pf_12splitBBoxLUT_11HistoBBox1d_6__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
+static PyObject *__pyx_pf_12splitBBoxLUT_11HistoBBox1d_8__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
 static PyObject *__pyx_pf_12splitBBoxLUT_11HistoBBox1d___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_pos0, PyObject *__pyx_v_delta_pos0, PyObject *__pyx_v_pos1, PyObject *__pyx_v_delta_pos1, int __pyx_v_bins, PyObject *__pyx_v_pos0Range, PyObject *__pyx_v_pos1Range, PyObject *__pyx_v_mask, PyObject *__pyx_v_mask_checksum, PyObject *__pyx_v_allow_pos0_neg, PyObject *__pyx_v_unit); /* proto */
-static PyObject *__pyx_pf_12splitBBoxLUT_11HistoBBox1d_2calc_lut(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_12splitBBoxLUT_11HistoBBox1d_4integrate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_weights, PyObject *__pyx_v_dummy, PyObject *__pyx_v_delta_dummy, PyObject *__pyx_v_dark, PyObject *__pyx_v_flat, PyObject *__pyx_v_solidAngle, PyObject *__pyx_v_polarization); /* proto */
-static PyObject *__pyx_pf_12splitBBoxLUT_11HistoBBox2d_6__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
-static PyObject *__pyx_pf_12splitBBoxLUT_11HistoBBox2d___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_pos0, PyObject *__pyx_v_delta_pos0, PyObject *__pyx_v_pos1, PyObject *__pyx_v_delta_pos1, PyObject *__pyx_v_bins, PyObject *__pyx_v_pos0Range, PyObject *__pyx_v_pos1Range, PyObject *__pyx_v_mask, PyObject *__pyx_v_mask_checksum, PyObject *__pyx_v_allow_pos0_neg, PyObject *__pyx_v_unit); /* proto */
-static PyObject *__pyx_pf_12splitBBoxLUT_11HistoBBox2d_2calc_lut(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_12splitBBoxLUT_11HistoBBox2d_4integrate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_weights, PyObject *__pyx_v_dummy, PyObject *__pyx_v_delta_dummy, PyObject *__pyx_v_dark, PyObject *__pyx_v_flat, PyObject *__pyx_v_solidAngle, PyObject *__pyx_v_polarization); /* proto */
-static PyObject *__pyx_pf_12splitBBoxLUT_histoBBox2d(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_weights, PyArrayObject *__pyx_v_pos0, PyArrayObject *__pyx_v_delta_pos0, PyArrayObject *__pyx_v_pos1, PyArrayObject *__pyx_v_delta_pos1, PyObject *__pyx_v_bins, PyObject *__pyx_v_pos0Range, PyObject *__pyx_v_pos1Range, PyObject *__pyx_v_dummy, PyObject *__pyx_v_delta_dummy, PyObject *__pyx_v_mask, PyObject *__pyx_v_dark, PyObject *__pyx_v_flat, PyObject *__pyx_v_solidangle, PyO [...]
-static PyObject *__pyx_pf_12splitBBoxLUT_2histoBBox1d(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_weights, PyObject *__pyx_v_pos0, PyObject *__pyx_v_delta_pos0, PyObject *__pyx_v_pos1, PyObject *__pyx_v_delta_pos1, PyObject *__pyx_v_bins, PyObject *__pyx_v_pos0Range, PyObject *__pyx_v_pos1Range, PyObject *__pyx_v_dummy, PyObject *__pyx_v_delta_dummy, PyObject *__pyx_v_mask, PyObject *__pyx_v_dark, PyObject *__pyx_v_flat); /* proto */
+static PyObject *__pyx_pf_12splitBBoxLUT_11HistoBBox1d_2calc_boundaries(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_pos0Range); /* proto */
+static PyObject *__pyx_pf_12splitBBoxLUT_11HistoBBox1d_4calc_lut(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_12splitBBoxLUT_11HistoBBox1d_6integrate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_weights, PyObject *__pyx_v_dummy, PyObject *__pyx_v_delta_dummy, PyObject *__pyx_v_dark, PyObject *__pyx_v_flat, PyObject *__pyx_v_solidAngle, PyObject *__pyx_v_polarization); /* proto */
+static PyObject *__pyx_pf_12splitBBoxLUT_11HistoBBox2d_8__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
+static PyObject *__pyx_pf_12splitBBoxLUT_11HistoBBox2d___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_pos0, PyObject *__pyx_v_delta_pos0, PyObject *__pyx_v_pos1, PyObject *__pyx_v_delta_pos1, PyObject *__pyx_v_bins, PyObject *__pyx_v_pos0Range, PyObject *__pyx_v_pos1Range, PyObject *__pyx_v_mask, PyObject *__pyx_v_mask_checksum, PyObject *__pyx_v_allow_pos0_neg, PyObject *__pyx_v_unit, PyObject *__pyx_v_chiDiscAtPi); /* proto */
+static PyObject *__pyx_pf_12splitBBoxLUT_11HistoBBox2d_2calc_boundaries(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_pos0Range, PyObject *__pyx_v_pos1Range); /* proto */
+static PyObject *__pyx_pf_12splitBBoxLUT_11HistoBBox2d_4calc_lut(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_12splitBBoxLUT_11HistoBBox2d_6integrate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_weights, PyObject *__pyx_v_dummy, PyObject *__pyx_v_delta_dummy, PyObject *__pyx_v_dark, PyObject *__pyx_v_flat, PyObject *__pyx_v_solidAngle, PyObject *__pyx_v_polarization); /* proto */
 static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
 static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */
 static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer); /* proto */
@@ -1555,47 +1709,53 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_20copy(struct __pyx_me
 static PyObject *__pyx_memoryview_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
 static void __pyx_memoryviewslice_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
 static PyObject *__pyx_memoryviewslice__get__base_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
+static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
 static char __pyx_k_3[] = "Lookup-table (%i, %i) is %.3fGB whereas the memory of the system is only %s";
 static char __pyx_k_7[] = "Lookup-table (%i, %i, %i) is %.3fGB whereas the memory of the system is only %s";
-static char __pyx_k_9[] = "ndarray is not C contiguous";
-static char __pyx_k_11[] = "ndarray is not Fortran contiguous";
-static char __pyx_k_13[] = "Non-native byte order not supported";
-static char __pyx_k_15[] = "unknown dtype code in numpy.pxd (%d)";
-static char __pyx_k_16[] = "Format string allocated too short, see comment in numpy.pxd";
-static char __pyx_k_19[] = "Format string allocated too short.";
-static char __pyx_k_21[] = "Empty shape tuple for cython.array";
-static char __pyx_k_23[] = "itemsize <= 0 for cython.array";
-static char __pyx_k_26[] = "unable to allocate shape or strides.";
-static char __pyx_k_28[] = "Invalid shape in axis %d: %d.";
-static char __pyx_k_29[] = "Invalid mode, expected 'c' or 'fortran', got %s";
-static char __pyx_k_31[] = "unable to allocate array data.";
-static char __pyx_k_33[] = "Can only create a buffer that is contiguous in memory.";
-static char __pyx_k_35[] = "Unable to convert item to object";
-static char __pyx_k_37[] = "Buffer view does not expose strides";
-static char __pyx_k_39[] = "<MemoryView of %r at 0x%x>";
-static char __pyx_k_40[] = "<MemoryView of %r object>";
-static char __pyx_k_43[] = "Cannot index with type '%s'";
-static char __pyx_k_45[] = "Indirect dimensions not supported";
-static char __pyx_k_47[] = "Index out of bounds (axis %d)";
-static char __pyx_k_48[] = "Step may not be zero (axis %d)";
-static char __pyx_k_49[] = "All dimensions preceding dimension %d must be indexed and not sliced";
-static char __pyx_k_50[] = "Out of bounds on buffer access (axis %d)";
-static char __pyx_k_51[] = "Cannot transpose memoryview with indirect dimensions";
-static char __pyx_k_52[] = "got differing extents in dimension %d (got %d and %d)";
-static char __pyx_k_53[] = "Dimension %d is not direct";
-static char __pyx_k_56[] = "/users/kieffer/workspace-ssd/pyFAI/src/splitBBoxLUT.pyx";
-static char __pyx_k_57[] = "HistoBBox1d.__init__";
-static char __pyx_k_60[] = "HistoBBox1d.calc_lut";
-static char __pyx_k_64[] = "HistoBBox1d.integrate";
-static char __pyx_k_67[] = "HistoBBox2d.__init__";
-static char __pyx_k_70[] = "HistoBBox2d.calc_lut";
-static char __pyx_k_74[] = "HistoBBox2d.integrate";
-static char __pyx_k_79[] = "getbuffer(obj, view, flags)";
-static char __pyx_k_80[] = "<strided and direct or indirect>";
-static char __pyx_k_82[] = "<strided and direct>";
-static char __pyx_k_84[] = "<strided and indirect>";
-static char __pyx_k_86[] = "<contiguous and direct>";
-static char __pyx_k_88[] = "<contiguous and indirect>";
+static char __pyx_k_8[] = "ndarray is not C contiguous";
+static char __pyx_k_10[] = "ndarray is not Fortran contiguous";
+static char __pyx_k_12[] = "Non-native byte order not supported";
+static char __pyx_k_14[] = "unknown dtype code in numpy.pxd (%d)";
+static char __pyx_k_15[] = "Format string allocated too short, see comment in numpy.pxd";
+static char __pyx_k_18[] = "Format string allocated too short.";
+static char __pyx_k_20[] = "Empty shape tuple for cython.array";
+static char __pyx_k_22[] = "itemsize <= 0 for cython.array";
+static char __pyx_k_25[] = "unable to allocate shape or strides.";
+static char __pyx_k_27[] = "Invalid shape in axis %d: %d.";
+static char __pyx_k_28[] = "Invalid mode, expected 'c' or 'fortran', got %s";
+static char __pyx_k_30[] = "unable to allocate array data.";
+static char __pyx_k_32[] = "Can only create a buffer that is contiguous in memory.";
+static char __pyx_k_34[] = "Unable to convert item to object";
+static char __pyx_k_36[] = "Buffer view does not expose strides";
+static char __pyx_k_38[] = "<MemoryView of %r at 0x%x>";
+static char __pyx_k_39[] = "<MemoryView of %r object>";
+static char __pyx_k_42[] = "Cannot index with type '%s'";
+static char __pyx_k_44[] = "Indirect dimensions not supported";
+static char __pyx_k_46[] = "Index out of bounds (axis %d)";
+static char __pyx_k_47[] = "Step may not be zero (axis %d)";
+static char __pyx_k_48[] = "All dimensions preceding dimension %d must be indexed and not sliced";
+static char __pyx_k_49[] = "Out of bounds on buffer access (axis %d)";
+static char __pyx_k_50[] = "Cannot transpose memoryview with indirect dimensions";
+static char __pyx_k_51[] = "got differing extents in dimension %d (got %d and %d)";
+static char __pyx_k_52[] = "Dimension %d is not direct";
+static char __pyx_k_55[] = "/users/kieffer/workspace-ssd/pyFAI/src/splitBBoxLUT.pyx";
+static char __pyx_k_56[] = "HistoBBox1d.__init__";
+static char __pyx_k_59[] = "HistoBBox1d.calc_boundaries";
+static char __pyx_k_62[] = "HistoBBox1d.calc_lut";
+static char __pyx_k_66[] = "HistoBBox1d.integrate";
+static char __pyx_k_69[] = "HistoBBox2d.__init__";
+static char __pyx_k_72[] = "HistoBBox2d.calc_boundaries";
+static char __pyx_k_75[] = "HistoBBox2d.calc_lut";
+static char __pyx_k_79[] = "HistoBBox2d.integrate";
+static char __pyx_k_80[] = "getbuffer(obj, view, flags)";
+static char __pyx_k_81[] = "<strided and direct or indirect>";
+static char __pyx_k_83[] = "<strided and direct>";
+static char __pyx_k_85[] = "<strided and indirect>";
+static char __pyx_k_87[] = "<contiguous and direct>";
+static char __pyx_k_89[] = "<contiguous and indirect>";
 static char __pyx_k__B[] = "B";
 static char __pyx_k__H[] = "H";
 static char __pyx_k__I[] = "I";
@@ -1617,16 +1777,18 @@ static char __pyx_k__q[] = "q";
 static char __pyx_k__Zd[] = "Zd";
 static char __pyx_k__Zf[] = "Zf";
 static char __pyx_k__Zg[] = "Zg";
+static char __pyx_k__c0[] = "c0";
+static char __pyx_k__c1[] = "c1";
+static char __pyx_k__d0[] = "d0";
+static char __pyx_k__d1[] = "d1";
 static char __pyx_k__id[] = "id";
 static char __pyx_k__os[] = "os";
-static char __pyx_k__bin[] = "bin";
 static char __pyx_k__eps[] = "eps";
 static char __pyx_k__idx[] = "idx";
 static char __pyx_k__lut[] = "lut";
 static char __pyx_k__max[] = "max";
 static char __pyx_k__min[] = "min";
 static char __pyx_k__obj[] = "obj";
-static char __pyx_k__tmp[] = "tmp";
 static char __pyx_k__base[] = "base";
 static char __pyx_k__bin0[] = "bin0";
 static char __pyx_k__bin1[] = "bin1";
@@ -1669,12 +1831,11 @@ static char __pyx_k__dpos0[] = "dpos0";
 static char __pyx_k__dpos1[] = "dpos1";
 static char __pyx_k__dtype[] = "dtype";
 static char __pyx_k__dummy[] = "dummy";
-static char __pyx_k__empty[] = "empty";
 static char __pyx_k__error[] = "error";
 static char __pyx_k__finfo[] = "finfo";
 static char __pyx_k__flags[] = "flags";
 static char __pyx_k__int32[] = "int32";
-static char __pyx_k__int64[] = "int64";
+static char __pyx_k__lower[] = "lower";
 static char __pyx_k__numpy[] = "numpy";
 static char __pyx_k__posix[] = "posix";
 static char __pyx_k__range[] = "range";
@@ -1682,9 +1843,9 @@ static char __pyx_k__ravel[] = "ravel";
 static char __pyx_k__shape[] = "shape";
 static char __pyx_k__start[] = "start";
 static char __pyx_k__tdata[] = "tdata";
+static char __pyx_k__upper[] = "upper";
 static char __pyx_k__zeros[] = "zeros";
 static char __pyx_k__cdummy[] = "cdummy";
-static char __pyx_k__ddummy[] = "ddummy";
 static char __pyx_k__decode[] = "decode";
 static char __pyx_k__delta0[] = "delta0";
 static char __pyx_k__delta1[] = "delta1";
@@ -1693,16 +1854,18 @@ static char __pyx_k__deltaD[] = "deltaD";
 static char __pyx_k__deltaL[] = "deltaL";
 static char __pyx_k__deltaR[] = "deltaR";
 static char __pyx_k__deltaU[] = "deltaU";
-static char __pyx_k__edges0[] = "edges0";
-static char __pyx_k__edges1[] = "edges1";
 static char __pyx_k__encode[] = "encode";
 static char __pyx_k__extend[] = "extend";
 static char __pyx_k__format[] = "format";
+static char __pyx_k__lower0[] = "lower0";
+static char __pyx_k__lower1[] = "lower1";
 static char __pyx_k__object[] = "object";
 static char __pyx_k__outMax[] = "outMax";
 static char __pyx_k__outPos[] = "outPos";
 static char __pyx_k__struct[] = "struct";
 static char __pyx_k__unpack[] = "unpack";
+static char __pyx_k__upper0[] = "upper0";
+static char __pyx_k__upper1[] = "upper1";
 static char __pyx_k__xrange[] = "xrange";
 static char __pyx_k__cddummy[] = "cddummy";
 static char __pyx_k__do_dark[] = "do_dark";
@@ -1761,82 +1924,85 @@ static char __pyx_k__sum_count[] = "sum_count";
 static char __pyx_k__undefined[] = "undefined";
 static char __pyx_k__IndexError[] = "IndexError";
 static char __pyx_k__ValueError[] = "ValueError";
+static char __pyx_k____import__[] = "__import__";
+static char __pyx_k____module__[] = "__module__";
 static char __pyx_k__check_mask[] = "check_mask";
 static char __pyx_k__check_pos1[] = "check_pos1";
 static char __pyx_k__delta_pos0[] = "delta_pos0";
 static char __pyx_k__delta_pos1[] = "delta_pos1";
+static char __pyx_k__empty_like[] = "empty_like";
 static char __pyx_k__lut_nbytes[] = "lut_nbytes";
 static char __pyx_k__outData_1d[] = "outData_1d";
 static char __pyx_k__pos0_maxin[] = "pos0_maxin";
 static char __pyx_k__pos1_maxin[] = "pos1_maxin";
 static char __pyx_k__solidAngle[] = "solidAngle";
-static char __pyx_k__solidangle[] = "solidangle";
 static char __pyx_k__HistoBBox1d[] = "HistoBBox1d";
 static char __pyx_k__HistoBBox2d[] = "HistoBBox2d";
 static char __pyx_k__MemoryError[] = "MemoryError";
-static char __pyx_k__check_dummy[] = "check_dummy";
-static char __pyx_k__cpos0_lower[] = "cpos0_lower";
-static char __pyx_k__cpos0_upper[] = "cpos0_upper";
+static char __pyx_k__chiDiscAtPi[] = "chiDiscAtPi";
 static char __pyx_k__csolidAngle[] = "csolidAngle";
-static char __pyx_k__csolidangle[] = "csolidangle";
 static char __pyx_k__delta_dummy[] = "delta_dummy";
-static char __pyx_k__histoBBox1d[] = "histoBBox1d";
-static char __pyx_k__histoBBox2d[] = "histoBBox2d";
 static char __pyx_k__lut_max_idx[] = "lut_max_idx";
 static char __pyx_k__outCount_1d[] = "outCount_1d";
 static char __pyx_k__outMerge_1d[] = "outMerge_1d";
 static char __pyx_k__RuntimeError[] = "RuntimeError";
 static char __pyx_k__SC_PAGE_SIZE[] = "SC_PAGE_SIZE";
+static char __pyx_k____qualname__[] = "__qualname__";
 static char __pyx_k__lut_checksum[] = "lut_checksum";
 static char __pyx_k__polarization[] = "polarization";
 static char __pyx_k__splitBBoxLUT[] = "splitBBoxLUT";
 static char __pyx_k__SC_PHYS_PAGES[] = "SC_PHYS_PAGES";
+static char __pyx_k____metaclass__[] = "__metaclass__";
 static char __pyx_k__cpolarization[] = "cpolarization";
 static char __pyx_k__do_solidAngle[] = "do_solidAngle";
-static char __pyx_k__do_solidangle[] = "do_solidangle";
 static char __pyx_k__mask_checksum[] = "mask_checksum";
 static char __pyx_k__sysconf_names[] = "sysconf_names";
+static char __pyx_k____pyx_vtable__[] = "__pyx_vtable__";
 static char __pyx_k__allow_pos0_neg[] = "allow_pos0_neg";
 static char __pyx_k____pyx_getbuffer[] = "__pyx_getbuffer";
 static char __pyx_k__allocate_buffer[] = "allocate_buffer";
+static char __pyx_k__calc_boundaries[] = "calc_boundaries";
 static char __pyx_k__do_polarization[] = "do_polarization";
 static char __pyx_k__dtype_is_object[] = "dtype_is_object";
 static char __pyx_k__ascontiguousarray[] = "ascontiguousarray";
-static PyObject *__pyx_kp_u_11;
-static PyObject *__pyx_kp_u_13;
+static char __pyx_k____pyx_releasebuffer[] = "__pyx_releasebuffer";
+static PyObject *__pyx_kp_u_10;
+static PyObject *__pyx_kp_u_12;
+static PyObject *__pyx_kp_u_14;
 static PyObject *__pyx_kp_u_15;
-static PyObject *__pyx_kp_u_16;
-static PyObject *__pyx_kp_u_19;
-static PyObject *__pyx_kp_s_21;
-static PyObject *__pyx_kp_s_23;
-static PyObject *__pyx_kp_s_26;
+static PyObject *__pyx_kp_u_18;
+static PyObject *__pyx_kp_s_20;
+static PyObject *__pyx_kp_s_22;
+static PyObject *__pyx_kp_s_25;
+static PyObject *__pyx_kp_s_27;
 static PyObject *__pyx_kp_s_28;
-static PyObject *__pyx_kp_s_29;
 static PyObject *__pyx_kp_s_3;
-static PyObject *__pyx_kp_s_31;
-static PyObject *__pyx_kp_s_33;
-static PyObject *__pyx_kp_s_35;
-static PyObject *__pyx_kp_s_37;
+static PyObject *__pyx_kp_s_30;
+static PyObject *__pyx_kp_s_32;
+static PyObject *__pyx_kp_s_34;
+static PyObject *__pyx_kp_s_36;
+static PyObject *__pyx_kp_s_38;
 static PyObject *__pyx_kp_s_39;
-static PyObject *__pyx_kp_s_40;
-static PyObject *__pyx_kp_s_43;
-static PyObject *__pyx_kp_s_45;
-static PyObject *__pyx_kp_s_50;
-static PyObject *__pyx_kp_s_52;
-static PyObject *__pyx_kp_s_56;
-static PyObject *__pyx_n_s_57;
-static PyObject *__pyx_n_s_60;
-static PyObject *__pyx_n_s_64;
-static PyObject *__pyx_n_s_67;
+static PyObject *__pyx_kp_s_42;
+static PyObject *__pyx_kp_s_44;
+static PyObject *__pyx_kp_s_49;
+static PyObject *__pyx_kp_s_51;
+static PyObject *__pyx_kp_s_55;
+static PyObject *__pyx_n_s_56;
+static PyObject *__pyx_n_s_59;
+static PyObject *__pyx_n_s_62;
+static PyObject *__pyx_n_s_66;
+static PyObject *__pyx_n_s_69;
 static PyObject *__pyx_kp_s_7;
-static PyObject *__pyx_n_s_70;
-static PyObject *__pyx_n_s_74;
-static PyObject *__pyx_kp_s_80;
-static PyObject *__pyx_kp_s_82;
-static PyObject *__pyx_kp_s_84;
-static PyObject *__pyx_kp_s_86;
-static PyObject *__pyx_kp_s_88;
-static PyObject *__pyx_kp_u_9;
+static PyObject *__pyx_n_s_72;
+static PyObject *__pyx_n_s_75;
+static PyObject *__pyx_n_s_79;
+static PyObject *__pyx_kp_u_8;
+static PyObject *__pyx_kp_s_81;
+static PyObject *__pyx_kp_s_83;
+static PyObject *__pyx_kp_s_85;
+static PyObject *__pyx_kp_s_87;
+static PyObject *__pyx_kp_s_89;
 static PyObject *__pyx_n_s__ASCII;
 static PyObject *__pyx_n_s__EPS32;
 static PyObject *__pyx_n_s__Ellipsis;
@@ -1852,16 +2018,21 @@ static PyObject *__pyx_n_s__T;
 static PyObject *__pyx_n_s__TypeError;
 static PyObject *__pyx_n_s__ValueError;
 static PyObject *__pyx_n_s____class__;
+static PyObject *__pyx_n_s____import__;
 static PyObject *__pyx_n_s____init__;
 static PyObject *__pyx_n_s____main__;
+static PyObject *__pyx_n_s____metaclass__;
+static PyObject *__pyx_n_s____module__;
 static PyObject *__pyx_n_s____name__;
 static PyObject *__pyx_n_s____pyx_getbuffer;
+static PyObject *__pyx_n_s____pyx_releasebuffer;
+static PyObject *__pyx_n_s____pyx_vtable__;
+static PyObject *__pyx_n_s____qualname__;
 static PyObject *__pyx_n_s____test__;
 static PyObject *__pyx_n_s__allocate_buffer;
 static PyObject *__pyx_n_s__allow_pos0_neg;
 static PyObject *__pyx_n_s__ascontiguousarray;
 static PyObject *__pyx_n_s__base;
-static PyObject *__pyx_n_s__bin;
 static PyObject *__pyx_n_s__bin0;
 static PyObject *__pyx_n_s__bin0_max;
 static PyObject *__pyx_n_s__bin0_min;
@@ -1874,23 +2045,24 @@ static PyObject *__pyx_n_s__bins1;
 static PyObject *__pyx_n_b__c;
 static PyObject *__pyx_n_s__c;
 static PyObject *__pyx_n_u__c;
+static PyObject *__pyx_n_s__c0;
+static PyObject *__pyx_n_s__c1;
+static PyObject *__pyx_n_s__calc_boundaries;
 static PyObject *__pyx_n_s__calc_lut;
 static PyObject *__pyx_n_s__cdark;
 static PyObject *__pyx_n_s__cdata;
 static PyObject *__pyx_n_s__cddummy;
 static PyObject *__pyx_n_s__cdummy;
 static PyObject *__pyx_n_s__cflat;
-static PyObject *__pyx_n_s__check_dummy;
 static PyObject *__pyx_n_s__check_mask;
 static PyObject *__pyx_n_s__check_pos1;
+static PyObject *__pyx_n_s__chiDiscAtPi;
 static PyObject *__pyx_n_s__cmask;
 static PyObject *__pyx_n_s__coef;
 static PyObject *__pyx_n_s__cpolarization;
 static PyObject *__pyx_n_s__cpos0;
 static PyObject *__pyx_n_s__cpos0_inf;
-static PyObject *__pyx_n_s__cpos0_lower;
 static PyObject *__pyx_n_s__cpos0_sup;
-static PyObject *__pyx_n_s__cpos0_upper;
 static PyObject *__pyx_n_s__cpos1;
 static PyObject *__pyx_n_s__cpos1_inf;
 static PyObject *__pyx_n_s__cpos1_max;
@@ -1898,10 +2070,11 @@ static PyObject *__pyx_n_s__cpos1_min;
 static PyObject *__pyx_n_s__cpos1_sup;
 static PyObject *__pyx_n_s__crc32;
 static PyObject *__pyx_n_s__csolidAngle;
-static PyObject *__pyx_n_s__csolidangle;
+static PyObject *__pyx_n_s__d;
+static PyObject *__pyx_n_s__d0;
+static PyObject *__pyx_n_s__d1;
 static PyObject *__pyx_n_s__dark;
 static PyObject *__pyx_n_s__data;
-static PyObject *__pyx_n_s__ddummy;
 static PyObject *__pyx_n_s__decode;
 static PyObject *__pyx_n_s__delta;
 static PyObject *__pyx_n_s__delta0;
@@ -1919,15 +2092,12 @@ static PyObject *__pyx_n_s__do_dummy;
 static PyObject *__pyx_n_s__do_flat;
 static PyObject *__pyx_n_s__do_polarization;
 static PyObject *__pyx_n_s__do_solidAngle;
-static PyObject *__pyx_n_s__do_solidangle;
 static PyObject *__pyx_n_s__dpos0;
 static PyObject *__pyx_n_s__dpos1;
 static PyObject *__pyx_n_s__dtype;
 static PyObject *__pyx_n_s__dtype_is_object;
 static PyObject *__pyx_n_s__dummy;
-static PyObject *__pyx_n_s__edges0;
-static PyObject *__pyx_n_s__edges1;
-static PyObject *__pyx_n_s__empty;
+static PyObject *__pyx_n_s__empty_like;
 static PyObject *__pyx_n_s__encode;
 static PyObject *__pyx_n_s__enumerate;
 static PyObject *__pyx_n_s__eps;
@@ -1947,19 +2117,19 @@ static PyObject *__pyx_n_s__float64;
 static PyObject *__pyx_n_s__format;
 static PyObject *__pyx_n_b__fortran;
 static PyObject *__pyx_n_s__fortran;
-static PyObject *__pyx_n_s__histoBBox1d;
-static PyObject *__pyx_n_s__histoBBox2d;
 static PyObject *__pyx_n_s__i;
 static PyObject *__pyx_n_s__id;
 static PyObject *__pyx_n_s__idx;
 static PyObject *__pyx_n_s__int32;
-static PyObject *__pyx_n_s__int64;
 static PyObject *__pyx_n_s__int8;
 static PyObject *__pyx_n_s__integrate;
 static PyObject *__pyx_n_s__itemsize;
 static PyObject *__pyx_n_s__j;
 static PyObject *__pyx_n_s__k;
 static PyObject *__pyx_n_s__linspace;
+static PyObject *__pyx_n_s__lower;
+static PyObject *__pyx_n_s__lower0;
+static PyObject *__pyx_n_s__lower1;
 static PyObject *__pyx_n_s__lut;
 static PyObject *__pyx_n_s__lut_checksum;
 static PyObject *__pyx_n_s__lut_max_idx;
@@ -2012,7 +2182,6 @@ static PyObject *__pyx_n_s__self;
 static PyObject *__pyx_n_s__shape;
 static PyObject *__pyx_n_s__size;
 static PyObject *__pyx_n_s__solidAngle;
-static PyObject *__pyx_n_s__solidangle;
 static PyObject *__pyx_n_s__splitBBoxLUT;
 static PyObject *__pyx_n_s__start;
 static PyObject *__pyx_n_s__step;
@@ -2023,10 +2192,12 @@ static PyObject *__pyx_n_s__sum_data;
 static PyObject *__pyx_n_s__sysconf;
 static PyObject *__pyx_n_s__sysconf_names;
 static PyObject *__pyx_n_s__tdata;
-static PyObject *__pyx_n_s__tmp;
 static PyObject *__pyx_n_s__undefined;
 static PyObject *__pyx_n_s__unit;
 static PyObject *__pyx_n_s__unpack;
+static PyObject *__pyx_n_s__upper;
+static PyObject *__pyx_n_s__upper0;
+static PyObject *__pyx_n_s__upper1;
 static PyObject *__pyx_n_s__weights;
 static PyObject *__pyx_n_s__xrange;
 static PyObject *__pyx_n_s__zeros;
@@ -2042,51 +2213,50 @@ static PyObject *__pyx_k_tuple_2;
 static PyObject *__pyx_k_tuple_4;
 static PyObject *__pyx_k_tuple_5;
 static PyObject *__pyx_k_tuple_6;
-static PyObject *__pyx_k_tuple_8;
-static PyObject *__pyx_k_tuple_10;
-static PyObject *__pyx_k_tuple_12;
-static PyObject *__pyx_k_tuple_14;
+static PyObject *__pyx_k_tuple_9;
+static PyObject *__pyx_k_tuple_11;
+static PyObject *__pyx_k_tuple_13;
+static PyObject *__pyx_k_tuple_16;
 static PyObject *__pyx_k_tuple_17;
-static PyObject *__pyx_k_tuple_18;
-static PyObject *__pyx_k_tuple_20;
-static PyObject *__pyx_k_tuple_22;
+static PyObject *__pyx_k_tuple_19;
+static PyObject *__pyx_k_tuple_21;
+static PyObject *__pyx_k_tuple_23;
 static PyObject *__pyx_k_tuple_24;
-static PyObject *__pyx_k_tuple_25;
-static PyObject *__pyx_k_tuple_27;
-static PyObject *__pyx_k_tuple_30;
-static PyObject *__pyx_k_tuple_32;
-static PyObject *__pyx_k_tuple_34;
-static PyObject *__pyx_k_tuple_36;
-static PyObject *__pyx_k_tuple_38;
+static PyObject *__pyx_k_tuple_26;
+static PyObject *__pyx_k_tuple_29;
+static PyObject *__pyx_k_tuple_31;
+static PyObject *__pyx_k_tuple_33;
+static PyObject *__pyx_k_tuple_35;
+static PyObject *__pyx_k_tuple_37;
+static PyObject *__pyx_k_tuple_40;
 static PyObject *__pyx_k_tuple_41;
-static PyObject *__pyx_k_tuple_42;
-static PyObject *__pyx_k_tuple_44;
-static PyObject *__pyx_k_tuple_46;
-static PyObject *__pyx_k_tuple_54;
-static PyObject *__pyx_k_tuple_58;
-static PyObject *__pyx_k_tuple_61;
+static PyObject *__pyx_k_tuple_43;
+static PyObject *__pyx_k_tuple_45;
+static PyObject *__pyx_k_tuple_53;
+static PyObject *__pyx_k_tuple_57;
+static PyObject *__pyx_k_tuple_60;
 static PyObject *__pyx_k_tuple_63;
 static PyObject *__pyx_k_tuple_65;
-static PyObject *__pyx_k_tuple_68;
-static PyObject *__pyx_k_tuple_71;
+static PyObject *__pyx_k_tuple_67;
+static PyObject *__pyx_k_tuple_70;
 static PyObject *__pyx_k_tuple_73;
-static PyObject *__pyx_k_tuple_75;
-static PyObject *__pyx_k_tuple_77;
-static PyObject *__pyx_k_tuple_81;
-static PyObject *__pyx_k_tuple_83;
-static PyObject *__pyx_k_tuple_85;
-static PyObject *__pyx_k_tuple_87;
-static PyObject *__pyx_k_tuple_89;
-static PyObject *__pyx_k_codeobj_55;
-static PyObject *__pyx_k_codeobj_59;
-static PyObject *__pyx_k_codeobj_62;
-static PyObject *__pyx_k_codeobj_66;
-static PyObject *__pyx_k_codeobj_69;
-static PyObject *__pyx_k_codeobj_72;
-static PyObject *__pyx_k_codeobj_76;
-static PyObject *__pyx_k_codeobj_78;
-
-/* "splitBBoxLUT.pyx":45
+static PyObject *__pyx_k_tuple_76;
+static PyObject *__pyx_k_tuple_78;
+static PyObject *__pyx_k_tuple_82;
+static PyObject *__pyx_k_tuple_84;
+static PyObject *__pyx_k_tuple_86;
+static PyObject *__pyx_k_tuple_88;
+static PyObject *__pyx_k_tuple_90;
+static PyObject *__pyx_k_codeobj_54;
+static PyObject *__pyx_k_codeobj_58;
+static PyObject *__pyx_k_codeobj_61;
+static PyObject *__pyx_k_codeobj_64;
+static PyObject *__pyx_k_codeobj_68;
+static PyObject *__pyx_k_codeobj_71;
+static PyObject *__pyx_k_codeobj_74;
+static PyObject *__pyx_k_codeobj_77;
+
+/* "splitBBoxLUT.pyx":46
  * 
  * @cython.cdivision(True)
  * cdef float getBinNr( float x0, float pos0_min, float delta) nogil:             # <<<<<<<<<<<<<<
@@ -2097,7 +2267,7 @@ static PyObject *__pyx_k_codeobj_78;
 static float __pyx_f_12splitBBoxLUT_getBinNr(float __pyx_v_x0, float __pyx_v_pos0_min, float __pyx_v_delta) {
   float __pyx_r;
 
-  /* "splitBBoxLUT.pyx":52
+  /* "splitBBoxLUT.pyx":53
  *     param delta: bin width
  *     """
  *     return (x0 - pos0_min) / delta             # <<<<<<<<<<<<<<
@@ -2112,7 +2282,7 @@ static float __pyx_f_12splitBBoxLUT_getBinNr(float __pyx_v_x0, float __pyx_v_pos
   return __pyx_r;
 }
 
-/* "splitBBoxLUT.pyx":56
+/* "splitBBoxLUT.pyx":57
  * class HistoBBox1d(object):
  *     @cython.boundscheck(False)
  *     def __init__(self,             # <<<<<<<<<<<<<<
@@ -2120,7 +2290,7 @@ static float __pyx_f_12splitBBoxLUT_getBinNr(float __pyx_v_x0, float __pyx_v_pos
  *                  delta_pos0,
  */
 
-static PyObject *__pyx_pf_12splitBBoxLUT_11HistoBBox1d_6__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
+static PyObject *__pyx_pf_12splitBBoxLUT_11HistoBBox1d_8__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -2131,24 +2301,24 @@ static PyObject *__pyx_pf_12splitBBoxLUT_11HistoBBox1d_6__defaults__(CYTHON_UNUS
   __Pyx_RefNannySetupContext("__defaults__", 0);
   __Pyx_XDECREF(__pyx_r);
 
-  /* "splitBBoxLUT.pyx":61
+  /* "splitBBoxLUT.pyx":62
  *                  pos1=None,
  *                  delta_pos1=None,
  *                  int bins=100,             # <<<<<<<<<<<<<<
  *                  pos0Range=None,
  *                  pos1Range=None,
  */
-  __pyx_t_1 = PyInt_FromLong(((int)100)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyInt_FromLong(((int)100)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
 
-  /* "splitBBoxLUT.pyx":56
+  /* "splitBBoxLUT.pyx":57
  * class HistoBBox1d(object):
  *     @cython.boundscheck(False)
  *     def __init__(self,             # <<<<<<<<<<<<<<
  *                  pos0,
  *                  delta_pos0,
  */
-  __pyx_t_2 = PyTuple_New(9); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyTuple_New(9); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_INCREF(((PyObject *)Py_None));
   PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)Py_None));
@@ -2177,8 +2347,16 @@ static PyObject *__pyx_pf_12splitBBoxLUT_11HistoBBox1d_6__defaults__(CYTHON_UNUS
   PyTuple_SET_ITEM(__pyx_t_2, 8, ((PyObject *)((PyObject*)__pyx_n_s__undefined)));
   __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_n_s__undefined)));
   __pyx_t_1 = 0;
-  __pyx_r = ((PyObject *)__pyx_t_2);
+  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_2));
+  __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
+  __Pyx_INCREF(Py_None);
+  PyTuple_SET_ITEM(__pyx_t_1, 1, Py_None);
+  __Pyx_GIVEREF(Py_None);
   __pyx_t_2 = 0;
+  __pyx_r = ((PyObject *)__pyx_t_1);
+  __pyx_t_1 = 0;
   goto __pyx_L0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -2210,6 +2388,9 @@ static PyObject *__pyx_pw_12splitBBoxLUT_11HistoBBox1d_1__init__(PyObject *__pyx
   PyObject *__pyx_v_mask_checksum = 0;
   PyObject *__pyx_v_allow_pos0_neg = 0;
   PyObject *__pyx_v_unit = 0;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
@@ -2252,12 +2433,12 @@ static PyObject *__pyx_pw_12splitBBoxLUT_11HistoBBox1d_1__init__(PyObject *__pyx
         case  1:
         if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos0)) != 0)) kw_args--;
         else {
-          __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 12, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+          __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 12, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  2:
         if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__delta_pos0)) != 0)) kw_args--;
         else {
-          __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 12, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+          __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 12, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  3:
         if (kw_args > 0) {
@@ -2306,7 +2487,7 @@ static PyObject *__pyx_pw_12splitBBoxLUT_11HistoBBox1d_1__init__(PyObject *__pyx
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     } else {
       switch (PyTuple_GET_SIZE(__pyx_args)) {
@@ -2332,7 +2513,7 @@ static PyObject *__pyx_pw_12splitBBoxLUT_11HistoBBox1d_1__init__(PyObject *__pyx
     __pyx_v_pos1 = values[3];
     __pyx_v_delta_pos1 = values[4];
     if (values[5]) {
-      __pyx_v_bins = __Pyx_PyInt_AsInt(values[5]); if (unlikely((__pyx_v_bins == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      __pyx_v_bins = __Pyx_PyInt_AsInt(values[5]); if (unlikely((__pyx_v_bins == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     } else {
       __pyx_v_bins = ((int)((int)100));
     }
@@ -2345,7 +2526,7 @@ static PyObject *__pyx_pw_12splitBBoxLUT_11HistoBBox1d_1__init__(PyObject *__pyx
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 12, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 12, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_AddTraceback("splitBBoxLUT.HistoBBox1d.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
@@ -2357,7 +2538,6 @@ static PyObject *__pyx_pw_12splitBBoxLUT_11HistoBBox1d_1__init__(PyObject *__pyx
 }
 
 static PyObject *__pyx_pf_12splitBBoxLUT_11HistoBBox1d___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_pos0, PyObject *__pyx_v_delta_pos0, PyObject *__pyx_v_pos1, PyObject *__pyx_v_delta_pos1, int __pyx_v_bins, PyObject *__pyx_v_pos0Range, PyObject *__pyx_v_pos1Range, PyObject *__pyx_v_mask, PyObject *__pyx_v_mask_checksum, PyObject *__pyx_v_allow_pos0_neg, PyObject *__pyx_v_unit) {
-  PyObject *__pyx_v_pos0_maxin = NULL;
   PyObject *__pyx_v_pos1_maxin = NULL;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
@@ -2365,39 +2545,40 @@ static PyObject *__pyx_pf_12splitBBoxLUT_11HistoBBox1d___init__(CYTHON_UNUSED Py
   PyObject *__pyx_t_2 = NULL;
   PyObject *__pyx_t_3 = NULL;
   int __pyx_t_4;
-  PyObject *__pyx_t_5 = NULL;
+  int __pyx_t_5;
   PyObject *__pyx_t_6 = NULL;
-  Py_ssize_t __pyx_t_7;
-  int __pyx_t_8;
+  PyObject *__pyx_t_7 = NULL;
+  Py_ssize_t __pyx_t_8;
   int __pyx_t_9;
+  PyObject *__pyx_t_10 = NULL;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__init__", 0);
 
   /* "splitBBoxLUT.pyx":70
+ *                  unit="undefined"):
  * 
- *         cdef int i, size
  *         self.size = pos0.size             # <<<<<<<<<<<<<<
  *         assert delta_pos0.size == self.size
  *         self.bins = bins
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_pos0, __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_pos0, __pyx_n_s__size); 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);
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__size, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__size, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
   /* "splitBBoxLUT.pyx":71
- *         cdef int i, size
+ * 
  *         self.size = pos0.size
  *         assert delta_pos0.size == self.size             # <<<<<<<<<<<<<<
  *         self.bins = bins
  *         self.lut_size = 0
  */
   #ifndef CYTHON_WITHOUT_ASSERTIONS
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_delta_pos0, __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_delta_pos0, __pyx_n_s__size); 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_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __pyx_t_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 = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -2415,338 +2596,396 @@ static PyObject *__pyx_pf_12splitBBoxLUT_11HistoBBox1d___init__(CYTHON_UNUSED Py
  *         assert delta_pos0.size == self.size
  *         self.bins = bins             # <<<<<<<<<<<<<<
  *         self.lut_size = 0
- *         self.cpos0 = numpy.ascontiguousarray(pos0.ravel(), dtype=numpy.float32)
+ *         self.allow_pos0_neg =  allow_pos0_neg
  */
   __pyx_t_3 = PyInt_FromLong(__pyx_v_bins); 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);
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__bins, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__bins, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
   /* "splitBBoxLUT.pyx":73
  *         assert delta_pos0.size == self.size
  *         self.bins = bins
  *         self.lut_size = 0             # <<<<<<<<<<<<<<
- *         self.cpos0 = numpy.ascontiguousarray(pos0.ravel(), dtype=numpy.float32)
- *         self.dpos0 = numpy.ascontiguousarray(delta_pos0.ravel(), dtype=numpy.float32)
+ *         self.allow_pos0_neg =  allow_pos0_neg
+ *         if  mask is not None:
  */
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__lut_size, __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__lut_size, __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   /* "splitBBoxLUT.pyx":74
  *         self.bins = bins
  *         self.lut_size = 0
+ *         self.allow_pos0_neg =  allow_pos0_neg             # <<<<<<<<<<<<<<
+ *         if  mask is not None:
+ *             assert mask.size == self.size
+ */
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__allow_pos0_neg, __pyx_v_allow_pos0_neg) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "splitBBoxLUT.pyx":75
+ *         self.lut_size = 0
+ *         self.allow_pos0_neg =  allow_pos0_neg
+ *         if  mask is not None:             # <<<<<<<<<<<<<<
+ *             assert mask.size == self.size
+ *             self.check_mask = True
+ */
+  __pyx_t_4 = (__pyx_v_mask != Py_None);
+  __pyx_t_5 = (__pyx_t_4 != 0);
+  if (__pyx_t_5) {
+
+    /* "splitBBoxLUT.pyx":76
+ *         self.allow_pos0_neg =  allow_pos0_neg
+ *         if  mask is not None:
+ *             assert mask.size == self.size             # <<<<<<<<<<<<<<
+ *             self.check_mask = True
+ *             self.cmask = numpy.ascontiguousarray(mask.ravel(), dtype=numpy.int8)
+ */
+    #ifndef CYTHON_WITHOUT_ASSERTIONS
+    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_mask, __pyx_n_s__size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __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 = 76; __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_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    if (unlikely(!__pyx_t_5)) {
+      PyErr_SetNone(PyExc_AssertionError);
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    }
+    #endif
+
+    /* "splitBBoxLUT.pyx":77
+ *         if  mask is not None:
+ *             assert mask.size == self.size
+ *             self.check_mask = True             # <<<<<<<<<<<<<<
+ *             self.cmask = numpy.ascontiguousarray(mask.ravel(), dtype=numpy.int8)
+ *             if mask_checksum:
+ */
+    __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__check_mask, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+    /* "splitBBoxLUT.pyx":78
+ *             assert mask.size == self.size
+ *             self.check_mask = True
+ *             self.cmask = numpy.ascontiguousarray(mask.ravel(), dtype=numpy.int8)             # <<<<<<<<<<<<<<
+ *             if mask_checksum:
+ *                 self.mask_checksum = mask_checksum
+ */
+    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_mask, __pyx_n_s__ravel); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __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 = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __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);
+    __pyx_t_3 = 0;
+    __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+    __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); 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_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s__int8); 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_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __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_1), ((PyObject *)__pyx_t_3)); 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_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__cmask, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+
+    /* "splitBBoxLUT.pyx":79
+ *             self.check_mask = True
+ *             self.cmask = numpy.ascontiguousarray(mask.ravel(), dtype=numpy.int8)
+ *             if mask_checksum:             # <<<<<<<<<<<<<<
+ *                 self.mask_checksum = mask_checksum
+ *             else:
+ */
+    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_mask_checksum); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (__pyx_t_5) {
+
+      /* "splitBBoxLUT.pyx":80
+ *             self.cmask = numpy.ascontiguousarray(mask.ravel(), dtype=numpy.int8)
+ *             if mask_checksum:
+ *                 self.mask_checksum = mask_checksum             # <<<<<<<<<<<<<<
+ *             else:
+ *                 self.mask_checksum = crc32(mask)
+ */
+      if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__mask_checksum, __pyx_v_mask_checksum) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      goto __pyx_L4;
+    }
+    /*else*/ {
+
+      /* "splitBBoxLUT.pyx":82
+ *                 self.mask_checksum = mask_checksum
+ *             else:
+ *                 self.mask_checksum = crc32(mask)             # <<<<<<<<<<<<<<
+ *         else:
+ *             self.check_mask = False
+ */
+      __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s__crc32); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_7);
+      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __Pyx_INCREF(__pyx_v_mask);
+      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_mask);
+      __Pyx_GIVEREF(__pyx_v_mask);
+      __pyx_t_1 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
+      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+      if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__mask_checksum, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    }
+    __pyx_L4:;
+    goto __pyx_L3;
+  }
+  /*else*/ {
+
+    /* "splitBBoxLUT.pyx":84
+ *                 self.mask_checksum = crc32(mask)
+ *         else:
+ *             self.check_mask = False             # <<<<<<<<<<<<<<
+ *             self.mask_checksum = None
+ * 
+ */
+    __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__check_mask, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+    /* "splitBBoxLUT.pyx":85
+ *         else:
+ *             self.check_mask = False
+ *             self.mask_checksum = None             # <<<<<<<<<<<<<<
+ * 
+ *         self.cpos0 = numpy.ascontiguousarray(pos0.ravel(), dtype=numpy.float32)
+ */
+    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__mask_checksum, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  }
+  __pyx_L3:;
+
+  /* "splitBBoxLUT.pyx":87
+ *             self.mask_checksum = None
+ * 
  *         self.cpos0 = numpy.ascontiguousarray(pos0.ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
  *         self.dpos0 = numpy.ascontiguousarray(delta_pos0.ravel(), dtype=numpy.float32)
- *         self.cpos0_sup = self.cpos0 + self.dpos0
+ *         self.cpos0_sup = numpy.empty_like(self.cpos0) #self.cpos0 + self.dpos0
  */
-  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = PyObject_GetAttr(__pyx_v_pos0, __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __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 = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __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 = 87; __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 = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__float32); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_pos0, __pyx_n_s__ravel); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_7);
+  __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 = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7);
+  __Pyx_GIVEREF(__pyx_t_7);
+  __pyx_t_7 = 0;
+  __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_7));
+  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__float32); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-  __pyx_t_6 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__cpos0, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__cpos0, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
 
-  /* "splitBBoxLUT.pyx":75
- *         self.lut_size = 0
+  /* "splitBBoxLUT.pyx":88
+ * 
  *         self.cpos0 = numpy.ascontiguousarray(pos0.ravel(), dtype=numpy.float32)
  *         self.dpos0 = numpy.ascontiguousarray(delta_pos0.ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
- *         self.cpos0_sup = self.cpos0 + self.dpos0
- *         self.cpos0_inf = self.cpos0 - self.dpos0
+ *         self.cpos0_sup = numpy.empty_like(self.cpos0) #self.cpos0 + self.dpos0
+ *         self.cpos0_inf = numpy.empty_like(self.cpos0) #self.cpos0 - self.dpos0
  */
-  __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__ascontiguousarray); if (unlikely(!__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_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_7);
   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-  __pyx_t_6 = PyObject_GetAttr(__pyx_v_delta_pos0, __pyx_n_s__ravel); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_delta_pos0, __pyx_n_s__ravel); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
-  __pyx_t_3 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_1 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
-  PyTuple_SET_ITEM(__pyx_t_6, 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 = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  PyTuple_SET_ITEM(__pyx_t_6, 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 = 88; __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 = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__float32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__float32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_2 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__dpos0, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__dpos0, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-  /* "splitBBoxLUT.pyx":76
+  /* "splitBBoxLUT.pyx":89
  *         self.cpos0 = numpy.ascontiguousarray(pos0.ravel(), dtype=numpy.float32)
  *         self.dpos0 = numpy.ascontiguousarray(delta_pos0.ravel(), dtype=numpy.float32)
- *         self.cpos0_sup = self.cpos0 + self.dpos0             # <<<<<<<<<<<<<<
- *         self.cpos0_inf = self.cpos0 - self.dpos0
+ *         self.cpos0_sup = numpy.empty_like(self.cpos0) #self.cpos0 + self.dpos0             # <<<<<<<<<<<<<<
+ *         self.cpos0_inf = numpy.empty_like(self.cpos0) #self.cpos0 - self.dpos0
  *         self.pos0Range = pos0Range
  */
-  __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__cpos0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__dpos0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__empty_like); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__cpos0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__cpos0_sup, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2);
+  __Pyx_GIVEREF(__pyx_t_2);
+  __pyx_t_2 = 0;
+  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__cpos0_sup, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-  /* "splitBBoxLUT.pyx":77
+  /* "splitBBoxLUT.pyx":90
  *         self.dpos0 = numpy.ascontiguousarray(delta_pos0.ravel(), dtype=numpy.float32)
- *         self.cpos0_sup = self.cpos0 + self.dpos0
- *         self.cpos0_inf = self.cpos0 - self.dpos0             # <<<<<<<<<<<<<<
+ *         self.cpos0_sup = numpy.empty_like(self.cpos0) #self.cpos0 + self.dpos0
+ *         self.cpos0_inf = numpy.empty_like(self.cpos0) #self.cpos0 - self.dpos0             # <<<<<<<<<<<<<<
  *         self.pos0Range = pos0Range
  *         self.pos1Range = pos1Range
  */
-  __pyx_t_6 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__cpos0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__empty_like); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__dpos0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_5 = PyNumber_Subtract(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__cpos0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __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 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__cpos0_inf, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__cpos0_inf, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-  /* "splitBBoxLUT.pyx":78
- *         self.cpos0_sup = self.cpos0 + self.dpos0
- *         self.cpos0_inf = self.cpos0 - self.dpos0
+  /* "splitBBoxLUT.pyx":91
+ *         self.cpos0_sup = numpy.empty_like(self.cpos0) #self.cpos0 + self.dpos0
+ *         self.cpos0_inf = numpy.empty_like(self.cpos0) #self.cpos0 - self.dpos0
  *         self.pos0Range = pos0Range             # <<<<<<<<<<<<<<
  *         self.pos1Range = pos1Range
- *         if pos0Range is not None and len(pos0Range) > 1:
+ *         self.calc_boundaries(pos0Range)
  */
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__pos0Range, __pyx_v_pos0Range) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__pos0Range, __pyx_v_pos0Range) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "splitBBoxLUT.pyx":79
- *         self.cpos0_inf = self.cpos0 - self.dpos0
+  /* "splitBBoxLUT.pyx":92
+ *         self.cpos0_inf = numpy.empty_like(self.cpos0) #self.cpos0 - self.dpos0
  *         self.pos0Range = pos0Range
  *         self.pos1Range = pos1Range             # <<<<<<<<<<<<<<
- *         if pos0Range is not None and len(pos0Range) > 1:
- *             self.pos0_min = min(pos0Range)
+ *         self.calc_boundaries(pos0Range)
+ *         if pos1Range is not None and len(pos1Range) > 1:
  */
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__pos1Range, __pyx_v_pos1Range) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__pos1Range, __pyx_v_pos1Range) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "splitBBoxLUT.pyx":80
+  /* "splitBBoxLUT.pyx":93
  *         self.pos0Range = pos0Range
  *         self.pos1Range = pos1Range
- *         if pos0Range is not None and len(pos0Range) > 1:             # <<<<<<<<<<<<<<
- *             self.pos0_min = min(pos0Range)
- *             pos0_maxin = max(pos0Range)
- */
-  __pyx_t_4 = (__pyx_v_pos0Range != Py_None);
-  if (__pyx_t_4) {
-    __pyx_t_7 = PyObject_Length(__pyx_v_pos0Range); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_8 = (__pyx_t_7 > 1);
-    __pyx_t_9 = __pyx_t_8;
-  } else {
-    __pyx_t_9 = __pyx_t_4;
-  }
-  if (__pyx_t_9) {
-
-    /* "splitBBoxLUT.pyx":81
- *         self.pos1Range = pos1Range
- *         if pos0Range is not None and len(pos0Range) > 1:
- *             self.pos0_min = min(pos0Range)             # <<<<<<<<<<<<<<
- *             pos0_maxin = max(pos0Range)
- *         else:
- */
-    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_INCREF(__pyx_v_pos0Range);
-    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_pos0Range);
-    __Pyx_GIVEREF(__pyx_v_pos0Range);
-    __pyx_t_3 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
-    if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__pos0_min, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-
-    /* "splitBBoxLUT.pyx":82
- *         if pos0Range is not None and len(pos0Range) > 1:
- *             self.pos0_min = min(pos0Range)
- *             pos0_maxin = max(pos0Range)             # <<<<<<<<<<<<<<
- *         else:
- *             self.pos0_min = (self.cpos0_inf).min()
- */
-    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_INCREF(__pyx_v_pos0Range);
-    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_pos0Range);
-    __Pyx_GIVEREF(__pyx_v_pos0Range);
-    __pyx_t_5 = PyObject_Call(__pyx_builtin_max, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-    __pyx_v_pos0_maxin = __pyx_t_5;
-    __pyx_t_5 = 0;
-    goto __pyx_L3;
-  }
-  /*else*/ {
-
-    /* "splitBBoxLUT.pyx":84
- *             pos0_maxin = max(pos0Range)
- *         else:
- *             self.pos0_min = (self.cpos0_inf).min()             # <<<<<<<<<<<<<<
- *             pos0_maxin = (self.cpos0_sup).max()
- *         if (not allow_pos0_neg) and self.pos0_min < 0:
- */
-    __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__cpos0_inf); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__min); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__pos0_min, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-
-    /* "splitBBoxLUT.pyx":85
- *         else:
- *             self.pos0_min = (self.cpos0_inf).min()
- *             pos0_maxin = (self.cpos0_sup).max()             # <<<<<<<<<<<<<<
- *         if (not allow_pos0_neg) and self.pos0_min < 0:
- *             self.pos0_min = 0
- */
-    __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__cpos0_sup); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__max); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_v_pos0_maxin = __pyx_t_5;
-    __pyx_t_5 = 0;
-  }
-  __pyx_L3:;
-
-  /* "splitBBoxLUT.pyx":86
- *             self.pos0_min = (self.cpos0_inf).min()
- *             pos0_maxin = (self.cpos0_sup).max()
- *         if (not allow_pos0_neg) and self.pos0_min < 0:             # <<<<<<<<<<<<<<
- *             self.pos0_min = 0
- *         self.pos0_max = pos0_maxin * EPS32
- */
-  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_allow_pos0_neg); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_4 = (!__pyx_t_9);
-  if (__pyx_t_4) {
-    __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pos0_min); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_8 = __pyx_t_9;
-  } else {
-    __pyx_t_8 = __pyx_t_4;
-  }
-  if (__pyx_t_8) {
-
-    /* "splitBBoxLUT.pyx":87
- *             pos0_maxin = (self.cpos0_sup).max()
- *         if (not allow_pos0_neg) and self.pos0_min < 0:
- *             self.pos0_min = 0             # <<<<<<<<<<<<<<
- *         self.pos0_max = pos0_maxin * EPS32
- * 
- */
-    if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__pos0_min, __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L4;
-  }
-  __pyx_L4:;
-
-  /* "splitBBoxLUT.pyx":88
- *         if (not allow_pos0_neg) and self.pos0_min < 0:
- *             self.pos0_min = 0
- *         self.pos0_max = pos0_maxin * EPS32             # <<<<<<<<<<<<<<
- * 
+ *         self.calc_boundaries(pos0Range)             # <<<<<<<<<<<<<<
  *         if pos1Range is not None and len(pos1Range) > 1:
+ *             assert pos1.size == self.size
  */
-  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__EPS32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_5 = PyNumber_Multiply(__pyx_v_pos0_maxin, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__pos0_max, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__calc_boundaries); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_INCREF(__pyx_v_pos0Range);
+  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_pos0Range);
+  __Pyx_GIVEREF(__pyx_v_pos0Range);
+  __pyx_t_6 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_6);
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
 
-  /* "splitBBoxLUT.pyx":90
- *         self.pos0_max = pos0_maxin * EPS32
- * 
+  /* "splitBBoxLUT.pyx":94
+ *         self.pos1Range = pos1Range
+ *         self.calc_boundaries(pos0Range)
  *         if pos1Range is not None and len(pos1Range) > 1:             # <<<<<<<<<<<<<<
  *             assert pos1.size == self.size
  *             assert delta_pos1.size == self.size
  */
-  __pyx_t_8 = (__pyx_v_pos1Range != Py_None);
-  if (__pyx_t_8) {
-    __pyx_t_7 = PyObject_Length(__pyx_v_pos1Range); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_4 = (__pyx_t_7 > 1);
+  __pyx_t_5 = (__pyx_v_pos1Range != Py_None);
+  if ((__pyx_t_5 != 0)) {
+    __pyx_t_8 = PyObject_Length(__pyx_v_pos1Range); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = ((__pyx_t_8 > 1) != 0);
     __pyx_t_9 = __pyx_t_4;
   } else {
-    __pyx_t_9 = __pyx_t_8;
+    __pyx_t_9 = (__pyx_t_5 != 0);
   }
   if (__pyx_t_9) {
 
-    /* "splitBBoxLUT.pyx":91
- * 
+    /* "splitBBoxLUT.pyx":95
+ *         self.calc_boundaries(pos0Range)
  *         if pos1Range is not None and len(pos1Range) > 1:
  *             assert pos1.size == self.size             # <<<<<<<<<<<<<<
  *             assert delta_pos1.size == self.size
  *             self.check_pos1 = True
  */
     #ifndef CYTHON_WITHOUT_ASSERTIONS
-    __pyx_t_5 = PyObject_GetAttr(__pyx_v_pos1, __pyx_n_s__size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_6 = PyObject_RichCompare(__pyx_t_5, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_pos1, __pyx_n_s__size); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_2 = PyObject_RichCompare(__pyx_t_6, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     if (unlikely(!__pyx_t_9)) {
       PyErr_SetNone(PyExc_AssertionError);
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     #endif
 
-    /* "splitBBoxLUT.pyx":92
+    /* "splitBBoxLUT.pyx":96
  *         if pos1Range is not None and len(pos1Range) > 1:
  *             assert pos1.size == self.size
  *             assert delta_pos1.size == self.size             # <<<<<<<<<<<<<<
@@ -2754,485 +2993,333 @@ static PyObject *__pyx_pf_12splitBBoxLUT_11HistoBBox1d___init__(CYTHON_UNUSED Py
  *             self.cpos1_min = numpy.ascontiguousarray((pos1-delta_pos1).ravel(), dtype=numpy.float32)
  */
     #ifndef CYTHON_WITHOUT_ASSERTIONS
-    __pyx_t_6 = PyObject_GetAttr(__pyx_v_delta_pos1, __pyx_n_s__size); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_5 = PyObject_RichCompare(__pyx_t_6, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_delta_pos1, __pyx_n_s__size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     if (unlikely(!__pyx_t_9)) {
       PyErr_SetNone(PyExc_AssertionError);
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     #endif
 
-    /* "splitBBoxLUT.pyx":93
+    /* "splitBBoxLUT.pyx":97
  *             assert pos1.size == self.size
  *             assert delta_pos1.size == self.size
  *             self.check_pos1 = True             # <<<<<<<<<<<<<<
  *             self.cpos1_min = numpy.ascontiguousarray((pos1-delta_pos1).ravel(), dtype=numpy.float32)
  *             self.cpos1_max = numpy.ascontiguousarray((pos1+delta_pos1).ravel(), dtype=numpy.float32)
  */
-    __pyx_t_5 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__check_pos1, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __pyx_t_6 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__check_pos1, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
 
-    /* "splitBBoxLUT.pyx":94
+    /* "splitBBoxLUT.pyx":98
  *             assert delta_pos1.size == self.size
  *             self.check_pos1 = True
  *             self.cpos1_min = numpy.ascontiguousarray((pos1-delta_pos1).ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
  *             self.cpos1_max = numpy.ascontiguousarray((pos1+delta_pos1).ravel(), dtype=numpy.float32)
  *             self.pos1_min = min(pos1Range)
  */
-    __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_5 = PyNumber_Subtract(__pyx_v_pos1, __pyx_v_delta_pos1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__ravel); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_5 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyNumber_Subtract(__pyx_v_pos1, __pyx_v_delta_pos1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
-    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
-    __Pyx_GIVEREF(__pyx_t_5);
-    __pyx_t_5 = 0;
-    __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
-    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s__ravel); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __pyx_t_6 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
+    PyTuple_SET_ITEM(__pyx_t_2, 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 = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
+    __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_7);
+    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s__float32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+    if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __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_2), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
-    if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__cpos1_min, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__cpos1_min, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
-    /* "splitBBoxLUT.pyx":95
+    /* "splitBBoxLUT.pyx":99
  *             self.check_pos1 = True
  *             self.cpos1_min = numpy.ascontiguousarray((pos1-delta_pos1).ravel(), dtype=numpy.float32)
  *             self.cpos1_max = numpy.ascontiguousarray((pos1+delta_pos1).ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
  *             self.pos1_min = min(pos1Range)
  *             pos1_maxin = max(pos1Range)
  */
-    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_2 = PyNumber_Add(__pyx_v_pos1, __pyx_v_delta_pos1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_6 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__ravel); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_2 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __pyx_t_3 = PyNumber_Add(__pyx_v_pos1, __pyx_v_delta_pos1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__ravel); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
-    PyTuple_SET_ITEM(__pyx_t_6, 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 = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__float32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __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 = 99; __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);
+    __pyx_t_3 = 0;
+    __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__float32); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_7);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+    if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+    __pyx_t_7 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_7);
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-    if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__cpos1_max, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__cpos1_max, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
 
-    /* "splitBBoxLUT.pyx":96
+    /* "splitBBoxLUT.pyx":100
  *             self.cpos1_min = numpy.ascontiguousarray((pos1-delta_pos1).ravel(), dtype=numpy.float32)
  *             self.cpos1_max = numpy.ascontiguousarray((pos1+delta_pos1).ravel(), dtype=numpy.float32)
  *             self.pos1_min = min(pos1Range)             # <<<<<<<<<<<<<<
  *             pos1_maxin = max(pos1Range)
  *             self.pos1_max = pos1_maxin * EPS32
  */
-    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_7);
     __Pyx_INCREF(__pyx_v_pos1Range);
-    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_pos1Range);
+    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_pos1Range);
     __Pyx_GIVEREF(__pyx_v_pos1Range);
-    __pyx_t_2 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-    if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__pos1_min, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
+    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__pos1_min, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
-    /* "splitBBoxLUT.pyx":97
+    /* "splitBBoxLUT.pyx":101
  *             self.cpos1_max = numpy.ascontiguousarray((pos1+delta_pos1).ravel(), dtype=numpy.float32)
  *             self.pos1_min = min(pos1Range)
  *             pos1_maxin = max(pos1Range)             # <<<<<<<<<<<<<<
  *             self.pos1_max = pos1_maxin * EPS32
  *         else:
  */
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
     __Pyx_INCREF(__pyx_v_pos1Range);
-    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_pos1Range);
+    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_pos1Range);
     __Pyx_GIVEREF(__pyx_v_pos1Range);
-    __pyx_t_1 = PyObject_Call(__pyx_builtin_max, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-    __pyx_v_pos1_maxin = __pyx_t_1;
-    __pyx_t_1 = 0;
+    __pyx_t_7 = PyObject_Call(__pyx_builtin_max, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_7);
+    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+    __pyx_v_pos1_maxin = __pyx_t_7;
+    __pyx_t_7 = 0;
 
-    /* "splitBBoxLUT.pyx":98
+    /* "splitBBoxLUT.pyx":102
  *             self.pos1_min = min(pos1Range)
  *             pos1_maxin = max(pos1Range)
  *             self.pos1_max = pos1_maxin * EPS32             # <<<<<<<<<<<<<<
  *         else:
  *             self.check_pos1 = False
  */
-    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__EPS32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_2 = PyNumber_Multiply(__pyx_v_pos1_maxin, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__pos1_max, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s__EPS32); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_7);
+    __pyx_t_3 = PyNumber_Multiply(__pyx_v_pos1_maxin, __pyx_t_7); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__pos1_max, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     goto __pyx_L5;
   }
   /*else*/ {
 
-    /* "splitBBoxLUT.pyx":100
+    /* "splitBBoxLUT.pyx":104
  *             self.pos1_max = pos1_maxin * EPS32
  *         else:
  *             self.check_pos1 = False             # <<<<<<<<<<<<<<
  *             self.cpos1_min = None
  *             self.pos1_max = None
  */
-    __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__check_pos1, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__check_pos1, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
-    /* "splitBBoxLUT.pyx":101
+    /* "splitBBoxLUT.pyx":105
  *         else:
  *             self.check_pos1 = False
  *             self.cpos1_min = None             # <<<<<<<<<<<<<<
  *             self.pos1_max = None
  * 
  */
-    if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__cpos1_min, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__cpos1_min, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-    /* "splitBBoxLUT.pyx":102
+    /* "splitBBoxLUT.pyx":106
  *             self.check_pos1 = False
  *             self.cpos1_min = None
  *             self.pos1_max = None             # <<<<<<<<<<<<<<
  * 
- *         if  mask is not None:
+ *         self.delta = (self.pos0_max - self.pos0_min) / bins
  */
-    if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__pos1_max, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__pos1_max, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   __pyx_L5:;
 
-  /* "splitBBoxLUT.pyx":104
+  /* "splitBBoxLUT.pyx":108
  *             self.pos1_max = None
  * 
- *         if  mask is not None:             # <<<<<<<<<<<<<<
- *             assert mask.size == self.size
- *             self.check_mask = True
- */
-  __pyx_t_9 = (__pyx_v_mask != Py_None);
-  if (__pyx_t_9) {
-
-    /* "splitBBoxLUT.pyx":105
- * 
- *         if  mask is not None:
- *             assert mask.size == self.size             # <<<<<<<<<<<<<<
- *             self.check_mask = True
- *             self.cmask = numpy.ascontiguousarray(mask.ravel(), dtype=numpy.int8)
- */
-    #ifndef CYTHON_WITHOUT_ASSERTIONS
-    __pyx_t_2 = PyObject_GetAttr(__pyx_v_mask, __pyx_n_s__size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    if (unlikely(!__pyx_t_9)) {
-      PyErr_SetNone(PyExc_AssertionError);
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    }
-    #endif
-
-    /* "splitBBoxLUT.pyx":106
- *         if  mask is not None:
- *             assert mask.size == self.size
- *             self.check_mask = True             # <<<<<<<<<<<<<<
- *             self.cmask = numpy.ascontiguousarray(mask.ravel(), dtype=numpy.int8)
- *             if mask_checksum:
- */
-    __pyx_t_6 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
-    if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__check_mask, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-
-    /* "splitBBoxLUT.pyx":107
- *             assert mask.size == self.size
- *             self.check_mask = True
- *             self.cmask = numpy.ascontiguousarray(mask.ravel(), dtype=numpy.int8)             # <<<<<<<<<<<<<<
- *             if mask_checksum:
- *                 self.mask_checksum = mask_checksum
- */
-    __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_1 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_t_6 = PyObject_GetAttr(__pyx_v_mask, __pyx_n_s__ravel); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_2 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
-    PyTuple_SET_ITEM(__pyx_t_6, 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 = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-    __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__int8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __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_6), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-    if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__cmask, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-
-    /* "splitBBoxLUT.pyx":108
- *             self.check_mask = True
- *             self.cmask = numpy.ascontiguousarray(mask.ravel(), dtype=numpy.int8)
- *             if mask_checksum:             # <<<<<<<<<<<<<<
- *                 self.mask_checksum = mask_checksum
- *             else:
- */
-    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_mask_checksum); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    if (__pyx_t_9) {
-
-      /* "splitBBoxLUT.pyx":109
- *             self.cmask = numpy.ascontiguousarray(mask.ravel(), dtype=numpy.int8)
- *             if mask_checksum:
- *                 self.mask_checksum = mask_checksum             # <<<<<<<<<<<<<<
- *             else:
- *                 self.mask_checksum = crc32(mask)
- */
-      if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__mask_checksum, __pyx_v_mask_checksum) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      goto __pyx_L7;
-    }
-    /*else*/ {
-
-      /* "splitBBoxLUT.pyx":111
- *                 self.mask_checksum = mask_checksum
- *             else:
- *                 self.mask_checksum = crc32(mask)             # <<<<<<<<<<<<<<
- *         else:
- *             self.check_mask = False
- */
-      __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__crc32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_INCREF(__pyx_v_mask);
-      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_mask);
-      __Pyx_GIVEREF(__pyx_v_mask);
-      __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_6);
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-      if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__mask_checksum, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    }
-    __pyx_L7:;
-    goto __pyx_L6;
-  }
-  /*else*/ {
-
-    /* "splitBBoxLUT.pyx":113
- *                 self.mask_checksum = crc32(mask)
- *         else:
- *             self.check_mask = False             # <<<<<<<<<<<<<<
- *             self.mask_checksum = None
- *         self.delta = (self.pos0_max - self.pos0_min) / bins
- */
-    __pyx_t_6 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
-    if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__check_mask, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-
-    /* "splitBBoxLUT.pyx":114
- *         else:
- *             self.check_mask = False
- *             self.mask_checksum = None             # <<<<<<<<<<<<<<
- *         self.delta = (self.pos0_max - self.pos0_min) / bins
- *         self.lut_max_idx = self.calc_lut()
- */
-    if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__mask_checksum, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  }
-  __pyx_L6:;
-
-  /* "splitBBoxLUT.pyx":115
- *             self.check_mask = False
- *             self.mask_checksum = None
  *         self.delta = (self.pos0_max - self.pos0_min) / bins             # <<<<<<<<<<<<<<
  *         self.lut_max_idx = self.calc_lut()
- *         self.outPos = numpy.linspace(self.pos0_min+0.5*self.delta, pos0_maxin-0.5*self.delta, self.bins)
+ *         self.outPos = numpy.linspace(self.pos0_min+0.5*self.delta, self.pos0_maxin-0.5*self.delta, self.bins)
  */
-  __pyx_t_6 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pos0_max); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pos0_min); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyNumber_Subtract(__pyx_t_6, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__pos0_max); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyInt_FromLong(__pyx_v_bins); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__pos0_min); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_7);
+  __pyx_t_2 = PyNumber_Subtract(__pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+  __pyx_t_7 = PyInt_FromLong(__pyx_v_bins); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_7);
+  __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_t_7); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__delta, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__delta, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
-  /* "splitBBoxLUT.pyx":116
- *             self.mask_checksum = None
+  /* "splitBBoxLUT.pyx":109
+ * 
  *         self.delta = (self.pos0_max - self.pos0_min) / bins
  *         self.lut_max_idx = self.calc_lut()             # <<<<<<<<<<<<<<
- *         self.outPos = numpy.linspace(self.pos0_min+0.5*self.delta, pos0_maxin-0.5*self.delta, self.bins)
+ *         self.outPos = numpy.linspace(self.pos0_min+0.5*self.delta, self.pos0_maxin-0.5*self.delta, self.bins)
  *         self.lut_checksum = crc32(self.lut)
  */
-  __pyx_t_6 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__calc_lut); 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_t_2 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__lut_max_idx, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__calc_lut); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_7 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_7);
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__lut_max_idx, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
 
-  /* "splitBBoxLUT.pyx":117
+  /* "splitBBoxLUT.pyx":110
  *         self.delta = (self.pos0_max - self.pos0_min) / bins
  *         self.lut_max_idx = self.calc_lut()
- *         self.outPos = numpy.linspace(self.pos0_min+0.5*self.delta, pos0_maxin-0.5*self.delta, self.bins)             # <<<<<<<<<<<<<<
+ *         self.outPos = numpy.linspace(self.pos0_min+0.5*self.delta, self.pos0_maxin-0.5*self.delta, self.bins)             # <<<<<<<<<<<<<<
  *         self.lut_checksum = crc32(self.lut)
  *         self.unit=unit
  */
-  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_7);
+  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s__linspace); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__pos0_min); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_7);
+  __pyx_t_2 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_6 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__linspace); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__delta); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pos0_min); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__delta); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_5 = PyNumber_Multiply(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+  __pyx_t_6 = PyNumber_Add(__pyx_t_7, __pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_6);
+  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__pos0_maxin); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __pyx_t_5 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__delta); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_7);
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__delta); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyNumber_Multiply(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+  __pyx_t_10 = PyNumber_Multiply(__pyx_t_7, __pyx_t_2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_10);
+  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyNumber_Subtract(__pyx_v_pos0_maxin, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_t_10); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__bins); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
-  __Pyx_GIVEREF(__pyx_t_1);
-  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__bins); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_10);
+  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6);
+  __Pyx_GIVEREF(__pyx_t_6);
+  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2);
   __Pyx_GIVEREF(__pyx_t_2);
-  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
-  __Pyx_GIVEREF(__pyx_t_3);
-  __pyx_t_1 = 0;
+  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_10);
+  __Pyx_GIVEREF(__pyx_t_10);
+  __pyx_t_6 = 0;
   __pyx_t_2 = 0;
-  __pyx_t_3 = 0;
-  __pyx_t_3 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__outPos, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_10 = 0;
+  __pyx_t_10 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_10);
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__outPos, __pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
 
-  /* "splitBBoxLUT.pyx":118
+  /* "splitBBoxLUT.pyx":111
  *         self.lut_max_idx = self.calc_lut()
- *         self.outPos = numpy.linspace(self.pos0_min+0.5*self.delta, pos0_maxin-0.5*self.delta, self.bins)
+ *         self.outPos = numpy.linspace(self.pos0_min+0.5*self.delta, self.pos0_maxin-0.5*self.delta, self.bins)
  *         self.lut_checksum = crc32(self.lut)             # <<<<<<<<<<<<<<
  *         self.unit=unit
  * 
  */
-  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__crc32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s__crc32); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_10);
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__lut); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__lut); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
-  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
-  __Pyx_GIVEREF(__pyx_t_5);
-  __pyx_t_5 = 0;
-  __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__lut_checksum, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
+  __Pyx_GIVEREF(__pyx_t_1);
+  __pyx_t_1 = 0;
+  __pyx_t_1 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__lut_checksum, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "splitBBoxLUT.pyx":119
- *         self.outPos = numpy.linspace(self.pos0_min+0.5*self.delta, pos0_maxin-0.5*self.delta, self.bins)
+  /* "splitBBoxLUT.pyx":112
+ *         self.outPos = numpy.linspace(self.pos0_min+0.5*self.delta, self.pos0_maxin-0.5*self.delta, self.bins)
  *         self.lut_checksum = crc32(self.lut)
  *         self.unit=unit             # <<<<<<<<<<<<<<
  * 
- *     @cython.cdivision(True)
+ *     @cython.boundscheck(False)
  */
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__unit, __pyx_v_unit) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__unit, __pyx_v_unit) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
@@ -3240,12 +3327,12 @@ static PyObject *__pyx_pf_12splitBBoxLUT_11HistoBBox1d___init__(CYTHON_UNUSED Py
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_XDECREF(__pyx_t_5);
   __Pyx_XDECREF(__pyx_t_6);
+  __Pyx_XDECREF(__pyx_t_7);
+  __Pyx_XDECREF(__pyx_t_10);
   __Pyx_AddTraceback("splitBBoxLUT.HistoBBox1d.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
-  __Pyx_XDECREF(__pyx_v_pos0_maxin);
   __Pyx_XDECREF(__pyx_v_pos1_maxin);
   __Pyx_XGIVEREF(__pyx_r);
   __Pyx_RefNannyFinishContext();
@@ -3253,994 +3340,1040 @@ static PyObject *__pyx_pf_12splitBBoxLUT_11HistoBBox1d___init__(CYTHON_UNUSED Py
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_12splitBBoxLUT_11HistoBBox1d_3calc_lut(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_12splitBBoxLUT_11HistoBBox1d_2calc_lut[] = "calculate the max number of elements in the LUT and populate it";
-static PyMethodDef __pyx_mdef_12splitBBoxLUT_11HistoBBox1d_3calc_lut = {__Pyx_NAMESTR("calc_lut"), (PyCFunction)__pyx_pw_12splitBBoxLUT_11HistoBBox1d_3calc_lut, METH_O, __Pyx_DOCSTR(__pyx_doc_12splitBBoxLUT_11HistoBBox1d_2calc_lut)};
-static PyObject *__pyx_pw_12splitBBoxLUT_11HistoBBox1d_3calc_lut(PyObject *__pyx_self, PyObject *__pyx_v_self) {
+static PyObject *__pyx_pw_12splitBBoxLUT_11HistoBBox1d_3calc_boundaries(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_12splitBBoxLUT_11HistoBBox1d_3calc_boundaries = {__Pyx_NAMESTR("calc_boundaries"), (PyCFunction)__pyx_pw_12splitBBoxLUT_11HistoBBox1d_3calc_boundaries, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pw_12splitBBoxLUT_11HistoBBox1d_3calc_boundaries(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  PyObject *__pyx_v_self = 0;
+  PyObject *__pyx_v_pos0Range = 0;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("calc_lut (wrapper)", 0);
-  __pyx_r = __pyx_pf_12splitBBoxLUT_11HistoBBox1d_2calc_lut(__pyx_self, ((PyObject *)__pyx_v_self));
+  __Pyx_RefNannySetupContext("calc_boundaries (wrapper)", 0);
+  {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__pos0Range,0};
+    PyObject* values[2] = {0,0};
+    if (unlikely(__pyx_kwds)) {
+      Py_ssize_t kw_args;
+      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+      switch (pos_args) {
+        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+        case  0: break;
+        default: goto __pyx_L5_argtuple_error;
+      }
+      kw_args = PyDict_Size(__pyx_kwds);
+      switch (pos_args) {
+        case  0:
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
+        else goto __pyx_L5_argtuple_error;
+        case  1:
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos0Range)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("calc_boundaries", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+      }
+      if (unlikely(kw_args > 0)) {
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calc_boundaries") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      }
+    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
+      goto __pyx_L5_argtuple_error;
+    } else {
+      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+    }
+    __pyx_v_self = values[0];
+    __pyx_v_pos0Range = values[1];
+  }
+  goto __pyx_L4_argument_unpacking_done;
+  __pyx_L5_argtuple_error:;
+  __Pyx_RaiseArgtupleInvalid("calc_boundaries", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __pyx_L3_error:;
+  __Pyx_AddTraceback("splitBBoxLUT.HistoBBox1d.calc_boundaries", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_RefNannyFinishContext();
+  return NULL;
+  __pyx_L4_argument_unpacking_done:;
+  __pyx_r = __pyx_pf_12splitBBoxLUT_11HistoBBox1d_2calc_boundaries(__pyx_self, __pyx_v_self, __pyx_v_pos0Range);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "splitBBoxLUT.pyx":124
+/* "splitBBoxLUT.pyx":116
  *     @cython.boundscheck(False)
  *     @cython.wraparound(False)
- *     def calc_lut(self):             # <<<<<<<<<<<<<<
- *         'calculate the max number of elements in the LUT and populate it'
- *         cdef float delta=self.delta, pos0_min=self.pos0_min, pos1_min, pos1_max, min0, max0, fbin0_min, fbin0_max, deltaL, deltaR, deltaA
+ *     def calc_boundaries(self,pos0Range):             # <<<<<<<<<<<<<<
+ *         cdef int size = self.cpos0.size
+ *         cdef bint check_mask = self.check_mask
  */
 
-static PyObject *__pyx_pf_12splitBBoxLUT_11HistoBBox1d_2calc_lut(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
-  float __pyx_v_delta;
+static PyObject *__pyx_pf_12splitBBoxLUT_11HistoBBox1d_2calc_boundaries(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_pos0Range) {
+  int __pyx_v_size;
+  int __pyx_v_check_mask;
+  __Pyx_memviewslice __pyx_v_cmask = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_cpos0 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_dpos0 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_cpos0_sup = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_cpos0_inf = { 0, 0, { 0 }, { 0 }, { 0 } };
+  float __pyx_v_upper;
+  float __pyx_v_lower;
+  float __pyx_v_pos0_max;
   float __pyx_v_pos0_min;
-  float __pyx_v_pos1_min;
-  float __pyx_v_pos1_max;
-  float __pyx_v_min0;
-  float __pyx_v_max0;
-  float __pyx_v_fbin0_min;
-  float __pyx_v_fbin0_max;
-  float __pyx_v_deltaL;
-  float __pyx_v_deltaR;
-  float __pyx_v_deltaA;
-  int __pyx_v_bin0_min;
-  int __pyx_v_bin0_max;
-  int __pyx_v_bins;
-  int __pyx_v_lut_size;
-  int __pyx_v_i;
-  int __pyx_v_size;
-  __pyx_t_5numpy_int32_t __pyx_v_k;
-  __pyx_t_5numpy_int32_t __pyx_v_idx;
-  int __pyx_v_check_mask;
-  int __pyx_v_check_pos1;
-  PyArrayObject *__pyx_v_outMax = 0;
-  __Pyx_memviewslice __pyx_v_cpos0_sup = { 0, 0, { 0 }, { 0 }, { 0 } };
-  __Pyx_memviewslice __pyx_v_cpos0_inf = { 0, 0, { 0 }, { 0 }, { 0 } };
-  __Pyx_memviewslice __pyx_v_cpos1_min = { 0, 0, { 0 }, { 0 }, { 0 } };
-  __Pyx_memviewslice __pyx_v_cpos1_max = { 0, 0, { 0 }, { 0 }, { 0 } };
-  PyArrayObject *__pyx_v_lut = 0;
-  __Pyx_memviewslice __pyx_v_cmask = { 0, 0, { 0 }, { 0 }, { 0 } };
-  size_t __pyx_v_lut_nbytes;
-  PyObject *__pyx_v_memsize = NULL;
-  __Pyx_LocalBuf_ND __pyx_pybuffernd_lut;
-  __Pyx_Buffer __pyx_pybuffer_lut;
-  __Pyx_LocalBuf_ND __pyx_pybuffernd_outMax;
-  __Pyx_Buffer __pyx_pybuffer_outMax;
+  float __pyx_v_c;
+  float __pyx_v_d;
+  int __pyx_v_allow_pos0_neg;
+  int __pyx_v_idx;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
-  float __pyx_t_2;
+  PyObject *__pyx_t_2 = NULL;
   int __pyx_t_3;
-  PyObject *__pyx_t_4 = NULL;
-  PyObject *__pyx_t_5 = NULL;
-  PyObject *__pyx_t_6 = NULL;
-  PyObject *__pyx_t_7 = NULL;
-  PyArrayObject *__pyx_t_8 = NULL;
-  __Pyx_memviewslice __pyx_t_9 = { 0, 0, { 0 }, { 0 }, { 0 } };
-  __Pyx_memviewslice __pyx_t_10 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  int __pyx_t_4;
+  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  Py_ssize_t __pyx_t_6;
+  Py_ssize_t __pyx_t_7;
+  __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  int __pyx_t_9;
+  int __pyx_t_10;
   int __pyx_t_11;
-  __Pyx_memviewslice __pyx_t_12 = { 0, 0, { 0 }, { 0 }, { 0 } };
-  __Pyx_memviewslice __pyx_t_13 = { 0, 0, { 0 }, { 0 }, { 0 } };
-  __pyx_t_5numpy_int32_t __pyx_t_14;
-  __pyx_t_5numpy_int32_t __pyx_t_15;
+  int __pyx_t_12;
+  int __pyx_t_13;
+  int __pyx_t_14;
+  int __pyx_t_15;
   int __pyx_t_16;
-  __pyx_t_5numpy_int32_t __pyx_t_17;
-  __pyx_t_5numpy_int32_t __pyx_t_18;
-  __pyx_t_5numpy_int32_t __pyx_t_19;
-  __pyx_t_5numpy_int32_t __pyx_t_20;
-  int __pyx_t_21;
-  int __pyx_t_22;
-  long __pyx_t_23;
-  int __pyx_t_24;
-  int __pyx_t_25;
-  int __pyx_t_26;
-  PyArrayObject *__pyx_t_27 = NULL;
-  PyObject *__pyx_t_28 = NULL;
-  PyObject *__pyx_t_29 = NULL;
-  PyObject *__pyx_t_30 = NULL;
-  long __pyx_t_31;
-  long __pyx_t_32;
-  __pyx_t_5numpy_int32_t __pyx_t_33;
-  __pyx_t_5numpy_int32_t __pyx_t_34;
-  __pyx_t_5numpy_int32_t __pyx_t_35;
-  __pyx_t_5numpy_int32_t __pyx_t_36;
-  __pyx_t_5numpy_int32_t __pyx_t_37;
-  int __pyx_t_38;
-  __pyx_t_5numpy_int32_t __pyx_t_39;
-  int __pyx_t_40;
-  __pyx_t_5numpy_int32_t __pyx_t_41;
-  int __pyx_t_42;
-  int __pyx_t_43;
-  int __pyx_t_44;
-  __pyx_t_5numpy_int32_t __pyx_t_45;
-  int __pyx_t_46;
-  __pyx_t_5numpy_int32_t __pyx_t_47;
-  int __pyx_t_48;
-  int __pyx_t_49;
-  int __pyx_t_50;
-  __pyx_t_5numpy_int32_t __pyx_t_51;
-  int __pyx_t_52;
-  __pyx_t_5numpy_int32_t __pyx_t_53;
-  int __pyx_t_54;
-  int __pyx_t_55;
-  int __pyx_t_56;
-  int __pyx_t_57;
-  int __pyx_t_58;
-  __pyx_t_5numpy_int32_t __pyx_t_59;
-  int __pyx_t_60;
-  __pyx_t_5numpy_int32_t __pyx_t_61;
-  int __pyx_t_62;
+  Py_ssize_t __pyx_t_17;
+  PyObject *__pyx_t_18 = NULL;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
-  __Pyx_RefNannySetupContext("calc_lut", 0);
-  __pyx_pybuffer_outMax.pybuffer.buf = NULL;
-  __pyx_pybuffer_outMax.refcount = 0;
-  __pyx_pybuffernd_outMax.data = NULL;
-  __pyx_pybuffernd_outMax.rcbuffer = &__pyx_pybuffer_outMax;
-  __pyx_pybuffer_lut.pybuffer.buf = NULL;
-  __pyx_pybuffer_lut.refcount = 0;
-  __pyx_pybuffernd_lut.data = NULL;
-  __pyx_pybuffernd_lut.rcbuffer = &__pyx_pybuffer_lut;
+  __Pyx_RefNannySetupContext("calc_boundaries", 0);
 
-  /* "splitBBoxLUT.pyx":126
- *     def calc_lut(self):
- *         'calculate the max number of elements in the LUT and populate it'
- *         cdef float delta=self.delta, pos0_min=self.pos0_min, pos1_min, pos1_max, min0, max0, fbin0_min, fbin0_max, deltaL, deltaR, deltaA             # <<<<<<<<<<<<<<
- *         cdef int bin0_min, bin0_max, bins = self.bins, lut_size, i, size
- *         cdef numpy.int32_t k,idx #same as numpy.int32
+  /* "splitBBoxLUT.pyx":117
+ *     @cython.wraparound(False)
+ *     def calc_boundaries(self,pos0Range):
+ *         cdef int size = self.cpos0.size             # <<<<<<<<<<<<<<
+ *         cdef bint check_mask = self.check_mask
+ *         cdef numpy.int8_t[:] cmask
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__delta); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_2 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_v_delta = __pyx_t_2;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pos0_min); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__cpos0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_2 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_v_pos0_min = __pyx_t_2;
+  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_v_size = __pyx_t_3;
 
-  /* "splitBBoxLUT.pyx":127
- *         'calculate the max number of elements in the LUT and populate it'
- *         cdef float delta=self.delta, pos0_min=self.pos0_min, pos1_min, pos1_max, min0, max0, fbin0_min, fbin0_max, deltaL, deltaR, deltaA
- *         cdef int bin0_min, bin0_max, bins = self.bins, lut_size, i, size             # <<<<<<<<<<<<<<
- *         cdef numpy.int32_t k,idx #same as numpy.int32
- *         cdef bint check_mask, check_pos1
+  /* "splitBBoxLUT.pyx":118
+ *     def calc_boundaries(self,pos0Range):
+ *         cdef int size = self.cpos0.size
+ *         cdef bint check_mask = self.check_mask             # <<<<<<<<<<<<<<
+ *         cdef numpy.int8_t[:] cmask
+ *         cdef float[:] cpos0, dpos0, cpos0_sup, cpos0_inf,
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__bins); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_v_bins = __pyx_t_3;
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__check_mask); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_v_check_mask = __pyx_t_4;
 
-  /* "splitBBoxLUT.pyx":130
- *         cdef numpy.int32_t k,idx #same as numpy.int32
- *         cdef bint check_mask, check_pos1
- *         cdef numpy.ndarray[numpy.int32_t, ndim = 1] outMax = numpy.zeros(bins, dtype=numpy.int32)             # <<<<<<<<<<<<<<
- *         cdef float[:] cpos0_sup = self.cpos0_sup
- *         cdef float[:] cpos0_inf = self.cpos0_inf
+  /* "splitBBoxLUT.pyx":122
+ *         cdef float[:] cpos0, dpos0, cpos0_sup, cpos0_inf,
+ *         cdef float upper, lower, pos0_max, pos0_min, c, d
+ *         cdef bint allow_pos0_neg=self.allow_pos0_neg             # <<<<<<<<<<<<<<
+ * 
+ *         cpos0_sup = self.cpos0_sup
  */
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyInt_FromLong(__pyx_v_bins); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
-  __Pyx_GIVEREF(__pyx_t_1);
-  __pyx_t_1 = 0;
-  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
-  __pyx_t_7 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__int32); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __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 = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-  __pyx_t_7 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_7);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-  if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_8 = ((PyArrayObject *)__pyx_t_7);
-  {
-    __Pyx_BufFmt_StackElem __pyx_stack[1];
-    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outMax.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
-      __pyx_v_outMax = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf = NULL;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    } else {__pyx_pybuffernd_outMax.diminfo[0].strides = __pyx_pybuffernd_outMax.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outMax.diminfo[0].shape = __pyx_pybuffernd_outMax.rcbuffer->pybuffer.shape[0];
-    }
-  }
-  __pyx_t_8 = 0;
-  __pyx_v_outMax = ((PyArrayObject *)__pyx_t_7);
-  __pyx_t_7 = 0;
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__allow_pos0_neg); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_v_allow_pos0_neg = __pyx_t_4;
 
-  /* "splitBBoxLUT.pyx":131
- *         cdef bint check_mask, check_pos1
- *         cdef numpy.ndarray[numpy.int32_t, ndim = 1] outMax = numpy.zeros(bins, dtype=numpy.int32)
- *         cdef float[:] cpos0_sup = self.cpos0_sup             # <<<<<<<<<<<<<<
- *         cdef float[:] cpos0_inf = self.cpos0_inf
- *         cdef float[:] cpos1_min, cpos1_max
+  /* "splitBBoxLUT.pyx":124
+ *         cdef bint allow_pos0_neg=self.allow_pos0_neg
+ * 
+ *         cpos0_sup = self.cpos0_sup             # <<<<<<<<<<<<<<
+ *         cpos0_inf = self.cpos0_inf
+ *         cpos0 = self.cpos0
  */
-  __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__cpos0_sup); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_7);
-  __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_7);
-  if (unlikely(!__pyx_t_9.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-  __pyx_v_cpos0_sup = __pyx_t_9;
-  __pyx_t_9.memview = NULL;
-  __pyx_t_9.data = NULL;
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__cpos0_sup); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_2);
+  if (unlikely(!__pyx_t_5.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_v_cpos0_sup = __pyx_t_5;
+  __pyx_t_5.memview = NULL;
+  __pyx_t_5.data = NULL;
 
-  /* "splitBBoxLUT.pyx":132
- *         cdef numpy.ndarray[numpy.int32_t, ndim = 1] outMax = numpy.zeros(bins, dtype=numpy.int32)
- *         cdef float[:] cpos0_sup = self.cpos0_sup
- *         cdef float[:] cpos0_inf = self.cpos0_inf             # <<<<<<<<<<<<<<
- *         cdef float[:] cpos1_min, cpos1_max
- *         cdef numpy.ndarray[lut_point, ndim = 2] lut
+  /* "splitBBoxLUT.pyx":125
+ * 
+ *         cpos0_sup = self.cpos0_sup
+ *         cpos0_inf = self.cpos0_inf             # <<<<<<<<<<<<<<
+ *         cpos0 = self.cpos0
+ *         dpos0 = self.dpos0
  */
-  __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__cpos0_inf); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_7);
-  __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_7);
-  if (unlikely(!__pyx_t_10.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-  __pyx_v_cpos0_inf = __pyx_t_10;
-  __pyx_t_10.memview = NULL;
-  __pyx_t_10.data = NULL;
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__cpos0_inf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_2);
+  if (unlikely(!__pyx_t_5.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_v_cpos0_inf = __pyx_t_5;
+  __pyx_t_5.memview = NULL;
+  __pyx_t_5.data = NULL;
 
-  /* "splitBBoxLUT.pyx":136
- *         cdef numpy.ndarray[lut_point, ndim = 2] lut
- *         cdef numpy.int8_t[:] cmask
- *         size = self.size             # <<<<<<<<<<<<<<
- *         if self.check_mask:
- *             cmask = self.cmask
+  /* "splitBBoxLUT.pyx":126
+ *         cpos0_sup = self.cpos0_sup
+ *         cpos0_inf = self.cpos0_inf
+ *         cpos0 = self.cpos0             # <<<<<<<<<<<<<<
+ *         dpos0 = self.dpos0
+ *         pos0_min=cpos0[0]
  */
-  __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__size); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_7);
-  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_7); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-  __pyx_v_size = __pyx_t_3;
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__cpos0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_2);
+  if (unlikely(!__pyx_t_5.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_v_cpos0 = __pyx_t_5;
+  __pyx_t_5.memview = NULL;
+  __pyx_t_5.data = NULL;
 
-  /* "splitBBoxLUT.pyx":137
- *         cdef numpy.int8_t[:] cmask
- *         size = self.size
- *         if self.check_mask:             # <<<<<<<<<<<<<<
- *             cmask = self.cmask
- *             check_mask = True
+  /* "splitBBoxLUT.pyx":127
+ *         cpos0_inf = self.cpos0_inf
+ *         cpos0 = self.cpos0
+ *         dpos0 = self.dpos0             # <<<<<<<<<<<<<<
+ *         pos0_min=cpos0[0]
+ *         pos0_max=cpos0[0]
  */
-  __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__check_mask); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_7);
-  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-  if (__pyx_t_11) {
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__dpos0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_2);
+  if (unlikely(!__pyx_t_5.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_v_dpos0 = __pyx_t_5;
+  __pyx_t_5.memview = NULL;
+  __pyx_t_5.data = NULL;
 
-    /* "splitBBoxLUT.pyx":138
- *         size = self.size
- *         if self.check_mask:
- *             cmask = self.cmask             # <<<<<<<<<<<<<<
- *             check_mask = True
- *         else:
+  /* "splitBBoxLUT.pyx":128
+ *         cpos0 = self.cpos0
+ *         dpos0 = self.dpos0
+ *         pos0_min=cpos0[0]             # <<<<<<<<<<<<<<
+ *         pos0_max=cpos0[0]
+ * 
  */
-    __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__cmask); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_7);
-    __pyx_t_12 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int8_t(__pyx_t_7);
-    if (unlikely(!__pyx_t_12.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-    __pyx_v_cmask = __pyx_t_12;
-    __pyx_t_12.memview = NULL;
-    __pyx_t_12.data = NULL;
+  __pyx_t_6 = 0;
+  __pyx_v_pos0_min = (*((float *) ( /* dim=0 */ (__pyx_v_cpos0.data + __pyx_t_6 * __pyx_v_cpos0.strides[0]) )));
 
-    /* "splitBBoxLUT.pyx":139
- *         if self.check_mask:
- *             cmask = self.cmask
- *             check_mask = True             # <<<<<<<<<<<<<<
- *         else:
- *             check_mask = False
+  /* "splitBBoxLUT.pyx":129
+ *         dpos0 = self.dpos0
+ *         pos0_min=cpos0[0]
+ *         pos0_max=cpos0[0]             # <<<<<<<<<<<<<<
+ * 
+ *         if check_mask:
  */
-    __pyx_v_check_mask = 1;
-    goto __pyx_L3;
-  }
-  /*else*/ {
+  __pyx_t_7 = 0;
+  __pyx_v_pos0_max = (*((float *) ( /* dim=0 */ (__pyx_v_cpos0.data + __pyx_t_7 * __pyx_v_cpos0.strides[0]) )));
 
-    /* "splitBBoxLUT.pyx":141
- *             check_mask = True
- *         else:
- *             check_mask = False             # <<<<<<<<<<<<<<
- * 
- *         if self.check_pos1:
- */
-    __pyx_v_check_mask = 0;
-  }
-  __pyx_L3:;
-
-  /* "splitBBoxLUT.pyx":143
- *             check_mask = False
+  /* "splitBBoxLUT.pyx":131
+ *         pos0_max=cpos0[0]
  * 
- *         if self.check_pos1:             # <<<<<<<<<<<<<<
- *             check_pos1 = True
- *             cpos1_min = self.cpos1_min
+ *         if check_mask:             # <<<<<<<<<<<<<<
+ *             cmask = self.cmask
+ *         with nogil:
  */
-  __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__check_pos1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_7);
-  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-  if (__pyx_t_11) {
+  __pyx_t_4 = (__pyx_v_check_mask != 0);
+  if (__pyx_t_4) {
 
-    /* "splitBBoxLUT.pyx":144
+    /* "splitBBoxLUT.pyx":132
  * 
- *         if self.check_pos1:
- *             check_pos1 = True             # <<<<<<<<<<<<<<
- *             cpos1_min = self.cpos1_min
- *             cpos1_max = self.cpos1_max
- */
-    __pyx_v_check_pos1 = 1;
-
-    /* "splitBBoxLUT.pyx":145
- *         if self.check_pos1:
- *             check_pos1 = True
- *             cpos1_min = self.cpos1_min             # <<<<<<<<<<<<<<
- *             cpos1_max = self.cpos1_max
- *             pos1_max = self.pos1_max
- */
-    __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__cpos1_min); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_7);
-    __pyx_t_13 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_7);
-    if (unlikely(!__pyx_t_13.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-    __pyx_v_cpos1_min = __pyx_t_13;
-    __pyx_t_13.memview = NULL;
-    __pyx_t_13.data = NULL;
-
-    /* "splitBBoxLUT.pyx":146
- *             check_pos1 = True
- *             cpos1_min = self.cpos1_min
- *             cpos1_max = self.cpos1_max             # <<<<<<<<<<<<<<
- *             pos1_max = self.pos1_max
- *             pos1_min = self.pos1_min
- */
-    __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__cpos1_max); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_7);
-    __pyx_t_13 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_7);
-    if (unlikely(!__pyx_t_13.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-    __pyx_v_cpos1_max = __pyx_t_13;
-    __pyx_t_13.memview = NULL;
-    __pyx_t_13.data = NULL;
-
-    /* "splitBBoxLUT.pyx":147
- *             cpos1_min = self.cpos1_min
- *             cpos1_max = self.cpos1_max
- *             pos1_max = self.pos1_max             # <<<<<<<<<<<<<<
- *             pos1_min = self.pos1_min
- *         else:
- */
-    __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pos1_max); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_7);
-    __pyx_t_2 = __pyx_PyFloat_AsFloat(__pyx_t_7); if (unlikely((__pyx_t_2 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-    __pyx_v_pos1_max = __pyx_t_2;
-
-    /* "splitBBoxLUT.pyx":148
- *             cpos1_max = self.cpos1_max
- *             pos1_max = self.pos1_max
- *             pos1_min = self.pos1_min             # <<<<<<<<<<<<<<
- *         else:
- *             check_pos1 = False
- */
-    __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pos1_min); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_7);
-    __pyx_t_2 = __pyx_PyFloat_AsFloat(__pyx_t_7); if (unlikely((__pyx_t_2 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-    __pyx_v_pos1_min = __pyx_t_2;
-    goto __pyx_L4;
-  }
-  /*else*/ {
-
-    /* "splitBBoxLUT.pyx":150
- *             pos1_min = self.pos1_min
- *         else:
- *             check_pos1 = False             # <<<<<<<<<<<<<<
- * #NOGIL
+ *         if check_mask:
+ *             cmask = self.cmask             # <<<<<<<<<<<<<<
  *         with nogil:
+ *             for idx in range(size):
  */
-    __pyx_v_check_pos1 = 0;
+    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__cmask); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int8_t(__pyx_t_2);
+    if (unlikely(!__pyx_t_8.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __pyx_v_cmask = __pyx_t_8;
+    __pyx_t_8.memview = NULL;
+    __pyx_t_8.data = NULL;
+    goto __pyx_L3;
   }
-  __pyx_L4:;
+  __pyx_L3:;
 
-  /* "splitBBoxLUT.pyx":152
- *             check_pos1 = False
- * #NOGIL
+  /* "splitBBoxLUT.pyx":133
+ *         if check_mask:
+ *             cmask = self.cmask
  *         with nogil:             # <<<<<<<<<<<<<<
  *             for idx in range(size):
- *                 if (check_mask) and (cmask[idx]):
+ *                 c = cpos0[idx]
  */
   {
       #ifdef WITH_THREAD
-      PyThreadState *_save = NULL;
-      #endif
+      PyThreadState *_save;
       Py_UNBLOCK_THREADS
+      #endif
       /*try:*/ {
 
-        /* "splitBBoxLUT.pyx":153
- * #NOGIL
+        /* "splitBBoxLUT.pyx":134
+ *             cmask = self.cmask
  *         with nogil:
  *             for idx in range(size):             # <<<<<<<<<<<<<<
- *                 if (check_mask) and (cmask[idx]):
- *                     continue
+ *                 c = cpos0[idx]
+ *                 d = dpos0[idx]
  */
         __pyx_t_3 = __pyx_v_size;
-        for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_3; __pyx_t_14+=1) {
-          __pyx_v_idx = __pyx_t_14;
+        for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_3; __pyx_t_9+=1) {
+          __pyx_v_idx = __pyx_t_9;
 
-          /* "splitBBoxLUT.pyx":154
+          /* "splitBBoxLUT.pyx":135
  *         with nogil:
  *             for idx in range(size):
- *                 if (check_mask) and (cmask[idx]):             # <<<<<<<<<<<<<<
- *                     continue
- * 
+ *                 c = cpos0[idx]             # <<<<<<<<<<<<<<
+ *                 d = dpos0[idx]
+ *                 lower = c - d
  */
-          __pyx_t_11 = __pyx_v_check_mask;
-          if (__pyx_t_11) {
-            if (unlikely(!__pyx_v_cmask.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cmask"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L6;} }
-            __pyx_t_15 = __pyx_v_idx;
-            __pyx_t_16 = (*((__pyx_t_5numpy_int8_t *) ( /* dim=0 */ (__pyx_v_cmask.data + __pyx_t_15 * __pyx_v_cmask.strides[0]) )));
-          } else {
-            __pyx_t_16 = __pyx_t_11;
-          }
-          if (__pyx_t_16) {
+          __pyx_t_10 = __pyx_v_idx;
+          __pyx_v_c = (*((float *) ( /* dim=0 */ (__pyx_v_cpos0.data + __pyx_t_10 * __pyx_v_cpos0.strides[0]) )));
 
-            /* "splitBBoxLUT.pyx":155
+          /* "splitBBoxLUT.pyx":136
  *             for idx in range(size):
- *                 if (check_mask) and (cmask[idx]):
- *                     continue             # <<<<<<<<<<<<<<
- * 
- *                 min0 = cpos0_inf[idx]
+ *                 c = cpos0[idx]
+ *                 d = dpos0[idx]             # <<<<<<<<<<<<<<
+ *                 lower = c - d
+ *                 upper = c + d
  */
-            goto __pyx_L8_continue;
-            goto __pyx_L10;
+          __pyx_t_11 = __pyx_v_idx;
+          __pyx_v_d = (*((float *) ( /* dim=0 */ (__pyx_v_dpos0.data + __pyx_t_11 * __pyx_v_dpos0.strides[0]) )));
+
+          /* "splitBBoxLUT.pyx":137
+ *                 c = cpos0[idx]
+ *                 d = dpos0[idx]
+ *                 lower = c - d             # <<<<<<<<<<<<<<
+ *                 upper = c + d
+ *                 cpos0_sup[idx] = upper
+ */
+          __pyx_v_lower = (__pyx_v_c - __pyx_v_d);
+
+          /* "splitBBoxLUT.pyx":138
+ *                 d = dpos0[idx]
+ *                 lower = c - d
+ *                 upper = c + d             # <<<<<<<<<<<<<<
+ *                 cpos0_sup[idx] = upper
+ *                 cpos0_inf[idx] = lower
+ */
+          __pyx_v_upper = (__pyx_v_c + __pyx_v_d);
+
+          /* "splitBBoxLUT.pyx":139
+ *                 lower = c - d
+ *                 upper = c + d
+ *                 cpos0_sup[idx] = upper             # <<<<<<<<<<<<<<
+ *                 cpos0_inf[idx] = lower
+ *                 if not allow_pos0_neg and lower<0:
+ */
+          __pyx_t_12 = __pyx_v_idx;
+          *((float *) ( /* dim=0 */ (__pyx_v_cpos0_sup.data + __pyx_t_12 * __pyx_v_cpos0_sup.strides[0]) )) = __pyx_v_upper;
+
+          /* "splitBBoxLUT.pyx":140
+ *                 upper = c + d
+ *                 cpos0_sup[idx] = upper
+ *                 cpos0_inf[idx] = lower             # <<<<<<<<<<<<<<
+ *                 if not allow_pos0_neg and lower<0:
+ *                     lower=0
+ */
+          __pyx_t_13 = __pyx_v_idx;
+          *((float *) ( /* dim=0 */ (__pyx_v_cpos0_inf.data + __pyx_t_13 * __pyx_v_cpos0_inf.strides[0]) )) = __pyx_v_lower;
+
+          /* "splitBBoxLUT.pyx":141
+ *                 cpos0_sup[idx] = upper
+ *                 cpos0_inf[idx] = lower
+ *                 if not allow_pos0_neg and lower<0:             # <<<<<<<<<<<<<<
+ *                     lower=0
+ *                 if not (check_mask and cmask[idx]):
+ */
+          __pyx_t_4 = ((!(__pyx_v_allow_pos0_neg != 0)) != 0);
+          if (__pyx_t_4) {
+            __pyx_t_14 = ((__pyx_v_lower < 0.0) != 0);
+            __pyx_t_15 = __pyx_t_14;
+          } else {
+            __pyx_t_15 = __pyx_t_4;
           }
-          __pyx_L10:;
+          if (__pyx_t_15) {
 
-          /* "splitBBoxLUT.pyx":157
- *                     continue
- * 
- *                 min0 = cpos0_inf[idx]             # <<<<<<<<<<<<<<
- *                 max0 = cpos0_sup[idx]
- * 
+            /* "splitBBoxLUT.pyx":142
+ *                 cpos0_inf[idx] = lower
+ *                 if not allow_pos0_neg and lower<0:
+ *                     lower=0             # <<<<<<<<<<<<<<
+ *                 if not (check_mask and cmask[idx]):
+ *                     if upper>pos0_max:
  */
-          __pyx_t_17 = __pyx_v_idx;
-          __pyx_v_min0 = (*((float *) ( /* dim=0 */ (__pyx_v_cpos0_inf.data + __pyx_t_17 * __pyx_v_cpos0_inf.strides[0]) )));
+            __pyx_v_lower = 0.0;
+            goto __pyx_L9;
+          }
+          __pyx_L9:;
 
-          /* "splitBBoxLUT.pyx":158
- * 
- *                 min0 = cpos0_inf[idx]
- *                 max0 = cpos0_sup[idx]             # <<<<<<<<<<<<<<
+          /* "splitBBoxLUT.pyx":143
+ *                 if not allow_pos0_neg and lower<0:
+ *                     lower=0
+ *                 if not (check_mask and cmask[idx]):             # <<<<<<<<<<<<<<
+ *                     if upper>pos0_max:
+ *                         pos0_max = upper
+ */
+          __pyx_t_15 = __pyx_v_check_mask;
+          if (__pyx_t_15) {
+            if (unlikely(!__pyx_v_cmask.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cmask"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L5;} }
+            __pyx_t_16 = __pyx_v_idx;
+            __pyx_t_4 = ((*((__pyx_t_5numpy_int8_t *) ( /* dim=0 */ (__pyx_v_cmask.data + __pyx_t_16 * __pyx_v_cmask.strides[0]) ))) != 0);
+          } else {
+            __pyx_t_4 = __pyx_t_15;
+          }
+          __pyx_t_15 = ((!__pyx_t_4) != 0);
+          if (__pyx_t_15) {
+
+            /* "splitBBoxLUT.pyx":144
+ *                     lower=0
+ *                 if not (check_mask and cmask[idx]):
+ *                     if upper>pos0_max:             # <<<<<<<<<<<<<<
+ *                         pos0_max = upper
+ *                     if lower<pos0_min:
+ */
+            __pyx_t_15 = ((__pyx_v_upper > __pyx_v_pos0_max) != 0);
+            if (__pyx_t_15) {
+
+              /* "splitBBoxLUT.pyx":145
+ *                 if not (check_mask and cmask[idx]):
+ *                     if upper>pos0_max:
+ *                         pos0_max = upper             # <<<<<<<<<<<<<<
+ *                     if lower<pos0_min:
+ *                         pos0_min = lower
+ */
+              __pyx_v_pos0_max = __pyx_v_upper;
+              goto __pyx_L11;
+            }
+            __pyx_L11:;
+
+            /* "splitBBoxLUT.pyx":146
+ *                     if upper>pos0_max:
+ *                         pos0_max = upper
+ *                     if lower<pos0_min:             # <<<<<<<<<<<<<<
+ *                         pos0_min = lower
  * 
- *                 if check_pos1 and ((cpos1_max[idx] < pos1_min) or (cpos1_min[idx] > pos1_max)):
  */
-          __pyx_t_18 = __pyx_v_idx;
-          __pyx_v_max0 = (*((float *) ( /* dim=0 */ (__pyx_v_cpos0_sup.data + __pyx_t_18 * __pyx_v_cpos0_sup.strides[0]) )));
+            __pyx_t_15 = ((__pyx_v_lower < __pyx_v_pos0_min) != 0);
+            if (__pyx_t_15) {
 
-          /* "splitBBoxLUT.pyx":160
- *                 max0 = cpos0_sup[idx]
- * 
- *                 if check_pos1 and ((cpos1_max[idx] < pos1_min) or (cpos1_min[idx] > pos1_max)):             # <<<<<<<<<<<<<<
- *                     continue
+              /* "splitBBoxLUT.pyx":147
+ *                         pos0_max = upper
+ *                     if lower<pos0_min:
+ *                         pos0_min = lower             # <<<<<<<<<<<<<<
  * 
+ *         if pos0Range is not None and len(pos0Range) > 1:
  */
-          if (__pyx_v_check_pos1) {
-            if (unlikely(!__pyx_v_cpos1_max.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cpos1_max"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L6;} }
-            __pyx_t_19 = __pyx_v_idx;
-            __pyx_t_16 = ((*((float *) ( /* dim=0 */ (__pyx_v_cpos1_max.data + __pyx_t_19 * __pyx_v_cpos1_max.strides[0]) ))) < __pyx_v_pos1_min);
-            if (!__pyx_t_16) {
-              if (unlikely(!__pyx_v_cpos1_min.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cpos1_min"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L6;} }
-              __pyx_t_20 = __pyx_v_idx;
-              __pyx_t_11 = ((*((float *) ( /* dim=0 */ (__pyx_v_cpos1_min.data + __pyx_t_20 * __pyx_v_cpos1_min.strides[0]) ))) > __pyx_v_pos1_max);
-              __pyx_t_21 = __pyx_t_11;
-            } else {
-              __pyx_t_21 = __pyx_t_16;
+              __pyx_v_pos0_min = __pyx_v_lower;
+              goto __pyx_L12;
             }
-            __pyx_t_16 = __pyx_t_21;
-          } else {
-            __pyx_t_16 = __pyx_v_check_pos1;
+            __pyx_L12:;
+            goto __pyx_L10;
           }
-          if (__pyx_t_16) {
+          __pyx_L10:;
+        }
+      }
 
-            /* "splitBBoxLUT.pyx":161
- * 
- *                 if check_pos1 and ((cpos1_max[idx] < pos1_min) or (cpos1_min[idx] > pos1_max)):
- *                     continue             # <<<<<<<<<<<<<<
- * 
- *                 fbin0_min = getBinNr(min0, pos0_min, delta)
+      /* "splitBBoxLUT.pyx":133
+ *         if check_mask:
+ *             cmask = self.cmask
+ *         with nogil:             # <<<<<<<<<<<<<<
+ *             for idx in range(size):
+ *                 c = cpos0[idx]
  */
-            goto __pyx_L8_continue;
-            goto __pyx_L11;
-          }
-          __pyx_L11:;
+      /*finally:*/ {
+        int __pyx_why;
+        __pyx_why = 0; goto __pyx_L6;
+        __pyx_L5: __pyx_why = 4; goto __pyx_L6;
+        __pyx_L6:;
+        #ifdef WITH_THREAD
+        Py_BLOCK_THREADS
+        #endif
+        switch (__pyx_why) {
+          case 4: goto __pyx_L1_error;
+        }
+      }
+  }
 
-          /* "splitBBoxLUT.pyx":163
- *                     continue
+  /* "splitBBoxLUT.pyx":149
+ *                         pos0_min = lower
  * 
- *                 fbin0_min = getBinNr(min0, pos0_min, delta)             # <<<<<<<<<<<<<<
- *                 fbin0_max = getBinNr(max0, pos0_min, delta)
- *                 bin0_min = < int > fbin0_min
+ *         if pos0Range is not None and len(pos0Range) > 1:             # <<<<<<<<<<<<<<
+ *             self.pos0_min = min(pos0Range)
+ *             self.pos0_maxin = max(pos0Range)
  */
-          __pyx_v_fbin0_min = __pyx_f_12splitBBoxLUT_getBinNr(__pyx_v_min0, __pyx_v_pos0_min, __pyx_v_delta);
+  __pyx_t_15 = (__pyx_v_pos0Range != Py_None);
+  if ((__pyx_t_15 != 0)) {
+    __pyx_t_17 = PyObject_Length(__pyx_v_pos0Range); if (unlikely(__pyx_t_17 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = ((__pyx_t_17 > 1) != 0);
+    __pyx_t_14 = __pyx_t_4;
+  } else {
+    __pyx_t_14 = (__pyx_t_15 != 0);
+  }
+  if (__pyx_t_14) {
 
-          /* "splitBBoxLUT.pyx":164
+    /* "splitBBoxLUT.pyx":150
  * 
- *                 fbin0_min = getBinNr(min0, pos0_min, delta)
- *                 fbin0_max = getBinNr(max0, pos0_min, delta)             # <<<<<<<<<<<<<<
- *                 bin0_min = < int > fbin0_min
- *                 bin0_max = < int > fbin0_max
+ *         if pos0Range is not None and len(pos0Range) > 1:
+ *             self.pos0_min = min(pos0Range)             # <<<<<<<<<<<<<<
+ *             self.pos0_maxin = max(pos0Range)
+ *         else:
  */
-          __pyx_v_fbin0_max = __pyx_f_12splitBBoxLUT_getBinNr(__pyx_v_max0, __pyx_v_pos0_min, __pyx_v_delta);
+    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_INCREF(__pyx_v_pos0Range);
+    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_pos0Range);
+    __Pyx_GIVEREF(__pyx_v_pos0Range);
+    __pyx_t_1 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__pos0_min, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-          /* "splitBBoxLUT.pyx":165
- *                 fbin0_min = getBinNr(min0, pos0_min, delta)
- *                 fbin0_max = getBinNr(max0, pos0_min, delta)
- *                 bin0_min = < int > fbin0_min             # <<<<<<<<<<<<<<
- *                 bin0_max = < int > fbin0_max
- * 
+    /* "splitBBoxLUT.pyx":151
+ *         if pos0Range is not None and len(pos0Range) > 1:
+ *             self.pos0_min = min(pos0Range)
+ *             self.pos0_maxin = max(pos0Range)             # <<<<<<<<<<<<<<
+ *         else:
+ *             self.pos0_min = pos0_min
  */
-          __pyx_v_bin0_min = ((int)__pyx_v_fbin0_min);
+    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_INCREF(__pyx_v_pos0Range);
+    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_pos0Range);
+    __Pyx_GIVEREF(__pyx_v_pos0Range);
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_max, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__pos0_maxin, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    goto __pyx_L14;
+  }
+  /*else*/ {
 
-          /* "splitBBoxLUT.pyx":166
- *                 fbin0_max = getBinNr(max0, pos0_min, delta)
- *                 bin0_min = < int > fbin0_min
- *                 bin0_max = < int > fbin0_max             # <<<<<<<<<<<<<<
- * 
- *                 if (bin0_max < 0) or (bin0_min >= bins):
+    /* "splitBBoxLUT.pyx":153
+ *             self.pos0_maxin = max(pos0Range)
+ *         else:
+ *             self.pos0_min = pos0_min             # <<<<<<<<<<<<<<
+ *             self.pos0_maxin = pos0_max
+ *         if (not allow_pos0_neg) and self.pos0_min < 0:
  */
-          __pyx_v_bin0_max = ((int)__pyx_v_fbin0_max);
+    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_pos0_min); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__pos0_min, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-          /* "splitBBoxLUT.pyx":168
- *                 bin0_max = < int > fbin0_max
- * 
- *                 if (bin0_max < 0) or (bin0_min >= bins):             # <<<<<<<<<<<<<<
- *                     continue
- *                 if bin0_max >= bins :
+    /* "splitBBoxLUT.pyx":154
+ *         else:
+ *             self.pos0_min = pos0_min
+ *             self.pos0_maxin = pos0_max             # <<<<<<<<<<<<<<
+ *         if (not allow_pos0_neg) and self.pos0_min < 0:
+ *             self.pos0_min = 0
  */
-          __pyx_t_16 = (__pyx_v_bin0_max < 0);
-          if (!__pyx_t_16) {
-            __pyx_t_21 = (__pyx_v_bin0_min >= __pyx_v_bins);
-            __pyx_t_11 = __pyx_t_21;
-          } else {
-            __pyx_t_11 = __pyx_t_16;
-          }
-          if (__pyx_t_11) {
+    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_pos0_max); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__pos0_maxin, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  }
+  __pyx_L14:;
 
-            /* "splitBBoxLUT.pyx":169
- * 
- *                 if (bin0_max < 0) or (bin0_min >= bins):
- *                     continue             # <<<<<<<<<<<<<<
- *                 if bin0_max >= bins :
- *                     bin0_max = bins - 1
- */
-            goto __pyx_L8_continue;
-            goto __pyx_L12;
-          }
-          __pyx_L12:;
-
-          /* "splitBBoxLUT.pyx":170
- *                 if (bin0_max < 0) or (bin0_min >= bins):
- *                     continue
- *                 if bin0_max >= bins :             # <<<<<<<<<<<<<<
- *                     bin0_max = bins - 1
- *                 if  bin0_min < 0:
- */
-          __pyx_t_11 = (__pyx_v_bin0_max >= __pyx_v_bins);
-          if (__pyx_t_11) {
-
-            /* "splitBBoxLUT.pyx":171
- *                     continue
- *                 if bin0_max >= bins :
- *                     bin0_max = bins - 1             # <<<<<<<<<<<<<<
- *                 if  bin0_min < 0:
- *                     bin0_min = 0
- */
-            __pyx_v_bin0_max = (__pyx_v_bins - 1);
-            goto __pyx_L13;
-          }
-          __pyx_L13:;
-
-          /* "splitBBoxLUT.pyx":172
- *                 if bin0_max >= bins :
- *                     bin0_max = bins - 1
- *                 if  bin0_min < 0:             # <<<<<<<<<<<<<<
- *                     bin0_min = 0
- * 
- */
-          __pyx_t_11 = (__pyx_v_bin0_min < 0);
-          if (__pyx_t_11) {
-
-            /* "splitBBoxLUT.pyx":173
- *                     bin0_max = bins - 1
- *                 if  bin0_min < 0:
- *                     bin0_min = 0             # <<<<<<<<<<<<<<
- * 
- *                 if bin0_min == bin0_max:
- */
-            __pyx_v_bin0_min = 0;
-            goto __pyx_L14;
-          }
-          __pyx_L14:;
-
-          /* "splitBBoxLUT.pyx":175
- *                     bin0_min = 0
- * 
- *                 if bin0_min == bin0_max:             # <<<<<<<<<<<<<<
- *                     #All pixel is within a single bin
- *                     outMax[bin0_min] += 1
- */
-          __pyx_t_11 = (__pyx_v_bin0_min == __pyx_v_bin0_max);
-          if (__pyx_t_11) {
-
-            /* "splitBBoxLUT.pyx":177
- *                 if bin0_min == bin0_max:
- *                     #All pixel is within a single bin
- *                     outMax[bin0_min] += 1             # <<<<<<<<<<<<<<
- * 
- *                 else: #we have pixel spliting.
- */
-            __pyx_t_22 = __pyx_v_bin0_min;
-            *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_outMax.diminfo[0].strides) += 1;
-            goto __pyx_L15;
-          }
-          /*else*/ {
-
-            /* "splitBBoxLUT.pyx":180
- * 
- *                 else: #we have pixel spliting.
- *                     for i in range(bin0_min, bin0_max + 1):             # <<<<<<<<<<<<<<
- *                         outMax[i] += 1
- * 
- */
-            __pyx_t_23 = (__pyx_v_bin0_max + 1);
-            for (__pyx_t_24 = __pyx_v_bin0_min; __pyx_t_24 < __pyx_t_23; __pyx_t_24+=1) {
-              __pyx_v_i = __pyx_t_24;
-
-              /* "splitBBoxLUT.pyx":181
- *                 else: #we have pixel spliting.
- *                     for i in range(bin0_min, bin0_max + 1):
- *                         outMax[i] += 1             # <<<<<<<<<<<<<<
- * 
- *         lut_size = outMax.max()
- */
-              __pyx_t_25 = __pyx_v_i;
-              *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_outMax.diminfo[0].strides) += 1;
-            }
-          }
-          __pyx_L15:;
-          __pyx_L8_continue:;
-        }
-      }
-
-      /* "splitBBoxLUT.pyx":152
- *             check_pos1 = False
- * #NOGIL
- *         with nogil:             # <<<<<<<<<<<<<<
- *             for idx in range(size):
- *                 if (check_mask) and (cmask[idx]):
+  /* "splitBBoxLUT.pyx":155
+ *             self.pos0_min = pos0_min
+ *             self.pos0_maxin = pos0_max
+ *         if (not allow_pos0_neg) and self.pos0_min < 0:             # <<<<<<<<<<<<<<
+ *             self.pos0_min = 0
+ *         self.pos0_max = self.pos0_maxin * EPS32
  */
-      /*finally:*/ {
-        int __pyx_why;
-        __pyx_why = 0; goto __pyx_L7;
-        __pyx_L6: __pyx_why = 4; goto __pyx_L7;
-        __pyx_L7:;
-        Py_BLOCK_THREADS
-        switch (__pyx_why) {
-          case 4: goto __pyx_L1_error;
-        }
-      }
+  __pyx_t_14 = (!(__pyx_v_allow_pos0_neg != 0));
+  if (__pyx_t_14) {
+    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__pos0_min); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_4 = __pyx_t_15;
+  } else {
+    __pyx_t_4 = __pyx_t_14;
   }
+  if (__pyx_t_4) {
 
-  /* "splitBBoxLUT.pyx":183
- *                         outMax[i] += 1
- * 
- *         lut_size = outMax.max()             # <<<<<<<<<<<<<<
- *         #just recycle the outMax array
- *         #outMax = numpy.zeros((bins0,bins1), dtype=numpy.int32)
- */
-  __pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_v_outMax), __pyx_n_s__max); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_7);
-  __pyx_t_1 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_v_lut_size = __pyx_t_3;
-
-  /* "splitBBoxLUT.pyx":186
- *         #just recycle the outMax array
- *         #outMax = numpy.zeros((bins0,bins1), dtype=numpy.int32)
- *         memset(&outMax[0], 0, bins * sizeof(numpy.int32_t))             # <<<<<<<<<<<<<<
+    /* "splitBBoxLUT.pyx":156
+ *             self.pos0_maxin = pos0_max
+ *         if (not allow_pos0_neg) and self.pos0_min < 0:
+ *             self.pos0_min = 0             # <<<<<<<<<<<<<<
+ *         self.pos0_max = self.pos0_maxin * EPS32
  * 
- *         self.lut_size = lut_size
  */
-  __pyx_t_23 = 0;
-  memset((&(*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_outMax.diminfo[0].strides))), 0, (__pyx_v_bins * (sizeof(__pyx_t_5numpy_int32_t))));
+    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__pos0_min, __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    goto __pyx_L15;
+  }
+  __pyx_L15:;
 
-  /* "splitBBoxLUT.pyx":188
- *         memset(&outMax[0], 0, bins * sizeof(numpy.int32_t))
+  /* "splitBBoxLUT.pyx":157
+ *         if (not allow_pos0_neg) and self.pos0_min < 0:
+ *             self.pos0_min = 0
+ *         self.pos0_max = self.pos0_maxin * EPS32             # <<<<<<<<<<<<<<
  * 
- *         self.lut_size = lut_size             # <<<<<<<<<<<<<<
  * 
- *         lut_nbytes = bins*lut_size*sizeof(lut_point)
  */
-  __pyx_t_1 = PyInt_FromLong(__pyx_v_lut_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__pos0_maxin); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__lut_size, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__EPS32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_18 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_18);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__pos0_max, __pyx_t_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
 
-  /* "splitBBoxLUT.pyx":190
- *         self.lut_size = lut_size
- * 
- *         lut_nbytes = bins*lut_size*sizeof(lut_point)             # <<<<<<<<<<<<<<
- *         if (os.name == "posix") and ("SC_PAGE_SIZE" in os.sysconf_names) and ("SC_PHYS_PAGES" in os.sysconf_names):
- *             memsize =  os.sysconf("SC_PAGE_SIZE")*os.sysconf("SC_PHYS_PAGES")
- */
-  __pyx_v_lut_nbytes = ((__pyx_v_bins * __pyx_v_lut_size) * (sizeof(struct __pyx_t_12splitBBoxLUT_lut_point)));
-
-  /* "splitBBoxLUT.pyx":191
- * 
- *         lut_nbytes = bins*lut_size*sizeof(lut_point)
- *         if (os.name == "posix") and ("SC_PAGE_SIZE" in os.sysconf_names) and ("SC_PHYS_PAGES" in os.sysconf_names):             # <<<<<<<<<<<<<<
- *             memsize =  os.sysconf("SC_PAGE_SIZE")*os.sysconf("SC_PHYS_PAGES")
- *             if memsize <  lut_nbytes:
- */
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_7 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__name); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_7);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_RichCompare(__pyx_t_7, ((PyObject *)__pyx_n_s__posix), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (__pyx_t_11) {
-    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_7 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__sysconf_names); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_7);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_16 = (__Pyx_PySequence_Contains(((PyObject *)__pyx_n_s__SC_PAGE_SIZE), __pyx_t_7, Py_EQ)); if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-    if (__pyx_t_16) {
-      __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_7);
-      __pyx_t_1 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__sysconf_names); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-      __pyx_t_21 = (__Pyx_PySequence_Contains(((PyObject *)__pyx_n_s__SC_PHYS_PAGES), __pyx_t_1, Py_EQ)); if (unlikely(__pyx_t_21 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __pyx_t_26 = __pyx_t_21;
-    } else {
-      __pyx_t_26 = __pyx_t_16;
-    }
-    __pyx_t_16 = __pyx_t_26;
-  } else {
-    __pyx_t_16 = __pyx_t_11;
-  }
-  if (__pyx_t_16) {
+  __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_XDEC_MEMVIEW(&__pyx_t_5, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
+  __Pyx_XDECREF(__pyx_t_18);
+  __Pyx_AddTraceback("splitBBoxLUT.HistoBBox1d.calc_boundaries", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __pyx_r = NULL;
+  __pyx_L0:;
+  __PYX_XDEC_MEMVIEW(&__pyx_v_cmask, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_cpos0, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_dpos0, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_cpos0_sup, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_cpos0_inf, 1);
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
 
-    /* "splitBBoxLUT.pyx":192
- *         lut_nbytes = bins*lut_size*sizeof(lut_point)
- *         if (os.name == "posix") and ("SC_PAGE_SIZE" in os.sysconf_names) and ("SC_PHYS_PAGES" in os.sysconf_names):
- *             memsize =  os.sysconf("SC_PAGE_SIZE")*os.sysconf("SC_PHYS_PAGES")             # <<<<<<<<<<<<<<
- *             if memsize <  lut_nbytes:
- *                 raise MemoryError("Lookup-table (%i, %i) is %.3fGB whereas the memory of the system is only %s"%(bins,lut_size,lut_nbytes,memsize))
- */
-    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); 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_7 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__sysconf); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_7);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_1 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_k_tuple_1), NULL); 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_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-    __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_7);
-    __pyx_t_5 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__sysconf); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-    __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_7);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_5 = PyNumber_Multiply(__pyx_t_1, __pyx_t_7); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-    __pyx_v_memsize = __pyx_t_5;
-    __pyx_t_5 = 0;
+/* Python wrapper */
+static PyObject *__pyx_pw_12splitBBoxLUT_11HistoBBox1d_5calc_lut(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_12splitBBoxLUT_11HistoBBox1d_4calc_lut[] = "calculate the max number of elements in the LUT and populate it";
+static PyMethodDef __pyx_mdef_12splitBBoxLUT_11HistoBBox1d_5calc_lut = {__Pyx_NAMESTR("calc_lut"), (PyCFunction)__pyx_pw_12splitBBoxLUT_11HistoBBox1d_5calc_lut, METH_O, __Pyx_DOCSTR(__pyx_doc_12splitBBoxLUT_11HistoBBox1d_4calc_lut)};
+static PyObject *__pyx_pw_12splitBBoxLUT_11HistoBBox1d_5calc_lut(PyObject *__pyx_self, PyObject *__pyx_v_self) {
+  PyObject *__pyx_r = 0;
+  __Pyx_RefNannyDeclarations
+  __Pyx_RefNannySetupContext("calc_lut (wrapper)", 0);
+  __pyx_r = __pyx_pf_12splitBBoxLUT_11HistoBBox1d_4calc_lut(__pyx_self, ((PyObject *)__pyx_v_self));
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
 
-    /* "splitBBoxLUT.pyx":193
- *         if (os.name == "posix") and ("SC_PAGE_SIZE" in os.sysconf_names) and ("SC_PHYS_PAGES" in os.sysconf_names):
- *             memsize =  os.sysconf("SC_PAGE_SIZE")*os.sysconf("SC_PHYS_PAGES")
- *             if memsize <  lut_nbytes:             # <<<<<<<<<<<<<<
- *                 raise MemoryError("Lookup-table (%i, %i) is %.3fGB whereas the memory of the system is only %s"%(bins,lut_size,lut_nbytes,memsize))
- *         #else hope we have enough memory
+/* "splitBBoxLUT.pyx":163
+ *     @cython.boundscheck(False)
+ *     @cython.wraparound(False)
+ *     def calc_lut(self):             # <<<<<<<<<<<<<<
+ *         'calculate the max number of elements in the LUT and populate it'
+ *         cdef float delta=self.delta, pos0_min=self.pos0_min, pos1_min, pos1_max, min0, max0, fbin0_min, fbin0_max, deltaL, deltaR, deltaA
  */
-    __pyx_t_5 = __Pyx_PyInt_FromSize_t(__pyx_v_lut_nbytes); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_7 = PyObject_RichCompare(__pyx_v_memsize, __pyx_t_5, Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-    if (__pyx_t_16) {
 
-      /* "splitBBoxLUT.pyx":194
- *             memsize =  os.sysconf("SC_PAGE_SIZE")*os.sysconf("SC_PHYS_PAGES")
- *             if memsize <  lut_nbytes:
- *                 raise MemoryError("Lookup-table (%i, %i) is %.3fGB whereas the memory of the system is only %s"%(bins,lut_size,lut_nbytes,memsize))             # <<<<<<<<<<<<<<
- *         #else hope we have enough memory
- *         lut = numpy.recarray(shape=(bins, lut_size),dtype=[("idx",numpy.int32),("coef",numpy.float32)])
- */
-      __pyx_t_7 = PyInt_FromLong(__pyx_v_bins); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_7);
-      __pyx_t_5 = PyInt_FromLong(__pyx_v_lut_size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
-      __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_lut_nbytes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7);
-      __Pyx_GIVEREF(__pyx_t_7);
-      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
-      __Pyx_GIVEREF(__pyx_t_5);
-      PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_1);
-      __Pyx_GIVEREF(__pyx_t_1);
-      __Pyx_INCREF(__pyx_v_memsize);
-      PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_memsize);
-      __Pyx_GIVEREF(__pyx_v_memsize);
-      __pyx_t_7 = 0;
-      __pyx_t_5 = 0;
-      __pyx_t_1 = 0;
-      __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_3), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_1));
-      __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
-      __pyx_t_1 = 0;
-      __pyx_t_1 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      goto __pyx_L20;
-    }
-    __pyx_L20:;
-    goto __pyx_L19;
-  }
-  __pyx_L19:;
+static PyObject *__pyx_pf_12splitBBoxLUT_11HistoBBox1d_4calc_lut(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
+  float __pyx_v_delta;
+  float __pyx_v_pos0_min;
+  float __pyx_v_pos1_min;
+  float __pyx_v_pos1_max;
+  float __pyx_v_min0;
+  float __pyx_v_max0;
+  float __pyx_v_fbin0_min;
+  float __pyx_v_fbin0_max;
+  float __pyx_v_deltaL;
+  float __pyx_v_deltaR;
+  float __pyx_v_deltaA;
+  int __pyx_v_bin0_min;
+  int __pyx_v_bin0_max;
+  int __pyx_v_bins;
+  int __pyx_v_lut_size;
+  int __pyx_v_i;
+  int __pyx_v_size;
+  __pyx_t_5numpy_int32_t __pyx_v_k;
+  __pyx_t_5numpy_int32_t __pyx_v_idx;
+  int __pyx_v_check_mask;
+  int __pyx_v_check_pos1;
+  PyArrayObject *__pyx_v_outMax = 0;
+  __Pyx_memviewslice __pyx_v_cpos0_sup = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_cpos0_inf = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_cpos1_min = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_cpos1_max = { 0, 0, { 0 }, { 0 }, { 0 } };
+  PyArrayObject *__pyx_v_lut = 0;
+  __Pyx_memviewslice __pyx_v_cmask = { 0, 0, { 0 }, { 0 }, { 0 } };
+  size_t __pyx_v_lut_nbytes;
+  PyObject *__pyx_v_memsize = NULL;
+  __Pyx_LocalBuf_ND __pyx_pybuffernd_lut;
+  __Pyx_Buffer __pyx_pybuffer_lut;
+  __Pyx_LocalBuf_ND __pyx_pybuffernd_outMax;
+  __Pyx_Buffer __pyx_pybuffer_outMax;
+  PyObject *__pyx_r = NULL;
+  __Pyx_RefNannyDeclarations
+  PyObject *__pyx_t_1 = NULL;
+  float __pyx_t_2;
+  int __pyx_t_3;
+  PyObject *__pyx_t_4 = NULL;
+  PyObject *__pyx_t_5 = NULL;
+  PyObject *__pyx_t_6 = NULL;
+  PyObject *__pyx_t_7 = NULL;
+  PyArrayObject *__pyx_t_8 = NULL;
+  __Pyx_memviewslice __pyx_t_9 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_t_10 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  int __pyx_t_11;
+  __Pyx_memviewslice __pyx_t_12 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_t_13 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __pyx_t_5numpy_int32_t __pyx_t_14;
+  __pyx_t_5numpy_int32_t __pyx_t_15;
+  int __pyx_t_16;
+  __pyx_t_5numpy_int32_t __pyx_t_17;
+  __pyx_t_5numpy_int32_t __pyx_t_18;
+  __pyx_t_5numpy_int32_t __pyx_t_19;
+  __pyx_t_5numpy_int32_t __pyx_t_20;
+  int __pyx_t_21;
+  int __pyx_t_22;
+  long __pyx_t_23;
+  int __pyx_t_24;
+  int __pyx_t_25;
+  int __pyx_t_26;
+  PyArrayObject *__pyx_t_27 = NULL;
+  PyObject *__pyx_t_28 = NULL;
+  PyObject *__pyx_t_29 = NULL;
+  PyObject *__pyx_t_30 = NULL;
+  long __pyx_t_31;
+  long __pyx_t_32;
+  __pyx_t_5numpy_int32_t __pyx_t_33;
+  __pyx_t_5numpy_int32_t __pyx_t_34;
+  __pyx_t_5numpy_int32_t __pyx_t_35;
+  __pyx_t_5numpy_int32_t __pyx_t_36;
+  __pyx_t_5numpy_int32_t __pyx_t_37;
+  int __pyx_t_38;
+  __pyx_t_5numpy_int32_t __pyx_t_39;
+  int __pyx_t_40;
+  __pyx_t_5numpy_int32_t __pyx_t_41;
+  int __pyx_t_42;
+  int __pyx_t_43;
+  int __pyx_t_44;
+  __pyx_t_5numpy_int32_t __pyx_t_45;
+  int __pyx_t_46;
+  __pyx_t_5numpy_int32_t __pyx_t_47;
+  int __pyx_t_48;
+  int __pyx_t_49;
+  int __pyx_t_50;
+  __pyx_t_5numpy_int32_t __pyx_t_51;
+  int __pyx_t_52;
+  __pyx_t_5numpy_int32_t __pyx_t_53;
+  int __pyx_t_54;
+  int __pyx_t_55;
+  int __pyx_t_56;
+  int __pyx_t_57;
+  int __pyx_t_58;
+  __pyx_t_5numpy_int32_t __pyx_t_59;
+  int __pyx_t_60;
+  __pyx_t_5numpy_int32_t __pyx_t_61;
+  int __pyx_t_62;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("calc_lut", 0);
+  __pyx_pybuffer_outMax.pybuffer.buf = NULL;
+  __pyx_pybuffer_outMax.refcount = 0;
+  __pyx_pybuffernd_outMax.data = NULL;
+  __pyx_pybuffernd_outMax.rcbuffer = &__pyx_pybuffer_outMax;
+  __pyx_pybuffer_lut.pybuffer.buf = NULL;
+  __pyx_pybuffer_lut.refcount = 0;
+  __pyx_pybuffernd_lut.data = NULL;
+  __pyx_pybuffernd_lut.rcbuffer = &__pyx_pybuffer_lut;
 
-  /* "splitBBoxLUT.pyx":196
- *                 raise MemoryError("Lookup-table (%i, %i) is %.3fGB whereas the memory of the system is only %s"%(bins,lut_size,lut_nbytes,memsize))
- *         #else hope we have enough memory
- *         lut = numpy.recarray(shape=(bins, lut_size),dtype=[("idx",numpy.int32),("coef",numpy.float32)])             # <<<<<<<<<<<<<<
- *         memset(&lut[0,0], 0, bins*lut_size*sizeof(lut_point))
- *         #NOGIL
+  /* "splitBBoxLUT.pyx":165
+ *     def calc_lut(self):
+ *         'calculate the max number of elements in the LUT and populate it'
+ *         cdef float delta=self.delta, pos0_min=self.pos0_min, pos1_min, pos1_max, min0, max0, fbin0_min, fbin0_max, deltaL, deltaR, deltaA             # <<<<<<<<<<<<<<
+ *         cdef int bin0_min, bin0_max, bins = self.bins, lut_size, i, size
+ *         cdef numpy.int32_t k,idx #same as numpy.int32
+ */
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__delta); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_2 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_2 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_v_delta = __pyx_t_2;
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__pos0_min); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_2 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_2 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_v_pos0_min = __pyx_t_2;
+
+  /* "splitBBoxLUT.pyx":166
+ *         'calculate the max number of elements in the LUT and populate it'
+ *         cdef float delta=self.delta, pos0_min=self.pos0_min, pos1_min, pos1_max, min0, max0, fbin0_min, fbin0_max, deltaL, deltaR, deltaA
+ *         cdef int bin0_min, bin0_max, bins = self.bins, lut_size, i, size             # <<<<<<<<<<<<<<
+ *         cdef numpy.int32_t k,idx #same as numpy.int32
+ *         cdef bint check_mask, check_pos1
+ */
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__bins); 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_t_3 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_v_bins = __pyx_t_3;
+
+  /* "splitBBoxLUT.pyx":169
+ *         cdef numpy.int32_t k,idx #same as numpy.int32
+ *         cdef bint check_mask, check_pos1
+ *         cdef numpy.ndarray[numpy.int32_t, ndim = 1] outMax = numpy.zeros(bins, dtype=numpy.int32)             # <<<<<<<<<<<<<<
+ *         cdef float[:] cpos0_sup = self.cpos0_sup
+ *         cdef float[:] cpos0_inf = self.cpos0_inf
  */
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__recarray); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  __pyx_t_5 = PyInt_FromLong(__pyx_v_bins); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyInt_FromLong(__pyx_v_bins); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_7 = PyInt_FromLong(__pyx_v_lut_size); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_7);
-  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
-  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
-  __Pyx_GIVEREF(__pyx_t_5);
-  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_7);
-  __Pyx_GIVEREF(__pyx_t_7);
-  __pyx_t_5 = 0;
-  __pyx_t_7 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__shape), ((PyObject *)__pyx_t_6)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
-  __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  PyTuple_SET_ITEM(__pyx_t_5, 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 = 169; __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 = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
-  __pyx_t_7 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__int32); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s__int32); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_7);
   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
-  PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_n_s__idx));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx));
-  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_7);
-  __Pyx_GIVEREF(__pyx_t_7);
-  __pyx_t_7 = 0;
-  __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_7);
-  __pyx_t_5 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__float32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-  __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_7);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__coef));
-  PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_n_s__coef));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__coef));
-  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_5);
-  __Pyx_GIVEREF(__pyx_t_5);
-  __pyx_t_5 = 0;
-  __pyx_t_5 = PyList_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  PyList_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_6));
-  __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
-  PyList_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_t_7));
-  __Pyx_GIVEREF(((PyObject *)__pyx_t_7));
-  __pyx_t_6 = 0;
-  __pyx_t_7 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_t_5)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
-  __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_27 = ((PyArrayObject *)__pyx_t_5);
+  if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_8 = ((PyArrayObject *)__pyx_t_7);
   {
-    __Pyx_BufFmt_StackElem __pyx_stack[2];
-    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lut.rcbuffer->pybuffer);
-    __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lut.rcbuffer->pybuffer, (PyObject*)__pyx_t_27, &__Pyx_TypeInfo_nn_struct___pyx_t_12splitBBoxLUT_lut_point, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
-    if (unlikely(__pyx_t_3 < 0)) {
-      PyErr_Fetch(&__pyx_t_28, &__pyx_t_29, &__pyx_t_30);
-      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lut.rcbuffer->pybuffer, (PyObject*)__pyx_v_lut, &__Pyx_TypeInfo_nn_struct___pyx_t_12splitBBoxLUT_lut_point, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
-        Py_XDECREF(__pyx_t_28); Py_XDECREF(__pyx_t_29); Py_XDECREF(__pyx_t_30);
-        __Pyx_RaiseBufferFallbackError();
-      } else {
-        PyErr_Restore(__pyx_t_28, __pyx_t_29, __pyx_t_30);
-      }
+    __Pyx_BufFmt_StackElem __pyx_stack[1];
+    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outMax.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
+      __pyx_v_outMax = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf = NULL;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    } else {__pyx_pybuffernd_outMax.diminfo[0].strides = __pyx_pybuffernd_outMax.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outMax.diminfo[0].shape = __pyx_pybuffernd_outMax.rcbuffer->pybuffer.shape[0];
     }
-    __pyx_pybuffernd_lut.diminfo[0].strides = __pyx_pybuffernd_lut.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lut.diminfo[0].shape = __pyx_pybuffernd_lut.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_lut.diminfo[1].strides = __pyx_pybuffernd_lut.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_lut.diminfo[1].shape = __pyx_pybuffernd_lut.rcbuffer->pybuffer.shape[1];
-    if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
-  __pyx_t_27 = 0;
-  __pyx_v_lut = ((PyArrayObject *)__pyx_t_5);
-  __pyx_t_5 = 0;
+  __pyx_t_8 = 0;
+  __pyx_v_outMax = ((PyArrayObject *)__pyx_t_7);
+  __pyx_t_7 = 0;
 
-  /* "splitBBoxLUT.pyx":197
- *         #else hope we have enough memory
- *         lut = numpy.recarray(shape=(bins, lut_size),dtype=[("idx",numpy.int32),("coef",numpy.float32)])
- *         memset(&lut[0,0], 0, bins*lut_size*sizeof(lut_point))             # <<<<<<<<<<<<<<
- *         #NOGIL
- *         with nogil:
+  /* "splitBBoxLUT.pyx":170
+ *         cdef bint check_mask, check_pos1
+ *         cdef numpy.ndarray[numpy.int32_t, ndim = 1] outMax = numpy.zeros(bins, dtype=numpy.int32)
+ *         cdef float[:] cpos0_sup = self.cpos0_sup             # <<<<<<<<<<<<<<
+ *         cdef float[:] cpos0_inf = self.cpos0_inf
+ *         cdef float[:] cpos1_min, cpos1_max
  */
-  __pyx_t_31 = 0;
-  __pyx_t_32 = 0;
-  memset((&(*__Pyx_BufPtrStrided2d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_lut.diminfo[1].strides))), 0, ((__pyx_v_bins * __pyx_v_lut_size) * (sizeof(struct __pyx_t_12splitBBoxLUT_lut_point))));
+  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__cpos0_sup); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_7);
+  __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_7);
+  if (unlikely(!__pyx_t_9.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+  __pyx_v_cpos0_sup = __pyx_t_9;
+  __pyx_t_9.memview = NULL;
+  __pyx_t_9.data = NULL;
 
-  /* "splitBBoxLUT.pyx":199
- *         memset(&lut[0,0], 0, bins*lut_size*sizeof(lut_point))
- *         #NOGIL
- *         with nogil:             # <<<<<<<<<<<<<<
- *             for idx in range(size):
- *                 if (check_mask) and (cmask[idx]):
- */
-  {
-      #ifdef WITH_THREAD
-      PyThreadState *_save = NULL;
-      #endif
+  /* "splitBBoxLUT.pyx":171
+ *         cdef numpy.ndarray[numpy.int32_t, ndim = 1] outMax = numpy.zeros(bins, dtype=numpy.int32)
+ *         cdef float[:] cpos0_sup = self.cpos0_sup
+ *         cdef float[:] cpos0_inf = self.cpos0_inf             # <<<<<<<<<<<<<<
+ *         cdef float[:] cpos1_min, cpos1_max
+ *         cdef numpy.ndarray[lut_point, ndim = 2] lut
+ */
+  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__cpos0_inf); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_7);
+  __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_7);
+  if (unlikely(!__pyx_t_10.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+  __pyx_v_cpos0_inf = __pyx_t_10;
+  __pyx_t_10.memview = NULL;
+  __pyx_t_10.data = NULL;
+
+  /* "splitBBoxLUT.pyx":175
+ *         cdef numpy.ndarray[lut_point, ndim = 2] lut
+ *         cdef numpy.int8_t[:] cmask
+ *         size = self.size             # <<<<<<<<<<<<<<
+ *         if self.check_mask:
+ *             cmask = self.cmask
+ */
+  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__size); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_7);
+  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_7); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+  __pyx_v_size = __pyx_t_3;
+
+  /* "splitBBoxLUT.pyx":176
+ *         cdef numpy.int8_t[:] cmask
+ *         size = self.size
+ *         if self.check_mask:             # <<<<<<<<<<<<<<
+ *             cmask = self.cmask
+ *             check_mask = True
+ */
+  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__check_mask); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_7);
+  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+  if (__pyx_t_11) {
+
+    /* "splitBBoxLUT.pyx":177
+ *         size = self.size
+ *         if self.check_mask:
+ *             cmask = self.cmask             # <<<<<<<<<<<<<<
+ *             check_mask = True
+ *         else:
+ */
+    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__cmask); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_7);
+    __pyx_t_12 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int8_t(__pyx_t_7);
+    if (unlikely(!__pyx_t_12.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+    __pyx_v_cmask = __pyx_t_12;
+    __pyx_t_12.memview = NULL;
+    __pyx_t_12.data = NULL;
+
+    /* "splitBBoxLUT.pyx":178
+ *         if self.check_mask:
+ *             cmask = self.cmask
+ *             check_mask = True             # <<<<<<<<<<<<<<
+ *         else:
+ *             check_mask = False
+ */
+    __pyx_v_check_mask = 1;
+    goto __pyx_L3;
+  }
+  /*else*/ {
+
+    /* "splitBBoxLUT.pyx":180
+ *             check_mask = True
+ *         else:
+ *             check_mask = False             # <<<<<<<<<<<<<<
+ * 
+ *         if self.check_pos1:
+ */
+    __pyx_v_check_mask = 0;
+  }
+  __pyx_L3:;
+
+  /* "splitBBoxLUT.pyx":182
+ *             check_mask = False
+ * 
+ *         if self.check_pos1:             # <<<<<<<<<<<<<<
+ *             check_pos1 = True
+ *             cpos1_min = self.cpos1_min
+ */
+  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__check_pos1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_7);
+  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+  if (__pyx_t_11) {
+
+    /* "splitBBoxLUT.pyx":183
+ * 
+ *         if self.check_pos1:
+ *             check_pos1 = True             # <<<<<<<<<<<<<<
+ *             cpos1_min = self.cpos1_min
+ *             cpos1_max = self.cpos1_max
+ */
+    __pyx_v_check_pos1 = 1;
+
+    /* "splitBBoxLUT.pyx":184
+ *         if self.check_pos1:
+ *             check_pos1 = True
+ *             cpos1_min = self.cpos1_min             # <<<<<<<<<<<<<<
+ *             cpos1_max = self.cpos1_max
+ *             pos1_max = self.pos1_max
+ */
+    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__cpos1_min); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_7);
+    __pyx_t_13 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_7);
+    if (unlikely(!__pyx_t_13.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+    __pyx_v_cpos1_min = __pyx_t_13;
+    __pyx_t_13.memview = NULL;
+    __pyx_t_13.data = NULL;
+
+    /* "splitBBoxLUT.pyx":185
+ *             check_pos1 = True
+ *             cpos1_min = self.cpos1_min
+ *             cpos1_max = self.cpos1_max             # <<<<<<<<<<<<<<
+ *             pos1_max = self.pos1_max
+ *             pos1_min = self.pos1_min
+ */
+    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__cpos1_max); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_7);
+    __pyx_t_13 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_7);
+    if (unlikely(!__pyx_t_13.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+    __pyx_v_cpos1_max = __pyx_t_13;
+    __pyx_t_13.memview = NULL;
+    __pyx_t_13.data = NULL;
+
+    /* "splitBBoxLUT.pyx":186
+ *             cpos1_min = self.cpos1_min
+ *             cpos1_max = self.cpos1_max
+ *             pos1_max = self.pos1_max             # <<<<<<<<<<<<<<
+ *             pos1_min = self.pos1_min
+ *         else:
+ */
+    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__pos1_max); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_7);
+    __pyx_t_2 = __pyx_PyFloat_AsFloat(__pyx_t_7); if (unlikely((__pyx_t_2 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+    __pyx_v_pos1_max = __pyx_t_2;
+
+    /* "splitBBoxLUT.pyx":187
+ *             cpos1_max = self.cpos1_max
+ *             pos1_max = self.pos1_max
+ *             pos1_min = self.pos1_min             # <<<<<<<<<<<<<<
+ *         else:
+ *             check_pos1 = False
+ */
+    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__pos1_min); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_7);
+    __pyx_t_2 = __pyx_PyFloat_AsFloat(__pyx_t_7); if (unlikely((__pyx_t_2 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+    __pyx_v_pos1_min = __pyx_t_2;
+    goto __pyx_L4;
+  }
+  /*else*/ {
+
+    /* "splitBBoxLUT.pyx":189
+ *             pos1_min = self.pos1_min
+ *         else:
+ *             check_pos1 = False             # <<<<<<<<<<<<<<
+ * #NOGIL
+ *         with nogil:
+ */
+    __pyx_v_check_pos1 = 0;
+  }
+  __pyx_L4:;
+
+  /* "splitBBoxLUT.pyx":191
+ *             check_pos1 = False
+ * #NOGIL
+ *         with nogil:             # <<<<<<<<<<<<<<
+ *             for idx in range(size):
+ *                 if (check_mask) and (cmask[idx]):
+ */
+  {
+      #ifdef WITH_THREAD
+      PyThreadState *_save;
       Py_UNBLOCK_THREADS
+      #endif
       /*try:*/ {
 
-        /* "splitBBoxLUT.pyx":200
- *         #NOGIL
+        /* "splitBBoxLUT.pyx":192
+ * #NOGIL
  *         with nogil:
  *             for idx in range(size):             # <<<<<<<<<<<<<<
  *                 if (check_mask) and (cmask[idx]):
@@ -4250,94 +4383,94 @@ static PyObject *__pyx_pf_12splitBBoxLUT_11HistoBBox1d_2calc_lut(CYTHON_UNUSED P
         for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_3; __pyx_t_14+=1) {
           __pyx_v_idx = __pyx_t_14;
 
-          /* "splitBBoxLUT.pyx":201
+          /* "splitBBoxLUT.pyx":193
  *         with nogil:
  *             for idx in range(size):
  *                 if (check_mask) and (cmask[idx]):             # <<<<<<<<<<<<<<
  *                     continue
  * 
  */
-          __pyx_t_16 = __pyx_v_check_mask;
-          if (__pyx_t_16) {
-            if (unlikely(!__pyx_v_cmask.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cmask"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L22;} }
-            __pyx_t_33 = __pyx_v_idx;
-            __pyx_t_11 = (*((__pyx_t_5numpy_int8_t *) ( /* dim=0 */ (__pyx_v_cmask.data + __pyx_t_33 * __pyx_v_cmask.strides[0]) )));
+          __pyx_t_11 = __pyx_v_check_mask;
+          if (__pyx_t_11) {
+            if (unlikely(!__pyx_v_cmask.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cmask"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L6;} }
+            __pyx_t_15 = __pyx_v_idx;
+            __pyx_t_16 = ((*((__pyx_t_5numpy_int8_t *) ( /* dim=0 */ (__pyx_v_cmask.data + __pyx_t_15 * __pyx_v_cmask.strides[0]) ))) != 0);
           } else {
-            __pyx_t_11 = __pyx_t_16;
+            __pyx_t_16 = __pyx_t_11;
           }
-          if (__pyx_t_11) {
+          if (__pyx_t_16) {
 
-            /* "splitBBoxLUT.pyx":202
+            /* "splitBBoxLUT.pyx":194
  *             for idx in range(size):
  *                 if (check_mask) and (cmask[idx]):
  *                     continue             # <<<<<<<<<<<<<<
  * 
  *                 min0 = cpos0_inf[idx]
  */
-            goto __pyx_L24_continue;
-            goto __pyx_L26;
+            goto __pyx_L8_continue;
+            goto __pyx_L10;
           }
-          __pyx_L26:;
+          __pyx_L10:;
 
-          /* "splitBBoxLUT.pyx":204
+          /* "splitBBoxLUT.pyx":196
  *                     continue
  * 
  *                 min0 = cpos0_inf[idx]             # <<<<<<<<<<<<<<
  *                 max0 = cpos0_sup[idx]
  * 
  */
-          __pyx_t_34 = __pyx_v_idx;
-          __pyx_v_min0 = (*((float *) ( /* dim=0 */ (__pyx_v_cpos0_inf.data + __pyx_t_34 * __pyx_v_cpos0_inf.strides[0]) )));
+          __pyx_t_17 = __pyx_v_idx;
+          __pyx_v_min0 = (*((float *) ( /* dim=0 */ (__pyx_v_cpos0_inf.data + __pyx_t_17 * __pyx_v_cpos0_inf.strides[0]) )));
 
-          /* "splitBBoxLUT.pyx":205
+          /* "splitBBoxLUT.pyx":197
  * 
  *                 min0 = cpos0_inf[idx]
  *                 max0 = cpos0_sup[idx]             # <<<<<<<<<<<<<<
  * 
  *                 if check_pos1 and ((cpos1_max[idx] < pos1_min) or (cpos1_min[idx] > pos1_max)):
  */
-          __pyx_t_35 = __pyx_v_idx;
-          __pyx_v_max0 = (*((float *) ( /* dim=0 */ (__pyx_v_cpos0_sup.data + __pyx_t_35 * __pyx_v_cpos0_sup.strides[0]) )));
+          __pyx_t_18 = __pyx_v_idx;
+          __pyx_v_max0 = (*((float *) ( /* dim=0 */ (__pyx_v_cpos0_sup.data + __pyx_t_18 * __pyx_v_cpos0_sup.strides[0]) )));
 
-          /* "splitBBoxLUT.pyx":207
+          /* "splitBBoxLUT.pyx":199
  *                 max0 = cpos0_sup[idx]
  * 
  *                 if check_pos1 and ((cpos1_max[idx] < pos1_min) or (cpos1_min[idx] > pos1_max)):             # <<<<<<<<<<<<<<
- *                         continue
+ *                     continue
  * 
  */
-          if (__pyx_v_check_pos1) {
-            if (unlikely(!__pyx_v_cpos1_max.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cpos1_max"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L22;} }
-            __pyx_t_36 = __pyx_v_idx;
-            __pyx_t_11 = ((*((float *) ( /* dim=0 */ (__pyx_v_cpos1_max.data + __pyx_t_36 * __pyx_v_cpos1_max.strides[0]) ))) < __pyx_v_pos1_min);
-            if (!__pyx_t_11) {
-              if (unlikely(!__pyx_v_cpos1_min.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cpos1_min"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L22;} }
-              __pyx_t_37 = __pyx_v_idx;
-              __pyx_t_16 = ((*((float *) ( /* dim=0 */ (__pyx_v_cpos1_min.data + __pyx_t_37 * __pyx_v_cpos1_min.strides[0]) ))) > __pyx_v_pos1_max);
-              __pyx_t_26 = __pyx_t_16;
+          if ((__pyx_v_check_pos1 != 0)) {
+            if (unlikely(!__pyx_v_cpos1_max.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cpos1_max"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L6;} }
+            __pyx_t_19 = __pyx_v_idx;
+            __pyx_t_16 = (((*((float *) ( /* dim=0 */ (__pyx_v_cpos1_max.data + __pyx_t_19 * __pyx_v_cpos1_max.strides[0]) ))) < __pyx_v_pos1_min) != 0);
+            if (!__pyx_t_16) {
+              if (unlikely(!__pyx_v_cpos1_min.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cpos1_min"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L6;} }
+              __pyx_t_20 = __pyx_v_idx;
+              __pyx_t_11 = (((*((float *) ( /* dim=0 */ (__pyx_v_cpos1_min.data + __pyx_t_20 * __pyx_v_cpos1_min.strides[0]) ))) > __pyx_v_pos1_max) != 0);
+              __pyx_t_21 = __pyx_t_11;
             } else {
-              __pyx_t_26 = __pyx_t_11;
+              __pyx_t_21 = __pyx_t_16;
             }
-            __pyx_t_11 = __pyx_t_26;
+            __pyx_t_16 = __pyx_t_21;
           } else {
-            __pyx_t_11 = __pyx_v_check_pos1;
+            __pyx_t_16 = (__pyx_v_check_pos1 != 0);
           }
-          if (__pyx_t_11) {
+          if (__pyx_t_16) {
 
-            /* "splitBBoxLUT.pyx":208
+            /* "splitBBoxLUT.pyx":200
  * 
  *                 if check_pos1 and ((cpos1_max[idx] < pos1_min) or (cpos1_min[idx] > pos1_max)):
- *                         continue             # <<<<<<<<<<<<<<
+ *                     continue             # <<<<<<<<<<<<<<
  * 
  *                 fbin0_min = getBinNr(min0, pos0_min, delta)
  */
-            goto __pyx_L24_continue;
-            goto __pyx_L27;
+            goto __pyx_L8_continue;
+            goto __pyx_L11;
           }
-          __pyx_L27:;
+          __pyx_L11:;
 
-          /* "splitBBoxLUT.pyx":210
- *                         continue
+          /* "splitBBoxLUT.pyx":202
+ *                     continue
  * 
  *                 fbin0_min = getBinNr(min0, pos0_min, delta)             # <<<<<<<<<<<<<<
  *                 fbin0_max = getBinNr(max0, pos0_min, delta)
@@ -4345,7 +4478,7 @@ static PyObject *__pyx_pf_12splitBBoxLUT_11HistoBBox1d_2calc_lut(CYTHON_UNUSED P
  */
           __pyx_v_fbin0_min = __pyx_f_12splitBBoxLUT_getBinNr(__pyx_v_min0, __pyx_v_pos0_min, __pyx_v_delta);
 
-          /* "splitBBoxLUT.pyx":211
+          /* "splitBBoxLUT.pyx":203
  * 
  *                 fbin0_min = getBinNr(min0, pos0_min, delta)
  *                 fbin0_max = getBinNr(max0, pos0_min, delta)             # <<<<<<<<<<<<<<
@@ -4354,7 +4487,7 @@ static PyObject *__pyx_pf_12splitBBoxLUT_11HistoBBox1d_2calc_lut(CYTHON_UNUSED P
  */
           __pyx_v_fbin0_max = __pyx_f_12splitBBoxLUT_getBinNr(__pyx_v_max0, __pyx_v_pos0_min, __pyx_v_delta);
 
-          /* "splitBBoxLUT.pyx":212
+          /* "splitBBoxLUT.pyx":204
  *                 fbin0_min = getBinNr(min0, pos0_min, delta)
  *                 fbin0_max = getBinNr(max0, pos0_min, delta)
  *                 bin0_min = < int > fbin0_min             # <<<<<<<<<<<<<<
@@ -4363,7 +4496,7 @@ static PyObject *__pyx_pf_12splitBBoxLUT_11HistoBBox1d_2calc_lut(CYTHON_UNUSED P
  */
           __pyx_v_bin0_min = ((int)__pyx_v_fbin0_min);
 
-          /* "splitBBoxLUT.pyx":213
+          /* "splitBBoxLUT.pyx":205
  *                 fbin0_max = getBinNr(max0, pos0_min, delta)
  *                 bin0_min = < int > fbin0_min
  *                 bin0_max = < int > fbin0_max             # <<<<<<<<<<<<<<
@@ -4372,45 +4505,45 @@ static PyObject *__pyx_pf_12splitBBoxLUT_11HistoBBox1d_2calc_lut(CYTHON_UNUSED P
  */
           __pyx_v_bin0_max = ((int)__pyx_v_fbin0_max);
 
-          /* "splitBBoxLUT.pyx":215
+          /* "splitBBoxLUT.pyx":207
  *                 bin0_max = < int > fbin0_max
  * 
  *                 if (bin0_max < 0) or (bin0_min >= bins):             # <<<<<<<<<<<<<<
  *                     continue
  *                 if bin0_max >= bins :
  */
-          __pyx_t_11 = (__pyx_v_bin0_max < 0);
-          if (!__pyx_t_11) {
-            __pyx_t_26 = (__pyx_v_bin0_min >= __pyx_v_bins);
-            __pyx_t_16 = __pyx_t_26;
+          __pyx_t_16 = ((__pyx_v_bin0_max < 0) != 0);
+          if (!__pyx_t_16) {
+            __pyx_t_21 = ((__pyx_v_bin0_min >= __pyx_v_bins) != 0);
+            __pyx_t_11 = __pyx_t_21;
           } else {
-            __pyx_t_16 = __pyx_t_11;
+            __pyx_t_11 = __pyx_t_16;
           }
-          if (__pyx_t_16) {
+          if (__pyx_t_11) {
 
-            /* "splitBBoxLUT.pyx":216
+            /* "splitBBoxLUT.pyx":208
  * 
  *                 if (bin0_max < 0) or (bin0_min >= bins):
  *                     continue             # <<<<<<<<<<<<<<
  *                 if bin0_max >= bins :
  *                     bin0_max = bins - 1
  */
-            goto __pyx_L24_continue;
-            goto __pyx_L28;
+            goto __pyx_L8_continue;
+            goto __pyx_L12;
           }
-          __pyx_L28:;
+          __pyx_L12:;
 
-          /* "splitBBoxLUT.pyx":217
+          /* "splitBBoxLUT.pyx":209
  *                 if (bin0_max < 0) or (bin0_min >= bins):
  *                     continue
  *                 if bin0_max >= bins :             # <<<<<<<<<<<<<<
  *                     bin0_max = bins - 1
  *                 if  bin0_min < 0:
  */
-          __pyx_t_16 = (__pyx_v_bin0_max >= __pyx_v_bins);
-          if (__pyx_t_16) {
+          __pyx_t_11 = ((__pyx_v_bin0_max >= __pyx_v_bins) != 0);
+          if (__pyx_t_11) {
 
-            /* "splitBBoxLUT.pyx":218
+            /* "splitBBoxLUT.pyx":210
  *                     continue
  *                 if bin0_max >= bins :
  *                     bin0_max = bins - 1             # <<<<<<<<<<<<<<
@@ -4418,21 +4551,21 @@ static PyObject *__pyx_pf_12splitBBoxLUT_11HistoBBox1d_2calc_lut(CYTHON_UNUSED P
  *                     bin0_min = 0
  */
             __pyx_v_bin0_max = (__pyx_v_bins - 1);
-            goto __pyx_L29;
+            goto __pyx_L13;
           }
-          __pyx_L29:;
+          __pyx_L13:;
 
-          /* "splitBBoxLUT.pyx":219
+          /* "splitBBoxLUT.pyx":211
  *                 if bin0_max >= bins :
  *                     bin0_max = bins - 1
  *                 if  bin0_min < 0:             # <<<<<<<<<<<<<<
  *                     bin0_min = 0
  * 
  */
-          __pyx_t_16 = (__pyx_v_bin0_min < 0);
-          if (__pyx_t_16) {
+          __pyx_t_11 = ((__pyx_v_bin0_min < 0) != 0);
+          if (__pyx_t_11) {
 
-            /* "splitBBoxLUT.pyx":220
+            /* "splitBBoxLUT.pyx":212
  *                     bin0_max = bins - 1
  *                 if  bin0_min < 0:
  *                     bin0_min = 0             # <<<<<<<<<<<<<<
@@ -4440,12132 +4573,7880 @@ static PyObject *__pyx_pf_12splitBBoxLUT_11HistoBBox1d_2calc_lut(CYTHON_UNUSED P
  *                 if bin0_min == bin0_max:
  */
             __pyx_v_bin0_min = 0;
-            goto __pyx_L30;
+            goto __pyx_L14;
           }
-          __pyx_L30:;
+          __pyx_L14:;
 
-          /* "splitBBoxLUT.pyx":222
+          /* "splitBBoxLUT.pyx":214
  *                     bin0_min = 0
  * 
  *                 if bin0_min == bin0_max:             # <<<<<<<<<<<<<<
  *                     #All pixel is within a single bin
- *                     k = outMax[bin0_min]
+ *                     outMax[bin0_min] += 1
  */
-          __pyx_t_16 = (__pyx_v_bin0_min == __pyx_v_bin0_max);
-          if (__pyx_t_16) {
+          __pyx_t_11 = ((__pyx_v_bin0_min == __pyx_v_bin0_max) != 0);
+          if (__pyx_t_11) {
 
-            /* "splitBBoxLUT.pyx":224
+            /* "splitBBoxLUT.pyx":216
  *                 if bin0_min == bin0_max:
  *                     #All pixel is within a single bin
- *                     k = outMax[bin0_min]             # <<<<<<<<<<<<<<
- *                     lut[bin0_min, k].idx = idx
- *                     lut[bin0_min, k].coef = 1.0
+ *                     outMax[bin0_min] += 1             # <<<<<<<<<<<<<<
+ * 
+ *                 else: #we have pixel spliting.
  */
-            __pyx_t_24 = __pyx_v_bin0_min;
-            __pyx_v_k = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_outMax.diminfo[0].strides));
-
-            /* "splitBBoxLUT.pyx":225
- *                     #All pixel is within a single bin
- *                     k = outMax[bin0_min]
- *                     lut[bin0_min, k].idx = idx             # <<<<<<<<<<<<<<
- *                     lut[bin0_min, k].coef = 1.0
- *                     outMax[bin0_min] = k + 1
- */
-            __pyx_t_38 = __pyx_v_bin0_min;
-            __pyx_t_39 = __pyx_v_k;
-            (*__Pyx_BufPtrStrided2d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_39, __pyx_pybuffernd_lut.diminfo[1].strides)).idx = __pyx_v_idx;
-
-            /* "splitBBoxLUT.pyx":226
- *                     k = outMax[bin0_min]
- *                     lut[bin0_min, k].idx = idx
- *                     lut[bin0_min, k].coef = 1.0             # <<<<<<<<<<<<<<
- *                     outMax[bin0_min] = k + 1
- *                 else: #we have pixel splitting.
- */
-            __pyx_t_40 = __pyx_v_bin0_min;
-            __pyx_t_41 = __pyx_v_k;
-            (*__Pyx_BufPtrStrided2d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_41, __pyx_pybuffernd_lut.diminfo[1].strides)).coef = 1.0;
-
-            /* "splitBBoxLUT.pyx":227
- *                     lut[bin0_min, k].idx = idx
- *                     lut[bin0_min, k].coef = 1.0
- *                     outMax[bin0_min] = k + 1             # <<<<<<<<<<<<<<
- *                 else: #we have pixel splitting.
- *                     deltaA = 1.0 / (fbin0_max - fbin0_min)
- */
-            __pyx_t_42 = __pyx_v_bin0_min;
-            *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_outMax.diminfo[0].strides) = (__pyx_v_k + 1);
-            goto __pyx_L31;
+            __pyx_t_22 = __pyx_v_bin0_min;
+            *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_outMax.diminfo[0].strides) += 1;
+            goto __pyx_L15;
           }
           /*else*/ {
 
-            /* "splitBBoxLUT.pyx":229
- *                     outMax[bin0_min] = k + 1
- *                 else: #we have pixel splitting.
- *                     deltaA = 1.0 / (fbin0_max - fbin0_min)             # <<<<<<<<<<<<<<
- * 
- *                     deltaL = (bin0_min + 1) - fbin0_min
- */
-            __pyx_v_deltaA = (1.0 / (__pyx_v_fbin0_max - __pyx_v_fbin0_min));
-
-            /* "splitBBoxLUT.pyx":231
- *                     deltaA = 1.0 / (fbin0_max - fbin0_min)
- * 
- *                     deltaL = (bin0_min + 1) - fbin0_min             # <<<<<<<<<<<<<<
- *                     deltaR = fbin0_max - (bin0_max)
- * 
- */
-            __pyx_v_deltaL = ((__pyx_v_bin0_min + 1) - __pyx_v_fbin0_min);
-
-            /* "splitBBoxLUT.pyx":232
- * 
- *                     deltaL = (bin0_min + 1) - fbin0_min
- *                     deltaR = fbin0_max - (bin0_max)             # <<<<<<<<<<<<<<
- * 
- *                     k = outMax[bin0_min]
- */
-            __pyx_v_deltaR = (__pyx_v_fbin0_max - __pyx_v_bin0_max);
-
-            /* "splitBBoxLUT.pyx":234
- *                     deltaR = fbin0_max - (bin0_max)
- * 
- *                     k = outMax[bin0_min]             # <<<<<<<<<<<<<<
- *                     lut[bin0_min, k].idx = idx
- *                     lut[bin0_min, k].coef = (deltaA * deltaL)
- */
-            __pyx_t_43 = __pyx_v_bin0_min;
-            __pyx_v_k = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_43, __pyx_pybuffernd_outMax.diminfo[0].strides));
-
-            /* "splitBBoxLUT.pyx":235
- * 
- *                     k = outMax[bin0_min]
- *                     lut[bin0_min, k].idx = idx             # <<<<<<<<<<<<<<
- *                     lut[bin0_min, k].coef = (deltaA * deltaL)
- *                     outMax[bin0_min] = k + 1
- */
-            __pyx_t_44 = __pyx_v_bin0_min;
-            __pyx_t_45 = __pyx_v_k;
-            (*__Pyx_BufPtrStrided2d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_45, __pyx_pybuffernd_lut.diminfo[1].strides)).idx = __pyx_v_idx;
-
-            /* "splitBBoxLUT.pyx":236
- *                     k = outMax[bin0_min]
- *                     lut[bin0_min, k].idx = idx
- *                     lut[bin0_min, k].coef = (deltaA * deltaL)             # <<<<<<<<<<<<<<
- *                     outMax[bin0_min] = k + 1
- * 
- */
-            __pyx_t_46 = __pyx_v_bin0_min;
-            __pyx_t_47 = __pyx_v_k;
-            (*__Pyx_BufPtrStrided2d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_46, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_47, __pyx_pybuffernd_lut.diminfo[1].strides)).coef = (__pyx_v_deltaA * __pyx_v_deltaL);
-
-            /* "splitBBoxLUT.pyx":237
- *                     lut[bin0_min, k].idx = idx
- *                     lut[bin0_min, k].coef = (deltaA * deltaL)
- *                     outMax[bin0_min] = k + 1             # <<<<<<<<<<<<<<
- * 
- *                     k = outMax[bin0_max]
- */
-            __pyx_t_48 = __pyx_v_bin0_min;
-            *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_48, __pyx_pybuffernd_outMax.diminfo[0].strides) = (__pyx_v_k + 1);
-
-            /* "splitBBoxLUT.pyx":239
- *                     outMax[bin0_min] = k + 1
- * 
- *                     k = outMax[bin0_max]             # <<<<<<<<<<<<<<
- *                     lut[bin0_max, k].idx = idx
- *                     lut[bin0_max, k].coef = (deltaA * deltaR)
- */
-            __pyx_t_49 = __pyx_v_bin0_max;
-            __pyx_v_k = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_49, __pyx_pybuffernd_outMax.diminfo[0].strides));
-
-            /* "splitBBoxLUT.pyx":240
- * 
- *                     k = outMax[bin0_max]
- *                     lut[bin0_max, k].idx = idx             # <<<<<<<<<<<<<<
- *                     lut[bin0_max, k].coef = (deltaA * deltaR)
- *                     outMax[bin0_max] = k + 1
- */
-            __pyx_t_50 = __pyx_v_bin0_max;
-            __pyx_t_51 = __pyx_v_k;
-            (*__Pyx_BufPtrStrided2d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_50, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_51, __pyx_pybuffernd_lut.diminfo[1].strides)).idx = __pyx_v_idx;
-
-            /* "splitBBoxLUT.pyx":241
- *                     k = outMax[bin0_max]
- *                     lut[bin0_max, k].idx = idx
- *                     lut[bin0_max, k].coef = (deltaA * deltaR)             # <<<<<<<<<<<<<<
- *                     outMax[bin0_max] = k + 1
- * 
- */
-            __pyx_t_52 = __pyx_v_bin0_max;
-            __pyx_t_53 = __pyx_v_k;
-            (*__Pyx_BufPtrStrided2d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_52, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_53, __pyx_pybuffernd_lut.diminfo[1].strides)).coef = (__pyx_v_deltaA * __pyx_v_deltaR);
-
-            /* "splitBBoxLUT.pyx":242
- *                     lut[bin0_max, k].idx = idx
- *                     lut[bin0_max, k].coef = (deltaA * deltaR)
- *                     outMax[bin0_max] = k + 1             # <<<<<<<<<<<<<<
+            /* "splitBBoxLUT.pyx":219
  * 
- *                     if bin0_min + 1 < bin0_max:
- */
-            __pyx_t_54 = __pyx_v_bin0_max;
-            *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_54, __pyx_pybuffernd_outMax.diminfo[0].strides) = (__pyx_v_k + 1);
-
-            /* "splitBBoxLUT.pyx":244
- *                     outMax[bin0_max] = k + 1
+ *                 else: #we have pixel spliting.
+ *                     for i in range(bin0_min, bin0_max + 1):             # <<<<<<<<<<<<<<
+ *                         outMax[i] += 1
  * 
- *                     if bin0_min + 1 < bin0_max:             # <<<<<<<<<<<<<<
- *                         for i in range(bin0_min + 1, bin0_max):
- *                             k = outMax[i]
  */
-            __pyx_t_16 = ((__pyx_v_bin0_min + 1) < __pyx_v_bin0_max);
-            if (__pyx_t_16) {
+            __pyx_t_23 = (__pyx_v_bin0_max + 1);
+            for (__pyx_t_24 = __pyx_v_bin0_min; __pyx_t_24 < __pyx_t_23; __pyx_t_24+=1) {
+              __pyx_v_i = __pyx_t_24;
 
-              /* "splitBBoxLUT.pyx":245
+              /* "splitBBoxLUT.pyx":220
+ *                 else: #we have pixel spliting.
+ *                     for i in range(bin0_min, bin0_max + 1):
+ *                         outMax[i] += 1             # <<<<<<<<<<<<<<
  * 
- *                     if bin0_min + 1 < bin0_max:
- *                         for i in range(bin0_min + 1, bin0_max):             # <<<<<<<<<<<<<<
- *                             k = outMax[i]
- *                             lut[i, k].idx = idx
- */
-              __pyx_t_55 = __pyx_v_bin0_max;
-              for (__pyx_t_56 = (__pyx_v_bin0_min + 1); __pyx_t_56 < __pyx_t_55; __pyx_t_56+=1) {
-                __pyx_v_i = __pyx_t_56;
-
-                /* "splitBBoxLUT.pyx":246
- *                     if bin0_min + 1 < bin0_max:
- *                         for i in range(bin0_min + 1, bin0_max):
- *                             k = outMax[i]             # <<<<<<<<<<<<<<
- *                             lut[i, k].idx = idx
- *                             lut[i, k].coef = (deltaA)
- */
-                __pyx_t_57 = __pyx_v_i;
-                __pyx_v_k = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_57, __pyx_pybuffernd_outMax.diminfo[0].strides));
-
-                /* "splitBBoxLUT.pyx":247
- *                         for i in range(bin0_min + 1, bin0_max):
- *                             k = outMax[i]
- *                             lut[i, k].idx = idx             # <<<<<<<<<<<<<<
- *                             lut[i, k].coef = (deltaA)
- *                             outMax[i] = k + 1
- */
-                __pyx_t_58 = __pyx_v_i;
-                __pyx_t_59 = __pyx_v_k;
-                (*__Pyx_BufPtrStrided2d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_58, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_59, __pyx_pybuffernd_lut.diminfo[1].strides)).idx = __pyx_v_idx;
-
-                /* "splitBBoxLUT.pyx":248
- *                             k = outMax[i]
- *                             lut[i, k].idx = idx
- *                             lut[i, k].coef = (deltaA)             # <<<<<<<<<<<<<<
- *                             outMax[i] = k + 1
- *         self.lut = lut
- */
-                __pyx_t_60 = __pyx_v_i;
-                __pyx_t_61 = __pyx_v_k;
-                (*__Pyx_BufPtrStrided2d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_60, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_61, __pyx_pybuffernd_lut.diminfo[1].strides)).coef = __pyx_v_deltaA;
-
-                /* "splitBBoxLUT.pyx":249
- *                             lut[i, k].idx = idx
- *                             lut[i, k].coef = (deltaA)
- *                             outMax[i] = k + 1             # <<<<<<<<<<<<<<
- *         self.lut = lut
- *         return outMax
+ *         lut_size = outMax.max()
  */
-                __pyx_t_62 = __pyx_v_i;
-                *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_62, __pyx_pybuffernd_outMax.diminfo[0].strides) = (__pyx_v_k + 1);
-              }
-              goto __pyx_L32;
+              __pyx_t_25 = __pyx_v_i;
+              *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_outMax.diminfo[0].strides) += 1;
             }
-            __pyx_L32:;
           }
-          __pyx_L31:;
-          __pyx_L24_continue:;
+          __pyx_L15:;
+          __pyx_L8_continue:;
         }
       }
 
-      /* "splitBBoxLUT.pyx":199
- *         memset(&lut[0,0], 0, bins*lut_size*sizeof(lut_point))
- *         #NOGIL
+      /* "splitBBoxLUT.pyx":191
+ *             check_pos1 = False
+ * #NOGIL
  *         with nogil:             # <<<<<<<<<<<<<<
  *             for idx in range(size):
  *                 if (check_mask) and (cmask[idx]):
  */
       /*finally:*/ {
         int __pyx_why;
-        __pyx_why = 0; goto __pyx_L23;
-        __pyx_L22: __pyx_why = 4; goto __pyx_L23;
-        __pyx_L23:;
+        __pyx_why = 0; goto __pyx_L7;
+        __pyx_L6: __pyx_why = 4; goto __pyx_L7;
+        __pyx_L7:;
+        #ifdef WITH_THREAD
         Py_BLOCK_THREADS
+        #endif
         switch (__pyx_why) {
           case 4: goto __pyx_L1_error;
         }
       }
   }
 
-  /* "splitBBoxLUT.pyx":250
- *                             lut[i, k].coef = (deltaA)
- *                             outMax[i] = k + 1
- *         self.lut = lut             # <<<<<<<<<<<<<<
- *         return outMax
+  /* "splitBBoxLUT.pyx":222
+ *                         outMax[i] += 1
+ * 
+ *         lut_size = outMax.max()             # <<<<<<<<<<<<<<
+ *         #just recycle the outMax array
+ *         #outMax = numpy.zeros((bins0,bins1), dtype=numpy.int32)
+ */
+  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_outMax), __pyx_n_s__max); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_7);
+  __pyx_t_1 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_v_lut_size = __pyx_t_3;
+
+  /* "splitBBoxLUT.pyx":225
+ *         #just recycle the outMax array
+ *         #outMax = numpy.zeros((bins0,bins1), dtype=numpy.int32)
+ *         memset(&outMax[0], 0, bins * sizeof(numpy.int32_t))             # <<<<<<<<<<<<<<
  * 
+ *         self.lut_size = lut_size
  */
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__lut, ((PyObject *)__pyx_v_lut)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_23 = 0;
+  memset((&(*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_outMax.diminfo[0].strides))), 0, (__pyx_v_bins * (sizeof(__pyx_t_5numpy_int32_t))));
 
-  /* "splitBBoxLUT.pyx":251
- *                             outMax[i] = k + 1
- *         self.lut = lut
- *         return outMax             # <<<<<<<<<<<<<<
+  /* "splitBBoxLUT.pyx":227
+ *         memset(&outMax[0], 0, bins * sizeof(numpy.int32_t))
  * 
+ *         self.lut_size = lut_size             # <<<<<<<<<<<<<<
  * 
+ *         lut_nbytes = bins*lut_size*sizeof(lut_point)
  */
-  __Pyx_XDECREF(__pyx_r);
-  __Pyx_INCREF(((PyObject *)__pyx_v_outMax));
-  __pyx_r = ((PyObject *)__pyx_v_outMax);
-  goto __pyx_L0;
+  __pyx_t_1 = PyInt_FromLong(__pyx_v_lut_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__lut_size, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_4);
-  __Pyx_XDECREF(__pyx_t_5);
-  __Pyx_XDECREF(__pyx_t_6);
-  __Pyx_XDECREF(__pyx_t_7);
-  __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1);
-  __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
-  __PYX_XDEC_MEMVIEW(&__pyx_t_12, 1);
-  __PYX_XDEC_MEMVIEW(&__pyx_t_13, 1);
-  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
-    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
-    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lut.rcbuffer->pybuffer);
-    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outMax.rcbuffer->pybuffer);
-  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
-  __Pyx_AddTraceback("splitBBoxLUT.HistoBBox1d.calc_lut", __pyx_clineno, __pyx_lineno, __pyx_filename);
-  __pyx_r = NULL;
-  goto __pyx_L2;
-  __pyx_L0:;
-  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lut.rcbuffer->pybuffer);
-  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outMax.rcbuffer->pybuffer);
-  __pyx_L2:;
-  __Pyx_XDECREF((PyObject *)__pyx_v_outMax);
-  __PYX_XDEC_MEMVIEW(&__pyx_v_cpos0_sup, 1);
-  __PYX_XDEC_MEMVIEW(&__pyx_v_cpos0_inf, 1);
-  __PYX_XDEC_MEMVIEW(&__pyx_v_cpos1_min, 1);
-  __PYX_XDEC_MEMVIEW(&__pyx_v_cpos1_max, 1);
-  __Pyx_XDECREF((PyObject *)__pyx_v_lut);
-  __PYX_XDEC_MEMVIEW(&__pyx_v_cmask, 1);
-  __Pyx_XDECREF(__pyx_v_memsize);
-  __Pyx_XGIVEREF(__pyx_r);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* Python wrapper */
-static PyObject *__pyx_pw_12splitBBoxLUT_11HistoBBox1d_5integrate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_12splitBBoxLUT_11HistoBBox1d_4integrate[] = "\n        Actually perform the integration which in this case looks more like a matrix-vector product\n        \n        @param weights: input image \n        @type weights: ndarray\n        @param dummy: value for dead pixels (optional)\n        @type dummy: float\n        @param delta_dummy: precision for dead-pixel value in dynamic masking\n        @type delta_dummy: float\n        @param dark: array with the dark-curr [...]
-static PyMethodDef __pyx_mdef_12splitBBoxLUT_11HistoBBox1d_5integrate = {__Pyx_NAMESTR("integrate"), (PyCFunction)__pyx_pw_12splitBBoxLUT_11HistoBBox1d_5integrate, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_12splitBBoxLUT_11HistoBBox1d_4integrate)};
-static PyObject *__pyx_pw_12splitBBoxLUT_11HistoBBox1d_5integrate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
-  PyObject *__pyx_v_self = 0;
-  PyObject *__pyx_v_weights = 0;
-  PyObject *__pyx_v_dummy = 0;
-  PyObject *__pyx_v_delta_dummy = 0;
-  PyObject *__pyx_v_dark = 0;
-  PyObject *__pyx_v_flat = 0;
-  PyObject *__pyx_v_solidAngle = 0;
-  PyObject *__pyx_v_polarization = 0;
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("integrate (wrapper)", 0);
-  {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__weights,&__pyx_n_s__dummy,&__pyx_n_s__delta_dummy,&__pyx_n_s__dark,&__pyx_n_s__flat,&__pyx_n_s__solidAngle,&__pyx_n_s__polarization,0};
-    PyObject* values[8] = {0,0,0,0,0,0,0,0};
+  /* "splitBBoxLUT.pyx":229
+ *         self.lut_size = lut_size
+ * 
+ *         lut_nbytes = bins*lut_size*sizeof(lut_point)             # <<<<<<<<<<<<<<
+ *         if (os.name == "posix") and ("SC_PAGE_SIZE" in os.sysconf_names) and ("SC_PHYS_PAGES" in os.sysconf_names):
+ *             memsize =  os.sysconf("SC_PAGE_SIZE")*os.sysconf("SC_PHYS_PAGES")
+ */
+  __pyx_v_lut_nbytes = ((__pyx_v_bins * __pyx_v_lut_size) * (sizeof(struct __pyx_t_12splitBBoxLUT_lut_point)));
 
-    /* "splitBBoxLUT.pyx":257
- *     @cython.boundscheck(False)
- *     @cython.wraparound(False)
- *     def integrate(self, weights, dummy=None, delta_dummy=None, dark=None, flat=None, solidAngle=None, polarization=None):             # <<<<<<<<<<<<<<
- *         """
- *         Actually perform the integration which in this case looks more like a matrix-vector product
+  /* "splitBBoxLUT.pyx":230
+ * 
+ *         lut_nbytes = bins*lut_size*sizeof(lut_point)
+ *         if (os.name == "posix") and ("SC_PAGE_SIZE" in os.sysconf_names) and ("SC_PHYS_PAGES" in os.sysconf_names):             # <<<<<<<<<<<<<<
+ *             memsize =  os.sysconf("SC_PAGE_SIZE")*os.sysconf("SC_PHYS_PAGES")
+ *             if memsize <  lut_nbytes:
  */
-    values[2] = ((PyObject *)((PyObject *)Py_None));
-    values[3] = ((PyObject *)((PyObject *)Py_None));
-    values[4] = ((PyObject *)((PyObject *)Py_None));
-    values[5] = ((PyObject *)((PyObject *)Py_None));
-    values[6] = ((PyObject *)((PyObject *)Py_None));
-    values[7] = ((PyObject *)((PyObject *)Py_None));
-    if (unlikely(__pyx_kwds)) {
-      Py_ssize_t kw_args;
-      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
-      switch (pos_args) {
-        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
-        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
-        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
-        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
-        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
-        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
-        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
-        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
-        case  0: break;
-        default: goto __pyx_L5_argtuple_error;
-      }
-      kw_args = PyDict_Size(__pyx_kwds);
-      switch (pos_args) {
-        case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 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("integrate", 0, 2, 8, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-        }
-        case  2:
-        if (kw_args > 0) {
-          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dummy);
-          if (value) { values[2] = value; kw_args--; }
-        }
-        case  3:
-        if (kw_args > 0) {
-          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__delta_dummy);
-          if (value) { values[3] = value; kw_args--; }
-        }
-        case  4:
-        if (kw_args > 0) {
-          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dark);
-          if (value) { values[4] = value; kw_args--; }
-        }
-        case  5:
-        if (kw_args > 0) {
-          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flat);
-          if (value) { values[5] = value; kw_args--; }
-        }
-        case  6:
-        if (kw_args > 0) {
-          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__solidAngle);
-          if (value) { values[6] = value; kw_args--; }
-        }
-        case  7:
-        if (kw_args > 0) {
-          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__polarization);
-          if (value) { values[7] = value; kw_args--; }
-        }
-      }
-      if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "integrate") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-      }
+  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__name); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_7);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_1 = PyObject_RichCompare(__pyx_t_7, ((PyObject *)__pyx_n_s__posix), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  if (__pyx_t_11) {
+    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__sysconf_names); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_7);
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_16 = (__Pyx_PySequence_Contains(((PyObject *)__pyx_n_s__SC_PAGE_SIZE), __pyx_t_7, Py_EQ)); if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+    if (__pyx_t_16) {
+      __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s__os); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_7);
+      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s__sysconf_names); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
+      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+      __pyx_t_21 = (__Pyx_PySequence_Contains(((PyObject *)__pyx_n_s__SC_PHYS_PAGES), __pyx_t_1, Py_EQ)); if (unlikely(__pyx_t_21 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __pyx_t_26 = __pyx_t_21;
     } else {
-      switch (PyTuple_GET_SIZE(__pyx_args)) {
-        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
-        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
-        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
-        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
-        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
-        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
-        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
-        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
-        break;
-        default: goto __pyx_L5_argtuple_error;
-      }
+      __pyx_t_26 = __pyx_t_16;
     }
-    __pyx_v_self = values[0];
-    __pyx_v_weights = values[1];
-    __pyx_v_dummy = values[2];
-    __pyx_v_delta_dummy = values[3];
-    __pyx_v_dark = values[4];
-    __pyx_v_flat = values[5];
-    __pyx_v_solidAngle = values[6];
-    __pyx_v_polarization = values[7];
+    __pyx_t_16 = __pyx_t_26;
+  } else {
+    __pyx_t_16 = __pyx_t_11;
   }
-  goto __pyx_L4_argument_unpacking_done;
-  __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("integrate", 0, 2, 8, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-  __pyx_L3_error:;
-  __Pyx_AddTraceback("splitBBoxLUT.HistoBBox1d.integrate", __pyx_clineno, __pyx_lineno, __pyx_filename);
-  __Pyx_RefNannyFinishContext();
-  return NULL;
-  __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_12splitBBoxLUT_11HistoBBox1d_4integrate(__pyx_self, __pyx_v_self, __pyx_v_weights, __pyx_v_dummy, __pyx_v_delta_dummy, __pyx_v_dark, __pyx_v_flat, __pyx_v_solidAngle, __pyx_v_polarization);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
+  if (__pyx_t_16) {
 
-static PyObject *__pyx_pf_12splitBBoxLUT_11HistoBBox1d_4integrate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_weights, PyObject *__pyx_v_dummy, PyObject *__pyx_v_delta_dummy, PyObject *__pyx_v_dark, PyObject *__pyx_v_flat, PyObject *__pyx_v_solidAngle, PyObject *__pyx_v_polarization) {
-  int __pyx_v_i;
-  int __pyx_v_j;
-  int __pyx_v_idx;
-  CYTHON_UNUSED int __pyx_v_bins;
-  int __pyx_v_lut_size;
-  int __pyx_v_size;
-  double __pyx_v_sum_data;
-  double __pyx_v_sum_count;
-  double __pyx_v_epsilon;
-  float __pyx_v_data;
-  float __pyx_v_coef;
-  float __pyx_v_cdummy;
-  float __pyx_v_cddummy;
-  int __pyx_v_do_dummy;
-  int __pyx_v_do_dark;
-  int __pyx_v_do_flat;
-  int __pyx_v_do_polarization;
-  int __pyx_v_do_solidAngle;
-  PyArrayObject *__pyx_v_outData = 0;
-  PyArrayObject *__pyx_v_outCount = 0;
-  PyArrayObject *__pyx_v_outMerge = 0;
-  __Pyx_memviewslice __pyx_v_lut = { 0, 0, { 0 }, { 0 }, { 0 } };
-  __Pyx_memviewslice __pyx_v_cdata = { 0, 0, { 0 }, { 0 }, { 0 } };
-  __Pyx_memviewslice __pyx_v_tdata = { 0, 0, { 0 }, { 0 }, { 0 } };
-  __Pyx_memviewslice __pyx_v_cflat = { 0, 0, { 0 }, { 0 }, { 0 } };
-  __Pyx_memviewslice __pyx_v_cdark = { 0, 0, { 0 }, { 0 }, { 0 } };
-  __Pyx_memviewslice __pyx_v_csolidAngle = { 0, 0, { 0 }, { 0 }, { 0 } };
-  __Pyx_memviewslice __pyx_v_cpolarization = { 0, 0, { 0 }, { 0 }, { 0 } };
-  __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
-  PyObject *__pyx_t_1 = NULL;
-  int __pyx_t_2;
-  PyObject *__pyx_t_3 = NULL;
-  PyObject *__pyx_t_4 = NULL;
-  PyObject *__pyx_t_5 = NULL;
-  PyObject *__pyx_t_6 = NULL;
-  PyArrayObject *__pyx_t_7 = NULL;
-  PyArrayObject *__pyx_t_8 = NULL;
-  PyArrayObject *__pyx_t_9 = NULL;
-  __Pyx_memviewslice __pyx_t_10 = { 0, 0, { 0 }, { 0 }, { 0 } };
-  int __pyx_t_11;
-  double __pyx_t_12;
-  __Pyx_memviewslice __pyx_t_13 = { 0, 0, { 0 }, { 0 }, { 0 } };
-  int __pyx_t_14;
-  int __pyx_t_15;
-  int __pyx_t_16;
-  int __pyx_t_17;
-  int __pyx_t_18;
-  int __pyx_t_19;
-  int __pyx_t_20;
-  int __pyx_t_21;
-  int __pyx_t_22;
-  int __pyx_t_23;
-  int __pyx_t_24;
-  int __pyx_t_25;
-  int __pyx_t_26;
-  int __pyx_t_27;
-  int __pyx_t_28;
-  int __pyx_t_29;
-  int __pyx_t_30;
-  int __pyx_t_31;
-  int __pyx_t_32;
-  int __pyx_t_33;
-  int __pyx_t_34;
-  int __pyx_t_35;
-  int __pyx_t_36;
-  int __pyx_t_37;
-  int __pyx_t_38;
-  __pyx_t_5numpy_int32_t __pyx_t_39;
-  int __pyx_t_40;
-  int __pyx_t_41;
-  __pyx_t_5numpy_float32_t __pyx_t_42;
-  int __pyx_t_43;
-  int __pyx_t_44;
-  int __pyx_t_45;
-  int __pyx_lineno = 0;
-  const char *__pyx_filename = NULL;
-  int __pyx_clineno = 0;
-  __Pyx_RefNannySetupContext("integrate", 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;
-
-  /* "splitBBoxLUT.pyx":279
- * 
- *         """
- *         cdef int i=0, j=0, idx=0, bins=self.bins, lut_size=self.lut_size, size=self.size             # <<<<<<<<<<<<<<
- *         cdef double sum_data=0, sum_count=0, epsilon=1e-10
- *         cdef float data=0, coef=0, cdummy=0, cddummy=0
- */
-  __pyx_v_i = 0;
-  __pyx_v_j = 0;
-  __pyx_v_idx = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__bins); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_v_bins = __pyx_t_2;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__lut_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_v_lut_size = __pyx_t_2;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_v_size = __pyx_t_2;
-
-  /* "splitBBoxLUT.pyx":280
- *         """
- *         cdef int i=0, j=0, idx=0, bins=self.bins, lut_size=self.lut_size, size=self.size
- *         cdef double sum_data=0, sum_count=0, epsilon=1e-10             # <<<<<<<<<<<<<<
- *         cdef float data=0, coef=0, cdummy=0, cddummy=0
- *         cdef bint do_dummy=False, do_dark=False, do_flat=False, do_polarization=False, do_solidAngle=False
+    /* "splitBBoxLUT.pyx":231
+ *         lut_nbytes = bins*lut_size*sizeof(lut_point)
+ *         if (os.name == "posix") and ("SC_PAGE_SIZE" in os.sysconf_names) and ("SC_PHYS_PAGES" in os.sysconf_names):
+ *             memsize =  os.sysconf("SC_PAGE_SIZE")*os.sysconf("SC_PHYS_PAGES")             # <<<<<<<<<<<<<<
+ *             if memsize <  lut_nbytes:
+ *                 raise MemoryError("Lookup-table (%i, %i) is %.3fGB whereas the memory of the system is only %s"%(bins,lut_size,lut_nbytes,memsize))
  */
-  __pyx_v_sum_data = 0.0;
-  __pyx_v_sum_count = 0.0;
-  __pyx_v_epsilon = 1e-10;
+    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__sysconf); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_7);
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_1 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_k_tuple_1), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+    __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s__os); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_7);
+    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s__sysconf); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+    __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_7);
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __pyx_t_5 = PyNumber_Multiply(__pyx_t_1, __pyx_t_7); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+    __pyx_v_memsize = __pyx_t_5;
+    __pyx_t_5 = 0;
 
-  /* "splitBBoxLUT.pyx":281
- *         cdef int i=0, j=0, idx=0, bins=self.bins, lut_size=self.lut_size, size=self.size
- *         cdef double sum_data=0, sum_count=0, epsilon=1e-10
- *         cdef float data=0, coef=0, cdummy=0, cddummy=0             # <<<<<<<<<<<<<<
- *         cdef bint do_dummy=False, do_dark=False, do_flat=False, do_polarization=False, do_solidAngle=False
- *         cdef numpy.ndarray[numpy.float64_t, ndim = 1] outData = numpy.zeros(self.bins, dtype=numpy.float64)
+    /* "splitBBoxLUT.pyx":232
+ *         if (os.name == "posix") and ("SC_PAGE_SIZE" in os.sysconf_names) and ("SC_PHYS_PAGES" in os.sysconf_names):
+ *             memsize =  os.sysconf("SC_PAGE_SIZE")*os.sysconf("SC_PHYS_PAGES")
+ *             if memsize <  lut_nbytes:             # <<<<<<<<<<<<<<
+ *                 raise MemoryError("Lookup-table (%i, %i) is %.3fGB whereas the memory of the system is only %s"%(bins,lut_size,lut_nbytes,memsize))
+ *         #else hope we have enough memory
  */
-  __pyx_v_data = 0.0;
-  __pyx_v_coef = 0.0;
-  __pyx_v_cdummy = 0.0;
-  __pyx_v_cddummy = 0.0;
+    __pyx_t_5 = __Pyx_PyInt_FromSize_t(__pyx_v_lut_nbytes); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    __pyx_t_7 = PyObject_RichCompare(__pyx_v_memsize, __pyx_t_5, Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+    if (__pyx_t_16) {
 
-  /* "splitBBoxLUT.pyx":282
- *         cdef double sum_data=0, sum_count=0, epsilon=1e-10
- *         cdef float data=0, coef=0, cdummy=0, cddummy=0
- *         cdef bint do_dummy=False, do_dark=False, do_flat=False, do_polarization=False, do_solidAngle=False             # <<<<<<<<<<<<<<
- *         cdef numpy.ndarray[numpy.float64_t, ndim = 1] outData = numpy.zeros(self.bins, dtype=numpy.float64)
- *         cdef numpy.ndarray[numpy.float64_t, ndim = 1] outCount = numpy.zeros(self.bins, dtype=numpy.float64)
+      /* "splitBBoxLUT.pyx":233
+ *             memsize =  os.sysconf("SC_PAGE_SIZE")*os.sysconf("SC_PHYS_PAGES")
+ *             if memsize <  lut_nbytes:
+ *                 raise MemoryError("Lookup-table (%i, %i) is %.3fGB whereas the memory of the system is only %s"%(bins,lut_size,lut_nbytes,memsize))             # <<<<<<<<<<<<<<
+ *         #else hope we have enough memory
+ *         lut = numpy.recarray(shape=(bins, lut_size),dtype=[("idx",numpy.int32),("coef",numpy.float32)])
  */
-  __pyx_v_do_dummy = 0;
-  __pyx_v_do_dark = 0;
-  __pyx_v_do_flat = 0;
-  __pyx_v_do_polarization = 0;
-  __pyx_v_do_solidAngle = 0;
+      __pyx_t_7 = PyInt_FromLong(__pyx_v_bins); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_7);
+      __pyx_t_5 = PyInt_FromLong(__pyx_v_lut_size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_lut_nbytes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
+      __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_4);
+      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7);
+      __Pyx_GIVEREF(__pyx_t_7);
+      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
+      __Pyx_GIVEREF(__pyx_t_5);
+      PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_1);
+      __Pyx_GIVEREF(__pyx_t_1);
+      __Pyx_INCREF(__pyx_v_memsize);
+      PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_memsize);
+      __Pyx_GIVEREF(__pyx_v_memsize);
+      __pyx_t_7 = 0;
+      __pyx_t_5 = 0;
+      __pyx_t_1 = 0;
+      __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_3), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_4);
+      PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_1));
+      __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
+      __pyx_t_1 = 0;
+      __pyx_t_1 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
+      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
+      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      goto __pyx_L20;
+    }
+    __pyx_L20:;
+    goto __pyx_L19;
+  }
+  __pyx_L19:;
 
-  /* "splitBBoxLUT.pyx":283
- *         cdef float data=0, coef=0, cdummy=0, cddummy=0
- *         cdef bint do_dummy=False, do_dark=False, do_flat=False, do_polarization=False, do_solidAngle=False
- *         cdef numpy.ndarray[numpy.float64_t, ndim = 1] outData = numpy.zeros(self.bins, dtype=numpy.float64)             # <<<<<<<<<<<<<<
- *         cdef numpy.ndarray[numpy.float64_t, ndim = 1] outCount = numpy.zeros(self.bins, dtype=numpy.float64)
- *         cdef numpy.ndarray[numpy.float32_t, ndim = 1] outMerge = numpy.zeros(self.bins, dtype=numpy.float32)
+  /* "splitBBoxLUT.pyx":235
+ *                 raise MemoryError("Lookup-table (%i, %i) is %.3fGB whereas the memory of the system is only %s"%(bins,lut_size,lut_nbytes,memsize))
+ *         #else hope we have enough memory
+ *         lut = numpy.recarray(shape=(bins, lut_size),dtype=[("idx",numpy.int32),("coef",numpy.float32)])             # <<<<<<<<<<<<<<
+ *         memset(&lut[0,0], 0, bins*lut_size*sizeof(lut_point))
+ *         #NOGIL
  */
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__bins); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__recarray); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
-  __Pyx_GIVEREF(__pyx_t_1);
-  __pyx_t_1 = 0;
-  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = PyInt_FromLong(__pyx_v_bins); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__float64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-  __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = PyInt_FromLong(__pyx_v_lut_size); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_7);
+  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-  if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_7 = ((PyArrayObject *)__pyx_t_6);
-  {
-    __Pyx_BufFmt_StackElem __pyx_stack[1];
-    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outData.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__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 = 283; __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];
-    }
-  }
+  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
+  __Pyx_GIVEREF(__pyx_t_5);
+  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_7);
+  __Pyx_GIVEREF(__pyx_t_7);
+  __pyx_t_5 = 0;
   __pyx_t_7 = 0;
-  __pyx_v_outData = ((PyArrayObject *)__pyx_t_6);
-  __pyx_t_6 = 0;
-
-  /* "splitBBoxLUT.pyx":284
- *         cdef bint do_dummy=False, do_dark=False, do_flat=False, do_polarization=False, do_solidAngle=False
- *         cdef numpy.ndarray[numpy.float64_t, ndim = 1] outData = numpy.zeros(self.bins, dtype=numpy.float64)
- *         cdef numpy.ndarray[numpy.float64_t, ndim = 1] outCount = numpy.zeros(self.bins, dtype=numpy.float64)             # <<<<<<<<<<<<<<
- *         cdef numpy.ndarray[numpy.float32_t, ndim = 1] outMerge = numpy.zeros(self.bins, dtype=numpy.float32)
- *         cdef lut_point[:,:] lut = self.lut
- */
-  __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__shape), ((PyObject *)__pyx_t_6)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s__int32); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_7);
   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-  __pyx_t_6 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__bins); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
-  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  PyTuple_SET_ITEM(__pyx_t_4, 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 = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_6));
-  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__float64); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
+  PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_n_s__idx));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx));
+  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_7);
+  __Pyx_GIVEREF(__pyx_t_7);
+  __pyx_t_7 = 0;
+  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_7);
+  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s__float32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+  __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_7);
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__coef));
+  PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_n_s__coef));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__coef));
+  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_5);
+  __Pyx_GIVEREF(__pyx_t_5);
+  __pyx_t_5 = 0;
+  __pyx_t_5 = PyList_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
-  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_8 = ((PyArrayObject *)__pyx_t_5);
+  PyList_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_6));
+  __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
+  PyList_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_t_7));
+  __Pyx_GIVEREF(((PyObject *)__pyx_t_7));
+  __pyx_t_6 = 0;
+  __pyx_t_7 = 0;
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_t_5)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+  __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
+  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_27 = ((PyArrayObject *)__pyx_t_5);
   {
-    __Pyx_BufFmt_StackElem __pyx_stack[1];
-    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outCount.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__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 = 284; __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_BufFmt_StackElem __pyx_stack[2];
+    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lut.rcbuffer->pybuffer);
+    __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lut.rcbuffer->pybuffer, (PyObject*)__pyx_t_27, &__Pyx_TypeInfo_nn_struct___pyx_t_12splitBBoxLUT_lut_point, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
+    if (unlikely(__pyx_t_3 < 0)) {
+      PyErr_Fetch(&__pyx_t_28, &__pyx_t_29, &__pyx_t_30);
+      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lut.rcbuffer->pybuffer, (PyObject*)__pyx_v_lut, &__Pyx_TypeInfo_nn_struct___pyx_t_12splitBBoxLUT_lut_point, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
+        Py_XDECREF(__pyx_t_28); Py_XDECREF(__pyx_t_29); Py_XDECREF(__pyx_t_30);
+        __Pyx_RaiseBufferFallbackError();
+      } else {
+        PyErr_Restore(__pyx_t_28, __pyx_t_29, __pyx_t_30);
+      }
     }
+    __pyx_pybuffernd_lut.diminfo[0].strides = __pyx_pybuffernd_lut.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lut.diminfo[0].shape = __pyx_pybuffernd_lut.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_lut.diminfo[1].strides = __pyx_pybuffernd_lut.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_lut.diminfo[1].shape = __pyx_pybuffernd_lut.rcbuffer->pybuffer.shape[1];
+    if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
-  __pyx_t_8 = 0;
-  __pyx_v_outCount = ((PyArrayObject *)__pyx_t_5);
+  __pyx_t_27 = 0;
+  __pyx_v_lut = ((PyArrayObject *)__pyx_t_5);
   __pyx_t_5 = 0;
 
-  /* "splitBBoxLUT.pyx":285
- *         cdef numpy.ndarray[numpy.float64_t, ndim = 1] outData = numpy.zeros(self.bins, dtype=numpy.float64)
- *         cdef numpy.ndarray[numpy.float64_t, ndim = 1] outCount = numpy.zeros(self.bins, dtype=numpy.float64)
- *         cdef numpy.ndarray[numpy.float32_t, ndim = 1] outMerge = numpy.zeros(self.bins, dtype=numpy.float32)             # <<<<<<<<<<<<<<
- *         cdef lut_point[:,:] lut = self.lut
- *         cdef float[:] cdata, tdata, cflat, cdark, csolidAngle, cpolarization
+  /* "splitBBoxLUT.pyx":236
+ *         #else hope we have enough memory
+ *         lut = numpy.recarray(shape=(bins, lut_size),dtype=[("idx",numpy.int32),("coef",numpy.float32)])
+ *         memset(&lut[0,0], 0, bins*lut_size*sizeof(lut_point))             # <<<<<<<<<<<<<<
+ *         #NOGIL
+ *         with nogil:
+ */
+  __pyx_t_31 = 0;
+  __pyx_t_32 = 0;
+  memset((&(*__Pyx_BufPtrStrided2d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_lut.diminfo[1].strides))), 0, ((__pyx_v_bins * __pyx_v_lut_size) * (sizeof(struct __pyx_t_12splitBBoxLUT_lut_point))));
+
+  /* "splitBBoxLUT.pyx":238
+ *         memset(&lut[0,0], 0, bins*lut_size*sizeof(lut_point))
+ *         #NOGIL
+ *         with nogil:             # <<<<<<<<<<<<<<
+ *             for idx in range(size):
+ *                 if (check_mask) and (cmask[idx]):
  */
-  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__zeros); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__bins); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
-  __Pyx_GIVEREF(__pyx_t_5);
-  __pyx_t_5 = 0;
-  __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __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_4)); __pyx_t_4 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 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 = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_9 = ((PyArrayObject *)__pyx_t_3);
   {
-    __Pyx_BufFmt_StackElem __pyx_stack[1];
-    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outMerge.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
-      __pyx_v_outMerge = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.buf = NULL;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __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_9 = 0;
-  __pyx_v_outMerge = ((PyArrayObject *)__pyx_t_3);
-  __pyx_t_3 = 0;
+      #ifdef WITH_THREAD
+      PyThreadState *_save;
+      Py_UNBLOCK_THREADS
+      #endif
+      /*try:*/ {
 
-  /* "splitBBoxLUT.pyx":286
- *         cdef numpy.ndarray[numpy.float64_t, ndim = 1] outCount = numpy.zeros(self.bins, dtype=numpy.float64)
- *         cdef numpy.ndarray[numpy.float32_t, ndim = 1] outMerge = numpy.zeros(self.bins, dtype=numpy.float32)
- *         cdef lut_point[:,:] lut = self.lut             # <<<<<<<<<<<<<<
- *         cdef float[:] cdata, tdata, cflat, cdark, csolidAngle, cpolarization
+        /* "splitBBoxLUT.pyx":239
+ *         #NOGIL
+ *         with nogil:
+ *             for idx in range(size):             # <<<<<<<<<<<<<<
+ *                 if (check_mask) and (cmask[idx]):
+ *                     continue
+ */
+        __pyx_t_3 = __pyx_v_size;
+        for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_3; __pyx_t_14+=1) {
+          __pyx_v_idx = __pyx_t_14;
+
+          /* "splitBBoxLUT.pyx":240
+ *         with nogil:
+ *             for idx in range(size):
+ *                 if (check_mask) and (cmask[idx]):             # <<<<<<<<<<<<<<
+ *                     continue
  * 
  */
-  __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__lut); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_dsds_nn_struct___pyx_t_12splitBBoxLUT_lut_point(__pyx_t_3);
-  if (unlikely(!__pyx_t_10.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_v_lut = __pyx_t_10;
-  __pyx_t_10.memview = NULL;
-  __pyx_t_10.data = NULL;
+          __pyx_t_16 = __pyx_v_check_mask;
+          if (__pyx_t_16) {
+            if (unlikely(!__pyx_v_cmask.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cmask"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L22;} }
+            __pyx_t_33 = __pyx_v_idx;
+            __pyx_t_11 = ((*((__pyx_t_5numpy_int8_t *) ( /* dim=0 */ (__pyx_v_cmask.data + __pyx_t_33 * __pyx_v_cmask.strides[0]) ))) != 0);
+          } else {
+            __pyx_t_11 = __pyx_t_16;
+          }
+          if (__pyx_t_11) {
 
-  /* "splitBBoxLUT.pyx":289
- *         cdef float[:] cdata, tdata, cflat, cdark, csolidAngle, cpolarization
+            /* "splitBBoxLUT.pyx":241
+ *             for idx in range(size):
+ *                 if (check_mask) and (cmask[idx]):
+ *                     continue             # <<<<<<<<<<<<<<
  * 
- *         assert size == weights.size             # <<<<<<<<<<<<<<
+ *                 min0 = cpos0_inf[idx]
+ */
+            goto __pyx_L24_continue;
+            goto __pyx_L26;
+          }
+          __pyx_L26:;
+
+          /* "splitBBoxLUT.pyx":243
+ *                     continue
+ * 
+ *                 min0 = cpos0_inf[idx]             # <<<<<<<<<<<<<<
+ *                 max0 = cpos0_sup[idx]
  * 
- *         if dummy is not None:
  */
-  #ifndef CYTHON_WITHOUT_ASSERTIONS
-  __pyx_t_3 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_5 = PyObject_GetAttr(__pyx_v_weights, __pyx_n_s__size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (unlikely(!__pyx_t_11)) {
-    PyErr_SetNone(PyExc_AssertionError);
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  }
-  #endif
+          __pyx_t_34 = __pyx_v_idx;
+          __pyx_v_min0 = (*((float *) ( /* dim=0 */ (__pyx_v_cpos0_inf.data + __pyx_t_34 * __pyx_v_cpos0_inf.strides[0]) )));
 
-  /* "splitBBoxLUT.pyx":291
- *         assert size == weights.size
+          /* "splitBBoxLUT.pyx":244
  * 
- *         if dummy is not None:             # <<<<<<<<<<<<<<
- *             do_dummy = True
- *             cdummy =  <float>float(dummy)
+ *                 min0 = cpos0_inf[idx]
+ *                 max0 = cpos0_sup[idx]             # <<<<<<<<<<<<<<
+ * 
+ *                 if check_pos1 and ((cpos1_max[idx] < pos1_min) or (cpos1_min[idx] > pos1_max)):
  */
-  __pyx_t_11 = (__pyx_v_dummy != Py_None);
-  if (__pyx_t_11) {
+          __pyx_t_35 = __pyx_v_idx;
+          __pyx_v_max0 = (*((float *) ( /* dim=0 */ (__pyx_v_cpos0_sup.data + __pyx_t_35 * __pyx_v_cpos0_sup.strides[0]) )));
 
-    /* "splitBBoxLUT.pyx":292
+          /* "splitBBoxLUT.pyx":246
+ *                 max0 = cpos0_sup[idx]
+ * 
+ *                 if check_pos1 and ((cpos1_max[idx] < pos1_min) or (cpos1_min[idx] > pos1_max)):             # <<<<<<<<<<<<<<
+ *                         continue
  * 
- *         if dummy is not None:
- *             do_dummy = True             # <<<<<<<<<<<<<<
- *             cdummy =  <float>float(dummy)
- *             if delta_dummy is None:
  */
-    __pyx_v_do_dummy = 1;
+          if ((__pyx_v_check_pos1 != 0)) {
+            if (unlikely(!__pyx_v_cpos1_max.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cpos1_max"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L22;} }
+            __pyx_t_36 = __pyx_v_idx;
+            __pyx_t_11 = (((*((float *) ( /* dim=0 */ (__pyx_v_cpos1_max.data + __pyx_t_36 * __pyx_v_cpos1_max.strides[0]) ))) < __pyx_v_pos1_min) != 0);
+            if (!__pyx_t_11) {
+              if (unlikely(!__pyx_v_cpos1_min.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cpos1_min"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L22;} }
+              __pyx_t_37 = __pyx_v_idx;
+              __pyx_t_16 = (((*((float *) ( /* dim=0 */ (__pyx_v_cpos1_min.data + __pyx_t_37 * __pyx_v_cpos1_min.strides[0]) ))) > __pyx_v_pos1_max) != 0);
+              __pyx_t_26 = __pyx_t_16;
+            } else {
+              __pyx_t_26 = __pyx_t_11;
+            }
+            __pyx_t_11 = __pyx_t_26;
+          } else {
+            __pyx_t_11 = (__pyx_v_check_pos1 != 0);
+          }
+          if (__pyx_t_11) {
 
-    /* "splitBBoxLUT.pyx":293
- *         if dummy is not None:
- *             do_dummy = True
- *             cdummy =  <float>float(dummy)             # <<<<<<<<<<<<<<
- *             if delta_dummy is None:
- *                 cddummy = <float>0.0
+            /* "splitBBoxLUT.pyx":247
+ * 
+ *                 if check_pos1 and ((cpos1_max[idx] < pos1_min) or (cpos1_min[idx] > pos1_max)):
+ *                         continue             # <<<<<<<<<<<<<<
+ * 
+ *                 fbin0_min = getBinNr(min0, pos0_min, delta)
  */
-    __pyx_t_12 = __Pyx_PyObject_AsDouble(__pyx_v_dummy); if (unlikely(__pyx_t_12 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_v_cdummy = ((float)__pyx_t_12);
+            goto __pyx_L24_continue;
+            goto __pyx_L27;
+          }
+          __pyx_L27:;
 
-    /* "splitBBoxLUT.pyx":294
- *             do_dummy = True
- *             cdummy =  <float>float(dummy)
- *             if delta_dummy is None:             # <<<<<<<<<<<<<<
- *                 cddummy = <float>0.0
- *             else:
+          /* "splitBBoxLUT.pyx":249
+ *                         continue
+ * 
+ *                 fbin0_min = getBinNr(min0, pos0_min, delta)             # <<<<<<<<<<<<<<
+ *                 fbin0_max = getBinNr(max0, pos0_min, delta)
+ *                 bin0_min = < int > fbin0_min
  */
-    __pyx_t_11 = (__pyx_v_delta_dummy == Py_None);
-    if (__pyx_t_11) {
+          __pyx_v_fbin0_min = __pyx_f_12splitBBoxLUT_getBinNr(__pyx_v_min0, __pyx_v_pos0_min, __pyx_v_delta);
 
-      /* "splitBBoxLUT.pyx":295
- *             cdummy =  <float>float(dummy)
- *             if delta_dummy is None:
- *                 cddummy = <float>0.0             # <<<<<<<<<<<<<<
- *             else:
- *                 cddummy = <float>float(delta_dummy)
+          /* "splitBBoxLUT.pyx":250
+ * 
+ *                 fbin0_min = getBinNr(min0, pos0_min, delta)
+ *                 fbin0_max = getBinNr(max0, pos0_min, delta)             # <<<<<<<<<<<<<<
+ *                 bin0_min = < int > fbin0_min
+ *                 bin0_max = < int > fbin0_max
  */
-      __pyx_v_cddummy = ((float)0.0);
-      goto __pyx_L4;
-    }
-    /*else*/ {
+          __pyx_v_fbin0_max = __pyx_f_12splitBBoxLUT_getBinNr(__pyx_v_max0, __pyx_v_pos0_min, __pyx_v_delta);
 
-      /* "splitBBoxLUT.pyx":297
- *                 cddummy = <float>0.0
- *             else:
- *                 cddummy = <float>float(delta_dummy)             # <<<<<<<<<<<<<<
+          /* "splitBBoxLUT.pyx":251
+ *                 fbin0_min = getBinNr(min0, pos0_min, delta)
+ *                 fbin0_max = getBinNr(max0, pos0_min, delta)
+ *                 bin0_min = < int > fbin0_min             # <<<<<<<<<<<<<<
+ *                 bin0_max = < int > fbin0_max
  * 
- *         if flat is not None:
  */
-      __pyx_t_12 = __Pyx_PyObject_AsDouble(__pyx_v_delta_dummy); if (unlikely(__pyx_t_12 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_v_cddummy = ((float)__pyx_t_12);
-    }
-    __pyx_L4:;
-    goto __pyx_L3;
-  }
-  __pyx_L3:;
+          __pyx_v_bin0_min = ((int)__pyx_v_fbin0_min);
 
-  /* "splitBBoxLUT.pyx":299
- *                 cddummy = <float>float(delta_dummy)
+          /* "splitBBoxLUT.pyx":252
+ *                 fbin0_max = getBinNr(max0, pos0_min, delta)
+ *                 bin0_min = < int > fbin0_min
+ *                 bin0_max = < int > fbin0_max             # <<<<<<<<<<<<<<
  * 
- *         if flat is not None:             # <<<<<<<<<<<<<<
- *             do_flat = True
- *             assert flat.size == size
+ *                 if (bin0_max < 0) or (bin0_min >= bins):
  */
-  __pyx_t_11 = (__pyx_v_flat != Py_None);
-  if (__pyx_t_11) {
+          __pyx_v_bin0_max = ((int)__pyx_v_fbin0_max);
 
-    /* "splitBBoxLUT.pyx":300
+          /* "splitBBoxLUT.pyx":254
+ *                 bin0_max = < int > fbin0_max
  * 
- *         if flat is not None:
- *             do_flat = True             # <<<<<<<<<<<<<<
- *             assert flat.size == size
- *             cflat = numpy.ascontiguousarray(flat.ravel(), dtype=numpy.float32)
+ *                 if (bin0_max < 0) or (bin0_min >= bins):             # <<<<<<<<<<<<<<
+ *                     continue
+ *                 if bin0_max >= bins :
  */
-    __pyx_v_do_flat = 1;
+          __pyx_t_11 = ((__pyx_v_bin0_max < 0) != 0);
+          if (!__pyx_t_11) {
+            __pyx_t_26 = ((__pyx_v_bin0_min >= __pyx_v_bins) != 0);
+            __pyx_t_16 = __pyx_t_26;
+          } else {
+            __pyx_t_16 = __pyx_t_11;
+          }
+          if (__pyx_t_16) {
 
-    /* "splitBBoxLUT.pyx":301
- *         if flat is not None:
- *             do_flat = True
- *             assert flat.size == size             # <<<<<<<<<<<<<<
- *             cflat = numpy.ascontiguousarray(flat.ravel(), dtype=numpy.float32)
- *         if dark is not None:
+            /* "splitBBoxLUT.pyx":255
+ * 
+ *                 if (bin0_max < 0) or (bin0_min >= bins):
+ *                     continue             # <<<<<<<<<<<<<<
+ *                 if bin0_max >= bins :
+ *                     bin0_max = bins - 1
  */
-    #ifndef CYTHON_WITHOUT_ASSERTIONS
-    __pyx_t_4 = PyObject_GetAttr(__pyx_v_flat, __pyx_n_s__size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_5 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    if (unlikely(!__pyx_t_11)) {
-      PyErr_SetNone(PyExc_AssertionError);
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    }
-    #endif
+            goto __pyx_L24_continue;
+            goto __pyx_L28;
+          }
+          __pyx_L28:;
 
-    /* "splitBBoxLUT.pyx":302
- *             do_flat = True
- *             assert flat.size == size
- *             cflat = numpy.ascontiguousarray(flat.ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
- *         if dark is not None:
- *             do_dark = True
+          /* "splitBBoxLUT.pyx":256
+ *                 if (bin0_max < 0) or (bin0_min >= bins):
+ *                     continue
+ *                 if bin0_max >= bins :             # <<<<<<<<<<<<<<
+ *                     bin0_max = bins - 1
+ *                 if  bin0_min < 0:
  */
-    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_3 = PyObject_GetAttr(__pyx_v_flat, __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __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 = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
-    __Pyx_GIVEREF(__pyx_t_4);
-    __pyx_t_4 = 0;
-    __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-    __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_1 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__float32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-    __pyx_t_13 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_1);
-    if (unlikely(!__pyx_t_13.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_v_cflat = __pyx_t_13;
-    __pyx_t_13.memview = NULL;
-    __pyx_t_13.data = NULL;
-    goto __pyx_L5;
-  }
-  __pyx_L5:;
+          __pyx_t_16 = ((__pyx_v_bin0_max >= __pyx_v_bins) != 0);
+          if (__pyx_t_16) {
 
-  /* "splitBBoxLUT.pyx":303
- *             assert flat.size == size
- *             cflat = numpy.ascontiguousarray(flat.ravel(), dtype=numpy.float32)
- *         if dark is not None:             # <<<<<<<<<<<<<<
- *             do_dark = True
- *             assert dark.size == size
+            /* "splitBBoxLUT.pyx":257
+ *                     continue
+ *                 if bin0_max >= bins :
+ *                     bin0_max = bins - 1             # <<<<<<<<<<<<<<
+ *                 if  bin0_min < 0:
+ *                     bin0_min = 0
  */
-  __pyx_t_11 = (__pyx_v_dark != Py_None);
-  if (__pyx_t_11) {
+            __pyx_v_bin0_max = (__pyx_v_bins - 1);
+            goto __pyx_L29;
+          }
+          __pyx_L29:;
 
-    /* "splitBBoxLUT.pyx":304
- *             cflat = numpy.ascontiguousarray(flat.ravel(), dtype=numpy.float32)
- *         if dark is not None:
- *             do_dark = True             # <<<<<<<<<<<<<<
- *             assert dark.size == size
- *             cdark = numpy.ascontiguousarray(dark.ravel(), dtype=numpy.float32)
+          /* "splitBBoxLUT.pyx":258
+ *                 if bin0_max >= bins :
+ *                     bin0_max = bins - 1
+ *                 if  bin0_min < 0:             # <<<<<<<<<<<<<<
+ *                     bin0_min = 0
+ * 
  */
-    __pyx_v_do_dark = 1;
+          __pyx_t_16 = ((__pyx_v_bin0_min < 0) != 0);
+          if (__pyx_t_16) {
 
-    /* "splitBBoxLUT.pyx":305
- *         if dark is not None:
- *             do_dark = True
- *             assert dark.size == size             # <<<<<<<<<<<<<<
- *             cdark = numpy.ascontiguousarray(dark.ravel(), dtype=numpy.float32)
- *         if solidAngle is not None:
+            /* "splitBBoxLUT.pyx":259
+ *                     bin0_max = bins - 1
+ *                 if  bin0_min < 0:
+ *                     bin0_min = 0             # <<<<<<<<<<<<<<
+ * 
+ *                 if bin0_min == bin0_max:
  */
-    #ifndef CYTHON_WITHOUT_ASSERTIONS
-    __pyx_t_1 = PyObject_GetAttr(__pyx_v_dark, __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_4 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    if (unlikely(!__pyx_t_11)) {
-      PyErr_SetNone(PyExc_AssertionError);
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    }
-    #endif
+            __pyx_v_bin0_min = 0;
+            goto __pyx_L30;
+          }
+          __pyx_L30:;
 
-    /* "splitBBoxLUT.pyx":306
- *             do_dark = True
- *             assert dark.size == size
- *             cdark = numpy.ascontiguousarray(dark.ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
- *         if solidAngle is not None:
- *             do_solidAngle = True
+          /* "splitBBoxLUT.pyx":261
+ *                     bin0_min = 0
+ * 
+ *                 if bin0_min == bin0_max:             # <<<<<<<<<<<<<<
+ *                     #All pixel is within a single bin
+ *                     k = outMax[bin0_min]
  */
-    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_3 = PyObject_GetAttr(__pyx_v_dark, __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __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 = 306; __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 = 306; __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 = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-    __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__float32); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-    __pyx_t_13 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_6);
-    if (unlikely(!__pyx_t_13.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_v_cdark = __pyx_t_13;
-    __pyx_t_13.memview = NULL;
-    __pyx_t_13.data = NULL;
-    goto __pyx_L6;
-  }
-  __pyx_L6:;
+          __pyx_t_16 = ((__pyx_v_bin0_min == __pyx_v_bin0_max) != 0);
+          if (__pyx_t_16) {
 
-  /* "splitBBoxLUT.pyx":307
- *             assert dark.size == size
- *             cdark = numpy.ascontiguousarray(dark.ravel(), dtype=numpy.float32)
- *         if solidAngle is not None:             # <<<<<<<<<<<<<<
- *             do_solidAngle = True
- *             assert solidAngle.size == size
+            /* "splitBBoxLUT.pyx":263
+ *                 if bin0_min == bin0_max:
+ *                     #All pixel is within a single bin
+ *                     k = outMax[bin0_min]             # <<<<<<<<<<<<<<
+ *                     lut[bin0_min, k].idx = idx
+ *                     lut[bin0_min, k].coef = 1.0
  */
-  __pyx_t_11 = (__pyx_v_solidAngle != Py_None);
-  if (__pyx_t_11) {
+            __pyx_t_24 = __pyx_v_bin0_min;
+            __pyx_v_k = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_outMax.diminfo[0].strides));
 
-    /* "splitBBoxLUT.pyx":308
- *             cdark = numpy.ascontiguousarray(dark.ravel(), dtype=numpy.float32)
- *         if solidAngle is not None:
- *             do_solidAngle = True             # <<<<<<<<<<<<<<
- *             assert solidAngle.size == size
- *             csolidAngle = numpy.ascontiguousarray(solidAngle.ravel(), dtype=numpy.float32)
+            /* "splitBBoxLUT.pyx":264
+ *                     #All pixel is within a single bin
+ *                     k = outMax[bin0_min]
+ *                     lut[bin0_min, k].idx = idx             # <<<<<<<<<<<<<<
+ *                     lut[bin0_min, k].coef = 1.0
+ *                     outMax[bin0_min] = k + 1
  */
-    __pyx_v_do_solidAngle = 1;
+            __pyx_t_38 = __pyx_v_bin0_min;
+            __pyx_t_39 = __pyx_v_k;
+            (*__Pyx_BufPtrStrided2d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_39, __pyx_pybuffernd_lut.diminfo[1].strides)).idx = __pyx_v_idx;
 
-    /* "splitBBoxLUT.pyx":309
- *         if solidAngle is not None:
- *             do_solidAngle = True
- *             assert solidAngle.size == size             # <<<<<<<<<<<<<<
- *             csolidAngle = numpy.ascontiguousarray(solidAngle.ravel(), dtype=numpy.float32)
- *         if polarization is not None:
+            /* "splitBBoxLUT.pyx":265
+ *                     k = outMax[bin0_min]
+ *                     lut[bin0_min, k].idx = idx
+ *                     lut[bin0_min, k].coef = 1.0             # <<<<<<<<<<<<<<
+ *                     outMax[bin0_min] = k + 1
+ *                 else: #we have pixel splitting.
  */
-    #ifndef CYTHON_WITHOUT_ASSERTIONS
-    __pyx_t_6 = PyObject_GetAttr(__pyx_v_solidAngle, __pyx_n_s__size); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_1 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_3 = PyObject_RichCompare(__pyx_t_6, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    if (unlikely(!__pyx_t_11)) {
-      PyErr_SetNone(PyExc_AssertionError);
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    }
-    #endif
+            __pyx_t_40 = __pyx_v_bin0_min;
+            __pyx_t_41 = __pyx_v_k;
+            (*__Pyx_BufPtrStrided2d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_41, __pyx_pybuffernd_lut.diminfo[1].strides)).coef = 1.0;
 
-    /* "splitBBoxLUT.pyx":310
- *             do_solidAngle = True
- *             assert solidAngle.size == size
- *             csolidAngle = numpy.ascontiguousarray(solidAngle.ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
- *         if polarization is not None:
- *             do_polarization = True
+            /* "splitBBoxLUT.pyx":266
+ *                     lut[bin0_min, k].idx = idx
+ *                     lut[bin0_min, k].coef = 1.0
+ *                     outMax[bin0_min] = k + 1             # <<<<<<<<<<<<<<
+ *                 else: #we have pixel splitting.
+ *                     deltaA = 1.0 / (fbin0_max - fbin0_min)
  */
-    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_3 = PyObject_GetAttr(__pyx_v_solidAngle, __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
-    __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 = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    PyTuple_SET_ITEM(__pyx_t_3, 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 = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
-    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__float32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
-    __pyx_t_13 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_5);
-    if (unlikely(!__pyx_t_13.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_v_csolidAngle = __pyx_t_13;
-    __pyx_t_13.memview = NULL;
-    __pyx_t_13.data = NULL;
-    goto __pyx_L7;
-  }
-  __pyx_L7:;
+            __pyx_t_42 = __pyx_v_bin0_min;
+            *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_outMax.diminfo[0].strides) = (__pyx_v_k + 1);
+            goto __pyx_L31;
+          }
+          /*else*/ {
 
-  /* "splitBBoxLUT.pyx":311
- *             assert solidAngle.size == size
- *             csolidAngle = numpy.ascontiguousarray(solidAngle.ravel(), dtype=numpy.float32)
- *         if polarization is not None:             # <<<<<<<<<<<<<<
- *             do_polarization = True
- *             assert polarization.size == size
+            /* "splitBBoxLUT.pyx":268
+ *                     outMax[bin0_min] = k + 1
+ *                 else: #we have pixel splitting.
+ *                     deltaA = 1.0 / (fbin0_max - fbin0_min)             # <<<<<<<<<<<<<<
+ * 
+ *                     deltaL = (bin0_min + 1) - fbin0_min
  */
-  __pyx_t_11 = (__pyx_v_polarization != Py_None);
-  if (__pyx_t_11) {
+            __pyx_v_deltaA = (1.0 / (__pyx_v_fbin0_max - __pyx_v_fbin0_min));
 
-    /* "splitBBoxLUT.pyx":312
- *             csolidAngle = numpy.ascontiguousarray(solidAngle.ravel(), dtype=numpy.float32)
- *         if polarization is not None:
- *             do_polarization = True             # <<<<<<<<<<<<<<
- *             assert polarization.size == size
- *             cpolarization = numpy.ascontiguousarray(polarization.ravel(), dtype=numpy.float32)
+            /* "splitBBoxLUT.pyx":270
+ *                     deltaA = 1.0 / (fbin0_max - fbin0_min)
+ * 
+ *                     deltaL = (bin0_min + 1) - fbin0_min             # <<<<<<<<<<<<<<
+ *                     deltaR = fbin0_max - (bin0_max)
+ * 
  */
-    __pyx_v_do_polarization = 1;
+            __pyx_v_deltaL = ((__pyx_v_bin0_min + 1) - __pyx_v_fbin0_min);
 
-    /* "splitBBoxLUT.pyx":313
- *         if polarization is not None:
- *             do_polarization = True
- *             assert polarization.size == size             # <<<<<<<<<<<<<<
- *             cpolarization = numpy.ascontiguousarray(polarization.ravel(), dtype=numpy.float32)
+            /* "splitBBoxLUT.pyx":271
+ * 
+ *                     deltaL = (bin0_min + 1) - fbin0_min
+ *                     deltaR = fbin0_max - (bin0_max)             # <<<<<<<<<<<<<<
  * 
+ *                     k = outMax[bin0_min]
  */
-    #ifndef CYTHON_WITHOUT_ASSERTIONS
-    __pyx_t_5 = PyObject_GetAttr(__pyx_v_polarization, __pyx_n_s__size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_6 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    if (unlikely(!__pyx_t_11)) {
-      PyErr_SetNone(PyExc_AssertionError);
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    }
-    #endif
+            __pyx_v_deltaR = (__pyx_v_fbin0_max - __pyx_v_bin0_max);
 
-    /* "splitBBoxLUT.pyx":314
- *             do_polarization = True
- *             assert polarization.size == size
- *             cpolarization = numpy.ascontiguousarray(polarization.ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
+            /* "splitBBoxLUT.pyx":273
+ *                     deltaR = fbin0_max - (bin0_max)
  * 
- *         if (do_dark + do_flat + do_polarization + do_solidAngle):
+ *                     k = outMax[bin0_min]             # <<<<<<<<<<<<<<
+ *                     lut[bin0_min, k].idx = idx
+ *                     lut[bin0_min, k].coef = (deltaA * deltaL)
  */
-    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_6 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_3 = PyObject_GetAttr(__pyx_v_polarization, __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __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 = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
-    __Pyx_GIVEREF(__pyx_t_5);
-    __pyx_t_5 = 0;
-    __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
-    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_4 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
-    __pyx_t_13 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_4);
-    if (unlikely(!__pyx_t_13.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_v_cpolarization = __pyx_t_13;
-    __pyx_t_13.memview = NULL;
-    __pyx_t_13.data = NULL;
-    goto __pyx_L8;
-  }
-  __pyx_L8:;
+            __pyx_t_43 = __pyx_v_bin0_min;
+            __pyx_v_k = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_43, __pyx_pybuffernd_outMax.diminfo[0].strides));
 
-  /* "splitBBoxLUT.pyx":316
- *             cpolarization = numpy.ascontiguousarray(polarization.ravel(), dtype=numpy.float32)
+            /* "splitBBoxLUT.pyx":274
  * 
- *         if (do_dark + do_flat + do_polarization + do_solidAngle):             # <<<<<<<<<<<<<<
- *             tdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)
- *             cdata = numpy.zeros(size,dtype=numpy.float32)
+ *                     k = outMax[bin0_min]
+ *                     lut[bin0_min, k].idx = idx             # <<<<<<<<<<<<<<
+ *                     lut[bin0_min, k].coef = (deltaA * deltaL)
+ *                     outMax[bin0_min] = k + 1
  */
-  __pyx_t_2 = (((__pyx_v_do_dark + __pyx_v_do_flat) + __pyx_v_do_polarization) + __pyx_v_do_solidAngle);
-  if (__pyx_t_2) {
+            __pyx_t_44 = __pyx_v_bin0_min;
+            __pyx_t_45 = __pyx_v_k;
+            (*__Pyx_BufPtrStrided2d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_45, __pyx_pybuffernd_lut.diminfo[1].strides)).idx = __pyx_v_idx;
 
-    /* "splitBBoxLUT.pyx":317
+            /* "splitBBoxLUT.pyx":275
+ *                     k = outMax[bin0_min]
+ *                     lut[bin0_min, k].idx = idx
+ *                     lut[bin0_min, k].coef = (deltaA * deltaL)             # <<<<<<<<<<<<<<
+ *                     outMax[bin0_min] = k + 1
  * 
- *         if (do_dark + do_flat + do_polarization + do_solidAngle):
- *             tdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
- *             cdata = numpy.zeros(size,dtype=numpy.float32)
- *             if do_dummy:
  */
-    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_4 = PyObject_GetAttr(__pyx_v_weights, __pyx_n_s__ravel); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
-    __Pyx_GIVEREF(__pyx_t_3);
-    __pyx_t_3 = 0;
-    __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-    __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_1 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__float32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-    __pyx_t_13 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_1);
-    if (unlikely(!__pyx_t_13.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_v_tdata = __pyx_t_13;
-    __pyx_t_13.memview = NULL;
-    __pyx_t_13.data = NULL;
+            __pyx_t_46 = __pyx_v_bin0_min;
+            __pyx_t_47 = __pyx_v_k;
+            (*__Pyx_BufPtrStrided2d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_46, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_47, __pyx_pybuffernd_lut.diminfo[1].strides)).coef = (__pyx_v_deltaA * __pyx_v_deltaL);
 
-    /* "splitBBoxLUT.pyx":318
- *         if (do_dark + do_flat + do_polarization + do_solidAngle):
- *             tdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)
- *             cdata = numpy.zeros(size,dtype=numpy.float32)             # <<<<<<<<<<<<<<
- *             if do_dummy:
- *                 for i in prange(size, nogil=True, schedule="static"):
+            /* "splitBBoxLUT.pyx":276
+ *                     lut[bin0_min, k].idx = idx
+ *                     lut[bin0_min, k].coef = (deltaA * deltaL)
+ *                     outMax[bin0_min] = k + 1             # <<<<<<<<<<<<<<
+ * 
+ *                     k = outMax[bin0_max]
  */
-    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_1 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
-    __Pyx_GIVEREF(__pyx_t_1);
-    __pyx_t_1 = 0;
-    __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-    __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__float32); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-    __pyx_t_13 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_6);
-    if (unlikely(!__pyx_t_13.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_v_cdata = __pyx_t_13;
-    __pyx_t_13.memview = NULL;
-    __pyx_t_13.data = NULL;
+            __pyx_t_48 = __pyx_v_bin0_min;
+            *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_48, __pyx_pybuffernd_outMax.diminfo[0].strides) = (__pyx_v_k + 1);
 
-    /* "splitBBoxLUT.pyx":319
- *             tdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)
- *             cdata = numpy.zeros(size,dtype=numpy.float32)
- *             if do_dummy:             # <<<<<<<<<<<<<<
- *                 for i in prange(size, nogil=True, schedule="static"):
- *                     data = tdata[i]
+            /* "splitBBoxLUT.pyx":278
+ *                     outMax[bin0_min] = k + 1
+ * 
+ *                     k = outMax[bin0_max]             # <<<<<<<<<<<<<<
+ *                     lut[bin0_max, k].idx = idx
+ *                     lut[bin0_max, k].coef = (deltaA * deltaR)
  */
-    if (__pyx_v_do_dummy) {
+            __pyx_t_49 = __pyx_v_bin0_max;
+            __pyx_v_k = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_49, __pyx_pybuffernd_outMax.diminfo[0].strides));
 
-      /* "splitBBoxLUT.pyx":320
- *             cdata = numpy.zeros(size,dtype=numpy.float32)
- *             if do_dummy:
- *                 for i in prange(size, nogil=True, schedule="static"):             # <<<<<<<<<<<<<<
- *                     data = tdata[i]
- *                     if ((cddummy!=0) and (fabs(data-cdummy) > cddummy)) or ((cddummy==0) and (data!=cdummy)):
+            /* "splitBBoxLUT.pyx":279
+ * 
+ *                     k = outMax[bin0_max]
+ *                     lut[bin0_max, k].idx = idx             # <<<<<<<<<<<<<<
+ *                     lut[bin0_max, k].coef = (deltaA * deltaR)
+ *                     outMax[bin0_max] = k + 1
  */
-      {
-          #ifdef WITH_THREAD
-          PyThreadState *_save = NULL;
-          #endif
-          Py_UNBLOCK_THREADS
-          /*try:*/ {
-            __pyx_t_2 = __pyx_v_size;
-            if (1 == 0) abort();
-            {
-                float __pyx_parallel_temp0 = __PYX_NAN;
-                int __pyx_parallel_temp1 = 0xbad0bad0;
-                const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0;
-                PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL;
-                int __pyx_parallel_why;
-                __pyx_parallel_why = 0;
-                #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_15 = (__pyx_t_2 - 0) / 1;
-                if (__pyx_t_15 > 0)
-                {
-                    #ifdef _OPENMP
-                    #pragma omp parallel private(__pyx_t_18, __pyx_t_23, __pyx_t_17, __pyx_t_20, __pyx_t_24, __pyx_t_16, __pyx_t_11, __pyx_t_21, __pyx_t_25, __pyx_t_19, __pyx_t_22) private(__pyx_filename, __pyx_lineno, __pyx_clineno) shared(__pyx_parallel_why, __pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb)
-                    #endif /* _OPENMP */
-                    {
-                        #ifdef _OPENMP
-                        #ifdef WITH_THREAD
-                        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
-                        #endif
-                        Py_BEGIN_ALLOW_THREADS
-                        #endif /* _OPENMP */
-                        #ifdef _OPENMP
-                        #pragma omp for lastprivate(__pyx_v_data) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) schedule(static)
-                        #endif /* _OPENMP */
-                        for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_15; __pyx_t_14++){
-                            if (__pyx_parallel_why < 2)
-                            {
-                                __pyx_v_i = 0 + 1 * __pyx_t_14;
-                                /* Initialize private variables to invalid values */
-                                __pyx_v_data = ((float)__PYX_NAN);
+            __pyx_t_50 = __pyx_v_bin0_max;
+            __pyx_t_51 = __pyx_v_k;
+            (*__Pyx_BufPtrStrided2d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_50, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_51, __pyx_pybuffernd_lut.diminfo[1].strides)).idx = __pyx_v_idx;
 
-                                /* "splitBBoxLUT.pyx":321
- *             if do_dummy:
- *                 for i in prange(size, nogil=True, schedule="static"):
- *                     data = tdata[i]             # <<<<<<<<<<<<<<
- *                     if ((cddummy!=0) and (fabs(data-cdummy) > cddummy)) or ((cddummy==0) and (data!=cdummy)):
- *                         #Nota: -= and /= operatore are seen as reduction in cython parallel.
+            /* "splitBBoxLUT.pyx":280
+ *                     k = outMax[bin0_max]
+ *                     lut[bin0_max, k].idx = idx
+ *                     lut[bin0_max, k].coef = (deltaA * deltaR)             # <<<<<<<<<<<<<<
+ *                     outMax[bin0_max] = k + 1
+ * 
  */
-                                __pyx_t_16 = __pyx_v_i;
-                                __pyx_v_data = (*((float *) ( /* dim=0 */ (__pyx_v_tdata.data + __pyx_t_16 * __pyx_v_tdata.strides[0]) )));
+            __pyx_t_52 = __pyx_v_bin0_max;
+            __pyx_t_53 = __pyx_v_k;
+            (*__Pyx_BufPtrStrided2d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_52, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_53, __pyx_pybuffernd_lut.diminfo[1].strides)).coef = (__pyx_v_deltaA * __pyx_v_deltaR);
 
-                                /* "splitBBoxLUT.pyx":322
- *                 for i in prange(size, nogil=True, schedule="static"):
- *                     data = tdata[i]
- *                     if ((cddummy!=0) and (fabs(data-cdummy) > cddummy)) or ((cddummy==0) and (data!=cdummy)):             # <<<<<<<<<<<<<<
- *                         #Nota: -= and /= operatore are seen as reduction in cython parallel.
- *                         if do_dark:
+            /* "splitBBoxLUT.pyx":281
+ *                     lut[bin0_max, k].idx = idx
+ *                     lut[bin0_max, k].coef = (deltaA * deltaR)
+ *                     outMax[bin0_max] = k + 1             # <<<<<<<<<<<<<<
+ * 
+ *                     if bin0_min + 1 < bin0_max:
  */
-                                __pyx_t_11 = (__pyx_v_cddummy != 0.0);
-                                if (__pyx_t_11) {
-                                  __pyx_t_17 = (fabs((__pyx_v_data - __pyx_v_cdummy)) > __pyx_v_cddummy);
-                                  __pyx_t_18 = __pyx_t_17;
-                                } else {
-                                  __pyx_t_18 = __pyx_t_11;
-                                }
-                                if (!__pyx_t_18) {
-                                  __pyx_t_11 = (__pyx_v_cddummy == 0.0);
-                                  if (__pyx_t_11) {
-                                    __pyx_t_17 = (__pyx_v_data != __pyx_v_cdummy);
-                                    __pyx_t_19 = __pyx_t_17;
-                                  } else {
-                                    __pyx_t_19 = __pyx_t_11;
-                                  }
-                                  __pyx_t_11 = __pyx_t_19;
-                                } else {
-                                  __pyx_t_11 = __pyx_t_18;
-                                }
-                                if (__pyx_t_11) {
+            __pyx_t_54 = __pyx_v_bin0_max;
+            *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_54, __pyx_pybuffernd_outMax.diminfo[0].strides) = (__pyx_v_k + 1);
 
-                                  /* "splitBBoxLUT.pyx":324
- *                     if ((cddummy!=0) and (fabs(data-cdummy) > cddummy)) or ((cddummy==0) and (data!=cdummy)):
- *                         #Nota: -= and /= operatore are seen as reduction in cython parallel.
- *                         if do_dark:             # <<<<<<<<<<<<<<
- *                             data = data - cdark[i]
- *                         if do_flat:
+            /* "splitBBoxLUT.pyx":283
+ *                     outMax[bin0_max] = k + 1
+ * 
+ *                     if bin0_min + 1 < bin0_max:             # <<<<<<<<<<<<<<
+ *                         for i in range(bin0_min + 1, bin0_max):
+ *                             k = outMax[i]
  */
-                                  if (__pyx_v_do_dark) {
+            __pyx_t_16 = (((__pyx_v_bin0_min + 1) < __pyx_v_bin0_max) != 0);
+            if (__pyx_t_16) {
 
-                                    /* "splitBBoxLUT.pyx":325
- *                         #Nota: -= and /= operatore are seen as reduction in cython parallel.
- *                         if do_dark:
- *                             data = data - cdark[i]             # <<<<<<<<<<<<<<
- *                         if do_flat:
- *                             data = data / cflat[i]
+              /* "splitBBoxLUT.pyx":284
+ * 
+ *                     if bin0_min + 1 < bin0_max:
+ *                         for i in range(bin0_min + 1, bin0_max):             # <<<<<<<<<<<<<<
+ *                             k = outMax[i]
+ *                             lut[i, k].idx = idx
  */
-                                    if (unlikely(!__pyx_v_cdark.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cdark"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L16_error;} }
-                                    __pyx_t_20 = __pyx_v_i;
-                                    __pyx_v_data = (__pyx_v_data - (*((float *) ( /* dim=0 */ (__pyx_v_cdark.data + __pyx_t_20 * __pyx_v_cdark.strides[0]) ))));
-                                    goto __pyx_L19;
-                                  }
-                                  __pyx_L19:;
+              __pyx_t_55 = __pyx_v_bin0_max;
+              for (__pyx_t_56 = (__pyx_v_bin0_min + 1); __pyx_t_56 < __pyx_t_55; __pyx_t_56+=1) {
+                __pyx_v_i = __pyx_t_56;
 
-                                  /* "splitBBoxLUT.pyx":326
- *                         if do_dark:
- *                             data = data - cdark[i]
- *                         if do_flat:             # <<<<<<<<<<<<<<
- *                             data = data / cflat[i]
- *                         if do_polarization:
+                /* "splitBBoxLUT.pyx":285
+ *                     if bin0_min + 1 < bin0_max:
+ *                         for i in range(bin0_min + 1, bin0_max):
+ *                             k = outMax[i]             # <<<<<<<<<<<<<<
+ *                             lut[i, k].idx = idx
+ *                             lut[i, k].coef = (deltaA)
  */
-                                  if (__pyx_v_do_flat) {
+                __pyx_t_57 = __pyx_v_i;
+                __pyx_v_k = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_57, __pyx_pybuffernd_outMax.diminfo[0].strides));
 
-                                    /* "splitBBoxLUT.pyx":327
- *                             data = data - cdark[i]
- *                         if do_flat:
- *                             data = data / cflat[i]             # <<<<<<<<<<<<<<
- *                         if do_polarization:
- *                             data = data / cpolarization[i]
+                /* "splitBBoxLUT.pyx":286
+ *                         for i in range(bin0_min + 1, bin0_max):
+ *                             k = outMax[i]
+ *                             lut[i, k].idx = idx             # <<<<<<<<<<<<<<
+ *                             lut[i, k].coef = (deltaA)
+ *                             outMax[i] = k + 1
  */
-                                    if (unlikely(!__pyx_v_cflat.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cflat"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L16_error;} }
-                                    __pyx_t_21 = __pyx_v_i;
-                                    __pyx_v_data = (__pyx_v_data / (*((float *) ( /* dim=0 */ (__pyx_v_cflat.data + __pyx_t_21 * __pyx_v_cflat.strides[0]) ))));
-                                    goto __pyx_L20;
-                                  }
-                                  __pyx_L20:;
+                __pyx_t_58 = __pyx_v_i;
+                __pyx_t_59 = __pyx_v_k;
+                (*__Pyx_BufPtrStrided2d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_58, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_59, __pyx_pybuffernd_lut.diminfo[1].strides)).idx = __pyx_v_idx;
 
-                                  /* "splitBBoxLUT.pyx":328
- *                         if do_flat:
- *                             data = data / cflat[i]
- *                         if do_polarization:             # <<<<<<<<<<<<<<
- *                             data = data / cpolarization[i]
- *                         if do_solidAngle:
+                /* "splitBBoxLUT.pyx":287
+ *                             k = outMax[i]
+ *                             lut[i, k].idx = idx
+ *                             lut[i, k].coef = (deltaA)             # <<<<<<<<<<<<<<
+ *                             outMax[i] = k + 1
+ *         self.lut = lut
  */
-                                  if (__pyx_v_do_polarization) {
-
-                                    /* "splitBBoxLUT.pyx":329
- *                             data = data / cflat[i]
- *                         if do_polarization:
- *                             data = data / cpolarization[i]             # <<<<<<<<<<<<<<
- *                         if do_solidAngle:
- *                             data = data / csolidAngle[i]
- */
-                                    if (unlikely(!__pyx_v_cpolarization.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cpolarization"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L16_error;} }
-                                    __pyx_t_22 = __pyx_v_i;
-                                    __pyx_v_data = (__pyx_v_data / (*((float *) ( /* dim=0 */ (__pyx_v_cpolarization.data + __pyx_t_22 * __pyx_v_cpolarization.strides[0]) ))));
-                                    goto __pyx_L21;
-                                  }
-                                  __pyx_L21:;
-
-                                  /* "splitBBoxLUT.pyx":330
- *                         if do_polarization:
- *                             data = data / cpolarization[i]
- *                         if do_solidAngle:             # <<<<<<<<<<<<<<
- *                             data = data / csolidAngle[i]
- *                         cdata[i]+=data
- */
-                                  if (__pyx_v_do_solidAngle) {
-
-                                    /* "splitBBoxLUT.pyx":331
- *                             data = data / cpolarization[i]
- *                         if do_solidAngle:
- *                             data = data / csolidAngle[i]             # <<<<<<<<<<<<<<
- *                         cdata[i]+=data
- *                     else: #set all dummy_like values to cdummy. simplifies further processing
- */
-                                    if (unlikely(!__pyx_v_csolidAngle.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("csolidAngle"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L16_error;} }
-                                    __pyx_t_23 = __pyx_v_i;
-                                    __pyx_v_data = (__pyx_v_data / (*((float *) ( /* dim=0 */ (__pyx_v_csolidAngle.data + __pyx_t_23 * __pyx_v_csolidAngle.strides[0]) ))));
-                                    goto __pyx_L22;
-                                  }
-                                  __pyx_L22:;
-
-                                  /* "splitBBoxLUT.pyx":332
- *                         if do_solidAngle:
- *                             data = data / csolidAngle[i]
- *                         cdata[i]+=data             # <<<<<<<<<<<<<<
- *                     else: #set all dummy_like values to cdummy. simplifies further processing
- *                         cdata[i]+=cdummy
- */
-                                  __pyx_t_24 = __pyx_v_i;
-                                  *((float *) ( /* dim=0 */ (__pyx_v_cdata.data + __pyx_t_24 * __pyx_v_cdata.strides[0]) )) += __pyx_v_data;
-                                  goto __pyx_L18;
-                                }
-                                /*else*/ {
-
-                                  /* "splitBBoxLUT.pyx":334
- *                         cdata[i]+=data
- *                     else: #set all dummy_like values to cdummy. simplifies further processing
- *                         cdata[i]+=cdummy             # <<<<<<<<<<<<<<
- *             else:
- *                 for i in prange(size, nogil=True, schedule="static"):
- */
-                                  __pyx_t_25 = __pyx_v_i;
-                                  *((float *) ( /* dim=0 */ (__pyx_v_cdata.data + __pyx_t_25 * __pyx_v_cdata.strides[0]) )) += __pyx_v_cdummy;
-                                }
-                                __pyx_L18:;
-                                goto __pyx_L24;
-                                __pyx_L16_error:;
-                                {
-                                    #ifdef WITH_THREAD
-                                    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
-                                    #endif
-                                    #ifdef _OPENMP
-                                    #pragma omp flush(__pyx_parallel_exc_type)
-                                    #endif /* _OPENMP */
-                                    if (!__pyx_parallel_exc_type) {
-                                      __Pyx_ErrFetch(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb);
-                                      __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno;
-                                      __Pyx_GOTREF(__pyx_parallel_exc_type);
-                                    }
-                                    #ifdef WITH_THREAD
-                                    PyGILState_Release(__pyx_gilstate_save);
-                                    #endif
-                                }
-                                __pyx_parallel_why = 4;
-                                goto __pyx_L23;
-                                __pyx_L23:;
-                                #ifdef _OPENMP
-                                #pragma omp critical(__pyx_parallel_lastprivates0)
-                                #endif /* _OPENMP */
-                                {
-                                    __pyx_parallel_temp0 = __pyx_v_data;
-                                    __pyx_parallel_temp1 = __pyx_v_i;
-                                }
-                                __pyx_L24:;
-                                #ifdef _OPENMP
-                                #pragma omp flush(__pyx_parallel_why)
-                                #endif /* _OPENMP */
-                            }
-                        }
-                        #ifdef _OPENMP
-                        Py_END_ALLOW_THREADS
-                        #else
-{
-#ifdef WITH_THREAD
-                        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
-                        #endif
-                        #endif /* _OPENMP */
-                        /* Clean up any temporaries */
-                        #ifdef WITH_THREAD
-                        PyGILState_Release(__pyx_gilstate_save);
-                        #endif
-                        #ifndef _OPENMP
-}
-#endif /* _OPENMP */
-                    }
-                }
-                if (__pyx_parallel_exc_type) {
-                  /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */
-                  __pyx_parallel_why = 4;
-                }
-                if (__pyx_parallel_why) {
-                  __pyx_v_data = __pyx_parallel_temp0;
-                  __pyx_v_i = __pyx_parallel_temp1;
-                  switch (__pyx_parallel_why) {
-                        case 3: goto __pyx_L11;
-                        case 4:
-                    {
-                        #ifdef WITH_THREAD
-                        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
-                        #endif
-                        __Pyx_ErrRestore(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb);
-                        __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno;
-                        __Pyx_GIVEREF(__pyx_parallel_exc_type);
-                        #ifdef WITH_THREAD
-                        PyGILState_Release(__pyx_gilstate_save);
-                        #endif
-                    }
-                    goto __pyx_L12;
-                  }
-                }
-            }
-            #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
-          }
+                __pyx_t_60 = __pyx_v_i;
+                __pyx_t_61 = __pyx_v_k;
+                (*__Pyx_BufPtrStrided2d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_60, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_61, __pyx_pybuffernd_lut.diminfo[1].strides)).coef = __pyx_v_deltaA;
 
-          /* "splitBBoxLUT.pyx":320
- *             cdata = numpy.zeros(size,dtype=numpy.float32)
- *             if do_dummy:
- *                 for i in prange(size, nogil=True, schedule="static"):             # <<<<<<<<<<<<<<
- *                     data = tdata[i]
- *                     if ((cddummy!=0) and (fabs(data-cdummy) > cddummy)) or ((cddummy==0) and (data!=cdummy)):
+                /* "splitBBoxLUT.pyx":288
+ *                             lut[i, k].idx = idx
+ *                             lut[i, k].coef = (deltaA)
+ *                             outMax[i] = k + 1             # <<<<<<<<<<<<<<
+ *         self.lut = lut
+ *         return outMax
  */
-          /*finally:*/ {
-            int __pyx_why;
-            __pyx_why = 0; goto __pyx_L13;
-            __pyx_L11: __pyx_why = 3; goto __pyx_L13;
-            __pyx_L12: __pyx_why = 4; goto __pyx_L13;
-            __pyx_L13:;
-            Py_BLOCK_THREADS
-            switch (__pyx_why) {
-              case 3: goto __pyx_L0;
-              case 4: goto __pyx_L1_error;
+                __pyx_t_62 = __pyx_v_i;
+                *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_62, __pyx_pybuffernd_outMax.diminfo[0].strides) = (__pyx_v_k + 1);
+              }
+              goto __pyx_L32;
             }
+            __pyx_L32:;
           }
+          __pyx_L31:;
+          __pyx_L24_continue:;
+        }
       }
-      goto __pyx_L10;
-    }
-    /*else*/ {
 
-      /* "splitBBoxLUT.pyx":336
- *                         cdata[i]+=cdummy
- *             else:
- *                 for i in prange(size, nogil=True, schedule="static"):             # <<<<<<<<<<<<<<
- *                     data = tdata[i]
- *                     if do_dark:
+      /* "splitBBoxLUT.pyx":238
+ *         memset(&lut[0,0], 0, bins*lut_size*sizeof(lut_point))
+ *         #NOGIL
+ *         with nogil:             # <<<<<<<<<<<<<<
+ *             for idx in range(size):
+ *                 if (check_mask) and (cmask[idx]):
  */
-      {
-          #ifdef WITH_THREAD
-          PyThreadState *_save = NULL;
-          #endif
-          Py_UNBLOCK_THREADS
-          /*try:*/ {
-            __pyx_t_15 = __pyx_v_size;
-            if (1 == 0) abort();
-            {
-                float __pyx_parallel_temp0 = __PYX_NAN;
-                int __pyx_parallel_temp1 = 0xbad0bad0;
-                const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0;
-                PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL;
-                int __pyx_parallel_why;
-                __pyx_parallel_why = 0;
-                #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_2 = (__pyx_t_15 - 0) / 1;
-                if (__pyx_t_2 > 0)
-                {
-                    #ifdef _OPENMP
-                    #pragma omp parallel private(__pyx_t_26, __pyx_t_27, __pyx_t_28, __pyx_t_30, __pyx_t_29, __pyx_t_31) private(__pyx_filename, __pyx_lineno, __pyx_clineno) shared(__pyx_parallel_why, __pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb)
-                    #endif /* _OPENMP */
-                    {
-                        #ifdef _OPENMP
-                        #ifdef WITH_THREAD
-                        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
-                        #endif
-                        Py_BEGIN_ALLOW_THREADS
-                        #endif /* _OPENMP */
-                        #ifdef _OPENMP
-                        #pragma omp for lastprivate(__pyx_v_data) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) schedule(static)
-                        #endif /* _OPENMP */
-                        for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_2; __pyx_t_14++){
-                            if (__pyx_parallel_why < 2)
-                            {
-                                __pyx_v_i = 0 + 1 * __pyx_t_14;
-                                /* Initialize private variables to invalid values */
-                                __pyx_v_data = ((float)__PYX_NAN);
+      /*finally:*/ {
+        int __pyx_why;
+        __pyx_why = 0; goto __pyx_L23;
+        __pyx_L22: __pyx_why = 4; goto __pyx_L23;
+        __pyx_L23:;
+        #ifdef WITH_THREAD
+        Py_BLOCK_THREADS
+        #endif
+        switch (__pyx_why) {
+          case 4: goto __pyx_L1_error;
+        }
+      }
+  }
 
-                                /* "splitBBoxLUT.pyx":337
- *             else:
- *                 for i in prange(size, nogil=True, schedule="static"):
- *                     data = tdata[i]             # <<<<<<<<<<<<<<
- *                     if do_dark:
- *                         data = data - cdark[i]
+  /* "splitBBoxLUT.pyx":289
+ *                             lut[i, k].coef = (deltaA)
+ *                             outMax[i] = k + 1
+ *         self.lut = lut             # <<<<<<<<<<<<<<
+ *         return outMax
+ * 
  */
-                                __pyx_t_26 = __pyx_v_i;
-                                __pyx_v_data = (*((float *) ( /* dim=0 */ (__pyx_v_tdata.data + __pyx_t_26 * __pyx_v_tdata.strides[0]) )));
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__lut, ((PyObject *)__pyx_v_lut)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-                                /* "splitBBoxLUT.pyx":338
- *                 for i in prange(size, nogil=True, schedule="static"):
- *                     data = tdata[i]
- *                     if do_dark:             # <<<<<<<<<<<<<<
- *                         data = data - cdark[i]
- *                     if do_flat:
+  /* "splitBBoxLUT.pyx":290
+ *                             outMax[i] = k + 1
+ *         self.lut = lut
+ *         return outMax             # <<<<<<<<<<<<<<
+ * 
+ * 
  */
-                                if (__pyx_v_do_dark) {
+  __Pyx_XDECREF(__pyx_r);
+  __Pyx_INCREF(((PyObject *)__pyx_v_outMax));
+  __pyx_r = ((PyObject *)__pyx_v_outMax);
+  goto __pyx_L0;
 
-                                  /* "splitBBoxLUT.pyx":339
- *                     data = tdata[i]
- *                     if do_dark:
- *                         data = data - cdark[i]             # <<<<<<<<<<<<<<
- *                     if do_flat:
- *                         data = data / cflat[i]
- */
-                                  if (unlikely(!__pyx_v_cdark.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cdark"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L31_error;} }
-                                  __pyx_t_27 = __pyx_v_i;
-                                  __pyx_v_data = (__pyx_v_data - (*((float *) ( /* dim=0 */ (__pyx_v_cdark.data + __pyx_t_27 * __pyx_v_cdark.strides[0]) ))));
-                                  goto __pyx_L33;
-                                }
-                                __pyx_L33:;
-
-                                /* "splitBBoxLUT.pyx":340
- *                     if do_dark:
- *                         data = data - cdark[i]
- *                     if do_flat:             # <<<<<<<<<<<<<<
- *                         data = data / cflat[i]
- *                     if do_polarization:
- */
-                                if (__pyx_v_do_flat) {
-
-                                  /* "splitBBoxLUT.pyx":341
- *                         data = data - cdark[i]
- *                     if do_flat:
- *                         data = data / cflat[i]             # <<<<<<<<<<<<<<
- *                     if do_polarization:
- *                         data = data / cpolarization[i]
- */
-                                  if (unlikely(!__pyx_v_cflat.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cflat"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L31_error;} }
-                                  __pyx_t_28 = __pyx_v_i;
-                                  __pyx_v_data = (__pyx_v_data / (*((float *) ( /* dim=0 */ (__pyx_v_cflat.data + __pyx_t_28 * __pyx_v_cflat.strides[0]) ))));
-                                  goto __pyx_L34;
-                                }
-                                __pyx_L34:;
-
-                                /* "splitBBoxLUT.pyx":342
- *                     if do_flat:
- *                         data = data / cflat[i]
- *                     if do_polarization:             # <<<<<<<<<<<<<<
- *                         data = data / cpolarization[i]
- *                     if do_solidAngle:
- */
-                                if (__pyx_v_do_polarization) {
-
-                                  /* "splitBBoxLUT.pyx":343
- *                         data = data / cflat[i]
- *                     if do_polarization:
- *                         data = data / cpolarization[i]             # <<<<<<<<<<<<<<
- *                     if do_solidAngle:
- *                         data = data / csolidAngle[i]
- */
-                                  if (unlikely(!__pyx_v_cpolarization.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cpolarization"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L31_error;} }
-                                  __pyx_t_29 = __pyx_v_i;
-                                  __pyx_v_data = (__pyx_v_data / (*((float *) ( /* dim=0 */ (__pyx_v_cpolarization.data + __pyx_t_29 * __pyx_v_cpolarization.strides[0]) ))));
-                                  goto __pyx_L35;
-                                }
-                                __pyx_L35:;
-
-                                /* "splitBBoxLUT.pyx":344
- *                     if do_polarization:
- *                         data = data / cpolarization[i]
- *                     if do_solidAngle:             # <<<<<<<<<<<<<<
- *                         data = data / csolidAngle[i]
- *                     cdata[i]+=data
- */
-                                if (__pyx_v_do_solidAngle) {
-
-                                  /* "splitBBoxLUT.pyx":345
- *                         data = data / cpolarization[i]
- *                     if do_solidAngle:
- *                         data = data / csolidAngle[i]             # <<<<<<<<<<<<<<
- *                     cdata[i]+=data
- *         else:
- */
-                                  if (unlikely(!__pyx_v_csolidAngle.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("csolidAngle"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L31_error;} }
-                                  __pyx_t_30 = __pyx_v_i;
-                                  __pyx_v_data = (__pyx_v_data / (*((float *) ( /* dim=0 */ (__pyx_v_csolidAngle.data + __pyx_t_30 * __pyx_v_csolidAngle.strides[0]) ))));
-                                  goto __pyx_L36;
-                                }
-                                __pyx_L36:;
-
-                                /* "splitBBoxLUT.pyx":346
- *                     if do_solidAngle:
- *                         data = data / csolidAngle[i]
- *                     cdata[i]+=data             # <<<<<<<<<<<<<<
- *         else:
- *             if do_dummy:
- */
-                                __pyx_t_31 = __pyx_v_i;
-                                *((float *) ( /* dim=0 */ (__pyx_v_cdata.data + __pyx_t_31 * __pyx_v_cdata.strides[0]) )) += __pyx_v_data;
-                                goto __pyx_L38;
-                                __pyx_L31_error:;
-                                {
-                                    #ifdef WITH_THREAD
-                                    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
-                                    #endif
-                                    #ifdef _OPENMP
-                                    #pragma omp flush(__pyx_parallel_exc_type)
-                                    #endif /* _OPENMP */
-                                    if (!__pyx_parallel_exc_type) {
-                                      __Pyx_ErrFetch(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb);
-                                      __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno;
-                                      __Pyx_GOTREF(__pyx_parallel_exc_type);
-                                    }
-                                    #ifdef WITH_THREAD
-                                    PyGILState_Release(__pyx_gilstate_save);
-                                    #endif
-                                }
-                                __pyx_parallel_why = 4;
-                                goto __pyx_L37;
-                                __pyx_L37:;
-                                #ifdef _OPENMP
-                                #pragma omp critical(__pyx_parallel_lastprivates1)
-                                #endif /* _OPENMP */
-                                {
-                                    __pyx_parallel_temp0 = __pyx_v_data;
-                                    __pyx_parallel_temp1 = __pyx_v_i;
-                                }
-                                __pyx_L38:;
-                                #ifdef _OPENMP
-                                #pragma omp flush(__pyx_parallel_why)
-                                #endif /* _OPENMP */
-                            }
-                        }
-                        #ifdef _OPENMP
-                        Py_END_ALLOW_THREADS
-                        #else
-{
-#ifdef WITH_THREAD
-                        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
-                        #endif
-                        #endif /* _OPENMP */
-                        /* Clean up any temporaries */
-                        #ifdef WITH_THREAD
-                        PyGILState_Release(__pyx_gilstate_save);
-                        #endif
-                        #ifndef _OPENMP
+  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_XDECREF(__pyx_t_4);
+  __Pyx_XDECREF(__pyx_t_5);
+  __Pyx_XDECREF(__pyx_t_6);
+  __Pyx_XDECREF(__pyx_t_7);
+  __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_t_12, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_t_13, 1);
+  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
+    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
+    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lut.rcbuffer->pybuffer);
+    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outMax.rcbuffer->pybuffer);
+  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
+  __Pyx_AddTraceback("splitBBoxLUT.HistoBBox1d.calc_lut", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __pyx_r = NULL;
+  goto __pyx_L2;
+  __pyx_L0:;
+  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lut.rcbuffer->pybuffer);
+  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outMax.rcbuffer->pybuffer);
+  __pyx_L2:;
+  __Pyx_XDECREF((PyObject *)__pyx_v_outMax);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_cpos0_sup, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_cpos0_inf, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_cpos1_min, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_cpos1_max, 1);
+  __Pyx_XDECREF((PyObject *)__pyx_v_lut);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_cmask, 1);
+  __Pyx_XDECREF(__pyx_v_memsize);
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
 }
-#endif /* _OPENMP */
-                    }
-                }
-                if (__pyx_parallel_exc_type) {
-                  /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */
-                  __pyx_parallel_why = 4;
-                }
-                if (__pyx_parallel_why) {
-                  __pyx_v_data = __pyx_parallel_temp0;
-                  __pyx_v_i = __pyx_parallel_temp1;
-                  switch (__pyx_parallel_why) {
-                        case 3: goto __pyx_L26;
-                        case 4:
-                    {
-                        #ifdef WITH_THREAD
-                        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
-                        #endif
-                        __Pyx_ErrRestore(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb);
-                        __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno;
-                        __Pyx_GIVEREF(__pyx_parallel_exc_type);
-                        #ifdef WITH_THREAD
-                        PyGILState_Release(__pyx_gilstate_save);
-                        #endif
-                    }
-                    goto __pyx_L27;
-                  }
-                }
-            }
-            #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
-          }
 
-          /* "splitBBoxLUT.pyx":336
- *                         cdata[i]+=cdummy
- *             else:
- *                 for i in prange(size, nogil=True, schedule="static"):             # <<<<<<<<<<<<<<
- *                     data = tdata[i]
- *                     if do_dark:
- */
-          /*finally:*/ {
-            int __pyx_why;
-            __pyx_why = 0; goto __pyx_L28;
-            __pyx_L26: __pyx_why = 3; goto __pyx_L28;
-            __pyx_L27: __pyx_why = 4; goto __pyx_L28;
-            __pyx_L28:;
-            Py_BLOCK_THREADS
-            switch (__pyx_why) {
-              case 3: goto __pyx_L0;
-              case 4: goto __pyx_L1_error;
-            }
-          }
-      }
-    }
-    __pyx_L10:;
-    goto __pyx_L9;
-  }
-  /*else*/ {
-
-    /* "splitBBoxLUT.pyx":348
- *                     cdata[i]+=data
- *         else:
- *             if do_dummy:             # <<<<<<<<<<<<<<
- *                 tdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)
- *                 cdata = numpy.zeros(size,dtype=numpy.float32)
- */
-    if (__pyx_v_do_dummy) {
+/* Python wrapper */
+static PyObject *__pyx_pw_12splitBBoxLUT_11HistoBBox1d_7integrate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_12splitBBoxLUT_11HistoBBox1d_6integrate[] = "\n        Actually perform the integration which in this case looks more like a matrix-vector product\n\n        @param weights: input image\n        @type weights: ndarray\n        @param dummy: value for dead pixels (optional)\n        @type dummy: float\n        @param delta_dummy: precision for dead-pixel value in dynamic masking\n        @type delta_dummy: float\n        @param dark: array with the dark-current value [...]
+static PyMethodDef __pyx_mdef_12splitBBoxLUT_11HistoBBox1d_7integrate = {__Pyx_NAMESTR("integrate"), (PyCFunction)__pyx_pw_12splitBBoxLUT_11HistoBBox1d_7integrate, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_12splitBBoxLUT_11HistoBBox1d_6integrate)};
+static PyObject *__pyx_pw_12splitBBoxLUT_11HistoBBox1d_7integrate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  PyObject *__pyx_v_self = 0;
+  PyObject *__pyx_v_weights = 0;
+  PyObject *__pyx_v_dummy = 0;
+  PyObject *__pyx_v_delta_dummy = 0;
+  PyObject *__pyx_v_dark = 0;
+  PyObject *__pyx_v_flat = 0;
+  PyObject *__pyx_v_solidAngle = 0;
+  PyObject *__pyx_v_polarization = 0;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  PyObject *__pyx_r = 0;
+  __Pyx_RefNannyDeclarations
+  __Pyx_RefNannySetupContext("integrate (wrapper)", 0);
+  {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__weights,&__pyx_n_s__dummy,&__pyx_n_s__delta_dummy,&__pyx_n_s__dark,&__pyx_n_s__flat,&__pyx_n_s__solidAngle,&__pyx_n_s__polarization,0};
+    PyObject* values[8] = {0,0,0,0,0,0,0,0};
 
-      /* "splitBBoxLUT.pyx":349
- *         else:
- *             if do_dummy:
- *                 tdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
- *                 cdata = numpy.zeros(size,dtype=numpy.float32)
- *                 for i in prange(size, nogil=True, schedule="static"):
+    /* "splitBBoxLUT.pyx":296
+ *     @cython.boundscheck(False)
+ *     @cython.wraparound(False)
+ *     def integrate(self, weights, dummy=None, delta_dummy=None, dark=None, flat=None, solidAngle=None, polarization=None):             # <<<<<<<<<<<<<<
+ *         """
+ *         Actually perform the integration which in this case looks more like a matrix-vector product
  */
-      __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_6);
-      __pyx_t_1 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-      __pyx_t_6 = PyObject_GetAttr(__pyx_v_weights, __pyx_n_s__ravel); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_6);
-      __pyx_t_4 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_6);
-      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
-      __Pyx_GIVEREF(__pyx_t_4);
-      __pyx_t_4 = 0;
-      __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-      __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__float32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
-      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-      __pyx_t_13 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_5);
-      if (unlikely(!__pyx_t_13.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __pyx_v_tdata = __pyx_t_13;
-      __pyx_t_13.memview = NULL;
-      __pyx_t_13.data = NULL;
-
-      /* "splitBBoxLUT.pyx":350
- *             if do_dummy:
- *                 tdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)
- *                 cdata = numpy.zeros(size,dtype=numpy.float32)             # <<<<<<<<<<<<<<
- *                 for i in prange(size, nogil=True, schedule="static"):
- *                     data = tdata[i]
- */
-      __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
-      __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __pyx_t_5 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
-      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_6);
-      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
-      __Pyx_GIVEREF(__pyx_t_5);
-      __pyx_t_5 = 0;
-      __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
-      __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
-      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
-      __pyx_t_13 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_3);
-      if (unlikely(!__pyx_t_13.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __pyx_v_cdata = __pyx_t_13;
-      __pyx_t_13.memview = NULL;
-      __pyx_t_13.data = NULL;
-
-      /* "splitBBoxLUT.pyx":351
- *                 tdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)
- *                 cdata = numpy.zeros(size,dtype=numpy.float32)
- *                 for i in prange(size, nogil=True, schedule="static"):             # <<<<<<<<<<<<<<
- *                     data = tdata[i]
- *                     if ((cddummy!=0) and (fabs(data-cdummy) > cddummy)) or ((cddummy==0) and (data!=cdummy)):
- */
-      {
-          #ifdef WITH_THREAD
-          PyThreadState *_save = NULL;
-          #endif
-          Py_UNBLOCK_THREADS
-          /*try:*/ {
-            __pyx_t_2 = __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_15 = (__pyx_t_2 - 0) / 1;
-                if (__pyx_t_15 > 0)
-                {
-                    #ifdef _OPENMP
-                    #pragma omp parallel private(__pyx_t_18, __pyx_t_34, __pyx_t_17, __pyx_t_33, __pyx_t_11, __pyx_t_32, __pyx_t_19)
-                    #endif /* _OPENMP */
-                    {
-                        #ifdef _OPENMP
-                        #pragma omp for lastprivate(__pyx_v_data) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) schedule(static)
-                        #endif /* _OPENMP */
-                        for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_15; __pyx_t_14++){
-                            {
-                                __pyx_v_i = 0 + 1 * __pyx_t_14;
-                                /* Initialize private variables to invalid values */
-                                __pyx_v_data = ((float)__PYX_NAN);
-
-                                /* "splitBBoxLUT.pyx":352
- *                 cdata = numpy.zeros(size,dtype=numpy.float32)
- *                 for i in prange(size, nogil=True, schedule="static"):
- *                     data = tdata[i]             # <<<<<<<<<<<<<<
- *                     if ((cddummy!=0) and (fabs(data-cdummy) > cddummy)) or ((cddummy==0) and (data!=cdummy)):
- *                         cdata[i]+=data
- */
-                                __pyx_t_32 = __pyx_v_i;
-                                __pyx_v_data = (*((float *) ( /* dim=0 */ (__pyx_v_tdata.data + __pyx_t_32 * __pyx_v_tdata.strides[0]) )));
-
-                                /* "splitBBoxLUT.pyx":353
- *                 for i in prange(size, nogil=True, schedule="static"):
- *                     data = tdata[i]
- *                     if ((cddummy!=0) and (fabs(data-cdummy) > cddummy)) or ((cddummy==0) and (data!=cdummy)):             # <<<<<<<<<<<<<<
- *                         cdata[i]+=data
- *                     else:
- */
-                                __pyx_t_11 = (__pyx_v_cddummy != 0.0);
-                                if (__pyx_t_11) {
-                                  __pyx_t_18 = (fabs((__pyx_v_data - __pyx_v_cdummy)) > __pyx_v_cddummy);
-                                  __pyx_t_19 = __pyx_t_18;
-                                } else {
-                                  __pyx_t_19 = __pyx_t_11;
-                                }
-                                if (!__pyx_t_19) {
-                                  __pyx_t_11 = (__pyx_v_cddummy == 0.0);
-                                  if (__pyx_t_11) {
-                                    __pyx_t_18 = (__pyx_v_data != __pyx_v_cdummy);
-                                    __pyx_t_17 = __pyx_t_18;
-                                  } else {
-                                    __pyx_t_17 = __pyx_t_11;
-                                  }
-                                  __pyx_t_11 = __pyx_t_17;
-                                } else {
-                                  __pyx_t_11 = __pyx_t_19;
-                                }
-                                if (__pyx_t_11) {
-
-                                  /* "splitBBoxLUT.pyx":354
- *                     data = tdata[i]
- *                     if ((cddummy!=0) and (fabs(data-cdummy) > cddummy)) or ((cddummy==0) and (data!=cdummy)):
- *                         cdata[i]+=data             # <<<<<<<<<<<<<<
- *                     else:
- *                         cdata[i]+=cdummy
- */
-                                  __pyx_t_33 = __pyx_v_i;
-                                  *((float *) ( /* dim=0 */ (__pyx_v_cdata.data + __pyx_t_33 * __pyx_v_cdata.strides[0]) )) += __pyx_v_data;
-                                  goto __pyx_L48;
-                                }
-                                /*else*/ {
-
-                                  /* "splitBBoxLUT.pyx":356
- *                         cdata[i]+=data
- *                     else:
- *                         cdata[i]+=cdummy             # <<<<<<<<<<<<<<
- *             else:
- *                 cdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)
- */
-                                  __pyx_t_34 = __pyx_v_i;
-                                  *((float *) ( /* dim=0 */ (__pyx_v_cdata.data + __pyx_t_34 * __pyx_v_cdata.strides[0]) )) += __pyx_v_cdummy;
-                                }
-                                __pyx_L48:;
-                            }
-                        }
-                    }
-                }
-            }
-            #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
-          }
-
-          /* "splitBBoxLUT.pyx":351
- *                 tdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)
- *                 cdata = numpy.zeros(size,dtype=numpy.float32)
- *                 for i in prange(size, nogil=True, schedule="static"):             # <<<<<<<<<<<<<<
- *                     data = tdata[i]
- *                     if ((cddummy!=0) and (fabs(data-cdummy) > cddummy)) or ((cddummy==0) and (data!=cdummy)):
- */
-          /*finally:*/ {
-            Py_BLOCK_THREADS
-          }
+    values[2] = ((PyObject *)((PyObject *)Py_None));
+    values[3] = ((PyObject *)((PyObject *)Py_None));
+    values[4] = ((PyObject *)((PyObject *)Py_None));
+    values[5] = ((PyObject *)((PyObject *)Py_None));
+    values[6] = ((PyObject *)((PyObject *)Py_None));
+    values[7] = ((PyObject *)((PyObject *)Py_None));
+    if (unlikely(__pyx_kwds)) {
+      Py_ssize_t kw_args;
+      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+      switch (pos_args) {
+        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
+        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
+        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
+        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
+        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
+        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+        case  0: break;
+        default: goto __pyx_L5_argtuple_error;
+      }
+      kw_args = PyDict_Size(__pyx_kwds);
+      switch (pos_args) {
+        case  0:
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 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("integrate", 0, 2, 8, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+        case  2:
+        if (kw_args > 0) {
+          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dummy);
+          if (value) { values[2] = value; kw_args--; }
+        }
+        case  3:
+        if (kw_args > 0) {
+          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__delta_dummy);
+          if (value) { values[3] = value; kw_args--; }
+        }
+        case  4:
+        if (kw_args > 0) {
+          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dark);
+          if (value) { values[4] = value; kw_args--; }
+        }
+        case  5:
+        if (kw_args > 0) {
+          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flat);
+          if (value) { values[5] = value; kw_args--; }
+        }
+        case  6:
+        if (kw_args > 0) {
+          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__solidAngle);
+          if (value) { values[6] = value; kw_args--; }
+        }
+        case  7:
+        if (kw_args > 0) {
+          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__polarization);
+          if (value) { values[7] = value; kw_args--; }
+        }
+      }
+      if (unlikely(kw_args > 0)) {
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "integrate") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      }
+    } else {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
+        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
+        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
+        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
+        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
+        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
+        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+        break;
+        default: goto __pyx_L5_argtuple_error;
       }
-      goto __pyx_L40;
     }
-    /*else*/ {
+    __pyx_v_self = values[0];
+    __pyx_v_weights = values[1];
+    __pyx_v_dummy = values[2];
+    __pyx_v_delta_dummy = values[3];
+    __pyx_v_dark = values[4];
+    __pyx_v_flat = values[5];
+    __pyx_v_solidAngle = values[6];
+    __pyx_v_polarization = values[7];
+  }
+  goto __pyx_L4_argument_unpacking_done;
+  __pyx_L5_argtuple_error:;
+  __Pyx_RaiseArgtupleInvalid("integrate", 0, 2, 8, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __pyx_L3_error:;
+  __Pyx_AddTraceback("splitBBoxLUT.HistoBBox1d.integrate", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_RefNannyFinishContext();
+  return NULL;
+  __pyx_L4_argument_unpacking_done:;
+  __pyx_r = __pyx_pf_12splitBBoxLUT_11HistoBBox1d_6integrate(__pyx_self, __pyx_v_self, __pyx_v_weights, __pyx_v_dummy, __pyx_v_delta_dummy, __pyx_v_dark, __pyx_v_flat, __pyx_v_solidAngle, __pyx_v_polarization);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
 
-      /* "splitBBoxLUT.pyx":358
- *                         cdata[i]+=cdummy
- *             else:
- *                 cdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
- * 
- *         for i in prange(bins, nogil=True, schedule="guided"):
- */
-      __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __pyx_t_3 = PyObject_GetAttr(__pyx_v_weights, __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_6);
-      __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 = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      PyTuple_SET_ITEM(__pyx_t_3, 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 = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
-      __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__float32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
-      __pyx_t_13 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_1);
-      if (unlikely(!__pyx_t_13.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __pyx_v_cdata = __pyx_t_13;
-      __pyx_t_13.memview = NULL;
-      __pyx_t_13.data = NULL;
-    }
-    __pyx_L40:;
-  }
-  __pyx_L9:;
+static PyObject *__pyx_pf_12splitBBoxLUT_11HistoBBox1d_6integrate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_weights, PyObject *__pyx_v_dummy, PyObject *__pyx_v_delta_dummy, PyObject *__pyx_v_dark, PyObject *__pyx_v_flat, PyObject *__pyx_v_solidAngle, PyObject *__pyx_v_polarization) {
+  int __pyx_v_i;
+  int __pyx_v_j;
+  int __pyx_v_idx;
+  CYTHON_UNUSED int __pyx_v_bins;
+  int __pyx_v_lut_size;
+  int __pyx_v_size;
+  double __pyx_v_sum_data;
+  double __pyx_v_sum_count;
+  double __pyx_v_epsilon;
+  float __pyx_v_data;
+  float __pyx_v_coef;
+  float __pyx_v_cdummy;
+  float __pyx_v_cddummy;
+  int __pyx_v_do_dummy;
+  int __pyx_v_do_dark;
+  int __pyx_v_do_flat;
+  int __pyx_v_do_polarization;
+  int __pyx_v_do_solidAngle;
+  PyArrayObject *__pyx_v_outData = 0;
+  PyArrayObject *__pyx_v_outCount = 0;
+  PyArrayObject *__pyx_v_outMerge = 0;
+  __Pyx_memviewslice __pyx_v_lut = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_cdata = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_tdata = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_cflat = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_cdark = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_csolidAngle = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_cpolarization = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __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
+  PyObject *__pyx_t_1 = NULL;
+  int __pyx_t_2;
+  PyObject *__pyx_t_3 = NULL;
+  PyObject *__pyx_t_4 = NULL;
+  PyObject *__pyx_t_5 = NULL;
+  PyObject *__pyx_t_6 = NULL;
+  PyArrayObject *__pyx_t_7 = NULL;
+  PyArrayObject *__pyx_t_8 = NULL;
+  PyArrayObject *__pyx_t_9 = NULL;
+  __Pyx_memviewslice __pyx_t_10 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  int __pyx_t_11;
+  int __pyx_t_12;
+  double __pyx_t_13;
+  __Pyx_memviewslice __pyx_t_14 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  int __pyx_t_15;
+  int __pyx_t_16;
+  int __pyx_t_17;
+  int __pyx_t_18;
+  int __pyx_t_19;
+  int __pyx_t_20;
+  int __pyx_t_21;
+  int __pyx_t_22;
+  int __pyx_t_23;
+  int __pyx_t_24;
+  int __pyx_t_25;
+  int __pyx_t_26;
+  int __pyx_t_27;
+  int __pyx_t_28;
+  int __pyx_t_29;
+  int __pyx_t_30;
+  int __pyx_t_31;
+  int __pyx_t_32;
+  int __pyx_t_33;
+  int __pyx_t_34;
+  int __pyx_t_35;
+  int __pyx_t_36;
+  int __pyx_t_37;
+  int __pyx_t_38;
+  __pyx_t_5numpy_int32_t __pyx_t_39;
+  int __pyx_t_40;
+  int __pyx_t_41;
+  __pyx_t_5numpy_float32_t __pyx_t_42;
+  int __pyx_t_43;
+  int __pyx_t_44;
+  int __pyx_t_45;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("integrate", 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;
 
-  /* "splitBBoxLUT.pyx":360
- *                 cdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)
+  /* "splitBBoxLUT.pyx":318
  * 
- *         for i in prange(bins, nogil=True, schedule="guided"):             # <<<<<<<<<<<<<<
- *             sum_data = 0.0
- *             sum_count = 0.0
+ *         """
+ *         cdef int i=0, j=0, idx=0, bins=self.bins, lut_size=self.lut_size, size=self.size             # <<<<<<<<<<<<<<
+ *         cdef double sum_data=0, sum_count=0, epsilon=1e-10
+ *         cdef float data=0, coef=0, cdummy=0, cddummy=0
  */
-  {
-      #ifdef WITH_THREAD
-      PyThreadState *_save = NULL;
-      #endif
-      Py_UNBLOCK_THREADS
-      /*try:*/ {
-        __pyx_t_15 = __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_2 = (__pyx_t_15 - 0) / 1;
-            if (__pyx_t_2 > 0)
-            {
-                #ifdef _OPENMP
-                #pragma omp parallel private(__pyx_t_42, __pyx_t_38, __pyx_t_43, __pyx_t_17, __pyx_t_37, __pyx_t_44, __pyx_t_40, __pyx_t_11, __pyx_t_36, __pyx_t_45, __pyx_t_39, __pyx_t_41, __pyx_t_19, __pyx_t_35)
-                #endif /* _OPENMP */
-                {
-                    #ifdef _OPENMP
-                    #pragma omp for lastprivate(__pyx_v_sum_count) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_coef) lastprivate(__pyx_v_idx) lastprivate(__pyx_v_data) lastprivate(__pyx_v_sum_data) schedule(guided)
-                    #endif /* _OPENMP */
-                    for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_2; __pyx_t_14++){
-                        {
-                            __pyx_v_i = 0 + 1 * __pyx_t_14;
-                            /* Initialize private variables to invalid values */
-                            __pyx_v_sum_count = ((double)__PYX_NAN);
-                            __pyx_v_j = ((int)0xbad0bad0);
-                            __pyx_v_coef = ((float)__PYX_NAN);
-                            __pyx_v_idx = ((int)0xbad0bad0);
-                            __pyx_v_data = ((float)__PYX_NAN);
-                            __pyx_v_sum_data = ((double)__PYX_NAN);
+  __pyx_v_i = 0;
+  __pyx_v_j = 0;
+  __pyx_v_idx = 0;
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__bins); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_v_bins = __pyx_t_2;
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__lut_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_v_lut_size = __pyx_t_2;
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_v_size = __pyx_t_2;
 
-                            /* "splitBBoxLUT.pyx":361
- * 
- *         for i in prange(bins, nogil=True, schedule="guided"):
- *             sum_data = 0.0             # <<<<<<<<<<<<<<
- *             sum_count = 0.0
- *             for j in range(lut_size):
+  /* "splitBBoxLUT.pyx":319
+ *         """
+ *         cdef int i=0, j=0, idx=0, bins=self.bins, lut_size=self.lut_size, size=self.size
+ *         cdef double sum_data=0, sum_count=0, epsilon=1e-10             # <<<<<<<<<<<<<<
+ *         cdef float data=0, coef=0, cdummy=0, cddummy=0
+ *         cdef bint do_dummy=False, do_dark=False, do_flat=False, do_polarization=False, do_solidAngle=False
  */
-                            __pyx_v_sum_data = 0.0;
+  __pyx_v_sum_data = 0.0;
+  __pyx_v_sum_count = 0.0;
+  __pyx_v_epsilon = 1e-10;
 
-                            /* "splitBBoxLUT.pyx":362
- *         for i in prange(bins, nogil=True, schedule="guided"):
- *             sum_data = 0.0
- *             sum_count = 0.0             # <<<<<<<<<<<<<<
- *             for j in range(lut_size):
- *                 idx = lut[i, j].idx
+  /* "splitBBoxLUT.pyx":320
+ *         cdef int i=0, j=0, idx=0, bins=self.bins, lut_size=self.lut_size, size=self.size
+ *         cdef double sum_data=0, sum_count=0, epsilon=1e-10
+ *         cdef float data=0, coef=0, cdummy=0, cddummy=0             # <<<<<<<<<<<<<<
+ *         cdef bint do_dummy=False, do_dark=False, do_flat=False, do_polarization=False, do_solidAngle=False
+ *         cdef numpy.ndarray[numpy.float64_t, ndim = 1] outData = numpy.zeros(self.bins, dtype=numpy.float64)
  */
-                            __pyx_v_sum_count = 0.0;
+  __pyx_v_data = 0.0;
+  __pyx_v_coef = 0.0;
+  __pyx_v_cdummy = 0.0;
+  __pyx_v_cddummy = 0.0;
 
-                            /* "splitBBoxLUT.pyx":363
- *             sum_data = 0.0
- *             sum_count = 0.0
- *             for j in range(lut_size):             # <<<<<<<<<<<<<<
- *                 idx = lut[i, j].idx
- *                 coef = lut[i, j].coef
+  /* "splitBBoxLUT.pyx":321
+ *         cdef double sum_data=0, sum_count=0, epsilon=1e-10
+ *         cdef float data=0, coef=0, cdummy=0, cddummy=0
+ *         cdef bint do_dummy=False, do_dark=False, do_flat=False, do_polarization=False, do_solidAngle=False             # <<<<<<<<<<<<<<
+ *         cdef numpy.ndarray[numpy.float64_t, ndim = 1] outData = numpy.zeros(self.bins, dtype=numpy.float64)
+ *         cdef numpy.ndarray[numpy.float64_t, ndim = 1] outCount = numpy.zeros(self.bins, dtype=numpy.float64)
  */
-                            __pyx_t_35 = __pyx_v_lut_size;
-                            for (__pyx_t_36 = 0; __pyx_t_36 < __pyx_t_35; __pyx_t_36+=1) {
-                              __pyx_v_j = __pyx_t_36;
+  __pyx_v_do_dummy = 0;
+  __pyx_v_do_dark = 0;
+  __pyx_v_do_flat = 0;
+  __pyx_v_do_polarization = 0;
+  __pyx_v_do_solidAngle = 0;
 
-                              /* "splitBBoxLUT.pyx":364
- *             sum_count = 0.0
- *             for j in range(lut_size):
- *                 idx = lut[i, j].idx             # <<<<<<<<<<<<<<
- *                 coef = lut[i, j].coef
- *                 if idx <= 0 and coef <= 0.0:
+  /* "splitBBoxLUT.pyx":322
+ *         cdef float data=0, coef=0, cdummy=0, cddummy=0
+ *         cdef bint do_dummy=False, do_dark=False, do_flat=False, do_polarization=False, do_solidAngle=False
+ *         cdef numpy.ndarray[numpy.float64_t, ndim = 1] outData = numpy.zeros(self.bins, dtype=numpy.float64)             # <<<<<<<<<<<<<<
+ *         cdef numpy.ndarray[numpy.float64_t, ndim = 1] outCount = numpy.zeros(self.bins, dtype=numpy.float64)
+ *         cdef numpy.ndarray[numpy.float32_t, ndim = 1] outMerge = numpy.zeros(self.bins, dtype=numpy.float32)
  */
-                              __pyx_t_37 = __pyx_v_i;
-                              __pyx_t_38 = __pyx_v_j;
-                              __pyx_t_39 = (*((struct __pyx_t_12splitBBoxLUT_lut_point *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_lut.data + __pyx_t_37 * __pyx_v_lut.strides[0]) ) + __pyx_t_38 * __pyx_v_lut.strides[1]) ))).idx;
-                              __pyx_v_idx = __pyx_t_39;
+  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__bins); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
+  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_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 = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
+  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__float64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_6);
+  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+  __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_6);
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+  if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = ((PyArrayObject *)__pyx_t_6);
+  {
+    __Pyx_BufFmt_StackElem __pyx_stack[1];
+    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outData.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__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 = 322; __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_7 = 0;
+  __pyx_v_outData = ((PyArrayObject *)__pyx_t_6);
+  __pyx_t_6 = 0;
 
-                              /* "splitBBoxLUT.pyx":365
- *             for j in range(lut_size):
- *                 idx = lut[i, j].idx
- *                 coef = lut[i, j].coef             # <<<<<<<<<<<<<<
- *                 if idx <= 0 and coef <= 0.0:
- *                     break
+  /* "splitBBoxLUT.pyx":323
+ *         cdef bint do_dummy=False, do_dark=False, do_flat=False, do_polarization=False, do_solidAngle=False
+ *         cdef numpy.ndarray[numpy.float64_t, ndim = 1] outData = numpy.zeros(self.bins, dtype=numpy.float64)
+ *         cdef numpy.ndarray[numpy.float64_t, ndim = 1] outCount = numpy.zeros(self.bins, dtype=numpy.float64)             # <<<<<<<<<<<<<<
+ *         cdef numpy.ndarray[numpy.float32_t, ndim = 1] outMerge = numpy.zeros(self.bins, dtype=numpy.float32)
+ *         cdef lut_point[:,:] lut = self.lut
  */
-                              __pyx_t_40 = __pyx_v_i;
-                              __pyx_t_41 = __pyx_v_j;
-                              __pyx_t_42 = (*((struct __pyx_t_12splitBBoxLUT_lut_point *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_lut.data + __pyx_t_40 * __pyx_v_lut.strides[0]) ) + __pyx_t_41 * __pyx_v_lut.strides[1]) ))).coef;
-                              __pyx_v_coef = __pyx_t_42;
-
-                              /* "splitBBoxLUT.pyx":366
- *                 idx = lut[i, j].idx
- *                 coef = lut[i, j].coef
- *                 if idx <= 0 and coef <= 0.0:             # <<<<<<<<<<<<<<
- *                     break
- *                 data = cdata[idx]
- */
-                              __pyx_t_11 = (__pyx_v_idx <= 0);
-                              if (__pyx_t_11) {
-                                __pyx_t_19 = (__pyx_v_coef <= 0.0);
-                                __pyx_t_17 = __pyx_t_19;
-                              } else {
-                                __pyx_t_17 = __pyx_t_11;
-                              }
-                              if (__pyx_t_17) {
-
-                                /* "splitBBoxLUT.pyx":367
- *                 coef = lut[i, j].coef
- *                 if idx <= 0 and coef <= 0.0:
- *                     break             # <<<<<<<<<<<<<<
- *                 data = cdata[idx]
- *                 if do_dummy and data==cdummy:
- */
-                                goto __pyx_L59_break;
-                                goto __pyx_L60;
-                              }
-                              __pyx_L60:;
+  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_6);
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__bins); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_6);
+  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
+  PyTuple_SET_ITEM(__pyx_t_4, 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 = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_6));
+  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__float64); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+  __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_8 = ((PyArrayObject *)__pyx_t_5);
+  {
+    __Pyx_BufFmt_StackElem __pyx_stack[1];
+    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outCount.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__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 = 323; __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_8 = 0;
+  __pyx_v_outCount = ((PyArrayObject *)__pyx_t_5);
+  __pyx_t_5 = 0;
 
-                              /* "splitBBoxLUT.pyx":368
- *                 if idx <= 0 and coef <= 0.0:
- *                     break
- *                 data = cdata[idx]             # <<<<<<<<<<<<<<
- *                 if do_dummy and data==cdummy:
- *                     continue
+  /* "splitBBoxLUT.pyx":324
+ *         cdef numpy.ndarray[numpy.float64_t, ndim = 1] outData = numpy.zeros(self.bins, dtype=numpy.float64)
+ *         cdef numpy.ndarray[numpy.float64_t, ndim = 1] outCount = numpy.zeros(self.bins, dtype=numpy.float64)
+ *         cdef numpy.ndarray[numpy.float32_t, ndim = 1] outMerge = numpy.zeros(self.bins, dtype=numpy.float32)             # <<<<<<<<<<<<<<
+ *         cdef lut_point[:,:] lut = self.lut
+ *         cdef float[:] cdata, tdata, cflat, cdark, csolidAngle, cpolarization
  */
-                              __pyx_t_43 = __pyx_v_idx;
-                              __pyx_v_data = (*((float *) ( /* dim=0 */ (__pyx_v_cdata.data + __pyx_t_43 * __pyx_v_cdata.strides[0]) )));
+  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
+  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__zeros); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_6);
+  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__bins); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
+  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
+  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
+  __Pyx_GIVEREF(__pyx_t_5);
+  __pyx_t_5 = 0;
+  __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__float32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_3 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __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_4)); __pyx_t_4 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 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 = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_9 = ((PyArrayObject *)__pyx_t_3);
+  {
+    __Pyx_BufFmt_StackElem __pyx_stack[1];
+    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outMerge.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
+      __pyx_v_outMerge = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.buf = NULL;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __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_9 = 0;
+  __pyx_v_outMerge = ((PyArrayObject *)__pyx_t_3);
+  __pyx_t_3 = 0;
 
-                              /* "splitBBoxLUT.pyx":369
- *                     break
- *                 data = cdata[idx]
- *                 if do_dummy and data==cdummy:             # <<<<<<<<<<<<<<
- *                     continue
+  /* "splitBBoxLUT.pyx":325
+ *         cdef numpy.ndarray[numpy.float64_t, ndim = 1] outCount = numpy.zeros(self.bins, dtype=numpy.float64)
+ *         cdef numpy.ndarray[numpy.float32_t, ndim = 1] outMerge = numpy.zeros(self.bins, dtype=numpy.float32)
+ *         cdef lut_point[:,:] lut = self.lut             # <<<<<<<<<<<<<<
+ *         cdef float[:] cdata, tdata, cflat, cdark, csolidAngle, cpolarization
  * 
  */
-                              if (__pyx_v_do_dummy) {
-                                __pyx_t_17 = (__pyx_v_data == __pyx_v_cdummy);
-                                __pyx_t_11 = __pyx_t_17;
-                              } else {
-                                __pyx_t_11 = __pyx_v_do_dummy;
-                              }
-                              if (__pyx_t_11) {
+  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__lut); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_dsds_nn_struct___pyx_t_12splitBBoxLUT_lut_point(__pyx_t_3);
+  if (unlikely(!__pyx_t_10.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_v_lut = __pyx_t_10;
+  __pyx_t_10.memview = NULL;
+  __pyx_t_10.data = NULL;
 
-                                /* "splitBBoxLUT.pyx":370
- *                 data = cdata[idx]
- *                 if do_dummy and data==cdummy:
- *                     continue             # <<<<<<<<<<<<<<
+  /* "splitBBoxLUT.pyx":328
+ *         cdef float[:] cdata, tdata, cflat, cdark, csolidAngle, cpolarization
  * 
- *                 sum_data = sum_data + coef * data
- */
-                                goto __pyx_L58_continue;
-                                goto __pyx_L61;
-                              }
-                              __pyx_L61:;
-
-                              /* "splitBBoxLUT.pyx":372
- *                     continue
+ *         assert size == weights.size             # <<<<<<<<<<<<<<
  * 
- *                 sum_data = sum_data + coef * data             # <<<<<<<<<<<<<<
- *                 sum_count = sum_count + coef
- *             outData[i] += sum_data
+ *         if dummy is not None:
  */
-                              __pyx_v_sum_data = (__pyx_v_sum_data + (__pyx_v_coef * __pyx_v_data));
+  #ifndef CYTHON_WITHOUT_ASSERTIONS
+  __pyx_t_3 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_weights, __pyx_n_s__size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
+  __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  if (unlikely(!__pyx_t_11)) {
+    PyErr_SetNone(PyExc_AssertionError);
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  }
+  #endif
 
-                              /* "splitBBoxLUT.pyx":373
+  /* "splitBBoxLUT.pyx":330
+ *         assert size == weights.size
  * 
- *                 sum_data = sum_data + coef * data
- *                 sum_count = sum_count + coef             # <<<<<<<<<<<<<<
- *             outData[i] += sum_data
- *             outCount[i] += sum_count
+ *         if dummy is not None:             # <<<<<<<<<<<<<<
+ *             do_dummy = True
+ *             cdummy =  <float>float(dummy)
  */
-                              __pyx_v_sum_count = (__pyx_v_sum_count + __pyx_v_coef);
-                              __pyx_L58_continue:;
-                            }
-                            __pyx_L59_break:;
+  __pyx_t_11 = (__pyx_v_dummy != Py_None);
+  __pyx_t_12 = (__pyx_t_11 != 0);
+  if (__pyx_t_12) {
 
-                            /* "splitBBoxLUT.pyx":374
- *                 sum_data = sum_data + coef * data
- *                 sum_count = sum_count + coef
- *             outData[i] += sum_data             # <<<<<<<<<<<<<<
- *             outCount[i] += sum_count
- *             if sum_count > epsilon:
+    /* "splitBBoxLUT.pyx":331
+ * 
+ *         if dummy is not None:
+ *             do_dummy = True             # <<<<<<<<<<<<<<
+ *             cdummy =  <float>float(dummy)
+ *             if delta_dummy is None:
  */
-                            __pyx_t_35 = __pyx_v_i;
-                            *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_outData.diminfo[0].strides) += __pyx_v_sum_data;
+    __pyx_v_do_dummy = 1;
 
-                            /* "splitBBoxLUT.pyx":375
- *                 sum_count = sum_count + coef
- *             outData[i] += sum_data
- *             outCount[i] += sum_count             # <<<<<<<<<<<<<<
- *             if sum_count > epsilon:
- *                 outMerge[i] += sum_data / sum_count
+    /* "splitBBoxLUT.pyx":332
+ *         if dummy is not None:
+ *             do_dummy = True
+ *             cdummy =  <float>float(dummy)             # <<<<<<<<<<<<<<
+ *             if delta_dummy is None:
+ *                 cddummy = <float>0.0
  */
-                            __pyx_t_36 = __pyx_v_i;
-                            *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_outCount.diminfo[0].strides) += __pyx_v_sum_count;
+    __pyx_t_13 = __Pyx_PyObject_AsDouble(__pyx_v_dummy); if (unlikely(__pyx_t_13 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_v_cdummy = ((float)__pyx_t_13);
 
-                            /* "splitBBoxLUT.pyx":376
- *             outData[i] += sum_data
- *             outCount[i] += sum_count
- *             if sum_count > epsilon:             # <<<<<<<<<<<<<<
- *                 outMerge[i] += sum_data / sum_count
+    /* "splitBBoxLUT.pyx":333
+ *             do_dummy = True
+ *             cdummy =  <float>float(dummy)
+ *             if delta_dummy is None:             # <<<<<<<<<<<<<<
+ *                 cddummy = <float>0.0
  *             else:
  */
-                            __pyx_t_11 = (__pyx_v_sum_count > __pyx_v_epsilon);
-                            if (__pyx_t_11) {
+    __pyx_t_12 = (__pyx_v_delta_dummy == Py_None);
+    __pyx_t_11 = (__pyx_t_12 != 0);
+    if (__pyx_t_11) {
 
-                              /* "splitBBoxLUT.pyx":377
- *             outCount[i] += sum_count
- *             if sum_count > epsilon:
- *                 outMerge[i] += sum_data / sum_count             # <<<<<<<<<<<<<<
+      /* "splitBBoxLUT.pyx":334
+ *             cdummy =  <float>float(dummy)
+ *             if delta_dummy is None:
+ *                 cddummy = <float>0.0             # <<<<<<<<<<<<<<
  *             else:
- *                 outMerge[i] += cdummy
+ *                 cddummy = <float>float(delta_dummy)
  */
-                              __pyx_t_44 = __pyx_v_i;
-                              *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_outMerge.diminfo[0].strides) += (__pyx_v_sum_data / __pyx_v_sum_count);
-                              goto __pyx_L62;
-                            }
-                            /*else*/ {
+      __pyx_v_cddummy = ((float)0.0);
+      goto __pyx_L4;
+    }
+    /*else*/ {
 
-                              /* "splitBBoxLUT.pyx":379
- *                 outMerge[i] += sum_data / sum_count
+      /* "splitBBoxLUT.pyx":336
+ *                 cddummy = <float>0.0
  *             else:
- *                 outMerge[i] += cdummy             # <<<<<<<<<<<<<<
- *         return  self.outPos, outMerge, outData, outCount
+ *                 cddummy = <float>float(delta_dummy)             # <<<<<<<<<<<<<<
  * 
+ *         if flat is not None:
  */
-                              __pyx_t_45 = __pyx_v_i;
-                              *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.buf, __pyx_t_45, __pyx_pybuffernd_outMerge.diminfo[0].strides) += __pyx_v_cdummy;
-                            }
-                            __pyx_L62:;
-                        }
-                    }
-                }
-            }
-        }
-        #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
-      }
+      __pyx_t_13 = __Pyx_PyObject_AsDouble(__pyx_v_delta_dummy); if (unlikely(__pyx_t_13 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_v_cddummy = ((float)__pyx_t_13);
+    }
+    __pyx_L4:;
+    goto __pyx_L3;
+  }
+  __pyx_L3:;
 
-      /* "splitBBoxLUT.pyx":360
- *                 cdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)
+  /* "splitBBoxLUT.pyx":338
+ *                 cddummy = <float>float(delta_dummy)
  * 
- *         for i in prange(bins, nogil=True, schedule="guided"):             # <<<<<<<<<<<<<<
- *             sum_data = 0.0
- *             sum_count = 0.0
+ *         if flat is not None:             # <<<<<<<<<<<<<<
+ *             do_flat = True
+ *             assert flat.size == size
  */
-      /*finally:*/ {
-        Py_BLOCK_THREADS
-      }
-  }
+  __pyx_t_11 = (__pyx_v_flat != Py_None);
+  __pyx_t_12 = (__pyx_t_11 != 0);
+  if (__pyx_t_12) {
 
-  /* "splitBBoxLUT.pyx":380
- *             else:
- *                 outMerge[i] += cdummy
- *         return  self.outPos, outMerge, outData, outCount             # <<<<<<<<<<<<<<
- * 
+    /* "splitBBoxLUT.pyx":339
  * 
+ *         if flat is not None:
+ *             do_flat = True             # <<<<<<<<<<<<<<
+ *             assert flat.size == size
+ *             cflat = numpy.ascontiguousarray(flat.ravel(), dtype=numpy.float32)
  */
-  __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__outPos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __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_INCREF(((PyObject *)__pyx_v_outMerge));
-  PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_v_outMerge));
-  __Pyx_GIVEREF(((PyObject *)__pyx_v_outMerge));
-  __Pyx_INCREF(((PyObject *)__pyx_v_outData));
-  PyTuple_SET_ITEM(__pyx_t_6, 2, ((PyObject *)__pyx_v_outData));
-  __Pyx_GIVEREF(((PyObject *)__pyx_v_outData));
-  __Pyx_INCREF(((PyObject *)__pyx_v_outCount));
-  PyTuple_SET_ITEM(__pyx_t_6, 3, ((PyObject *)__pyx_v_outCount));
-  __Pyx_GIVEREF(((PyObject *)__pyx_v_outCount));
-  __pyx_t_1 = 0;
-  __pyx_r = ((PyObject *)__pyx_t_6);
-  __pyx_t_6 = 0;
-  goto __pyx_L0;
+    __pyx_v_do_flat = 1;
 
-  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_XDECREF(__pyx_t_4);
-  __Pyx_XDECREF(__pyx_t_5);
-  __Pyx_XDECREF(__pyx_t_6);
-  __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
-  __PYX_XDEC_MEMVIEW(&__pyx_t_13, 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_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
-  __Pyx_AddTraceback("splitBBoxLUT.HistoBBox1d.integrate", __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_L2:;
-  __Pyx_XDECREF((PyObject *)__pyx_v_outData);
-  __Pyx_XDECREF((PyObject *)__pyx_v_outCount);
-  __Pyx_XDECREF((PyObject *)__pyx_v_outMerge);
-  __PYX_XDEC_MEMVIEW(&__pyx_v_lut, 1);
-  __PYX_XDEC_MEMVIEW(&__pyx_v_cdata, 1);
-  __PYX_XDEC_MEMVIEW(&__pyx_v_tdata, 1);
-  __PYX_XDEC_MEMVIEW(&__pyx_v_cflat, 1);
-  __PYX_XDEC_MEMVIEW(&__pyx_v_cdark, 1);
-  __PYX_XDEC_MEMVIEW(&__pyx_v_csolidAngle, 1);
-  __PYX_XDEC_MEMVIEW(&__pyx_v_cpolarization, 1);
-  __Pyx_XGIVEREF(__pyx_r);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
+    /* "splitBBoxLUT.pyx":340
+ *         if flat is not None:
+ *             do_flat = True
+ *             assert flat.size == size             # <<<<<<<<<<<<<<
+ *             cflat = numpy.ascontiguousarray(flat.ravel(), dtype=numpy.float32)
+ *         if dark is not None:
+ */
+    #ifndef CYTHON_WITHOUT_ASSERTIONS
+    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_flat, __pyx_n_s__size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_5 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    if (unlikely(!__pyx_t_12)) {
+      PyErr_SetNone(PyExc_AssertionError);
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    }
+    #endif
 
-/* "splitBBoxLUT.pyx":390
- * class HistoBBox2d(object):
- *     @cython.boundscheck(False)
- *     def __init__(self,             # <<<<<<<<<<<<<<
- *                  pos0,
- *                  delta_pos0,
+    /* "splitBBoxLUT.pyx":341
+ *             do_flat = True
+ *             assert flat.size == size
+ *             cflat = numpy.ascontiguousarray(flat.ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
+ *         if dark is not None:
+ *             do_dark = True
  */
+    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_flat, __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __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 = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
+    __Pyx_GIVEREF(__pyx_t_4);
+    __pyx_t_4 = 0;
+    __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+    __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s__float32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+    __pyx_t_14 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_1);
+    if (unlikely(!__pyx_t_14.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_v_cflat = __pyx_t_14;
+    __pyx_t_14.memview = NULL;
+    __pyx_t_14.data = NULL;
+    goto __pyx_L5;
+  }
+  __pyx_L5:;
 
-static PyObject *__pyx_pf_12splitBBoxLUT_11HistoBBox2d_6__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
-  PyObject *__pyx_r = NULL;
-  __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
-  int __pyx_lineno = 0;
-  const char *__pyx_filename = NULL;
-  int __pyx_clineno = 0;
-  __Pyx_RefNannySetupContext("__defaults__", 0);
-  __Pyx_XDECREF(__pyx_r);
+  /* "splitBBoxLUT.pyx":342
+ *             assert flat.size == size
+ *             cflat = numpy.ascontiguousarray(flat.ravel(), dtype=numpy.float32)
+ *         if dark is not None:             # <<<<<<<<<<<<<<
+ *             do_dark = True
+ *             assert dark.size == size
+ */
+  __pyx_t_12 = (__pyx_v_dark != Py_None);
+  __pyx_t_11 = (__pyx_t_12 != 0);
+  if (__pyx_t_11) {
 
-  /* "splitBBoxLUT.pyx":399
- *                  pos1Range=None,
- *                  mask=None,
- *                  mask_checksum=None,             # <<<<<<<<<<<<<<
- *                  allow_pos0_neg=False,
- *                  unit="undefined"):
+    /* "splitBBoxLUT.pyx":343
+ *             cflat = numpy.ascontiguousarray(flat.ravel(), dtype=numpy.float32)
+ *         if dark is not None:
+ *             do_dark = True             # <<<<<<<<<<<<<<
+ *             assert dark.size == size
+ *             cdark = numpy.ascontiguousarray(dark.ravel(), dtype=numpy.float32)
  */
-  __pyx_t_1 = PyTuple_New(7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_k_tuple_4)));
-  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_k_tuple_4)));
-  __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_k_tuple_4)));
-  __Pyx_INCREF(((PyObject *)Py_None));
-  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)Py_None));
-  __Pyx_GIVEREF(((PyObject *)Py_None));
-  __Pyx_INCREF(((PyObject *)Py_None));
-  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)Py_None));
-  __Pyx_GIVEREF(((PyObject *)Py_None));
-  __Pyx_INCREF(((PyObject *)Py_None));
-  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)Py_None));
-  __Pyx_GIVEREF(((PyObject *)Py_None));
-  __Pyx_INCREF(((PyObject *)Py_None));
-  PyTuple_SET_ITEM(__pyx_t_1, 4, ((PyObject *)Py_None));
-  __Pyx_GIVEREF(((PyObject *)Py_None));
-  __Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self)->__pyx_arg_allow_pos0_neg);
-  PyTuple_SET_ITEM(__pyx_t_1, 5, __Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self)->__pyx_arg_allow_pos0_neg);
-  __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self)->__pyx_arg_allow_pos0_neg);
-  __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_n_s__undefined)));
-  PyTuple_SET_ITEM(__pyx_t_1, 6, ((PyObject *)((PyObject*)__pyx_n_s__undefined)));
-  __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_n_s__undefined)));
-  __pyx_r = ((PyObject *)__pyx_t_1);
-  __pyx_t_1 = 0;
-  goto __pyx_L0;
+    __pyx_v_do_dark = 1;
 
-  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_AddTraceback("splitBBoxLUT.HistoBBox2d.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename);
-  __pyx_r = NULL;
-  __pyx_L0:;
-  __Pyx_XGIVEREF(__pyx_r);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
+    /* "splitBBoxLUT.pyx":344
+ *         if dark is not None:
+ *             do_dark = True
+ *             assert dark.size == size             # <<<<<<<<<<<<<<
+ *             cdark = numpy.ascontiguousarray(dark.ravel(), dtype=numpy.float32)
+ *         if solidAngle is not None:
+ */
+    #ifndef CYTHON_WITHOUT_ASSERTIONS
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_dark, __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_4 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    if (unlikely(!__pyx_t_11)) {
+      PyErr_SetNone(PyExc_AssertionError);
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    }
+    #endif
 
-/* Python wrapper */
-static PyObject *__pyx_pw_12splitBBoxLUT_11HistoBBox2d_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_12splitBBoxLUT_11HistoBBox2d_1__init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pw_12splitBBoxLUT_11HistoBBox2d_1__init__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pw_12splitBBoxLUT_11HistoBBox2d_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
-  PyObject *__pyx_v_self = 0;
-  PyObject *__pyx_v_pos0 = 0;
-  PyObject *__pyx_v_delta_pos0 = 0;
-  PyObject *__pyx_v_pos1 = 0;
-  PyObject *__pyx_v_delta_pos1 = 0;
-  PyObject *__pyx_v_bins = 0;
-  PyObject *__pyx_v_pos0Range = 0;
-  PyObject *__pyx_v_pos1Range = 0;
-  PyObject *__pyx_v_mask = 0;
-  PyObject *__pyx_v_mask_checksum = 0;
-  PyObject *__pyx_v_allow_pos0_neg = 0;
-  PyObject *__pyx_v_unit = 0;
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
-  {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__pos0,&__pyx_n_s__delta_pos0,&__pyx_n_s__pos1,&__pyx_n_s__delta_pos1,&__pyx_n_s__bins,&__pyx_n_s__pos0Range,&__pyx_n_s__pos1Range,&__pyx_n_s__mask,&__pyx_n_s__mask_checksum,&__pyx_n_s__allow_pos0_neg,&__pyx_n_s__unit,0};
-    PyObject* values[12] = {0,0,0,0,0,0,0,0,0,0,0,0};
-    __pyx_defaults1 *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self);
-    values[5] = ((PyObject *)((PyObject*)__pyx_k_tuple_4));
-    values[6] = ((PyObject *)((PyObject *)Py_None));
-    values[7] = ((PyObject *)((PyObject *)Py_None));
-    values[8] = ((PyObject *)((PyObject *)Py_None));
-    values[9] = ((PyObject *)((PyObject *)Py_None));
-    values[10] = __pyx_dynamic_args->__pyx_arg_allow_pos0_neg;
-    values[11] = ((PyObject *)((PyObject*)__pyx_n_s__undefined));
-    if (unlikely(__pyx_kwds)) {
-      Py_ssize_t kw_args;
-      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
-      switch (pos_args) {
-        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
-        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
-        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
-        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
-        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
-        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
-        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
-        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
-        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
-        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
-        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
-        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
-        case  0: break;
-        default: goto __pyx_L5_argtuple_error;
-      }
-      kw_args = PyDict_Size(__pyx_kwds);
-      switch (pos_args) {
-        case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
-        else goto __pyx_L5_argtuple_error;
-        case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos0)) != 0)) kw_args--;
-        else {
-          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 12, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-        }
-        case  2:
-        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__delta_pos0)) != 0)) kw_args--;
-        else {
-          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 12, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-        }
-        case  3:
-        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos1)) != 0)) kw_args--;
-        else {
-          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 12, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-        }
-        case  4:
-        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__delta_pos1)) != 0)) kw_args--;
-        else {
-          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 12, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-        }
-        case  5:
-        if (kw_args > 0) {
-          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bins);
-          if (value) { values[5] = value; kw_args--; }
-        }
-        case  6:
-        if (kw_args > 0) {
-          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos0Range);
-          if (value) { values[6] = value; kw_args--; }
-        }
-        case  7:
-        if (kw_args > 0) {
-          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos1Range);
-          if (value) { values[7] = value; kw_args--; }
-        }
-        case  8:
-        if (kw_args > 0) {
-          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mask);
-          if (value) { values[8] = value; kw_args--; }
-        }
-        case  9:
-        if (kw_args > 0) {
-          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mask_checksum);
-          if (value) { values[9] = value; kw_args--; }
-        }
-        case 10:
-        if (kw_args > 0) {
-          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__allow_pos0_neg);
-          if (value) { values[10] = value; kw_args--; }
-        }
-        case 11:
-        if (kw_args > 0) {
-          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__unit);
-          if (value) { values[11] = value; kw_args--; }
-        }
-      }
-      if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-      }
-    } else {
-      switch (PyTuple_GET_SIZE(__pyx_args)) {
-        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
-        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
-        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
-        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
-        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
-        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
-        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
-        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
-        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
-        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
-        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
-        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
-        break;
-        default: goto __pyx_L5_argtuple_error;
-      }
-    }
-    __pyx_v_self = values[0];
-    __pyx_v_pos0 = values[1];
-    __pyx_v_delta_pos0 = values[2];
-    __pyx_v_pos1 = values[3];
-    __pyx_v_delta_pos1 = values[4];
-    __pyx_v_bins = values[5];
-    __pyx_v_pos0Range = values[6];
-    __pyx_v_pos1Range = values[7];
-    __pyx_v_mask = values[8];
-    __pyx_v_mask_checksum = values[9];
-    __pyx_v_allow_pos0_neg = values[10];
-    __pyx_v_unit = values[11];
+    /* "splitBBoxLUT.pyx":345
+ *             do_dark = True
+ *             assert dark.size == size
+ *             cdark = numpy.ascontiguousarray(dark.ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
+ *         if solidAngle is not None:
+ *             do_solidAngle = True
+ */
+    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_dark, __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __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 = 345; __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 = 345; __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 = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__float32); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+    __pyx_t_14 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_6);
+    if (unlikely(!__pyx_t_14.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __pyx_v_cdark = __pyx_t_14;
+    __pyx_t_14.memview = NULL;
+    __pyx_t_14.data = NULL;
+    goto __pyx_L6;
   }
-  goto __pyx_L4_argument_unpacking_done;
-  __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 12, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-  __pyx_L3_error:;
-  __Pyx_AddTraceback("splitBBoxLUT.HistoBBox2d.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
-  __Pyx_RefNannyFinishContext();
-  return NULL;
-  __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_12splitBBoxLUT_11HistoBBox2d___init__(__pyx_self, __pyx_v_self, __pyx_v_pos0, __pyx_v_delta_pos0, __pyx_v_pos1, __pyx_v_delta_pos1, __pyx_v_bins, __pyx_v_pos0Range, __pyx_v_pos1Range, __pyx_v_mask, __pyx_v_mask_checksum, __pyx_v_allow_pos0_neg, __pyx_v_unit);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
+  __pyx_L6:;
 
-/* "splitBBoxLUT.pyx":390
- * class HistoBBox2d(object):
- *     @cython.boundscheck(False)
- *     def __init__(self,             # <<<<<<<<<<<<<<
- *                  pos0,
- *                  delta_pos0,
+  /* "splitBBoxLUT.pyx":346
+ *             assert dark.size == size
+ *             cdark = numpy.ascontiguousarray(dark.ravel(), dtype=numpy.float32)
+ *         if solidAngle is not None:             # <<<<<<<<<<<<<<
+ *             do_solidAngle = True
+ *             assert solidAngle.size == size
  */
+  __pyx_t_11 = (__pyx_v_solidAngle != Py_None);
+  __pyx_t_12 = (__pyx_t_11 != 0);
+  if (__pyx_t_12) {
 
-static PyObject *__pyx_pf_12splitBBoxLUT_11HistoBBox2d___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_pos0, PyObject *__pyx_v_delta_pos0, PyObject *__pyx_v_pos1, PyObject *__pyx_v_delta_pos1, PyObject *__pyx_v_bins, PyObject *__pyx_v_pos0Range, PyObject *__pyx_v_pos1Range, PyObject *__pyx_v_mask, PyObject *__pyx_v_mask_checksum, PyObject *__pyx_v_allow_pos0_neg, PyObject *__pyx_v_unit) {
-  PyObject *__pyx_v_bins0 = NULL;
-  PyObject *__pyx_v_bins1 = NULL;
-  PyObject *__pyx_v_pos0_maxin = NULL;
-  PyObject *__pyx_v_pos1_maxin = NULL;
-  PyObject *__pyx_r = NULL;
-  __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
-  PyObject *__pyx_t_2 = NULL;
-  PyObject *__pyx_t_3 = NULL;
-  int __pyx_t_4;
-  PyObject *__pyx_t_5 = NULL;
-  PyObject *__pyx_t_6 = NULL;
-  PyObject *__pyx_t_7 = NULL;
-  PyObject *__pyx_t_8 = NULL;
-  PyObject *(*__pyx_t_9)(PyObject *);
-  PyObject *__pyx_t_10 = NULL;
-  Py_ssize_t __pyx_t_11;
-  int __pyx_t_12;
-  int __pyx_t_13;
-  double __pyx_t_14;
-  int __pyx_lineno = 0;
-  const char *__pyx_filename = NULL;
-  int __pyx_clineno = 0;
-  __Pyx_RefNannySetupContext("__init__", 0);
-
-  /* "splitBBoxLUT.pyx":404
- * 
- *         cdef int i, size, bin0, bin1
- *         self.size = pos0.size             # <<<<<<<<<<<<<<
- *         assert delta_pos0.size == self.size
- *         assert pos1.size == self.size
+    /* "splitBBoxLUT.pyx":347
+ *             cdark = numpy.ascontiguousarray(dark.ravel(), dtype=numpy.float32)
+ *         if solidAngle is not None:
+ *             do_solidAngle = True             # <<<<<<<<<<<<<<
+ *             assert solidAngle.size == size
+ *             csolidAngle = numpy.ascontiguousarray(solidAngle.ravel(), dtype=numpy.float32)
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_pos0, __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__size, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_v_do_solidAngle = 1;
 
-  /* "splitBBoxLUT.pyx":405
- *         cdef int i, size, bin0, bin1
- *         self.size = pos0.size
- *         assert delta_pos0.size == self.size             # <<<<<<<<<<<<<<
- *         assert pos1.size == self.size
- *         assert delta_pos1.size == self.size
+    /* "splitBBoxLUT.pyx":348
+ *         if solidAngle is not None:
+ *             do_solidAngle = True
+ *             assert solidAngle.size == size             # <<<<<<<<<<<<<<
+ *             csolidAngle = numpy.ascontiguousarray(solidAngle.ravel(), dtype=numpy.float32)
+ *         if polarization is not None:
  */
-  #ifndef CYTHON_WITHOUT_ASSERTIONS
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_delta_pos0, __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __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 = 405; __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 = 405; __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 = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  }
-  #endif
+    #ifndef CYTHON_WITHOUT_ASSERTIONS
+    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_solidAngle, __pyx_n_s__size); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __pyx_t_1 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_3 = PyObject_RichCompare(__pyx_t_6, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    if (unlikely(!__pyx_t_12)) {
+      PyErr_SetNone(PyExc_AssertionError);
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    }
+    #endif
 
-  /* "splitBBoxLUT.pyx":406
- *         self.size = pos0.size
- *         assert delta_pos0.size == self.size
- *         assert pos1.size == self.size             # <<<<<<<<<<<<<<
- *         assert delta_pos1.size == self.size
- * 
+    /* "splitBBoxLUT.pyx":349
+ *             do_solidAngle = True
+ *             assert solidAngle.size == size
+ *             csolidAngle = numpy.ascontiguousarray(solidAngle.ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
+ *         if polarization is not None:
+ *             do_polarization = True
  */
-  #ifndef CYTHON_WITHOUT_ASSERTIONS
-  __pyx_t_3 = PyObject_GetAttr(__pyx_v_pos1, __pyx_n_s__size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __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 = 406; __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 = 406; __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 = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_solidAngle, __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __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 = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    PyTuple_SET_ITEM(__pyx_t_3, 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 = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
+    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__float32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+    __pyx_t_14 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_5);
+    if (unlikely(!__pyx_t_14.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __pyx_v_csolidAngle = __pyx_t_14;
+    __pyx_t_14.memview = NULL;
+    __pyx_t_14.data = NULL;
+    goto __pyx_L7;
   }
-  #endif
+  __pyx_L7:;
 
-  /* "splitBBoxLUT.pyx":407
- *         assert delta_pos0.size == self.size
- *         assert pos1.size == self.size
- *         assert delta_pos1.size == self.size             # <<<<<<<<<<<<<<
- * 
- *         try:
+  /* "splitBBoxLUT.pyx":350
+ *             assert solidAngle.size == size
+ *             csolidAngle = numpy.ascontiguousarray(solidAngle.ravel(), dtype=numpy.float32)
+ *         if polarization is not None:             # <<<<<<<<<<<<<<
+ *             do_polarization = True
+ *             assert polarization.size == size
  */
-  #ifndef CYTHON_WITHOUT_ASSERTIONS
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_delta_pos1, __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __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 = 407; __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 = 407; __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 = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  }
-  #endif
+  __pyx_t_12 = (__pyx_v_polarization != Py_None);
+  __pyx_t_11 = (__pyx_t_12 != 0);
+  if (__pyx_t_11) {
 
-  /* "splitBBoxLUT.pyx":409
- *         assert delta_pos1.size == self.size
- * 
- *         try:             # <<<<<<<<<<<<<<
- *             bins0, bins1 = tuple(bins)
- *         except:
+    /* "splitBBoxLUT.pyx":351
+ *             csolidAngle = numpy.ascontiguousarray(solidAngle.ravel(), dtype=numpy.float32)
+ *         if polarization is not None:
+ *             do_polarization = True             # <<<<<<<<<<<<<<
+ *             assert polarization.size == size
+ *             cpolarization = numpy.ascontiguousarray(polarization.ravel(), dtype=numpy.float32)
  */
-  {
-    __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
-    __Pyx_XGOTREF(__pyx_t_5);
-    __Pyx_XGOTREF(__pyx_t_6);
-    __Pyx_XGOTREF(__pyx_t_7);
-    /*try:*/ {
+    __pyx_v_do_polarization = 1;
 
-      /* "splitBBoxLUT.pyx":410
+    /* "splitBBoxLUT.pyx":352
+ *         if polarization is not None:
+ *             do_polarization = True
+ *             assert polarization.size == size             # <<<<<<<<<<<<<<
+ *             cpolarization = numpy.ascontiguousarray(polarization.ravel(), dtype=numpy.float32)
  * 
- *         try:
- *             bins0, bins1 = tuple(bins)             # <<<<<<<<<<<<<<
- *         except:
- *             bins0 = bins1 = bins
  */
-      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __Pyx_INCREF(__pyx_v_bins);
-      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_bins);
-      __Pyx_GIVEREF(__pyx_v_bins);
-      __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 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 = 410; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-        }
-        #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
-        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
-        __Pyx_INCREF(__pyx_t_3);
-        __Pyx_INCREF(__pyx_t_1);
-        #else
-        __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-        __Pyx_GOTREF(__pyx_t_3);
-        __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-        __Pyx_GOTREF(__pyx_t_1);
-        #endif
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      } else if (1) {
-        __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-      } else
-      {
-        Py_ssize_t index = -1;
-        __pyx_t_8 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-        __Pyx_GOTREF(__pyx_t_8);
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-        __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
-        index = 0; __pyx_t_3 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_3)) goto __pyx_L11_unpacking_failed;
-        __Pyx_GOTREF(__pyx_t_3);
-        index = 1; __pyx_t_1 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_1)) goto __pyx_L11_unpacking_failed;
-        __Pyx_GOTREF(__pyx_t_1);
-        if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-        __pyx_t_9 = NULL;
-        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-        goto __pyx_L12_unpacking_done;
-        __pyx_L11_unpacking_failed:;
-        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-        __pyx_t_9 = NULL;
-        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
-        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-        __pyx_L12_unpacking_done:;
-      }
-      __pyx_v_bins0 = __pyx_t_3;
-      __pyx_t_3 = 0;
-      __pyx_v_bins1 = __pyx_t_1;
-      __pyx_t_1 = 0;
+    #ifndef CYTHON_WITHOUT_ASSERTIONS
+    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_polarization, __pyx_n_s__size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    __pyx_t_6 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    if (unlikely(!__pyx_t_11)) {
+      PyErr_SetNone(PyExc_AssertionError);
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
-    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
-    goto __pyx_L10_try_end;
-    __pyx_L3_error:;
-    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
-    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
-
-    /* "splitBBoxLUT.pyx":411
- *         try:
- *             bins0, bins1 = tuple(bins)
- *         except:             # <<<<<<<<<<<<<<
- *             bins0 = bins1 = bins
- *         if bins0 <= 0:
- */
-    /*except:*/ {
-      __Pyx_AddTraceback("splitBBoxLUT.HistoBBox2d.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
-      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_GOTREF(__pyx_t_3);
+    #endif
 
-      /* "splitBBoxLUT.pyx":412
- *             bins0, bins1 = tuple(bins)
- *         except:
- *             bins0 = bins1 = bins             # <<<<<<<<<<<<<<
- *         if bins0 <= 0:
- *             bins0 = 1
+    /* "splitBBoxLUT.pyx":353
+ *             do_polarization = True
+ *             assert polarization.size == size
+ *             cpolarization = numpy.ascontiguousarray(polarization.ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
+ * 
+ *         if (do_dark + do_flat + do_polarization + do_solidAngle):
  */
-      __Pyx_INCREF(__pyx_v_bins);
-      __Pyx_XDECREF(__pyx_v_bins0);
-      __pyx_v_bins0 = __pyx_v_bins;
-      __Pyx_INCREF(__pyx_v_bins);
-      __Pyx_XDECREF(__pyx_v_bins1);
-      __pyx_v_bins1 = __pyx_v_bins;
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      goto __pyx_L4_exception_handled;
-    }
-    __pyx_L5_except_error:;
-    __Pyx_XGIVEREF(__pyx_t_5);
-    __Pyx_XGIVEREF(__pyx_t_6);
-    __Pyx_XGIVEREF(__pyx_t_7);
-    __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
-    goto __pyx_L1_error;
-    __pyx_L4_exception_handled:;
-    __Pyx_XGIVEREF(__pyx_t_5);
-    __Pyx_XGIVEREF(__pyx_t_6);
-    __Pyx_XGIVEREF(__pyx_t_7);
-    __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
-    __pyx_L10_try_end:;
+    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_polarization, __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    __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 = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
+    __Pyx_GIVEREF(__pyx_t_5);
+    __pyx_t_5 = 0;
+    __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__float32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_t_4 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+    __pyx_t_14 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_4);
+    if (unlikely(!__pyx_t_14.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_v_cpolarization = __pyx_t_14;
+    __pyx_t_14.memview = NULL;
+    __pyx_t_14.data = NULL;
+    goto __pyx_L8;
   }
+  __pyx_L8:;
 
-  /* "splitBBoxLUT.pyx":413
- *         except:
- *             bins0 = bins1 = bins
- *         if bins0 <= 0:             # <<<<<<<<<<<<<<
- *             bins0 = 1
- *         if bins1 <= 0:
- */
-  __pyx_t_3 = PyObject_RichCompare(__pyx_v_bins0, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (__pyx_t_4) {
-
-    /* "splitBBoxLUT.pyx":414
- *             bins0 = bins1 = bins
- *         if bins0 <= 0:
- *             bins0 = 1             # <<<<<<<<<<<<<<
- *         if bins1 <= 0:
- *             bins1 = 1
+  /* "splitBBoxLUT.pyx":355
+ *             cpolarization = numpy.ascontiguousarray(polarization.ravel(), dtype=numpy.float32)
+ * 
+ *         if (do_dark + do_flat + do_polarization + do_solidAngle):             # <<<<<<<<<<<<<<
+ *             tdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)
+ *             cdata = numpy.zeros(size,dtype=numpy.float32)
  */
-    __Pyx_INCREF(__pyx_int_1);
-    __Pyx_DECREF(__pyx_v_bins0);
-    __pyx_v_bins0 = __pyx_int_1;
-    goto __pyx_L15;
-  }
-  __pyx_L15:;
+  __pyx_t_11 = ((((__pyx_v_do_dark + __pyx_v_do_flat) + __pyx_v_do_polarization) + __pyx_v_do_solidAngle) != 0);
+  if (__pyx_t_11) {
 
-  /* "splitBBoxLUT.pyx":415
- *         if bins0 <= 0:
- *             bins0 = 1
- *         if bins1 <= 0:             # <<<<<<<<<<<<<<
- *             bins1 = 1
- *         self.bins = (int(bins0),int(bins1))
+    /* "splitBBoxLUT.pyx":356
+ * 
+ *         if (do_dark + do_flat + do_polarization + do_solidAngle):
+ *             tdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
+ *             cdata = numpy.zeros(size,dtype=numpy.float32)
+ *             if do_dummy:
  */
-  __pyx_t_3 = PyObject_RichCompare(__pyx_v_bins1, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (__pyx_t_4) {
+    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_weights, __pyx_n_s__ravel); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
+    __Pyx_GIVEREF(__pyx_t_3);
+    __pyx_t_3 = 0;
+    __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+    __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s__float32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+    __pyx_t_14 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_1);
+    if (unlikely(!__pyx_t_14.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_v_tdata = __pyx_t_14;
+    __pyx_t_14.memview = NULL;
+    __pyx_t_14.data = NULL;
 
-    /* "splitBBoxLUT.pyx":416
- *             bins0 = 1
- *         if bins1 <= 0:
- *             bins1 = 1             # <<<<<<<<<<<<<<
- *         self.bins = (int(bins0),int(bins1))
- *         self.lut_size = 0
+    /* "splitBBoxLUT.pyx":357
+ *         if (do_dark + do_flat + do_polarization + do_solidAngle):
+ *             tdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)
+ *             cdata = numpy.zeros(size,dtype=numpy.float32)             # <<<<<<<<<<<<<<
+ *             if do_dummy:
+ *                 for i in prange(size, nogil=True, schedule="static"):
  */
-    __Pyx_INCREF(__pyx_int_1);
-    __Pyx_DECREF(__pyx_v_bins1);
-    __pyx_v_bins1 = __pyx_int_1;
-    goto __pyx_L16;
-  }
-  __pyx_L16:;
+    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_1 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
+    __Pyx_GIVEREF(__pyx_t_1);
+    __pyx_t_1 = 0;
+    __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__float32); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+    __pyx_t_14 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_6);
+    if (unlikely(!__pyx_t_14.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __pyx_v_cdata = __pyx_t_14;
+    __pyx_t_14.memview = NULL;
+    __pyx_t_14.data = NULL;
 
-  /* "splitBBoxLUT.pyx":417
- *         if bins1 <= 0:
- *             bins1 = 1
- *         self.bins = (int(bins0),int(bins1))             # <<<<<<<<<<<<<<
- *         self.lut_size = 0
- *         self.cpos0 = numpy.ascontiguousarray(pos0.ravel(), dtype=numpy.float32)
+    /* "splitBBoxLUT.pyx":358
+ *             tdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)
+ *             cdata = numpy.zeros(size,dtype=numpy.float32)
+ *             if do_dummy:             # <<<<<<<<<<<<<<
+ *                 for i in prange(size, nogil=True, schedule="static"):
+ *                     data = tdata[i]
  */
-  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_INCREF(__pyx_v_bins0);
-  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_bins0);
-  __Pyx_GIVEREF(__pyx_v_bins0);
-  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_INCREF(__pyx_v_bins1);
-  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_bins1);
-  __Pyx_GIVEREF(__pyx_v_bins1);
-  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __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);
-  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
-  __Pyx_GIVEREF(__pyx_t_2);
-  __pyx_t_1 = 0;
-  __pyx_t_2 = 0;
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__bins, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+    __pyx_t_11 = (__pyx_v_do_dummy != 0);
+    if (__pyx_t_11) {
 
-  /* "splitBBoxLUT.pyx":418
- *             bins1 = 1
- *         self.bins = (int(bins0),int(bins1))
- *         self.lut_size = 0             # <<<<<<<<<<<<<<
- *         self.cpos0 = numpy.ascontiguousarray(pos0.ravel(), dtype=numpy.float32)
- *         self.dpos0 = numpy.ascontiguousarray(delta_pos0.ravel(), dtype=numpy.float32)
+      /* "splitBBoxLUT.pyx":359
+ *             cdata = numpy.zeros(size,dtype=numpy.float32)
+ *             if do_dummy:
+ *                 for i in prange(size, nogil=True, schedule="static"):             # <<<<<<<<<<<<<<
+ *                     data = tdata[i]
+ *                     if ((cddummy!=0) and (fabs(data-cdummy) > cddummy)) or ((cddummy==0) and (data!=cdummy)):
  */
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__lut_size, __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
-  /* "splitBBoxLUT.pyx":419
- *         self.bins = (int(bins0),int(bins1))
- *         self.lut_size = 0
- *         self.cpos0 = numpy.ascontiguousarray(pos0.ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
- *         self.dpos0 = numpy.ascontiguousarray(delta_pos0.ravel(), dtype=numpy.float32)
- *         self.cpos0_sup = self.cpos0 + self.dpos0
- */
-  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = PyObject_GetAttr(__pyx_v_pos0, __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __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 = 419; __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 = 419; __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 = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_8);
-  __pyx_t_10 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__float32); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_10);
-  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-  __pyx_t_10 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_10);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__cpos0, __pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+      {
+          #ifdef WITH_THREAD
+          PyThreadState *_save;
+          Py_UNBLOCK_THREADS
+          #endif
+          /*try:*/ {
+            __pyx_t_2 = __pyx_v_size;
+            if (1 == 0) abort();
+            {
+                float __pyx_parallel_temp0 = __PYX_NAN();
+                int __pyx_parallel_temp1 = 0xbad0bad0;
+                const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0;
+                PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL;
+                int __pyx_parallel_why;
+                __pyx_parallel_why = 0;
+                #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_16 = (__pyx_t_2 - 0) / 1;
+                if (__pyx_t_16 > 0)
+                {
+                    #ifdef _OPENMP
+                    #pragma omp parallel private(__pyx_t_18, __pyx_t_23, __pyx_t_17, __pyx_t_20, __pyx_t_12, __pyx_t_24, __pyx_t_11, __pyx_t_21, __pyx_t_25, __pyx_t_19, __pyx_t_22) private(__pyx_filename, __pyx_lineno, __pyx_clineno) shared(__pyx_parallel_why, __pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb)
+                    #endif /* _OPENMP */
+                    {
+                        #ifdef _OPENMP
+                        #ifdef WITH_THREAD
+                        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+                        #endif
+                        Py_BEGIN_ALLOW_THREADS
+                        #endif /* _OPENMP */
+                        #ifdef _OPENMP
+                        #pragma omp for lastprivate(__pyx_v_data) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) schedule(static)
+                        #endif /* _OPENMP */
+                        for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_16; __pyx_t_15++){
+                            if (__pyx_parallel_why < 2)
+                            {
+                                __pyx_v_i = 0 + 1 * __pyx_t_15;
+                                /* Initialize private variables to invalid values */
+                                __pyx_v_data = ((float)__PYX_NAN());
 
-  /* "splitBBoxLUT.pyx":420
- *         self.lut_size = 0
- *         self.cpos0 = numpy.ascontiguousarray(pos0.ravel(), dtype=numpy.float32)
- *         self.dpos0 = numpy.ascontiguousarray(delta_pos0.ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
- *         self.cpos0_sup = self.cpos0 + self.dpos0
- *         self.cpos0_inf = self.cpos0 - self.dpos0
+                                /* "splitBBoxLUT.pyx":360
+ *             if do_dummy:
+ *                 for i in prange(size, nogil=True, schedule="static"):
+ *                     data = tdata[i]             # <<<<<<<<<<<<<<
+ *                     if ((cddummy!=0) and (fabs(data-cdummy) > cddummy)) or ((cddummy==0) and (data!=cdummy)):
+ *                         #Nota: -= and /= operatore are seen as reduction in cython parallel.
  */
-  __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_10);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-  __pyx_t_10 = PyObject_GetAttr(__pyx_v_delta_pos0, __pyx_n_s__ravel); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_10);
-  __pyx_t_3 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-  __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_10);
-  PyTuple_SET_ITEM(__pyx_t_10, 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 = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_8 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__float32); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_8);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-  __pyx_t_8 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_10), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_8);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__dpos0, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+                                __pyx_t_17 = __pyx_v_i;
+                                __pyx_v_data = (*((float *) ( /* dim=0 */ (__pyx_v_tdata.data + __pyx_t_17 * __pyx_v_tdata.strides[0]) )));
 
-  /* "splitBBoxLUT.pyx":421
- *         self.cpos0 = numpy.ascontiguousarray(pos0.ravel(), dtype=numpy.float32)
- *         self.dpos0 = numpy.ascontiguousarray(delta_pos0.ravel(), dtype=numpy.float32)
- *         self.cpos0_sup = self.cpos0 + self.dpos0             # <<<<<<<<<<<<<<
- *         self.cpos0_inf = self.cpos0 - self.dpos0
- *         self.pos0Range = pos0Range
+                                /* "splitBBoxLUT.pyx":361
+ *                 for i in prange(size, nogil=True, schedule="static"):
+ *                     data = tdata[i]
+ *                     if ((cddummy!=0) and (fabs(data-cdummy) > cddummy)) or ((cddummy==0) and (data!=cdummy)):             # <<<<<<<<<<<<<<
+ *                         #Nota: -= and /= operatore are seen as reduction in cython parallel.
+ *                         if do_dark:
  */
-  __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__cpos0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_8);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__dpos0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_10 = PyNumber_Add(__pyx_t_8, __pyx_t_3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_10);
-  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__cpos0_sup, __pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+                                __pyx_t_11 = ((__pyx_v_cddummy != 0.0) != 0);
+                                if (__pyx_t_11) {
+                                  __pyx_t_12 = ((fabs((__pyx_v_data - __pyx_v_cdummy)) > __pyx_v_cddummy) != 0);
+                                  __pyx_t_18 = __pyx_t_12;
+                                } else {
+                                  __pyx_t_18 = __pyx_t_11;
+                                }
+                                if (!__pyx_t_18) {
+                                  __pyx_t_11 = ((__pyx_v_cddummy == 0.0) != 0);
+                                  if (__pyx_t_11) {
+                                    __pyx_t_12 = ((__pyx_v_data != __pyx_v_cdummy) != 0);
+                                    __pyx_t_19 = __pyx_t_12;
+                                  } else {
+                                    __pyx_t_19 = __pyx_t_11;
+                                  }
+                                  __pyx_t_11 = __pyx_t_19;
+                                } else {
+                                  __pyx_t_11 = __pyx_t_18;
+                                }
+                                if (__pyx_t_11) {
 
-  /* "splitBBoxLUT.pyx":422
- *         self.dpos0 = numpy.ascontiguousarray(delta_pos0.ravel(), dtype=numpy.float32)
- *         self.cpos0_sup = self.cpos0 + self.dpos0
- *         self.cpos0_inf = self.cpos0 - self.dpos0             # <<<<<<<<<<<<<<
- *         self.pos0Range = pos0Range
- *         self.pos1Range = pos1Range
+                                  /* "splitBBoxLUT.pyx":363
+ *                     if ((cddummy!=0) and (fabs(data-cdummy) > cddummy)) or ((cddummy==0) and (data!=cdummy)):
+ *                         #Nota: -= and /= operatore are seen as reduction in cython parallel.
+ *                         if do_dark:             # <<<<<<<<<<<<<<
+ *                             data = data - cdark[i]
+ *                         if do_flat:
  */
-  __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__cpos0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_10);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__dpos0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_8 = PyNumber_Subtract(__pyx_t_10, __pyx_t_3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_8);
-  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__cpos0_inf, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+                                  __pyx_t_11 = (__pyx_v_do_dark != 0);
+                                  if (__pyx_t_11) {
 
-  /* "splitBBoxLUT.pyx":423
- *         self.cpos0_sup = self.cpos0 + self.dpos0
- *         self.cpos0_inf = self.cpos0 - self.dpos0
- *         self.pos0Range = pos0Range             # <<<<<<<<<<<<<<
- *         self.pos1Range = pos1Range
- *         if pos0Range is not None and len(pos0Range) > 1:
+                                    /* "splitBBoxLUT.pyx":364
+ *                         #Nota: -= and /= operatore are seen as reduction in cython parallel.
+ *                         if do_dark:
+ *                             data = data - cdark[i]             # <<<<<<<<<<<<<<
+ *                         if do_flat:
+ *                             data = data / cflat[i]
  */
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__pos0Range, __pyx_v_pos0Range) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+                                    if (unlikely(!__pyx_v_cdark.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cdark"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L16_error;} }
+                                    __pyx_t_20 = __pyx_v_i;
+                                    __pyx_v_data = (__pyx_v_data - (*((float *) ( /* dim=0 */ (__pyx_v_cdark.data + __pyx_t_20 * __pyx_v_cdark.strides[0]) ))));
+                                    goto __pyx_L19;
+                                  }
+                                  __pyx_L19:;
 
-  /* "splitBBoxLUT.pyx":424
- *         self.cpos0_inf = self.cpos0 - self.dpos0
- *         self.pos0Range = pos0Range
- *         self.pos1Range = pos1Range             # <<<<<<<<<<<<<<
- *         if pos0Range is not None and len(pos0Range) > 1:
- *             self.pos0_min = min(pos0Range)
+                                  /* "splitBBoxLUT.pyx":365
+ *                         if do_dark:
+ *                             data = data - cdark[i]
+ *                         if do_flat:             # <<<<<<<<<<<<<<
+ *                             data = data / cflat[i]
+ *                         if do_polarization:
  */
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__pos1Range, __pyx_v_pos1Range) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+                                  __pyx_t_11 = (__pyx_v_do_flat != 0);
+                                  if (__pyx_t_11) {
 
-  /* "splitBBoxLUT.pyx":425
- *         self.pos0Range = pos0Range
- *         self.pos1Range = pos1Range
- *         if pos0Range is not None and len(pos0Range) > 1:             # <<<<<<<<<<<<<<
- *             self.pos0_min = min(pos0Range)
- *             pos0_maxin = max(pos0Range)
+                                    /* "splitBBoxLUT.pyx":366
+ *                             data = data - cdark[i]
+ *                         if do_flat:
+ *                             data = data / cflat[i]             # <<<<<<<<<<<<<<
+ *                         if do_polarization:
+ *                             data = data / cpolarization[i]
  */
-  __pyx_t_4 = (__pyx_v_pos0Range != Py_None);
-  if (__pyx_t_4) {
-    __pyx_t_11 = PyObject_Length(__pyx_v_pos0Range); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_12 = (__pyx_t_11 > 1);
-    __pyx_t_13 = __pyx_t_12;
-  } else {
-    __pyx_t_13 = __pyx_t_4;
-  }
-  if (__pyx_t_13) {
+                                    if (unlikely(!__pyx_v_cflat.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cflat"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L16_error;} }
+                                    __pyx_t_21 = __pyx_v_i;
+                                    __pyx_v_data = (__pyx_v_data / (*((float *) ( /* dim=0 */ (__pyx_v_cflat.data + __pyx_t_21 * __pyx_v_cflat.strides[0]) ))));
+                                    goto __pyx_L20;
+                                  }
+                                  __pyx_L20:;
 
-    /* "splitBBoxLUT.pyx":426
- *         self.pos1Range = pos1Range
- *         if pos0Range is not None and len(pos0Range) > 1:
- *             self.pos0_min = min(pos0Range)             # <<<<<<<<<<<<<<
- *             pos0_maxin = max(pos0Range)
- *         else:
+                                  /* "splitBBoxLUT.pyx":367
+ *                         if do_flat:
+ *                             data = data / cflat[i]
+ *                         if do_polarization:             # <<<<<<<<<<<<<<
+ *                             data = data / cpolarization[i]
+ *                         if do_solidAngle:
  */
-    __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_8);
-    __Pyx_INCREF(__pyx_v_pos0Range);
-    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_pos0Range);
-    __Pyx_GIVEREF(__pyx_v_pos0Range);
-    __pyx_t_3 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
-    if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__pos0_min, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+                                  __pyx_t_11 = (__pyx_v_do_polarization != 0);
+                                  if (__pyx_t_11) {
 
-    /* "splitBBoxLUT.pyx":427
- *         if pos0Range is not None and len(pos0Range) > 1:
- *             self.pos0_min = min(pos0Range)
- *             pos0_maxin = max(pos0Range)             # <<<<<<<<<<<<<<
- *         else:
- *             self.pos0_min = (self.cpos0_inf).min()
+                                    /* "splitBBoxLUT.pyx":368
+ *                             data = data / cflat[i]
+ *                         if do_polarization:
+ *                             data = data / cpolarization[i]             # <<<<<<<<<<<<<<
+ *                         if do_solidAngle:
+ *                             data = data / csolidAngle[i]
  */
-    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_INCREF(__pyx_v_pos0Range);
-    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_pos0Range);
-    __Pyx_GIVEREF(__pyx_v_pos0Range);
-    __pyx_t_8 = PyObject_Call(__pyx_builtin_max, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_8);
-    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-    __pyx_v_pos0_maxin = __pyx_t_8;
-    __pyx_t_8 = 0;
-    goto __pyx_L17;
-  }
-  /*else*/ {
+                                    if (unlikely(!__pyx_v_cpolarization.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cpolarization"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L16_error;} }
+                                    __pyx_t_22 = __pyx_v_i;
+                                    __pyx_v_data = (__pyx_v_data / (*((float *) ( /* dim=0 */ (__pyx_v_cpolarization.data + __pyx_t_22 * __pyx_v_cpolarization.strides[0]) ))));
+                                    goto __pyx_L21;
+                                  }
+                                  __pyx_L21:;
 
-    /* "splitBBoxLUT.pyx":429
- *             pos0_maxin = max(pos0Range)
- *         else:
- *             self.pos0_min = (self.cpos0_inf).min()             # <<<<<<<<<<<<<<
- *             pos0_maxin = (self.cpos0_sup).max()
- *         if (not allow_pos0_neg) and self.pos0_min < 0:
+                                  /* "splitBBoxLUT.pyx":369
+ *                         if do_polarization:
+ *                             data = data / cpolarization[i]
+ *                         if do_solidAngle:             # <<<<<<<<<<<<<<
+ *                             data = data / csolidAngle[i]
+ *                         cdata[i]+=data
  */
-    __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__cpos0_inf); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_8);
-    __pyx_t_3 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__min); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-    __pyx_t_8 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_8);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__pos0_min, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+                                  __pyx_t_11 = (__pyx_v_do_solidAngle != 0);
+                                  if (__pyx_t_11) {
 
-    /* "splitBBoxLUT.pyx":430
- *         else:
- *             self.pos0_min = (self.cpos0_inf).min()
- *             pos0_maxin = (self.cpos0_sup).max()             # <<<<<<<<<<<<<<
- *         if (not allow_pos0_neg) and self.pos0_min < 0:
- *             self.pos0_min = 0
+                                    /* "splitBBoxLUT.pyx":370
+ *                             data = data / cpolarization[i]
+ *                         if do_solidAngle:
+ *                             data = data / csolidAngle[i]             # <<<<<<<<<<<<<<
+ *                         cdata[i]+=data
+ *                     else: #set all dummy_like values to cdummy. simplifies further processing
  */
-    __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__cpos0_sup); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_8);
-    __pyx_t_3 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__max); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-    __pyx_t_8 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_8);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_v_pos0_maxin = __pyx_t_8;
-    __pyx_t_8 = 0;
-  }
-  __pyx_L17:;
+                                    if (unlikely(!__pyx_v_csolidAngle.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("csolidAngle"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L16_error;} }
+                                    __pyx_t_23 = __pyx_v_i;
+                                    __pyx_v_data = (__pyx_v_data / (*((float *) ( /* dim=0 */ (__pyx_v_csolidAngle.data + __pyx_t_23 * __pyx_v_csolidAngle.strides[0]) ))));
+                                    goto __pyx_L22;
+                                  }
+                                  __pyx_L22:;
 
-  /* "splitBBoxLUT.pyx":431
- *             self.pos0_min = (self.cpos0_inf).min()
- *             pos0_maxin = (self.cpos0_sup).max()
- *         if (not allow_pos0_neg) and self.pos0_min < 0:             # <<<<<<<<<<<<<<
- *             self.pos0_min = 0
- *         self.pos0_max = pos0_maxin * EPS32
+                                  /* "splitBBoxLUT.pyx":371
+ *                         if do_solidAngle:
+ *                             data = data / csolidAngle[i]
+ *                         cdata[i]+=data             # <<<<<<<<<<<<<<
+ *                     else: #set all dummy_like values to cdummy. simplifies further processing
+ *                         cdata[i]+=cdummy
  */
-  __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_v_allow_pos0_neg); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_4 = (!__pyx_t_13);
-  if (__pyx_t_4) {
-    __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pos0_min); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_8);
-    __pyx_t_3 = PyObject_RichCompare(__pyx_t_8, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-    __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_12 = __pyx_t_13;
-  } else {
-    __pyx_t_12 = __pyx_t_4;
-  }
-  if (__pyx_t_12) {
+                                  __pyx_t_24 = __pyx_v_i;
+                                  *((float *) ( /* dim=0 */ (__pyx_v_cdata.data + __pyx_t_24 * __pyx_v_cdata.strides[0]) )) += __pyx_v_data;
+                                  goto __pyx_L18;
+                                }
+                                /*else*/ {
 
-    /* "splitBBoxLUT.pyx":432
- *             pos0_maxin = (self.cpos0_sup).max()
- *         if (not allow_pos0_neg) and self.pos0_min < 0:
- *             self.pos0_min = 0             # <<<<<<<<<<<<<<
- *         self.pos0_max = pos0_maxin * EPS32
- * 
+                                  /* "splitBBoxLUT.pyx":373
+ *                         cdata[i]+=data
+ *                     else: #set all dummy_like values to cdummy. simplifies further processing
+ *                         cdata[i]+=cdummy             # <<<<<<<<<<<<<<
+ *             else:
+ *                 for i in prange(size, nogil=True, schedule="static"):
  */
-    if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__pos0_min, __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L18;
-  }
-  __pyx_L18:;
+                                  __pyx_t_25 = __pyx_v_i;
+                                  *((float *) ( /* dim=0 */ (__pyx_v_cdata.data + __pyx_t_25 * __pyx_v_cdata.strides[0]) )) += __pyx_v_cdummy;
+                                }
+                                __pyx_L18:;
+                                goto __pyx_L24;
+                                __pyx_L16_error:;
+                                {
+                                    #ifdef WITH_THREAD
+                                    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+                                    #endif
+                                    #ifdef _OPENMP
+                                    #pragma omp flush(__pyx_parallel_exc_type)
+                                    #endif /* _OPENMP */
+                                    if (!__pyx_parallel_exc_type) {
+                                      __Pyx_ErrFetch(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb);
+                                      __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno;
+                                      __Pyx_GOTREF(__pyx_parallel_exc_type);
+                                    }
+                                    #ifdef WITH_THREAD
+                                    PyGILState_Release(__pyx_gilstate_save);
+                                    #endif
+                                }
+                                __pyx_parallel_why = 4;
+                                goto __pyx_L23;
+                                __pyx_L23:;
+                                #ifdef _OPENMP
+                                #pragma omp critical(__pyx_parallel_lastprivates0)
+                                #endif /* _OPENMP */
+                                {
+                                    __pyx_parallel_temp0 = __pyx_v_data;
+                                    __pyx_parallel_temp1 = __pyx_v_i;
+                                }
+                                __pyx_L24:;
+                                #ifdef _OPENMP
+                                #pragma omp flush(__pyx_parallel_why)
+                                #endif /* _OPENMP */
+                            }
+                        }
+                        #ifdef _OPENMP
+                        Py_END_ALLOW_THREADS
+                        #else
+{
+#ifdef WITH_THREAD
+                        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+                        #endif
+                        #endif /* _OPENMP */
+                        /* Clean up any temporaries */
+                        #ifdef WITH_THREAD
+                        PyGILState_Release(__pyx_gilstate_save);
+                        #endif
+                        #ifndef _OPENMP
+}
+#endif /* _OPENMP */
+                    }
+                }
+                if (__pyx_parallel_exc_type) {
+                  /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */
+                  __pyx_parallel_why = 4;
+                }
+                if (__pyx_parallel_why) {
+                  __pyx_v_data = __pyx_parallel_temp0;
+                  __pyx_v_i = __pyx_parallel_temp1;
+                  switch (__pyx_parallel_why) {
+                        case 3: goto __pyx_L11;
+                        case 4:
+                    {
+                        #ifdef WITH_THREAD
+                        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+                        #endif
+                        __Pyx_ErrRestore(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb);
+                        __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno;
+                        __Pyx_GIVEREF(__pyx_parallel_exc_type);
+                        #ifdef WITH_THREAD
+                        PyGILState_Release(__pyx_gilstate_save);
+                        #endif
+                    }
+                    goto __pyx_L12;
+                  }
+                }
+            }
+            #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
+          }
 
-  /* "splitBBoxLUT.pyx":433
- *         if (not allow_pos0_neg) and self.pos0_min < 0:
- *             self.pos0_min = 0
- *         self.pos0_max = pos0_maxin * EPS32             # <<<<<<<<<<<<<<
- * 
- * 
+          /* "splitBBoxLUT.pyx":359
+ *             cdata = numpy.zeros(size,dtype=numpy.float32)
+ *             if do_dummy:
+ *                 for i in prange(size, nogil=True, schedule="static"):             # <<<<<<<<<<<<<<
+ *                     data = tdata[i]
+ *                     if ((cddummy!=0) and (fabs(data-cdummy) > cddummy)) or ((cddummy==0) and (data!=cdummy)):
  */
-  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__EPS32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_8 = PyNumber_Multiply(__pyx_v_pos0_maxin, __pyx_t_3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_8);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__pos0_max, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+          /*finally:*/ {
+            int __pyx_why;
+            __pyx_why = 0; goto __pyx_L13;
+            __pyx_L11: __pyx_why = 3; goto __pyx_L13;
+            __pyx_L12: __pyx_why = 4; goto __pyx_L13;
+            __pyx_L13:;
+            #ifdef WITH_THREAD
+            Py_BLOCK_THREADS
+            #endif
+            switch (__pyx_why) {
+              case 3: goto __pyx_L0;
+              case 4: goto __pyx_L1_error;
+            }
+          }
+      }
+      goto __pyx_L10;
+    }
+    /*else*/ {
 
-  /* "splitBBoxLUT.pyx":436
- * 
- * 
- *         self.cpos1_inf = numpy.ascontiguousarray((pos1-delta_pos1).ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
- *         self.cpos1_sup = numpy.ascontiguousarray((pos1+delta_pos1).ravel(), dtype=numpy.float32)
- * 
+      /* "splitBBoxLUT.pyx":375
+ *                         cdata[i]+=cdummy
+ *             else:
+ *                 for i in prange(size, nogil=True, schedule="static"):             # <<<<<<<<<<<<<<
+ *                     data = tdata[i]
+ *                     if do_dark:
  */
-  __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_8);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-  __pyx_t_8 = PyNumber_Subtract(__pyx_v_pos1, __pyx_v_delta_pos1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_8);
-  __pyx_t_10 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__ravel); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_10);
-  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-  __pyx_t_8 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_8);
-  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-  __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_10);
-  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8);
-  __Pyx_GIVEREF(__pyx_t_8);
-  __pyx_t_8 = 0;
-  __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_8));
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (PyDict_SetItem(__pyx_t_8, ((PyObject *)__pyx_n_s__dtype), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_10), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__cpos1_inf, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      {
+          #ifdef WITH_THREAD
+          PyThreadState *_save;
+          Py_UNBLOCK_THREADS
+          #endif
+          /*try:*/ {
+            __pyx_t_16 = __pyx_v_size;
+            if (1 == 0) abort();
+            {
+                float __pyx_parallel_temp0 = __PYX_NAN();
+                int __pyx_parallel_temp1 = 0xbad0bad0;
+                const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0;
+                PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL;
+                int __pyx_parallel_why;
+                __pyx_parallel_why = 0;
+                #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_2 = (__pyx_t_16 - 0) / 1;
+                if (__pyx_t_2 > 0)
+                {
+                    #ifdef _OPENMP
+                    #pragma omp parallel private(__pyx_t_26, __pyx_t_27, __pyx_t_28, __pyx_t_31, __pyx_t_30, __pyx_t_29, __pyx_t_11) private(__pyx_filename, __pyx_lineno, __pyx_clineno) shared(__pyx_parallel_why, __pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb)
+                    #endif /* _OPENMP */
+                    {
+                        #ifdef _OPENMP
+                        #ifdef WITH_THREAD
+                        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+                        #endif
+                        Py_BEGIN_ALLOW_THREADS
+                        #endif /* _OPENMP */
+                        #ifdef _OPENMP
+                        #pragma omp for lastprivate(__pyx_v_data) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) schedule(static)
+                        #endif /* _OPENMP */
+                        for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_2; __pyx_t_15++){
+                            if (__pyx_parallel_why < 2)
+                            {
+                                __pyx_v_i = 0 + 1 * __pyx_t_15;
+                                /* Initialize private variables to invalid values */
+                                __pyx_v_data = ((float)__PYX_NAN());
 
-  /* "splitBBoxLUT.pyx":437
- * 
- *         self.cpos1_inf = numpy.ascontiguousarray((pos1-delta_pos1).ravel(), dtype=numpy.float32)
- *         self.cpos1_sup = numpy.ascontiguousarray((pos1+delta_pos1).ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
- * 
- *         if pos1Range is not None and len(pos1Range) > 1:
+                                /* "splitBBoxLUT.pyx":376
+ *             else:
+ *                 for i in prange(size, nogil=True, schedule="static"):
+ *                     data = tdata[i]             # <<<<<<<<<<<<<<
+ *                     if do_dark:
+ *                         data = data - cdark[i]
  */
-  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_8 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_8);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyNumber_Add(__pyx_v_pos1, __pyx_v_delta_pos1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_10 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__ravel); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_10);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-  __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_10);
-  PyTuple_SET_ITEM(__pyx_t_10, 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 = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__float32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_10), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__cpos1_sup, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+                                __pyx_t_26 = __pyx_v_i;
+                                __pyx_v_data = (*((float *) ( /* dim=0 */ (__pyx_v_tdata.data + __pyx_t_26 * __pyx_v_tdata.strides[0]) )));
 
-  /* "splitBBoxLUT.pyx":439
- *         self.cpos1_sup = numpy.ascontiguousarray((pos1+delta_pos1).ravel(), dtype=numpy.float32)
- * 
- *         if pos1Range is not None and len(pos1Range) > 1:             # <<<<<<<<<<<<<<
- *             self.pos1_min = min(pos1Range)
- *             pos1_maxin = max(pos1Range)
+                                /* "splitBBoxLUT.pyx":377
+ *                 for i in prange(size, nogil=True, schedule="static"):
+ *                     data = tdata[i]
+ *                     if do_dark:             # <<<<<<<<<<<<<<
+ *                         data = data - cdark[i]
+ *                     if do_flat:
  */
-  __pyx_t_12 = (__pyx_v_pos1Range != Py_None);
-  if (__pyx_t_12) {
-    __pyx_t_11 = PyObject_Length(__pyx_v_pos1Range); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_4 = (__pyx_t_11 > 1);
-    __pyx_t_13 = __pyx_t_4;
-  } else {
-    __pyx_t_13 = __pyx_t_12;
-  }
-  if (__pyx_t_13) {
+                                __pyx_t_11 = (__pyx_v_do_dark != 0);
+                                if (__pyx_t_11) {
 
-    /* "splitBBoxLUT.pyx":440
- * 
- *         if pos1Range is not None and len(pos1Range) > 1:
- *             self.pos1_min = min(pos1Range)             # <<<<<<<<<<<<<<
- *             pos1_maxin = max(pos1Range)
- *         else:
+                                  /* "splitBBoxLUT.pyx":378
+ *                     data = tdata[i]
+ *                     if do_dark:
+ *                         data = data - cdark[i]             # <<<<<<<<<<<<<<
+ *                     if do_flat:
+ *                         data = data / cflat[i]
  */
-    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_INCREF(__pyx_v_pos1Range);
-    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_pos1Range);
-    __Pyx_GIVEREF(__pyx_v_pos1Range);
-    __pyx_t_2 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-    if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__pos1_min, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-
-    /* "splitBBoxLUT.pyx":441
- *         if pos1Range is not None and len(pos1Range) > 1:
- *             self.pos1_min = min(pos1Range)
- *             pos1_maxin = max(pos1Range)             # <<<<<<<<<<<<<<
- *         else:
- *             self.pos1_min = pos1.min()
- */
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_INCREF(__pyx_v_pos1Range);
-    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_pos1Range);
-    __Pyx_GIVEREF(__pyx_v_pos1Range);
-    __pyx_t_1 = PyObject_Call(__pyx_builtin_max, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-    __pyx_v_pos1_maxin = __pyx_t_1;
-    __pyx_t_1 = 0;
-    goto __pyx_L19;
-  }
-  /*else*/ {
-
-    /* "splitBBoxLUT.pyx":443
- *             pos1_maxin = max(pos1Range)
- *         else:
- *             self.pos1_min = pos1.min()             # <<<<<<<<<<<<<<
- *             pos1_maxin = pos1.max()
- *         self.pos1_max = pos1_maxin * EPS32
- */
-    __pyx_t_1 = PyObject_GetAttr(__pyx_v_pos1, __pyx_n_s__min); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __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 = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__pos1_min, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+                                  if (unlikely(!__pyx_v_cdark.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cdark"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L31_error;} }
+                                  __pyx_t_27 = __pyx_v_i;
+                                  __pyx_v_data = (__pyx_v_data - (*((float *) ( /* dim=0 */ (__pyx_v_cdark.data + __pyx_t_27 * __pyx_v_cdark.strides[0]) ))));
+                                  goto __pyx_L33;
+                                }
+                                __pyx_L33:;
 
-    /* "splitBBoxLUT.pyx":444
- *         else:
- *             self.pos1_min = pos1.min()
- *             pos1_maxin = pos1.max()             # <<<<<<<<<<<<<<
- *         self.pos1_max = pos1_maxin * EPS32
- * 
+                                /* "splitBBoxLUT.pyx":379
+ *                     if do_dark:
+ *                         data = data - cdark[i]
+ *                     if do_flat:             # <<<<<<<<<<<<<<
+ *                         data = data / cflat[i]
+ *                     if do_polarization:
  */
-    __pyx_t_2 = PyObject_GetAttr(__pyx_v_pos1, __pyx_n_s__max); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_v_pos1_maxin = __pyx_t_1;
-    __pyx_t_1 = 0;
-  }
-  __pyx_L19:;
+                                __pyx_t_11 = (__pyx_v_do_flat != 0);
+                                if (__pyx_t_11) {
 
-  /* "splitBBoxLUT.pyx":445
- *             self.pos1_min = pos1.min()
- *             pos1_maxin = pos1.max()
- *         self.pos1_max = pos1_maxin * EPS32             # <<<<<<<<<<<<<<
- * 
- *         if  mask is not None:
+                                  /* "splitBBoxLUT.pyx":380
+ *                         data = data - cdark[i]
+ *                     if do_flat:
+ *                         data = data / cflat[i]             # <<<<<<<<<<<<<<
+ *                     if do_polarization:
+ *                         data = data / cpolarization[i]
  */
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__EPS32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyNumber_Multiply(__pyx_v_pos1_maxin, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__pos1_max, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+                                  if (unlikely(!__pyx_v_cflat.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cflat"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L31_error;} }
+                                  __pyx_t_28 = __pyx_v_i;
+                                  __pyx_v_data = (__pyx_v_data / (*((float *) ( /* dim=0 */ (__pyx_v_cflat.data + __pyx_t_28 * __pyx_v_cflat.strides[0]) ))));
+                                  goto __pyx_L34;
+                                }
+                                __pyx_L34:;
 
-  /* "splitBBoxLUT.pyx":447
- *         self.pos1_max = pos1_maxin * EPS32
- * 
- *         if  mask is not None:             # <<<<<<<<<<<<<<
- *             assert mask.size == self.size
- *             self.check_mask = True
+                                /* "splitBBoxLUT.pyx":381
+ *                     if do_flat:
+ *                         data = data / cflat[i]
+ *                     if do_polarization:             # <<<<<<<<<<<<<<
+ *                         data = data / cpolarization[i]
+ *                     if do_solidAngle:
  */
-  __pyx_t_13 = (__pyx_v_mask != Py_None);
-  if (__pyx_t_13) {
+                                __pyx_t_11 = (__pyx_v_do_polarization != 0);
+                                if (__pyx_t_11) {
 
-    /* "splitBBoxLUT.pyx":448
- * 
- *         if  mask is not None:
- *             assert mask.size == self.size             # <<<<<<<<<<<<<<
- *             self.check_mask = True
- *             self.cmask = numpy.ascontiguousarray(mask.ravel(), dtype=numpy.int8)
+                                  /* "splitBBoxLUT.pyx":382
+ *                         data = data / cflat[i]
+ *                     if do_polarization:
+ *                         data = data / cpolarization[i]             # <<<<<<<<<<<<<<
+ *                     if do_solidAngle:
+ *                         data = data / csolidAngle[i]
  */
-    #ifndef CYTHON_WITHOUT_ASSERTIONS
-    __pyx_t_2 = PyObject_GetAttr(__pyx_v_mask, __pyx_n_s__size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_10 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-    if (unlikely(!__pyx_t_13)) {
-      PyErr_SetNone(PyExc_AssertionError);
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    }
-    #endif
+                                  if (unlikely(!__pyx_v_cpolarization.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cpolarization"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L31_error;} }
+                                  __pyx_t_29 = __pyx_v_i;
+                                  __pyx_v_data = (__pyx_v_data / (*((float *) ( /* dim=0 */ (__pyx_v_cpolarization.data + __pyx_t_29 * __pyx_v_cpolarization.strides[0]) ))));
+                                  goto __pyx_L35;
+                                }
+                                __pyx_L35:;
 
-    /* "splitBBoxLUT.pyx":449
- *         if  mask is not None:
- *             assert mask.size == self.size
- *             self.check_mask = True             # <<<<<<<<<<<<<<
- *             self.cmask = numpy.ascontiguousarray(mask.ravel(), dtype=numpy.int8)
- *             if mask_checksum:
+                                /* "splitBBoxLUT.pyx":383
+ *                     if do_polarization:
+ *                         data = data / cpolarization[i]
+ *                     if do_solidAngle:             # <<<<<<<<<<<<<<
+ *                         data = data / csolidAngle[i]
+ *                     cdata[i]+=data
  */
-    __pyx_t_10 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_10);
-    if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__check_mask, __pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+                                __pyx_t_11 = (__pyx_v_do_solidAngle != 0);
+                                if (__pyx_t_11) {
 
-    /* "splitBBoxLUT.pyx":450
- *             assert mask.size == self.size
- *             self.check_mask = True
- *             self.cmask = numpy.ascontiguousarray(mask.ravel(), dtype=numpy.int8)             # <<<<<<<<<<<<<<
- *             if mask_checksum:
- *                 self.mask_checksum = mask_checksum
+                                  /* "splitBBoxLUT.pyx":384
+ *                         data = data / cpolarization[i]
+ *                     if do_solidAngle:
+ *                         data = data / csolidAngle[i]             # <<<<<<<<<<<<<<
+ *                     cdata[i]+=data
+ *         else:
  */
-    __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_10);
-    __pyx_t_1 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-    __pyx_t_10 = PyObject_GetAttr(__pyx_v_mask, __pyx_n_s__ravel); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_10);
-    __pyx_t_2 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-    __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_10);
-    PyTuple_SET_ITEM(__pyx_t_10, 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 = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-    __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_8);
-    __pyx_t_3 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__int8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-    if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __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_10), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __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_10)); __pyx_t_10 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-    if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__cmask, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+                                  if (unlikely(!__pyx_v_csolidAngle.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("csolidAngle"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L31_error;} }
+                                  __pyx_t_30 = __pyx_v_i;
+                                  __pyx_v_data = (__pyx_v_data / (*((float *) ( /* dim=0 */ (__pyx_v_csolidAngle.data + __pyx_t_30 * __pyx_v_csolidAngle.strides[0]) ))));
+                                  goto __pyx_L36;
+                                }
+                                __pyx_L36:;
 
-    /* "splitBBoxLUT.pyx":451
- *             self.check_mask = True
- *             self.cmask = numpy.ascontiguousarray(mask.ravel(), dtype=numpy.int8)
- *             if mask_checksum:             # <<<<<<<<<<<<<<
- *                 self.mask_checksum = mask_checksum
- *             else:
+                                /* "splitBBoxLUT.pyx":385
+ *                     if do_solidAngle:
+ *                         data = data / csolidAngle[i]
+ *                     cdata[i]+=data             # <<<<<<<<<<<<<<
+ *         else:
+ *             if do_dummy:
  */
-    __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_v_mask_checksum); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    if (__pyx_t_13) {
+                                __pyx_t_31 = __pyx_v_i;
+                                *((float *) ( /* dim=0 */ (__pyx_v_cdata.data + __pyx_t_31 * __pyx_v_cdata.strides[0]) )) += __pyx_v_data;
+                                goto __pyx_L38;
+                                __pyx_L31_error:;
+                                {
+                                    #ifdef WITH_THREAD
+                                    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+                                    #endif
+                                    #ifdef _OPENMP
+                                    #pragma omp flush(__pyx_parallel_exc_type)
+                                    #endif /* _OPENMP */
+                                    if (!__pyx_parallel_exc_type) {
+                                      __Pyx_ErrFetch(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb);
+                                      __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno;
+                                      __Pyx_GOTREF(__pyx_parallel_exc_type);
+                                    }
+                                    #ifdef WITH_THREAD
+                                    PyGILState_Release(__pyx_gilstate_save);
+                                    #endif
+                                }
+                                __pyx_parallel_why = 4;
+                                goto __pyx_L37;
+                                __pyx_L37:;
+                                #ifdef _OPENMP
+                                #pragma omp critical(__pyx_parallel_lastprivates1)
+                                #endif /* _OPENMP */
+                                {
+                                    __pyx_parallel_temp0 = __pyx_v_data;
+                                    __pyx_parallel_temp1 = __pyx_v_i;
+                                }
+                                __pyx_L38:;
+                                #ifdef _OPENMP
+                                #pragma omp flush(__pyx_parallel_why)
+                                #endif /* _OPENMP */
+                            }
+                        }
+                        #ifdef _OPENMP
+                        Py_END_ALLOW_THREADS
+                        #else
+{
+#ifdef WITH_THREAD
+                        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+                        #endif
+                        #endif /* _OPENMP */
+                        /* Clean up any temporaries */
+                        #ifdef WITH_THREAD
+                        PyGILState_Release(__pyx_gilstate_save);
+                        #endif
+                        #ifndef _OPENMP
+}
+#endif /* _OPENMP */
+                    }
+                }
+                if (__pyx_parallel_exc_type) {
+                  /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */
+                  __pyx_parallel_why = 4;
+                }
+                if (__pyx_parallel_why) {
+                  __pyx_v_data = __pyx_parallel_temp0;
+                  __pyx_v_i = __pyx_parallel_temp1;
+                  switch (__pyx_parallel_why) {
+                        case 3: goto __pyx_L26;
+                        case 4:
+                    {
+                        #ifdef WITH_THREAD
+                        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+                        #endif
+                        __Pyx_ErrRestore(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb);
+                        __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno;
+                        __Pyx_GIVEREF(__pyx_parallel_exc_type);
+                        #ifdef WITH_THREAD
+                        PyGILState_Release(__pyx_gilstate_save);
+                        #endif
+                    }
+                    goto __pyx_L27;
+                  }
+                }
+            }
+            #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
+          }
 
-      /* "splitBBoxLUT.pyx":452
- *             self.cmask = numpy.ascontiguousarray(mask.ravel(), dtype=numpy.int8)
- *             if mask_checksum:
- *                 self.mask_checksum = mask_checksum             # <<<<<<<<<<<<<<
+          /* "splitBBoxLUT.pyx":375
+ *                         cdata[i]+=cdummy
  *             else:
- *                 self.mask_checksum = crc32(mask)
+ *                 for i in prange(size, nogil=True, schedule="static"):             # <<<<<<<<<<<<<<
+ *                     data = tdata[i]
+ *                     if do_dark:
  */
-      if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__mask_checksum, __pyx_v_mask_checksum) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      goto __pyx_L21;
-    }
-    /*else*/ {
-
-      /* "splitBBoxLUT.pyx":454
- *                 self.mask_checksum = mask_checksum
- *             else:
- *                 self.mask_checksum = crc32(mask)             # <<<<<<<<<<<<<<
- *         else:
- *             self.check_mask = False
- */
-      __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__crc32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_INCREF(__pyx_v_mask);
-      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_mask);
-      __Pyx_GIVEREF(__pyx_v_mask);
-      __pyx_t_10 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_10);
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-      if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__mask_checksum, __pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+          /*finally:*/ {
+            int __pyx_why;
+            __pyx_why = 0; goto __pyx_L28;
+            __pyx_L26: __pyx_why = 3; goto __pyx_L28;
+            __pyx_L27: __pyx_why = 4; goto __pyx_L28;
+            __pyx_L28:;
+            #ifdef WITH_THREAD
+            Py_BLOCK_THREADS
+            #endif
+            switch (__pyx_why) {
+              case 3: goto __pyx_L0;
+              case 4: goto __pyx_L1_error;
+            }
+          }
+      }
     }
-    __pyx_L21:;
-    goto __pyx_L20;
+    __pyx_L10:;
+    goto __pyx_L9;
   }
   /*else*/ {
 
-    /* "splitBBoxLUT.pyx":456
- *                 self.mask_checksum = crc32(mask)
+    /* "splitBBoxLUT.pyx":387
+ *                     cdata[i]+=data
  *         else:
- *             self.check_mask = False             # <<<<<<<<<<<<<<
- *             self.mask_checksum = None
- *         self.delta0 = (self.pos0_max - self.pos0_min) / float(bins0)
+ *             if do_dummy:             # <<<<<<<<<<<<<<
+ *                 tdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)
+ *                 cdata = numpy.zeros(size,dtype=numpy.float32)
  */
-    __pyx_t_10 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_10);
-    if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__check_mask, __pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+    __pyx_t_11 = (__pyx_v_do_dummy != 0);
+    if (__pyx_t_11) {
 
-    /* "splitBBoxLUT.pyx":457
+      /* "splitBBoxLUT.pyx":388
  *         else:
- *             self.check_mask = False
- *             self.mask_checksum = None             # <<<<<<<<<<<<<<
- *         self.delta0 = (self.pos0_max - self.pos0_min) / float(bins0)
- *         self.delta1 = (self.pos1_max - self.pos1_min) / float(bins1)
+ *             if do_dummy:
+ *                 tdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
+ *                 cdata = numpy.zeros(size,dtype=numpy.float32)
+ *                 for i in prange(size, nogil=True, schedule="static"):
  */
-    if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__mask_checksum, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  }
-  __pyx_L20:;
+      __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_6);
+      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
+      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_weights, __pyx_n_s__ravel); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_6);
+      __pyx_t_4 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_4);
+      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_6);
+      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
+      __Pyx_GIVEREF(__pyx_t_4);
+      __pyx_t_4 = 0;
+      __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__float32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+      __pyx_t_14 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_5);
+      if (unlikely(!__pyx_t_14.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      __pyx_v_tdata = __pyx_t_14;
+      __pyx_t_14.memview = NULL;
+      __pyx_t_14.data = NULL;
 
-  /* "splitBBoxLUT.pyx":458
- *             self.check_mask = False
- *             self.mask_checksum = None
- *         self.delta0 = (self.pos0_max - self.pos0_min) / float(bins0)             # <<<<<<<<<<<<<<
- *         self.delta1 = (self.pos1_max - self.pos1_min) / float(bins1)
- *         self.lut_max_idx = self.calc_lut()
+      /* "splitBBoxLUT.pyx":389
+ *             if do_dummy:
+ *                 tdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)
+ *                 cdata = numpy.zeros(size,dtype=numpy.float32)             # <<<<<<<<<<<<<<
+ *                 for i in prange(size, nogil=True, schedule="static"):
+ *                     data = tdata[i]
  */
-  __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pos0_max); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_10);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pos0_min); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyNumber_Subtract(__pyx_t_10, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_14 = __Pyx_PyObject_AsDouble(__pyx_v_bins0); if (unlikely(__pyx_t_14 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_2 = PyFloat_FromDouble(__pyx_t_14); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_10 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_10);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__delta0, __pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+      __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_4);
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      __pyx_t_5 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_6);
+      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
+      __Pyx_GIVEREF(__pyx_t_5);
+      __pyx_t_5 = 0;
+      __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+      __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
+      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__float32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+      if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+      __pyx_t_14 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_3);
+      if (unlikely(!__pyx_t_14.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __pyx_v_cdata = __pyx_t_14;
+      __pyx_t_14.memview = NULL;
+      __pyx_t_14.data = NULL;
 
-  /* "splitBBoxLUT.pyx":459
- *             self.mask_checksum = None
- *         self.delta0 = (self.pos0_max - self.pos0_min) / float(bins0)
- *         self.delta1 = (self.pos1_max - self.pos1_min) / float(bins1)             # <<<<<<<<<<<<<<
- *         self.lut_max_idx = self.calc_lut()
- *         self.outPos0 = numpy.linspace(self.pos0_min+0.5*self.delta0, pos0_maxin-0.5*self.delta0, bins0)
+      /* "splitBBoxLUT.pyx":390
+ *                 tdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)
+ *                 cdata = numpy.zeros(size,dtype=numpy.float32)
+ *                 for i in prange(size, nogil=True, schedule="static"):             # <<<<<<<<<<<<<<
+ *                     data = tdata[i]
+ *                     if ((cddummy!=0) and (fabs(data-cdummy) > cddummy)) or ((cddummy==0) and (data!=cdummy)):
  */
-  __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pos1_max); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_10);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pos1_min); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyNumber_Subtract(__pyx_t_10, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_14 = __Pyx_PyObject_AsDouble(__pyx_v_bins1); if (unlikely(__pyx_t_14 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_2 = PyFloat_FromDouble(__pyx_t_14); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_10 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_10);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__delta1, __pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+      {
+          #ifdef WITH_THREAD
+          PyThreadState *_save;
+          Py_UNBLOCK_THREADS
+          #endif
+          /*try:*/ {
+            __pyx_t_2 = __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_16 = (__pyx_t_2 - 0) / 1;
+                if (__pyx_t_16 > 0)
+                {
+                    #ifdef _OPENMP
+                    #pragma omp parallel private(__pyx_t_18, __pyx_t_34, __pyx_t_12, __pyx_t_33, __pyx_t_11, __pyx_t_32, __pyx_t_19)
+                    #endif /* _OPENMP */
+                    {
+                        #ifdef _OPENMP
+                        #pragma omp for lastprivate(__pyx_v_data) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) schedule(static)
+                        #endif /* _OPENMP */
+                        for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_16; __pyx_t_15++){
+                            {
+                                __pyx_v_i = 0 + 1 * __pyx_t_15;
+                                /* Initialize private variables to invalid values */
+                                __pyx_v_data = ((float)__PYX_NAN());
 
-  /* "splitBBoxLUT.pyx":460
- *         self.delta0 = (self.pos0_max - self.pos0_min) / float(bins0)
- *         self.delta1 = (self.pos1_max - self.pos1_min) / float(bins1)
- *         self.lut_max_idx = self.calc_lut()             # <<<<<<<<<<<<<<
- *         self.outPos0 = numpy.linspace(self.pos0_min+0.5*self.delta0, pos0_maxin-0.5*self.delta0, bins0)
- *         self.outPos1 = numpy.linspace(self.pos1_min+0.5*self.delta1, pos1_maxin-0.5*self.delta1, bins1)
+                                /* "splitBBoxLUT.pyx":391
+ *                 cdata = numpy.zeros(size,dtype=numpy.float32)
+ *                 for i in prange(size, nogil=True, schedule="static"):
+ *                     data = tdata[i]             # <<<<<<<<<<<<<<
+ *                     if ((cddummy!=0) and (fabs(data-cdummy) > cddummy)) or ((cddummy==0) and (data!=cdummy)):
+ *                         cdata[i]+=data
  */
-  __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__calc_lut); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_10);
-  __pyx_t_2 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__lut_max_idx, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+                                __pyx_t_32 = __pyx_v_i;
+                                __pyx_v_data = (*((float *) ( /* dim=0 */ (__pyx_v_tdata.data + __pyx_t_32 * __pyx_v_tdata.strides[0]) )));
 
-  /* "splitBBoxLUT.pyx":461
- *         self.delta1 = (self.pos1_max - self.pos1_min) / float(bins1)
- *         self.lut_max_idx = self.calc_lut()
- *         self.outPos0 = numpy.linspace(self.pos0_min+0.5*self.delta0, pos0_maxin-0.5*self.delta0, bins0)             # <<<<<<<<<<<<<<
- *         self.outPos1 = numpy.linspace(self.pos1_min+0.5*self.delta1, pos1_maxin-0.5*self.delta1, bins1)
- *         self.unit=unit
+                                /* "splitBBoxLUT.pyx":392
+ *                 for i in prange(size, nogil=True, schedule="static"):
+ *                     data = tdata[i]
+ *                     if ((cddummy!=0) and (fabs(data-cdummy) > cddummy)) or ((cddummy==0) and (data!=cdummy)):             # <<<<<<<<<<<<<<
+ *                         cdata[i]+=data
+ *                     else:
  */
-  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_10 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__linspace); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_10);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pos0_min); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__delta0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_8 = PyNumber_Multiply(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_8);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_t_8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-  __pyx_t_8 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_8);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__delta0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyNumber_Multiply(__pyx_t_8, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyNumber_Subtract(__pyx_v_pos0_maxin, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __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);
-  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
-  __Pyx_GIVEREF(__pyx_t_2);
-  __Pyx_INCREF(__pyx_v_bins0);
-  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_bins0);
-  __Pyx_GIVEREF(__pyx_v_bins0);
-  __pyx_t_1 = 0;
-  __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__outPos0, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+                                __pyx_t_11 = ((__pyx_v_cddummy != 0.0) != 0);
+                                if (__pyx_t_11) {
+                                  __pyx_t_18 = ((fabs((__pyx_v_data - __pyx_v_cdummy)) > __pyx_v_cddummy) != 0);
+                                  __pyx_t_19 = __pyx_t_18;
+                                } else {
+                                  __pyx_t_19 = __pyx_t_11;
+                                }
+                                if (!__pyx_t_19) {
+                                  __pyx_t_11 = ((__pyx_v_cddummy == 0.0) != 0);
+                                  if (__pyx_t_11) {
+                                    __pyx_t_18 = ((__pyx_v_data != __pyx_v_cdummy) != 0);
+                                    __pyx_t_12 = __pyx_t_18;
+                                  } else {
+                                    __pyx_t_12 = __pyx_t_11;
+                                  }
+                                  __pyx_t_11 = __pyx_t_12;
+                                } else {
+                                  __pyx_t_11 = __pyx_t_19;
+                                }
+                                if (__pyx_t_11) {
 
-  /* "splitBBoxLUT.pyx":462
- *         self.lut_max_idx = self.calc_lut()
- *         self.outPos0 = numpy.linspace(self.pos0_min+0.5*self.delta0, pos0_maxin-0.5*self.delta0, bins0)
- *         self.outPos1 = numpy.linspace(self.pos1_min+0.5*self.delta1, pos1_maxin-0.5*self.delta1, bins1)             # <<<<<<<<<<<<<<
- *         self.unit=unit
- *         self.lut.shape = -1, self.lut_size #this makes integration look like a 1D integration
+                                  /* "splitBBoxLUT.pyx":393
+ *                     data = tdata[i]
+ *                     if ((cddummy!=0) and (fabs(data-cdummy) > cddummy)) or ((cddummy==0) and (data!=cdummy)):
+ *                         cdata[i]+=data             # <<<<<<<<<<<<<<
+ *                     else:
+ *                         cdata[i]+=cdummy
  */
-  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__linspace); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pos1_min); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_10 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_10);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__delta1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_8 = PyNumber_Multiply(__pyx_t_10, __pyx_t_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_8);
-  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_t_8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-  __pyx_t_8 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_8);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__delta1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_10 = PyNumber_Multiply(__pyx_t_8, __pyx_t_2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_10);
-  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyNumber_Subtract(__pyx_v_pos1_maxin, __pyx_t_10); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-  __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_10);
-  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1);
-  __Pyx_GIVEREF(__pyx_t_1);
-  PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_2);
-  __Pyx_GIVEREF(__pyx_t_2);
-  __Pyx_INCREF(__pyx_v_bins1);
-  PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_v_bins1);
-  __Pyx_GIVEREF(__pyx_v_bins1);
-  __pyx_t_1 = 0;
-  __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__outPos1, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+                                  __pyx_t_33 = __pyx_v_i;
+                                  *((float *) ( /* dim=0 */ (__pyx_v_cdata.data + __pyx_t_33 * __pyx_v_cdata.strides[0]) )) += __pyx_v_data;
+                                  goto __pyx_L48;
+                                }
+                                /*else*/ {
 
-  /* "splitBBoxLUT.pyx":463
- *         self.outPos0 = numpy.linspace(self.pos0_min+0.5*self.delta0, pos0_maxin-0.5*self.delta0, bins0)
- *         self.outPos1 = numpy.linspace(self.pos1_min+0.5*self.delta1, pos1_maxin-0.5*self.delta1, bins1)
- *         self.unit=unit             # <<<<<<<<<<<<<<
- *         self.lut.shape = -1, self.lut_size #this makes integration look like a 1D integration
- *         self.lut_checksum = crc32(self.lut)
+                                  /* "splitBBoxLUT.pyx":395
+ *                         cdata[i]+=data
+ *                     else:
+ *                         cdata[i]+=cdummy             # <<<<<<<<<<<<<<
+ *             else:
+ *                 cdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)
  */
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__unit, __pyx_v_unit) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+                                  __pyx_t_34 = __pyx_v_i;
+                                  *((float *) ( /* dim=0 */ (__pyx_v_cdata.data + __pyx_t_34 * __pyx_v_cdata.strides[0]) )) += __pyx_v_cdummy;
+                                }
+                                __pyx_L48:;
+                            }
+                        }
+                    }
+                }
+            }
+            #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
+          }
 
-  /* "splitBBoxLUT.pyx":464
- *         self.outPos1 = numpy.linspace(self.pos1_min+0.5*self.delta1, pos1_maxin-0.5*self.delta1, bins1)
- *         self.unit=unit
- *         self.lut.shape = -1, self.lut_size #this makes integration look like a 1D integration             # <<<<<<<<<<<<<<
- *         self.lut_checksum = crc32(self.lut)
+          /* "splitBBoxLUT.pyx":390
+ *                 tdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)
+ *                 cdata = numpy.zeros(size,dtype=numpy.float32)
+ *                 for i in prange(size, nogil=True, schedule="static"):             # <<<<<<<<<<<<<<
+ *                     data = tdata[i]
+ *                     if ((cddummy!=0) and (fabs(data-cdummy) > cddummy)) or ((cddummy==0) and (data!=cdummy)):
+ */
+          /*finally:*/ {
+            #ifdef WITH_THREAD
+            Py_BLOCK_THREADS
+            #endif
+          }
+      }
+      goto __pyx_L40;
+    }
+    /*else*/ {
+
+      /* "splitBBoxLUT.pyx":397
+ *                         cdata[i]+=cdummy
+ *             else:
+ *                 cdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
  * 
+ *         for i in prange(bins, nogil=True, schedule="guided"):
  */
-  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__lut_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_10);
-  __Pyx_INCREF(__pyx_int_neg_1);
-  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_int_neg_1);
-  __Pyx_GIVEREF(__pyx_int_neg_1);
-  PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_2);
-  __Pyx_GIVEREF(__pyx_t_2);
-  __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__lut); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s__shape, ((PyObject *)__pyx_t_10)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_weights, __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_6);
+      __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 = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      PyTuple_SET_ITEM(__pyx_t_3, 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 = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
+      __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_4);
+      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__float32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
+      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+      if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+      __pyx_t_14 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_1);
+      if (unlikely(!__pyx_t_14.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __pyx_v_cdata = __pyx_t_14;
+      __pyx_t_14.memview = NULL;
+      __pyx_t_14.data = NULL;
+    }
+    __pyx_L40:;
+  }
+  __pyx_L9:;
 
-  /* "splitBBoxLUT.pyx":465
- *         self.unit=unit
- *         self.lut.shape = -1, self.lut_size #this makes integration look like a 1D integration
- *         self.lut_checksum = crc32(self.lut)             # <<<<<<<<<<<<<<
+  /* "splitBBoxLUT.pyx":399
+ *                 cdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)
  * 
- *     @cython.boundscheck(False)
+ *         for i in prange(bins, nogil=True, schedule="guided"):             # <<<<<<<<<<<<<<
+ *             sum_data = 0.0
+ *             sum_count = 0.0
  */
-  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__crc32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__lut); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_10);
-  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_10);
-  __Pyx_GIVEREF(__pyx_t_10);
-  __pyx_t_10 = 0;
-  __pyx_t_10 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_10);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__lut_checksum, __pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+  {
+      #ifdef WITH_THREAD
+      PyThreadState *_save;
+      Py_UNBLOCK_THREADS
+      #endif
+      /*try:*/ {
+        __pyx_t_16 = __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_2 = (__pyx_t_16 - 0) / 1;
+            if (__pyx_t_2 > 0)
+            {
+                #ifdef _OPENMP
+                #pragma omp parallel private(__pyx_t_42, __pyx_t_38, __pyx_t_43, __pyx_t_37, __pyx_t_44, __pyx_t_12, __pyx_t_40, __pyx_t_11, __pyx_t_36, __pyx_t_45, __pyx_t_39, __pyx_t_41, __pyx_t_19, __pyx_t_35)
+                #endif /* _OPENMP */
+                {
+                    #ifdef _OPENMP
+                    #pragma omp for lastprivate(__pyx_v_sum_data) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_coef) lastprivate(__pyx_v_sum_count) lastprivate(__pyx_v_data) lastprivate(__pyx_v_j) lastprivate(__pyx_v_idx) schedule(guided)
+                    #endif /* _OPENMP */
+                    for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_2; __pyx_t_15++){
+                        {
+                            __pyx_v_i = 0 + 1 * __pyx_t_15;
+                            /* Initialize private variables to invalid values */
+                            __pyx_v_sum_data = ((double)__PYX_NAN());
+                            __pyx_v_coef = ((float)__PYX_NAN());
+                            __pyx_v_sum_count = ((double)__PYX_NAN());
+                            __pyx_v_data = ((float)__PYX_NAN());
+                            __pyx_v_j = ((int)0xbad0bad0);
+                            __pyx_v_idx = ((int)0xbad0bad0);
 
-  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_XDECREF(__pyx_t_8);
-  __Pyx_XDECREF(__pyx_t_10);
-  __Pyx_AddTraceback("splitBBoxLUT.HistoBBox2d.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
-  __pyx_r = NULL;
-  __pyx_L0:;
-  __Pyx_XDECREF(__pyx_v_bins0);
-  __Pyx_XDECREF(__pyx_v_bins1);
-  __Pyx_XDECREF(__pyx_v_pos0_maxin);
-  __Pyx_XDECREF(__pyx_v_pos1_maxin);
-  __Pyx_XGIVEREF(__pyx_r);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
+                            /* "splitBBoxLUT.pyx":400
+ * 
+ *         for i in prange(bins, nogil=True, schedule="guided"):
+ *             sum_data = 0.0             # <<<<<<<<<<<<<<
+ *             sum_count = 0.0
+ *             for j in range(lut_size):
+ */
+                            __pyx_v_sum_data = 0.0;
 
-/* Python wrapper */
-static PyObject *__pyx_pw_12splitBBoxLUT_11HistoBBox2d_3calc_lut(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
-static char __pyx_doc_12splitBBoxLUT_11HistoBBox2d_2calc_lut[] = "calculate the max number of elements in the LUT and populate it";
-static PyMethodDef __pyx_mdef_12splitBBoxLUT_11HistoBBox2d_3calc_lut = {__Pyx_NAMESTR("calc_lut"), (PyCFunction)__pyx_pw_12splitBBoxLUT_11HistoBBox2d_3calc_lut, METH_O, __Pyx_DOCSTR(__pyx_doc_12splitBBoxLUT_11HistoBBox2d_2calc_lut)};
-static PyObject *__pyx_pw_12splitBBoxLUT_11HistoBBox2d_3calc_lut(PyObject *__pyx_self, PyObject *__pyx_v_self) {
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("calc_lut (wrapper)", 0);
-  __pyx_r = __pyx_pf_12splitBBoxLUT_11HistoBBox2d_2calc_lut(__pyx_self, ((PyObject *)__pyx_v_self));
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
+                            /* "splitBBoxLUT.pyx":401
+ *         for i in prange(bins, nogil=True, schedule="guided"):
+ *             sum_data = 0.0
+ *             sum_count = 0.0             # <<<<<<<<<<<<<<
+ *             for j in range(lut_size):
+ *                 idx = lut[i, j].idx
+ */
+                            __pyx_v_sum_count = 0.0;
 
-/* "splitBBoxLUT.pyx":470
- *     @cython.wraparound(False)
- *     @cython.cdivision(True)
- *     def calc_lut(self):             # <<<<<<<<<<<<<<
- *         'calculate the max number of elements in the LUT and populate it'
- *         cdef float delta0=self.delta0, pos0_min=self.pos0_min, min0, max0, fbin0_min, fbin0_max
+                            /* "splitBBoxLUT.pyx":402
+ *             sum_data = 0.0
+ *             sum_count = 0.0
+ *             for j in range(lut_size):             # <<<<<<<<<<<<<<
+ *                 idx = lut[i, j].idx
+ *                 coef = lut[i, j].coef
  */
+                            __pyx_t_35 = __pyx_v_lut_size;
+                            for (__pyx_t_36 = 0; __pyx_t_36 < __pyx_t_35; __pyx_t_36+=1) {
+                              __pyx_v_j = __pyx_t_36;
 
-static PyObject *__pyx_pf_12splitBBoxLUT_11HistoBBox2d_2calc_lut(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
-  float __pyx_v_delta0;
-  float __pyx_v_pos0_min;
-  float __pyx_v_min0;
-  float __pyx_v_max0;
-  float __pyx_v_fbin0_min;
-  float __pyx_v_fbin0_max;
-  float __pyx_v_delta1;
-  float __pyx_v_pos1_min;
-  float __pyx_v_min1;
-  float __pyx_v_max1;
-  float __pyx_v_fbin1_min;
-  float __pyx_v_fbin1_max;
-  int __pyx_v_bin0_min;
-  int __pyx_v_bin0_max;
-  int __pyx_v_bins0;
-  int __pyx_v_bin1_min;
-  int __pyx_v_bin1_max;
-  int __pyx_v_bins1;
-  __pyx_t_5numpy_int32_t __pyx_v_k;
-  __pyx_t_5numpy_int32_t __pyx_v_idx;
-  __pyx_t_5numpy_int32_t __pyx_v_lut_size;
-  __pyx_t_5numpy_int32_t __pyx_v_i;
-  __pyx_t_5numpy_int32_t __pyx_v_j;
-  __pyx_t_5numpy_int32_t __pyx_v_size;
-  int __pyx_v_check_mask;
-  __Pyx_memviewslice __pyx_v_cpos0_sup = { 0, 0, { 0 }, { 0 }, { 0 } };
-  __Pyx_memviewslice __pyx_v_cpos0_inf = { 0, 0, { 0 }, { 0 }, { 0 } };
-  __Pyx_memviewslice __pyx_v_cpos1_inf = { 0, 0, { 0 }, { 0 }, { 0 } };
-  __Pyx_memviewslice __pyx_v_cpos1_sup = { 0, 0, { 0 }, { 0 }, { 0 } };
-  PyArrayObject *__pyx_v_outMax = 0;
-  PyArrayObject *__pyx_v_lut = 0;
-  __Pyx_memviewslice __pyx_v_cmask = { 0, 0, { 0 }, { 0 }, { 0 } };
-  size_t __pyx_v_lut_nbytes;
-  PyObject *__pyx_v_memsize = NULL;
-  double __pyx_v_deltaD;
-  double __pyx_v_deltaU;
-  double __pyx_v_deltaA;
-  double __pyx_v_deltaL;
-  double __pyx_v_deltaR;
-  __Pyx_LocalBuf_ND __pyx_pybuffernd_lut;
-  __Pyx_Buffer __pyx_pybuffer_lut;
-  __Pyx_LocalBuf_ND __pyx_pybuffernd_outMax;
-  __Pyx_Buffer __pyx_pybuffer_outMax;
-  PyObject *__pyx_r = NULL;
-  __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
-  float __pyx_t_2;
-  PyObject *__pyx_t_3 = NULL;
-  int __pyx_t_4;
-  __pyx_t_5numpy_int32_t __pyx_t_5;
-  __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
-  __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
-  __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
-  __Pyx_memviewslice __pyx_t_9 = { 0, 0, { 0 }, { 0 }, { 0 } };
-  PyObject *__pyx_t_10 = NULL;
-  PyObject *__pyx_t_11 = NULL;
-  PyObject *__pyx_t_12 = NULL;
-  PyArrayObject *__pyx_t_13 = NULL;
-  int __pyx_t_14;
-  __Pyx_memviewslice __pyx_t_15 = { 0, 0, { 0 }, { 0 }, { 0 } };
-  __pyx_t_5numpy_int32_t __pyx_t_16;
-  __pyx_t_5numpy_int32_t __pyx_t_17;
-  int __pyx_t_18;
-  __pyx_t_5numpy_int32_t __pyx_t_19;
-  __pyx_t_5numpy_int32_t __pyx_t_20;
-  __pyx_t_5numpy_int32_t __pyx_t_21;
-  __pyx_t_5numpy_int32_t __pyx_t_22;
-  int __pyx_t_23;
-  int __pyx_t_24;
-  int __pyx_t_25;
-  long __pyx_t_26;
-  __pyx_t_5numpy_int32_t __pyx_t_27;
-  long __pyx_t_28;
-  __pyx_t_5numpy_int32_t __pyx_t_29;
-  __pyx_t_5numpy_int32_t __pyx_t_30;
-  __pyx_t_5numpy_int32_t __pyx_t_31;
-  PyObject *__pyx_t_32 = NULL;
-  PyArrayObject *__pyx_t_33 = NULL;
-  PyObject *__pyx_t_34 = NULL;
-  PyObject *__pyx_t_35 = NULL;
-  PyObject *__pyx_t_36 = NULL;
-  long __pyx_t_37;
-  long __pyx_t_38;
-  long __pyx_t_39;
-  __pyx_t_5numpy_int32_t __pyx_t_40;
-  __pyx_t_5numpy_int32_t __pyx_t_41;
-  __pyx_t_5numpy_int32_t __pyx_t_42;
-  int __pyx_t_43;
-  int __pyx_t_44;
-  int __pyx_t_45;
-  __pyx_t_5numpy_int32_t __pyx_t_46;
-  int __pyx_t_47;
-  int __pyx_t_48;
-  __pyx_t_5numpy_int32_t __pyx_t_49;
-  int __pyx_t_50;
-  int __pyx_t_51;
-  int __pyx_t_52;
-  int __pyx_t_53;
-  int __pyx_t_54;
-  int __pyx_t_55;
-  __pyx_t_5numpy_int32_t __pyx_t_56;
-  int __pyx_t_57;
-  int __pyx_t_58;
-  __pyx_t_5numpy_int32_t __pyx_t_59;
-  int __pyx_t_60;
-  int __pyx_t_61;
-  int __pyx_t_62;
-  int __pyx_t_63;
-  int __pyx_t_64;
-  int __pyx_t_65;
-  __pyx_t_5numpy_int32_t __pyx_t_66;
-  int __pyx_t_67;
-  int __pyx_t_68;
-  __pyx_t_5numpy_int32_t __pyx_t_69;
-  int __pyx_t_70;
-  int __pyx_t_71;
-  int __pyx_t_72;
-  __pyx_t_5numpy_int32_t __pyx_t_73;
-  int __pyx_t_74;
-  __pyx_t_5numpy_int32_t __pyx_t_75;
-  int __pyx_t_76;
-  __pyx_t_5numpy_int32_t __pyx_t_77;
-  __pyx_t_5numpy_int32_t __pyx_t_78;
-  int __pyx_t_79;
-  __pyx_t_5numpy_int32_t __pyx_t_80;
-  __pyx_t_5numpy_int32_t __pyx_t_81;
-  int __pyx_t_82;
-  __pyx_t_5numpy_int32_t __pyx_t_83;
-  int __pyx_t_84;
-  int __pyx_t_85;
-  int __pyx_t_86;
-  int __pyx_t_87;
-  int __pyx_t_88;
-  __pyx_t_5numpy_int32_t __pyx_t_89;
-  int __pyx_t_90;
-  int __pyx_t_91;
-  int __pyx_t_92;
-  int __pyx_t_93;
-  int __pyx_t_94;
-  int __pyx_t_95;
-  __pyx_t_5numpy_int32_t __pyx_t_96;
-  int __pyx_t_97;
-  int __pyx_t_98;
-  __pyx_t_5numpy_int32_t __pyx_t_99;
-  int __pyx_t_100;
-  int __pyx_t_101;
-  int __pyx_t_102;
-  __pyx_t_5numpy_int32_t __pyx_t_103;
-  __pyx_t_5numpy_int32_t __pyx_t_104;
-  int __pyx_t_105;
-  __pyx_t_5numpy_int32_t __pyx_t_106;
-  int __pyx_t_107;
-  __pyx_t_5numpy_int32_t __pyx_t_108;
-  __pyx_t_5numpy_int32_t __pyx_t_109;
-  int __pyx_t_110;
-  __pyx_t_5numpy_int32_t __pyx_t_111;
-  __pyx_t_5numpy_int32_t __pyx_t_112;
-  int __pyx_t_113;
-  int __pyx_t_114;
-  int __pyx_t_115;
-  int __pyx_t_116;
-  int __pyx_t_117;
-  int __pyx_t_118;
-  __pyx_t_5numpy_int32_t __pyx_t_119;
-  int __pyx_t_120;
-  int __pyx_t_121;
-  int __pyx_t_122;
-  int __pyx_t_123;
-  int __pyx_t_124;
-  int __pyx_t_125;
-  __pyx_t_5numpy_int32_t __pyx_t_126;
-  int __pyx_t_127;
-  int __pyx_t_128;
-  __pyx_t_5numpy_int32_t __pyx_t_129;
-  int __pyx_t_130;
-  int __pyx_t_131;
-  int __pyx_t_132;
-  int __pyx_t_133;
-  int __pyx_t_134;
-  int __pyx_t_135;
-  __pyx_t_5numpy_int32_t __pyx_t_136;
-  int __pyx_t_137;
-  int __pyx_t_138;
-  __pyx_t_5numpy_int32_t __pyx_t_139;
-  int __pyx_t_140;
-  int __pyx_t_141;
-  int __pyx_t_142;
-  int __pyx_t_143;
-  int __pyx_t_144;
-  int __pyx_t_145;
-  __pyx_t_5numpy_int32_t __pyx_t_146;
-  int __pyx_t_147;
-  int __pyx_t_148;
-  __pyx_t_5numpy_int32_t __pyx_t_149;
-  int __pyx_t_150;
-  int __pyx_t_151;
-  int __pyx_t_152;
-  __pyx_t_5numpy_int32_t __pyx_t_153;
-  __pyx_t_5numpy_int32_t __pyx_t_154;
-  int __pyx_t_155;
-  __pyx_t_5numpy_int32_t __pyx_t_156;
-  int __pyx_t_157;
-  __pyx_t_5numpy_int32_t __pyx_t_158;
-  __pyx_t_5numpy_int32_t __pyx_t_159;
-  int __pyx_t_160;
-  __pyx_t_5numpy_int32_t __pyx_t_161;
-  __pyx_t_5numpy_int32_t __pyx_t_162;
-  int __pyx_t_163;
-  int __pyx_t_164;
-  __pyx_t_5numpy_int32_t __pyx_t_165;
-  __pyx_t_5numpy_int32_t __pyx_t_166;
-  __pyx_t_5numpy_int32_t __pyx_t_167;
-  __pyx_t_5numpy_int32_t __pyx_t_168;
-  __pyx_t_5numpy_int32_t __pyx_t_169;
-  __pyx_t_5numpy_int32_t __pyx_t_170;
-  __pyx_t_5numpy_int32_t __pyx_t_171;
-  __pyx_t_5numpy_int32_t __pyx_t_172;
-  __pyx_t_5numpy_int32_t __pyx_t_173;
-  __pyx_t_5numpy_int32_t __pyx_t_174;
-  __pyx_t_5numpy_int32_t __pyx_t_175;
-  __pyx_t_5numpy_int32_t __pyx_t_176;
-  int __pyx_t_177;
-  __pyx_t_5numpy_int32_t __pyx_t_178;
-  __pyx_t_5numpy_int32_t __pyx_t_179;
-  int __pyx_t_180;
-  __pyx_t_5numpy_int32_t __pyx_t_181;
-  __pyx_t_5numpy_int32_t __pyx_t_182;
-  int __pyx_t_183;
-  int __pyx_t_184;
-  __pyx_t_5numpy_int32_t __pyx_t_185;
-  int __pyx_t_186;
-  __pyx_t_5numpy_int32_t __pyx_t_187;
-  __pyx_t_5numpy_int32_t __pyx_t_188;
-  int __pyx_t_189;
-  __pyx_t_5numpy_int32_t __pyx_t_190;
-  __pyx_t_5numpy_int32_t __pyx_t_191;
-  int __pyx_t_192;
-  __pyx_t_5numpy_int32_t __pyx_t_193;
-  int __pyx_t_194;
-  __pyx_t_5numpy_int32_t __pyx_t_195;
-  int __pyx_t_196;
-  __pyx_t_5numpy_int32_t __pyx_t_197;
-  __pyx_t_5numpy_int32_t __pyx_t_198;
-  int __pyx_t_199;
-  __pyx_t_5numpy_int32_t __pyx_t_200;
-  __pyx_t_5numpy_int32_t __pyx_t_201;
-  int __pyx_t_202;
-  __pyx_t_5numpy_int32_t __pyx_t_203;
-  int __pyx_lineno = 0;
-  const char *__pyx_filename = NULL;
-  int __pyx_clineno = 0;
-  __Pyx_RefNannySetupContext("calc_lut", 0);
-  __pyx_pybuffer_outMax.pybuffer.buf = NULL;
-  __pyx_pybuffer_outMax.refcount = 0;
-  __pyx_pybuffernd_outMax.data = NULL;
-  __pyx_pybuffernd_outMax.rcbuffer = &__pyx_pybuffer_outMax;
-  __pyx_pybuffer_lut.pybuffer.buf = NULL;
-  __pyx_pybuffer_lut.refcount = 0;
-  __pyx_pybuffernd_lut.data = NULL;
-  __pyx_pybuffernd_lut.rcbuffer = &__pyx_pybuffer_lut;
-
-  /* "splitBBoxLUT.pyx":472
- *     def calc_lut(self):
- *         'calculate the max number of elements in the LUT and populate it'
- *         cdef float delta0=self.delta0, pos0_min=self.pos0_min, min0, max0, fbin0_min, fbin0_max             # <<<<<<<<<<<<<<
- *         cdef float delta1=self.delta1, pos1_min=self.pos1_min, min1, max1, fbin1_min, fbin1_max
- *         cdef int bin0_min, bin0_max, bins0 = self.bins[0]
+                              /* "splitBBoxLUT.pyx":403
+ *             sum_count = 0.0
+ *             for j in range(lut_size):
+ *                 idx = lut[i, j].idx             # <<<<<<<<<<<<<<
+ *                 coef = lut[i, j].coef
+ *                 if idx <= 0 and coef <= 0.0:
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__delta0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_2 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_v_delta0 = __pyx_t_2;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pos0_min); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_2 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_v_pos0_min = __pyx_t_2;
+                              __pyx_t_37 = __pyx_v_i;
+                              __pyx_t_38 = __pyx_v_j;
+                              __pyx_t_39 = (*((struct __pyx_t_12splitBBoxLUT_lut_point *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_lut.data + __pyx_t_37 * __pyx_v_lut.strides[0]) ) + __pyx_t_38 * __pyx_v_lut.strides[1]) ))).idx;
+                              __pyx_v_idx = __pyx_t_39;
 
-  /* "splitBBoxLUT.pyx":473
- *         'calculate the max number of elements in the LUT and populate it'
- *         cdef float delta0=self.delta0, pos0_min=self.pos0_min, min0, max0, fbin0_min, fbin0_max
- *         cdef float delta1=self.delta1, pos1_min=self.pos1_min, min1, max1, fbin1_min, fbin1_max             # <<<<<<<<<<<<<<
- *         cdef int bin0_min, bin0_max, bins0 = self.bins[0]
- *         cdef int bin1_min, bin1_max, bins1 = self.bins[1]
+                              /* "splitBBoxLUT.pyx":404
+ *             for j in range(lut_size):
+ *                 idx = lut[i, j].idx
+ *                 coef = lut[i, j].coef             # <<<<<<<<<<<<<<
+ *                 if idx <= 0 and coef <= 0.0:
+ *                     break
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__delta1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_2 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_v_delta1 = __pyx_t_2;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pos1_min); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_2 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_v_pos1_min = __pyx_t_2;
+                              __pyx_t_40 = __pyx_v_i;
+                              __pyx_t_41 = __pyx_v_j;
+                              __pyx_t_42 = (*((struct __pyx_t_12splitBBoxLUT_lut_point *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_lut.data + __pyx_t_40 * __pyx_v_lut.strides[0]) ) + __pyx_t_41 * __pyx_v_lut.strides[1]) ))).coef;
+                              __pyx_v_coef = __pyx_t_42;
 
-  /* "splitBBoxLUT.pyx":474
- *         cdef float delta0=self.delta0, pos0_min=self.pos0_min, min0, max0, fbin0_min, fbin0_max
- *         cdef float delta1=self.delta1, pos1_min=self.pos1_min, min1, max1, fbin1_min, fbin1_max
- *         cdef int bin0_min, bin0_max, bins0 = self.bins[0]             # <<<<<<<<<<<<<<
- *         cdef int bin1_min, bin1_max, bins1 = self.bins[1]
- *         cdef numpy.int32_t k, idx, lut_size, i, j, size=self.size
+                              /* "splitBBoxLUT.pyx":405
+ *                 idx = lut[i, j].idx
+ *                 coef = lut[i, j].coef
+ *                 if idx <= 0 and coef <= 0.0:             # <<<<<<<<<<<<<<
+ *                     break
+ *                 data = cdata[idx]
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__bins); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_v_bins0 = __pyx_t_4;
+                              __pyx_t_11 = ((__pyx_v_idx <= 0) != 0);
+                              if (__pyx_t_11) {
+                                __pyx_t_19 = ((__pyx_v_coef <= 0.0) != 0);
+                                __pyx_t_12 = __pyx_t_19;
+                              } else {
+                                __pyx_t_12 = __pyx_t_11;
+                              }
+                              if (__pyx_t_12) {
 
-  /* "splitBBoxLUT.pyx":475
- *         cdef float delta1=self.delta1, pos1_min=self.pos1_min, min1, max1, fbin1_min, fbin1_max
- *         cdef int bin0_min, bin0_max, bins0 = self.bins[0]
- *         cdef int bin1_min, bin1_max, bins1 = self.bins[1]             # <<<<<<<<<<<<<<
- *         cdef numpy.int32_t k, idx, lut_size, i, j, size=self.size
- *         cdef bint check_mask
+                                /* "splitBBoxLUT.pyx":406
+ *                 coef = lut[i, j].coef
+ *                 if idx <= 0 and coef <= 0.0:
+ *                     break             # <<<<<<<<<<<<<<
+ *                 data = cdata[idx]
+ *                 if do_dummy and data==cdummy:
  */
-  __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__bins); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_v_bins1 = __pyx_t_4;
+                                goto __pyx_L59_break;
+                                goto __pyx_L60;
+                              }
+                              __pyx_L60:;
 
-  /* "splitBBoxLUT.pyx":476
- *         cdef int bin0_min, bin0_max, bins0 = self.bins[0]
- *         cdef int bin1_min, bin1_max, bins1 = self.bins[1]
- *         cdef numpy.int32_t k, idx, lut_size, i, j, size=self.size             # <<<<<<<<<<<<<<
- *         cdef bint check_mask
- *         cdef float[:] cpos0_sup = self.cpos0_sup
+                              /* "splitBBoxLUT.pyx":407
+ *                 if idx <= 0 and coef <= 0.0:
+ *                     break
+ *                 data = cdata[idx]             # <<<<<<<<<<<<<<
+ *                 if do_dummy and data==cdummy:
+ *                     continue
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_5 = __Pyx_PyInt_from_py_npy_int32(__pyx_t_1); if (unlikely((__pyx_t_5 == (npy_int32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_v_size = __pyx_t_5;
+                              __pyx_t_43 = __pyx_v_idx;
+                              __pyx_v_data = (*((float *) ( /* dim=0 */ (__pyx_v_cdata.data + __pyx_t_43 * __pyx_v_cdata.strides[0]) )));
 
-  /* "splitBBoxLUT.pyx":478
- *         cdef numpy.int32_t k, idx, lut_size, i, j, size=self.size
- *         cdef bint check_mask
- *         cdef float[:] cpos0_sup = self.cpos0_sup             # <<<<<<<<<<<<<<
- *         cdef float[:] cpos0_inf = self.cpos0_inf
- *         cdef float[:] cpos1_inf = self.cpos1_inf
+                              /* "splitBBoxLUT.pyx":408
+ *                     break
+ *                 data = cdata[idx]
+ *                 if do_dummy and data==cdummy:             # <<<<<<<<<<<<<<
+ *                     continue
+ * 
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__cpos0_sup); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_1);
-  if (unlikely(!__pyx_t_6.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_v_cpos0_sup = __pyx_t_6;
-  __pyx_t_6.memview = NULL;
-  __pyx_t_6.data = NULL;
+                              if ((__pyx_v_do_dummy != 0)) {
+                                __pyx_t_12 = ((__pyx_v_data == __pyx_v_cdummy) != 0);
+                                __pyx_t_11 = __pyx_t_12;
+                              } else {
+                                __pyx_t_11 = (__pyx_v_do_dummy != 0);
+                              }
+                              if (__pyx_t_11) {
 
-  /* "splitBBoxLUT.pyx":479
- *         cdef bint check_mask
- *         cdef float[:] cpos0_sup = self.cpos0_sup
- *         cdef float[:] cpos0_inf = self.cpos0_inf             # <<<<<<<<<<<<<<
- *         cdef float[:] cpos1_inf = self.cpos1_inf
- *         cdef float[:] cpos1_sup = self.cpos1_sup
+                                /* "splitBBoxLUT.pyx":409
+ *                 data = cdata[idx]
+ *                 if do_dummy and data==cdummy:
+ *                     continue             # <<<<<<<<<<<<<<
+ * 
+ *                 sum_data = sum_data + coef * data
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__cpos0_inf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_1);
-  if (unlikely(!__pyx_t_7.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_v_cpos0_inf = __pyx_t_7;
-  __pyx_t_7.memview = NULL;
-  __pyx_t_7.data = NULL;
+                                goto __pyx_L58_continue;
+                                goto __pyx_L61;
+                              }
+                              __pyx_L61:;
 
-  /* "splitBBoxLUT.pyx":480
- *         cdef float[:] cpos0_sup = self.cpos0_sup
- *         cdef float[:] cpos0_inf = self.cpos0_inf
- *         cdef float[:] cpos1_inf = self.cpos1_inf             # <<<<<<<<<<<<<<
- *         cdef float[:] cpos1_sup = self.cpos1_sup
- *         cdef numpy.ndarray[numpy.int32_t, ndim = 2] outMax = numpy.zeros((bins0,bins1), dtype=numpy.int32)
+                              /* "splitBBoxLUT.pyx":411
+ *                     continue
+ * 
+ *                 sum_data = sum_data + coef * data             # <<<<<<<<<<<<<<
+ *                 sum_count = sum_count + coef
+ *             outData[i] += sum_data
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__cpos1_inf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_1);
-  if (unlikely(!__pyx_t_8.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_v_cpos1_inf = __pyx_t_8;
-  __pyx_t_8.memview = NULL;
-  __pyx_t_8.data = NULL;
+                              __pyx_v_sum_data = (__pyx_v_sum_data + (__pyx_v_coef * __pyx_v_data));
 
-  /* "splitBBoxLUT.pyx":481
- *         cdef float[:] cpos0_inf = self.cpos0_inf
- *         cdef float[:] cpos1_inf = self.cpos1_inf
- *         cdef float[:] cpos1_sup = self.cpos1_sup             # <<<<<<<<<<<<<<
- *         cdef numpy.ndarray[numpy.int32_t, ndim = 2] outMax = numpy.zeros((bins0,bins1), dtype=numpy.int32)
- *         cdef numpy.ndarray[lut_point, ndim = 3] lut
+                              /* "splitBBoxLUT.pyx":412
+ * 
+ *                 sum_data = sum_data + coef * data
+ *                 sum_count = sum_count + coef             # <<<<<<<<<<<<<<
+ *             outData[i] += sum_data
+ *             outCount[i] += sum_count
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__cpos1_sup); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_1);
-  if (unlikely(!__pyx_t_9.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_v_cpos1_sup = __pyx_t_9;
-  __pyx_t_9.memview = NULL;
-  __pyx_t_9.data = NULL;
+                              __pyx_v_sum_count = (__pyx_v_sum_count + __pyx_v_coef);
+                              __pyx_L58_continue:;
+                            }
+                            __pyx_L59_break:;
 
-  /* "splitBBoxLUT.pyx":482
- *         cdef float[:] cpos1_inf = self.cpos1_inf
- *         cdef float[:] cpos1_sup = self.cpos1_sup
- *         cdef numpy.ndarray[numpy.int32_t, ndim = 2] outMax = numpy.zeros((bins0,bins1), dtype=numpy.int32)             # <<<<<<<<<<<<<<
- *         cdef numpy.ndarray[lut_point, ndim = 3] lut
- *         cdef numpy.int8_t[:] cmask
+                            /* "splitBBoxLUT.pyx":413
+ *                 sum_data = sum_data + coef * data
+ *                 sum_count = sum_count + coef
+ *             outData[i] += sum_data             # <<<<<<<<<<<<<<
+ *             outCount[i] += sum_count
+ *             if sum_count > epsilon:
  */
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyInt_FromLong(__pyx_v_bins0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_10 = PyInt_FromLong(__pyx_v_bins1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_10);
-  __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_11);
-  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_1);
-  __Pyx_GIVEREF(__pyx_t_1);
-  PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_10);
-  __Pyx_GIVEREF(__pyx_t_10);
-  __pyx_t_1 = 0;
-  __pyx_t_10 = 0;
-  __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_10);
-  PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_t_11));
-  __Pyx_GIVEREF(((PyObject *)__pyx_t_11));
-  __pyx_t_11 = 0;
-  __pyx_t_11 = PyDict_New(); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_11));
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_12 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__int32); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_12);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (PyDict_SetItem(__pyx_t_11, ((PyObject *)__pyx_n_s__dtype), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-  __pyx_t_12 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_10), ((PyObject *)__pyx_t_11)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_12);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
-  if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_13 = ((PyArrayObject *)__pyx_t_12);
-  {
-    __Pyx_BufFmt_StackElem __pyx_stack[1];
-    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outMax.rcbuffer->pybuffer, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
-      __pyx_v_outMax = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf = NULL;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    } else {__pyx_pybuffernd_outMax.diminfo[0].strides = __pyx_pybuffernd_outMax.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outMax.diminfo[0].shape = __pyx_pybuffernd_outMax.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_outMax.diminfo[1].strides = __pyx_pybuffernd_outMax.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_outMax.diminfo[1].shape = __pyx_pybuffernd_outMax.rcbuffer->pybuffer.shape[1];
-    }
-  }
-  __pyx_t_13 = 0;
-  __pyx_v_outMax = ((PyArrayObject *)__pyx_t_12);
-  __pyx_t_12 = 0;
+                            __pyx_t_35 = __pyx_v_i;
+                            *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_outData.diminfo[0].strides) += __pyx_v_sum_data;
 
-  /* "splitBBoxLUT.pyx":485
- *         cdef numpy.ndarray[lut_point, ndim = 3] lut
- *         cdef numpy.int8_t[:] cmask
- *         if self.check_mask:             # <<<<<<<<<<<<<<
- *             cmask = self.cmask
- *             check_mask = True
+                            /* "splitBBoxLUT.pyx":414
+ *                 sum_count = sum_count + coef
+ *             outData[i] += sum_data
+ *             outCount[i] += sum_count             # <<<<<<<<<<<<<<
+ *             if sum_count > epsilon:
+ *                 outMerge[i] += sum_data / sum_count
  */
-  __pyx_t_12 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__check_mask); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_12);
-  __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-  if (__pyx_t_14) {
+                            __pyx_t_36 = __pyx_v_i;
+                            *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_outCount.diminfo[0].strides) += __pyx_v_sum_count;
 
-    /* "splitBBoxLUT.pyx":486
- *         cdef numpy.int8_t[:] cmask
- *         if self.check_mask:
- *             cmask = self.cmask             # <<<<<<<<<<<<<<
- *             check_mask = True
- *         else:
+                            /* "splitBBoxLUT.pyx":415
+ *             outData[i] += sum_data
+ *             outCount[i] += sum_count
+ *             if sum_count > epsilon:             # <<<<<<<<<<<<<<
+ *                 outMerge[i] += sum_data / sum_count
+ *             else:
  */
-    __pyx_t_12 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__cmask); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_12);
-    __pyx_t_15 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int8_t(__pyx_t_12);
-    if (unlikely(!__pyx_t_15.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-    __pyx_v_cmask = __pyx_t_15;
-    __pyx_t_15.memview = NULL;
-    __pyx_t_15.data = NULL;
+                            __pyx_t_11 = ((__pyx_v_sum_count > __pyx_v_epsilon) != 0);
+                            if (__pyx_t_11) {
 
-    /* "splitBBoxLUT.pyx":487
- *         if self.check_mask:
- *             cmask = self.cmask
- *             check_mask = True             # <<<<<<<<<<<<<<
- *         else:
- *             check_mask = False
+                              /* "splitBBoxLUT.pyx":416
+ *             outCount[i] += sum_count
+ *             if sum_count > epsilon:
+ *                 outMerge[i] += sum_data / sum_count             # <<<<<<<<<<<<<<
+ *             else:
+ *                 outMerge[i] += cdummy
  */
-    __pyx_v_check_mask = 1;
-    goto __pyx_L3;
-  }
-  /*else*/ {
+                              __pyx_t_44 = __pyx_v_i;
+                              *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_outMerge.diminfo[0].strides) += (__pyx_v_sum_data / __pyx_v_sum_count);
+                              goto __pyx_L62;
+                            }
+                            /*else*/ {
 
-    /* "splitBBoxLUT.pyx":489
- *             check_mask = True
- *         else:
- *             check_mask = False             # <<<<<<<<<<<<<<
+                              /* "splitBBoxLUT.pyx":418
+ *                 outMerge[i] += sum_data / sum_count
+ *             else:
+ *                 outMerge[i] += cdummy             # <<<<<<<<<<<<<<
+ *         return  self.outPos, outMerge, outData, outCount
  * 
- * #NOGIL
  */
-    __pyx_v_check_mask = 0;
-  }
-  __pyx_L3:;
+                              __pyx_t_45 = __pyx_v_i;
+                              *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.buf, __pyx_t_45, __pyx_pybuffernd_outMerge.diminfo[0].strides) += __pyx_v_cdummy;
+                            }
+                            __pyx_L62:;
+                        }
+                    }
+                }
+            }
+        }
+        #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
+      }
 
-  /* "splitBBoxLUT.pyx":492
+      /* "splitBBoxLUT.pyx":399
+ *                 cdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)
  * 
- * #NOGIL
- *         with nogil:             # <<<<<<<<<<<<<<
- *             for idx in range(size):
- *                 if (check_mask) and (cmask[idx]):
+ *         for i in prange(bins, nogil=True, schedule="guided"):             # <<<<<<<<<<<<<<
+ *             sum_data = 0.0
+ *             sum_count = 0.0
  */
-  {
-      #ifdef WITH_THREAD
-      PyThreadState *_save = NULL;
-      #endif
-      Py_UNBLOCK_THREADS
-      /*try:*/ {
+      /*finally:*/ {
+        #ifdef WITH_THREAD
+        Py_BLOCK_THREADS
+        #endif
+      }
+  }
 
-        /* "splitBBoxLUT.pyx":493
- * #NOGIL
- *         with nogil:
- *             for idx in range(size):             # <<<<<<<<<<<<<<
- *                 if (check_mask) and (cmask[idx]):
- *                     continue
+  /* "splitBBoxLUT.pyx":419
+ *             else:
+ *                 outMerge[i] += cdummy
+ *         return  self.outPos, outMerge, outData, outCount             # <<<<<<<<<<<<<<
+ * 
+ * 
  */
-        __pyx_t_5 = __pyx_v_size;
-        for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_5; __pyx_t_16+=1) {
-          __pyx_v_idx = __pyx_t_16;
-
-          /* "splitBBoxLUT.pyx":494
- *         with nogil:
- *             for idx in range(size):
- *                 if (check_mask) and (cmask[idx]):             # <<<<<<<<<<<<<<
- *                     continue
- * 
- */
-          __pyx_t_14 = __pyx_v_check_mask;
-          if (__pyx_t_14) {
-            if (unlikely(!__pyx_v_cmask.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cmask"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L5;} }
-            __pyx_t_17 = __pyx_v_idx;
-            __pyx_t_18 = (*((__pyx_t_5numpy_int8_t *) ( /* dim=0 */ (__pyx_v_cmask.data + __pyx_t_17 * __pyx_v_cmask.strides[0]) )));
-          } else {
-            __pyx_t_18 = __pyx_t_14;
-          }
-          if (__pyx_t_18) {
-
-            /* "splitBBoxLUT.pyx":495
- *             for idx in range(size):
- *                 if (check_mask) and (cmask[idx]):
- *                     continue             # <<<<<<<<<<<<<<
- * 
- *                 min0 = cpos0_inf[idx]
- */
-            goto __pyx_L7_continue;
-            goto __pyx_L9;
-          }
-          __pyx_L9:;
-
-          /* "splitBBoxLUT.pyx":497
- *                     continue
- * 
- *                 min0 = cpos0_inf[idx]             # <<<<<<<<<<<<<<
- *                 max0 = cpos0_sup[idx]
- *                 min1 = cpos1_inf[idx]
- */
-          __pyx_t_19 = __pyx_v_idx;
-          __pyx_v_min0 = (*((float *) ( /* dim=0 */ (__pyx_v_cpos0_inf.data + __pyx_t_19 * __pyx_v_cpos0_inf.strides[0]) )));
-
-          /* "splitBBoxLUT.pyx":498
- * 
- *                 min0 = cpos0_inf[idx]
- *                 max0 = cpos0_sup[idx]             # <<<<<<<<<<<<<<
- *                 min1 = cpos1_inf[idx]
- *                 max1 = cpos1_sup[idx]
- */
-          __pyx_t_20 = __pyx_v_idx;
-          __pyx_v_max0 = (*((float *) ( /* dim=0 */ (__pyx_v_cpos0_sup.data + __pyx_t_20 * __pyx_v_cpos0_sup.strides[0]) )));
-
-          /* "splitBBoxLUT.pyx":499
- *                 min0 = cpos0_inf[idx]
- *                 max0 = cpos0_sup[idx]
- *                 min1 = cpos1_inf[idx]             # <<<<<<<<<<<<<<
- *                 max1 = cpos1_sup[idx]
- * 
- */
-          __pyx_t_21 = __pyx_v_idx;
-          __pyx_v_min1 = (*((float *) ( /* dim=0 */ (__pyx_v_cpos1_inf.data + __pyx_t_21 * __pyx_v_cpos1_inf.strides[0]) )));
-
-          /* "splitBBoxLUT.pyx":500
- *                 max0 = cpos0_sup[idx]
- *                 min1 = cpos1_inf[idx]
- *                 max1 = cpos1_sup[idx]             # <<<<<<<<<<<<<<
- * 
- *                 bin0_min = < int > getBinNr(min0, pos0_min, delta0)
- */
-          __pyx_t_22 = __pyx_v_idx;
-          __pyx_v_max1 = (*((float *) ( /* dim=0 */ (__pyx_v_cpos1_sup.data + __pyx_t_22 * __pyx_v_cpos1_sup.strides[0]) )));
-
-          /* "splitBBoxLUT.pyx":502
- *                 max1 = cpos1_sup[idx]
- * 
- *                 bin0_min = < int > getBinNr(min0, pos0_min, delta0)             # <<<<<<<<<<<<<<
- *                 bin0_max = < int > getBinNr(max0, pos0_min, delta0)
- * 
- */
-          __pyx_v_bin0_min = ((int)__pyx_f_12splitBBoxLUT_getBinNr(__pyx_v_min0, __pyx_v_pos0_min, __pyx_v_delta0));
+  __Pyx_XDECREF(__pyx_r);
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__outPos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __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_INCREF(((PyObject *)__pyx_v_outMerge));
+  PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_v_outMerge));
+  __Pyx_GIVEREF(((PyObject *)__pyx_v_outMerge));
+  __Pyx_INCREF(((PyObject *)__pyx_v_outData));
+  PyTuple_SET_ITEM(__pyx_t_6, 2, ((PyObject *)__pyx_v_outData));
+  __Pyx_GIVEREF(((PyObject *)__pyx_v_outData));
+  __Pyx_INCREF(((PyObject *)__pyx_v_outCount));
+  PyTuple_SET_ITEM(__pyx_t_6, 3, ((PyObject *)__pyx_v_outCount));
+  __Pyx_GIVEREF(((PyObject *)__pyx_v_outCount));
+  __pyx_t_1 = 0;
+  __pyx_r = ((PyObject *)__pyx_t_6);
+  __pyx_t_6 = 0;
+  goto __pyx_L0;
 
-          /* "splitBBoxLUT.pyx":503
- * 
- *                 bin0_min = < int > getBinNr(min0, pos0_min, delta0)
- *                 bin0_max = < int > getBinNr(max0, pos0_min, delta0)             # <<<<<<<<<<<<<<
- * 
- *                 bin1_min = < int > getBinNr(min1, pos1_min, delta1)
- */
-          __pyx_v_bin0_max = ((int)__pyx_f_12splitBBoxLUT_getBinNr(__pyx_v_max0, __pyx_v_pos0_min, __pyx_v_delta0));
+  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_XDECREF(__pyx_t_3);
+  __Pyx_XDECREF(__pyx_t_4);
+  __Pyx_XDECREF(__pyx_t_5);
+  __Pyx_XDECREF(__pyx_t_6);
+  __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_t_14, 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_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
+  __Pyx_AddTraceback("splitBBoxLUT.HistoBBox1d.integrate", __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_L2:;
+  __Pyx_XDECREF((PyObject *)__pyx_v_outData);
+  __Pyx_XDECREF((PyObject *)__pyx_v_outCount);
+  __Pyx_XDECREF((PyObject *)__pyx_v_outMerge);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_lut, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_cdata, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_tdata, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_cflat, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_cdark, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_csolidAngle, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_cpolarization, 1);
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
 
-          /* "splitBBoxLUT.pyx":505
- *                 bin0_max = < int > getBinNr(max0, pos0_min, delta0)
- * 
- *                 bin1_min = < int > getBinNr(min1, pos1_min, delta1)             # <<<<<<<<<<<<<<
- *                 bin1_max = < int > getBinNr(max1, pos1_min, delta1)
- * 
+/* "splitBBoxLUT.pyx":429
+ * class HistoBBox2d(object):
+ *     @cython.boundscheck(False)
+ *     def __init__(self,             # <<<<<<<<<<<<<<
+ *                  pos0,
+ *                  delta_pos0,
  */
-          __pyx_v_bin1_min = ((int)__pyx_f_12splitBBoxLUT_getBinNr(__pyx_v_min1, __pyx_v_pos1_min, __pyx_v_delta1));
 
-          /* "splitBBoxLUT.pyx":506
- * 
- *                 bin1_min = < int > getBinNr(min1, pos1_min, delta1)
- *                 bin1_max = < int > getBinNr(max1, pos1_min, delta1)             # <<<<<<<<<<<<<<
- * 
- *                 if (bin0_max < 0) or (bin0_min >= bins0) or (bin1_max < 0) or (bin1_min >= bins1):
- */
-          __pyx_v_bin1_max = ((int)__pyx_f_12splitBBoxLUT_getBinNr(__pyx_v_max1, __pyx_v_pos1_min, __pyx_v_delta1));
+static PyObject *__pyx_pf_12splitBBoxLUT_11HistoBBox2d_8__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
+  PyObject *__pyx_r = NULL;
+  __Pyx_RefNannyDeclarations
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("__defaults__", 0);
+  __Pyx_XDECREF(__pyx_r);
 
-          /* "splitBBoxLUT.pyx":508
- *                 bin1_max = < int > getBinNr(max1, pos1_min, delta1)
- * 
- *                 if (bin0_max < 0) or (bin0_min >= bins0) or (bin1_max < 0) or (bin1_min >= bins1):             # <<<<<<<<<<<<<<
- *                     continue
- * 
+  /* "splitBBoxLUT.pyx":438
+ *                  pos1Range=None,
+ *                  mask=None,
+ *                  mask_checksum=None,             # <<<<<<<<<<<<<<
+ *                  allow_pos0_neg=False,
+ *                  unit="undefined",
  */
-          __pyx_t_18 = (__pyx_v_bin0_max < 0);
-          if (!__pyx_t_18) {
-            __pyx_t_14 = (__pyx_v_bin0_min >= __pyx_v_bins0);
-            if (!__pyx_t_14) {
-              __pyx_t_23 = (__pyx_v_bin1_max < 0);
-              if (!__pyx_t_23) {
-                __pyx_t_24 = (__pyx_v_bin1_min >= __pyx_v_bins1);
-                __pyx_t_25 = __pyx_t_24;
-              } else {
-                __pyx_t_25 = __pyx_t_23;
-              }
-              __pyx_t_23 = __pyx_t_25;
-            } else {
-              __pyx_t_23 = __pyx_t_14;
-            }
-            __pyx_t_14 = __pyx_t_23;
-          } else {
-            __pyx_t_14 = __pyx_t_18;
-          }
-          if (__pyx_t_14) {
+  __pyx_t_1 = PyTuple_New(8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_k_tuple_4)));
+  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_k_tuple_4)));
+  __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_k_tuple_4)));
+  __Pyx_INCREF(((PyObject *)Py_None));
+  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)Py_None));
+  __Pyx_GIVEREF(((PyObject *)Py_None));
+  __Pyx_INCREF(((PyObject *)Py_None));
+  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)Py_None));
+  __Pyx_GIVEREF(((PyObject *)Py_None));
+  __Pyx_INCREF(((PyObject *)Py_None));
+  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)Py_None));
+  __Pyx_GIVEREF(((PyObject *)Py_None));
+  __Pyx_INCREF(((PyObject *)Py_None));
+  PyTuple_SET_ITEM(__pyx_t_1, 4, ((PyObject *)Py_None));
+  __Pyx_GIVEREF(((PyObject *)Py_None));
+  __Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self)->__pyx_arg_allow_pos0_neg);
+  PyTuple_SET_ITEM(__pyx_t_1, 5, __Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self)->__pyx_arg_allow_pos0_neg);
+  __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self)->__pyx_arg_allow_pos0_neg);
+  __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_n_s__undefined)));
+  PyTuple_SET_ITEM(__pyx_t_1, 6, ((PyObject *)((PyObject*)__pyx_n_s__undefined)));
+  __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_n_s__undefined)));
+  __Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self)->__pyx_arg_chiDiscAtPi);
+  PyTuple_SET_ITEM(__pyx_t_1, 7, __Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self)->__pyx_arg_chiDiscAtPi);
+  __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self)->__pyx_arg_chiDiscAtPi);
 
-            /* "splitBBoxLUT.pyx":509
- * 
- *                 if (bin0_max < 0) or (bin0_min >= bins0) or (bin1_max < 0) or (bin1_min >= bins1):
- *                     continue             # <<<<<<<<<<<<<<
- * 
- *                 if bin0_max >= bins0 :
+  /* "splitBBoxLUT.pyx":429
+ * class HistoBBox2d(object):
+ *     @cython.boundscheck(False)
+ *     def __init__(self,             # <<<<<<<<<<<<<<
+ *                  pos0,
+ *                  delta_pos0,
  */
-            goto __pyx_L7_continue;
-            goto __pyx_L10;
-          }
-          __pyx_L10:;
+  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
+  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
+  __Pyx_INCREF(Py_None);
+  PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None);
+  __Pyx_GIVEREF(Py_None);
+  __pyx_t_1 = 0;
+  __pyx_r = ((PyObject *)__pyx_t_2);
+  __pyx_t_2 = 0;
+  goto __pyx_L0;
 
-          /* "splitBBoxLUT.pyx":511
- *                     continue
- * 
- *                 if bin0_max >= bins0 :             # <<<<<<<<<<<<<<
- *                     bin0_max = bins0 - 1
- *                 if  bin0_min < 0:
- */
-          __pyx_t_14 = (__pyx_v_bin0_max >= __pyx_v_bins0);
-          if (__pyx_t_14) {
+  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_XDECREF(__pyx_t_2);
+  __Pyx_AddTraceback("splitBBoxLUT.HistoBBox2d.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __pyx_r = NULL;
+  __pyx_L0:;
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
 
-            /* "splitBBoxLUT.pyx":512
- * 
- *                 if bin0_max >= bins0 :
- *                     bin0_max = bins0 - 1             # <<<<<<<<<<<<<<
- *                 if  bin0_min < 0:
- *                     bin0_min = 0
- */
-            __pyx_v_bin0_max = (__pyx_v_bins0 - 1);
-            goto __pyx_L11;
-          }
-          __pyx_L11:;
+/* Python wrapper */
+static PyObject *__pyx_pw_12splitBBoxLUT_11HistoBBox2d_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_12splitBBoxLUT_11HistoBBox2d___init__[] = "\n        @param pos0: 1D array with pos0: tth or q_vect\n        @param delta_pos0: 1D array with delta pos0: max center-corner distance\n        @param pos1: 1D array with pos1: chi\n        @param delta_pos1: 1D array with max pos1: max center-corner distance, unused !\n        @param bins: number of output bins (tth=100, chi=36 by default)\n        @param pos0Range: minimum and maximum  of the 2th range\n        @param  [...]
+static PyMethodDef __pyx_mdef_12splitBBoxLUT_11HistoBBox2d_1__init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pw_12splitBBoxLUT_11HistoBBox2d_1__init__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_12splitBBoxLUT_11HistoBBox2d___init__)};
+static PyObject *__pyx_pw_12splitBBoxLUT_11HistoBBox2d_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  PyObject *__pyx_v_self = 0;
+  PyObject *__pyx_v_pos0 = 0;
+  PyObject *__pyx_v_delta_pos0 = 0;
+  PyObject *__pyx_v_pos1 = 0;
+  PyObject *__pyx_v_delta_pos1 = 0;
+  PyObject *__pyx_v_bins = 0;
+  PyObject *__pyx_v_pos0Range = 0;
+  PyObject *__pyx_v_pos1Range = 0;
+  PyObject *__pyx_v_mask = 0;
+  PyObject *__pyx_v_mask_checksum = 0;
+  PyObject *__pyx_v_allow_pos0_neg = 0;
+  PyObject *__pyx_v_unit = 0;
+  PyObject *__pyx_v_chiDiscAtPi = 0;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  PyObject *__pyx_r = 0;
+  __Pyx_RefNannyDeclarations
+  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
+  {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__pos0,&__pyx_n_s__delta_pos0,&__pyx_n_s__pos1,&__pyx_n_s__delta_pos1,&__pyx_n_s__bins,&__pyx_n_s__pos0Range,&__pyx_n_s__pos1Range,&__pyx_n_s__mask,&__pyx_n_s__mask_checksum,&__pyx_n_s__allow_pos0_neg,&__pyx_n_s__unit,&__pyx_n_s__chiDiscAtPi,0};
+    PyObject* values[13] = {0,0,0,0,0,0,0,0,0,0,0,0,0};
+    __pyx_defaults1 *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self);
+    values[5] = ((PyObject *)((PyObject*)__pyx_k_tuple_4));
+    values[6] = ((PyObject *)((PyObject *)Py_None));
+    values[7] = ((PyObject *)((PyObject *)Py_None));
+    values[8] = ((PyObject *)((PyObject *)Py_None));
+    values[9] = ((PyObject *)((PyObject *)Py_None));
+    values[10] = __pyx_dynamic_args->__pyx_arg_allow_pos0_neg;
+    values[11] = ((PyObject *)((PyObject*)__pyx_n_s__undefined));
+    values[12] = __pyx_dynamic_args->__pyx_arg_chiDiscAtPi;
+    if (unlikely(__pyx_kwds)) {
+      Py_ssize_t kw_args;
+      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+      switch (pos_args) {
+        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
+        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
+        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
+        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
+        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
+        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
+        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
+        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
+        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
+        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
+        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+        case  0: break;
+        default: goto __pyx_L5_argtuple_error;
+      }
+      kw_args = PyDict_Size(__pyx_kwds);
+      switch (pos_args) {
+        case  0:
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
+        else goto __pyx_L5_argtuple_error;
+        case  1:
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos0)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 13, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+        case  2:
+        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__delta_pos0)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 13, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+        case  3:
+        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos1)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 13, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+        case  4:
+        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__delta_pos1)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 13, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+        case  5:
+        if (kw_args > 0) {
+          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bins);
+          if (value) { values[5] = value; kw_args--; }
+        }
+        case  6:
+        if (kw_args > 0) {
+          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos0Range);
+          if (value) { values[6] = value; kw_args--; }
+        }
+        case  7:
+        if (kw_args > 0) {
+          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos1Range);
+          if (value) { values[7] = value; kw_args--; }
+        }
+        case  8:
+        if (kw_args > 0) {
+          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mask);
+          if (value) { values[8] = value; kw_args--; }
+        }
+        case  9:
+        if (kw_args > 0) {
+          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mask_checksum);
+          if (value) { values[9] = value; kw_args--; }
+        }
+        case 10:
+        if (kw_args > 0) {
+          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__allow_pos0_neg);
+          if (value) { values[10] = value; kw_args--; }
+        }
+        case 11:
+        if (kw_args > 0) {
+          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__unit);
+          if (value) { values[11] = value; kw_args--; }
+        }
+        case 12:
+        if (kw_args > 0) {
+          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__chiDiscAtPi);
+          if (value) { values[12] = value; kw_args--; }
+        }
+      }
+      if (unlikely(kw_args > 0)) {
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      }
+    } else {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
+        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
+        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
+        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
+        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
+        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
+        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
+        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
+        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
+        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
+        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
+        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+        break;
+        default: goto __pyx_L5_argtuple_error;
+      }
+    }
+    __pyx_v_self = values[0];
+    __pyx_v_pos0 = values[1];
+    __pyx_v_delta_pos0 = values[2];
+    __pyx_v_pos1 = values[3];
+    __pyx_v_delta_pos1 = values[4];
+    __pyx_v_bins = values[5];
+    __pyx_v_pos0Range = values[6];
+    __pyx_v_pos1Range = values[7];
+    __pyx_v_mask = values[8];
+    __pyx_v_mask_checksum = values[9];
+    __pyx_v_allow_pos0_neg = values[10];
+    __pyx_v_unit = values[11];
+    __pyx_v_chiDiscAtPi = values[12];
+  }
+  goto __pyx_L4_argument_unpacking_done;
+  __pyx_L5_argtuple_error:;
+  __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 13, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __pyx_L3_error:;
+  __Pyx_AddTraceback("splitBBoxLUT.HistoBBox2d.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_RefNannyFinishContext();
+  return NULL;
+  __pyx_L4_argument_unpacking_done:;
+  __pyx_r = __pyx_pf_12splitBBoxLUT_11HistoBBox2d___init__(__pyx_self, __pyx_v_self, __pyx_v_pos0, __pyx_v_delta_pos0, __pyx_v_pos1, __pyx_v_delta_pos1, __pyx_v_bins, __pyx_v_pos0Range, __pyx_v_pos1Range, __pyx_v_mask, __pyx_v_mask_checksum, __pyx_v_allow_pos0_neg, __pyx_v_unit, __pyx_v_chiDiscAtPi);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
 
-          /* "splitBBoxLUT.pyx":513
- *                 if bin0_max >= bins0 :
- *                     bin0_max = bins0 - 1
- *                 if  bin0_min < 0:             # <<<<<<<<<<<<<<
- *                     bin0_min = 0
- *                 if bin1_max >= bins1 :
- */
-          __pyx_t_14 = (__pyx_v_bin0_min < 0);
-          if (__pyx_t_14) {
+static PyObject *__pyx_pf_12splitBBoxLUT_11HistoBBox2d___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_pos0, PyObject *__pyx_v_delta_pos0, PyObject *__pyx_v_pos1, PyObject *__pyx_v_delta_pos1, PyObject *__pyx_v_bins, PyObject *__pyx_v_pos0Range, PyObject *__pyx_v_pos1Range, PyObject *__pyx_v_mask, PyObject *__pyx_v_mask_checksum, PyObject *__pyx_v_allow_pos0_neg, PyObject *__pyx_v_unit, PyObject *__pyx_v_chiDiscAtPi) {
+  PyObject *__pyx_v_bins0 = NULL;
+  PyObject *__pyx_v_bins1 = NULL;
+  PyObject *__pyx_r = NULL;
+  __Pyx_RefNannyDeclarations
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  PyObject *__pyx_t_3 = NULL;
+  int __pyx_t_4;
+  long __pyx_t_5;
+  PyObject *__pyx_t_6 = NULL;
+  PyObject *__pyx_t_7 = NULL;
+  PyObject *__pyx_t_8 = NULL;
+  PyObject *__pyx_t_9 = NULL;
+  PyObject *(*__pyx_t_10)(PyObject *);
+  int __pyx_t_11;
+  PyObject *__pyx_t_12 = NULL;
+  double __pyx_t_13;
+  PyObject *__pyx_t_14 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("__init__", 0);
 
-            /* "splitBBoxLUT.pyx":514
- *                     bin0_max = bins0 - 1
- *                 if  bin0_min < 0:
- *                     bin0_min = 0             # <<<<<<<<<<<<<<
- *                 if bin1_max >= bins1 :
- *                     bin1_max = bins1 - 1
+  /* "splitBBoxLUT.pyx":456
+ *         """
+ *         cdef int i, size, bin0, bin1
+ *         self.size = pos0.size             # <<<<<<<<<<<<<<
+ *         assert delta_pos0.size == self.size
+ *         assert pos1.size == self.size
  */
-            __pyx_v_bin0_min = 0;
-            goto __pyx_L12;
-          }
-          __pyx_L12:;
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_pos0, __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__size, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-          /* "splitBBoxLUT.pyx":515
- *                 if  bin0_min < 0:
- *                     bin0_min = 0
- *                 if bin1_max >= bins1 :             # <<<<<<<<<<<<<<
- *                     bin1_max = bins1 - 1
- *                 if  bin1_min < 0:
+  /* "splitBBoxLUT.pyx":457
+ *         cdef int i, size, bin0, bin1
+ *         self.size = pos0.size
+ *         assert delta_pos0.size == self.size             # <<<<<<<<<<<<<<
+ *         assert pos1.size == self.size
+ *         assert delta_pos1.size == self.size
  */
-          __pyx_t_14 = (__pyx_v_bin1_max >= __pyx_v_bins1);
-          if (__pyx_t_14) {
+  #ifndef CYTHON_WITHOUT_ASSERTIONS
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_delta_pos0, __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __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 = 457; __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 = 457; __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 = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  }
+  #endif
 
-            /* "splitBBoxLUT.pyx":516
- *                     bin0_min = 0
- *                 if bin1_max >= bins1 :
- *                     bin1_max = bins1 - 1             # <<<<<<<<<<<<<<
- *                 if  bin1_min < 0:
- *                     bin1_min = 0
+  /* "splitBBoxLUT.pyx":458
+ *         self.size = pos0.size
+ *         assert delta_pos0.size == self.size
+ *         assert pos1.size == self.size             # <<<<<<<<<<<<<<
+ *         assert delta_pos1.size == self.size
+ *         self.chiDiscAtPi = 1 if chiDiscAtPi else 0
  */
-            __pyx_v_bin1_max = (__pyx_v_bins1 - 1);
-            goto __pyx_L13;
-          }
-          __pyx_L13:;
+  #ifndef CYTHON_WITHOUT_ASSERTIONS
+  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_pos1, __pyx_n_s__size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __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 = 458; __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 = 458; __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 = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  }
+  #endif
 
-          /* "splitBBoxLUT.pyx":517
- *                 if bin1_max >= bins1 :
- *                     bin1_max = bins1 - 1
- *                 if  bin1_min < 0:             # <<<<<<<<<<<<<<
- *                     bin1_min = 0
- * 
+  /* "splitBBoxLUT.pyx":459
+ *         assert delta_pos0.size == self.size
+ *         assert pos1.size == self.size
+ *         assert delta_pos1.size == self.size             # <<<<<<<<<<<<<<
+ *         self.chiDiscAtPi = 1 if chiDiscAtPi else 0
+ *         self.allow_pos0_neg =  allow_pos0_neg
  */
-          __pyx_t_14 = (__pyx_v_bin1_min < 0);
-          if (__pyx_t_14) {
+  #ifndef CYTHON_WITHOUT_ASSERTIONS
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_delta_pos1, __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __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 = 459; __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 = 459; __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 = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  }
+  #endif
 
-            /* "splitBBoxLUT.pyx":518
- *                     bin1_max = bins1 - 1
- *                 if  bin1_min < 0:
- *                     bin1_min = 0             # <<<<<<<<<<<<<<
+  /* "splitBBoxLUT.pyx":460
+ *         assert pos1.size == self.size
+ *         assert delta_pos1.size == self.size
+ *         self.chiDiscAtPi = 1 if chiDiscAtPi else 0             # <<<<<<<<<<<<<<
+ *         self.allow_pos0_neg =  allow_pos0_neg
  * 
- *                 for i in range(bin0_min, bin0_max+1):
  */
-            __pyx_v_bin1_min = 0;
-            goto __pyx_L14;
-          }
-          __pyx_L14:;
+  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_chiDiscAtPi); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__pyx_t_4) {
+    __pyx_t_5 = 1;
+  } else {
+    __pyx_t_5 = 0;
+  }
+  __pyx_t_3 = PyInt_FromLong(__pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__chiDiscAtPi, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
-          /* "splitBBoxLUT.pyx":520
- *                     bin1_min = 0
+  /* "splitBBoxLUT.pyx":461
+ *         assert delta_pos1.size == self.size
+ *         self.chiDiscAtPi = 1 if chiDiscAtPi else 0
+ *         self.allow_pos0_neg =  allow_pos0_neg             # <<<<<<<<<<<<<<
  * 
- *                 for i in range(bin0_min, bin0_max+1):             # <<<<<<<<<<<<<<
- *                     for j in range(bin1_min , bin1_max+1):
- *                         outMax[i, j] +=  1
+ *         try:
  */
-          __pyx_t_26 = (__pyx_v_bin0_max + 1);
-          for (__pyx_t_27 = __pyx_v_bin0_min; __pyx_t_27 < __pyx_t_26; __pyx_t_27+=1) {
-            __pyx_v_i = __pyx_t_27;
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__allow_pos0_neg, __pyx_v_allow_pos0_neg) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-            /* "splitBBoxLUT.pyx":521
- * 
- *                 for i in range(bin0_min, bin0_max+1):
- *                     for j in range(bin1_min , bin1_max+1):             # <<<<<<<<<<<<<<
- *                         outMax[i, j] +=  1
+  /* "splitBBoxLUT.pyx":463
+ *         self.allow_pos0_neg =  allow_pos0_neg
  * 
+ *         try:             # <<<<<<<<<<<<<<
+ *             bins0, bins1 = tuple(bins)
+ *         except:
  */
-            __pyx_t_28 = (__pyx_v_bin1_max + 1);
-            for (__pyx_t_29 = __pyx_v_bin1_min; __pyx_t_29 < __pyx_t_28; __pyx_t_29+=1) {
-              __pyx_v_j = __pyx_t_29;
+  {
+    __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:*/ {
 
-              /* "splitBBoxLUT.pyx":522
- *                 for i in range(bin0_min, bin0_max+1):
- *                     for j in range(bin1_min , bin1_max+1):
- *                         outMax[i, j] +=  1             # <<<<<<<<<<<<<<
+      /* "splitBBoxLUT.pyx":464
  * 
- *         self.lut_size = lut_size = outMax.max()
+ *         try:
+ *             bins0, bins1 = tuple(bins)             # <<<<<<<<<<<<<<
+ *         except:
+ *             bins0 = bins1 = bins
  */
-              __pyx_t_30 = __pyx_v_i;
-              __pyx_t_31 = __pyx_v_j;
-              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_31, __pyx_pybuffernd_outMax.diminfo[1].strides) += 1;
-            }
-          }
-          __pyx_L7_continue:;
+      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __Pyx_INCREF(__pyx_v_bins);
+      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_bins);
+      __Pyx_GIVEREF(__pyx_v_bins);
+      __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      __Pyx_GOTREF(__pyx_t_2);
+      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 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 = 464; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
+        #if CYTHON_COMPILING_IN_CPYTHON
+        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
+        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
+        __Pyx_INCREF(__pyx_t_3);
+        __Pyx_INCREF(__pyx_t_1);
+        #else
+        __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        __Pyx_GOTREF(__pyx_t_3);
+        __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        __Pyx_GOTREF(__pyx_t_1);
+        #endif
+        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      } else if (1) {
+        __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __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 = 464; __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_3 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_3)) goto __pyx_L11_unpacking_failed;
+        __Pyx_GOTREF(__pyx_t_3);
+        index = 1; __pyx_t_1 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_1)) goto __pyx_L11_unpacking_failed;
+        __Pyx_GOTREF(__pyx_t_1);
+        if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __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 = 464; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        __pyx_L12_unpacking_done:;
       }
+      __pyx_v_bins0 = __pyx_t_3;
+      __pyx_t_3 = 0;
+      __pyx_v_bins1 = __pyx_t_1;
+      __pyx_t_1 = 0;
+    }
+    __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_3); __pyx_t_3 = 0;
+    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-      /* "splitBBoxLUT.pyx":492
- * 
- * #NOGIL
- *         with nogil:             # <<<<<<<<<<<<<<
- *             for idx in range(size):
- *                 if (check_mask) and (cmask[idx]):
+    /* "splitBBoxLUT.pyx":465
+ *         try:
+ *             bins0, bins1 = tuple(bins)
+ *         except:             # <<<<<<<<<<<<<<
+ *             bins0 = bins1 = bins
+ *         if bins0 <= 0:
  */
-      /*finally:*/ {
-        int __pyx_why;
-        __pyx_why = 0; goto __pyx_L6;
-        __pyx_L5: __pyx_why = 4; goto __pyx_L6;
-        __pyx_L6:;
-        Py_BLOCK_THREADS
-        switch (__pyx_why) {
-          case 4: goto __pyx_L1_error;
-        }
-      }
-  }
+    /*except:*/ {
+      __Pyx_AddTraceback("splitBBoxLUT.HistoBBox2d.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
+      __Pyx_GOTREF(__pyx_t_2);
+      __Pyx_GOTREF(__pyx_t_1);
+      __Pyx_GOTREF(__pyx_t_3);
 
-  /* "splitBBoxLUT.pyx":524
- *                         outMax[i, j] +=  1
- * 
- *         self.lut_size = lut_size = outMax.max()             # <<<<<<<<<<<<<<
- *         #just recycle the outMax array
- *         #outMax = numpy.zeros((bins0,bins1), dtype=numpy.int32)
+      /* "splitBBoxLUT.pyx":466
+ *             bins0, bins1 = tuple(bins)
+ *         except:
+ *             bins0 = bins1 = bins             # <<<<<<<<<<<<<<
+ *         if bins0 <= 0:
+ *             bins0 = 1
  */
-  __pyx_t_12 = PyObject_GetAttr(((PyObject *)__pyx_v_outMax), __pyx_n_s__max); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_12);
-  __pyx_t_11 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_11);
-  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__lut_size, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_5 = __Pyx_PyInt_from_py_npy_int32(__pyx_t_11); if (unlikely((__pyx_t_5 == (npy_int32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_lut_size = __pyx_t_5;
-  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+      __Pyx_INCREF(__pyx_v_bins);
+      __Pyx_XDECREF_SET(__pyx_v_bins0, __pyx_v_bins);
+      __Pyx_INCREF(__pyx_v_bins);
+      __Pyx_XDECREF_SET(__pyx_v_bins1, __pyx_v_bins);
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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:;
+  }
 
-  /* "splitBBoxLUT.pyx":527
- *         #just recycle the outMax array
- *         #outMax = numpy.zeros((bins0,bins1), dtype=numpy.int32)
- *         memset(&outMax[0,0], 0, bins0*bins1*sizeof(numpy.int32_t))             # <<<<<<<<<<<<<<
- * 
- *         lut_nbytes = bins0 * bins1 * lut_size * sizeof(lut_point)
+  /* "splitBBoxLUT.pyx":467
+ *         except:
+ *             bins0 = bins1 = bins
+ *         if bins0 <= 0:             # <<<<<<<<<<<<<<
+ *             bins0 = 1
+ *         if bins1 <= 0:
  */
-  __pyx_t_26 = 0;
-  __pyx_t_28 = 0;
-  memset((&(*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_outMax.diminfo[1].strides))), 0, ((__pyx_v_bins0 * __pyx_v_bins1) * (sizeof(__pyx_t_5numpy_int32_t))));
+  __pyx_t_3 = PyObject_RichCompare(__pyx_v_bins0, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  if (__pyx_t_4) {
 
-  /* "splitBBoxLUT.pyx":529
- *         memset(&outMax[0,0], 0, bins0*bins1*sizeof(numpy.int32_t))
- * 
- *         lut_nbytes = bins0 * bins1 * lut_size * sizeof(lut_point)             # <<<<<<<<<<<<<<
- *         if (os.name == "posix") and ("SC_PAGE_SIZE" in os.sysconf_names) and ("SC_PHYS_PAGES" in os.sysconf_names):
- *             memsize =  os.sysconf("SC_PAGE_SIZE")*os.sysconf("SC_PHYS_PAGES")
+    /* "splitBBoxLUT.pyx":468
+ *             bins0 = bins1 = bins
+ *         if bins0 <= 0:
+ *             bins0 = 1             # <<<<<<<<<<<<<<
+ *         if bins1 <= 0:
+ *             bins1 = 1
  */
-  __pyx_v_lut_nbytes = (((__pyx_v_bins0 * __pyx_v_bins1) * __pyx_v_lut_size) * (sizeof(struct __pyx_t_12splitBBoxLUT_lut_point)));
+    __Pyx_INCREF(__pyx_int_1);
+    __Pyx_DECREF_SET(__pyx_v_bins0, __pyx_int_1);
+    goto __pyx_L15;
+  }
+  __pyx_L15:;
 
-  /* "splitBBoxLUT.pyx":530
- * 
- *         lut_nbytes = bins0 * bins1 * lut_size * sizeof(lut_point)
- *         if (os.name == "posix") and ("SC_PAGE_SIZE" in os.sysconf_names) and ("SC_PHYS_PAGES" in os.sysconf_names):             # <<<<<<<<<<<<<<
- *             memsize =  os.sysconf("SC_PAGE_SIZE")*os.sysconf("SC_PHYS_PAGES")
- *             if memsize <  lut_nbytes:
+  /* "splitBBoxLUT.pyx":469
+ *         if bins0 <= 0:
+ *             bins0 = 1
+ *         if bins1 <= 0:             # <<<<<<<<<<<<<<
+ *             bins1 = 1
+ *         self.bins = (int(bins0),int(bins1))
  */
-  __pyx_t_11 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_11);
-  __pyx_t_12 = PyObject_GetAttr(__pyx_t_11, __pyx_n_s__name); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_12);
-  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-  __pyx_t_11 = PyObject_RichCompare(__pyx_t_12, ((PyObject *)__pyx_n_s__posix), Py_EQ); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-  __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-  if (__pyx_t_14) {
-    __pyx_t_11 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_11);
-    __pyx_t_12 = PyObject_GetAttr(__pyx_t_11, __pyx_n_s__sysconf_names); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_12);
-    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-    __pyx_t_18 = (__Pyx_PySequence_Contains(((PyObject *)__pyx_n_s__SC_PAGE_SIZE), __pyx_t_12, Py_EQ)); if (unlikely(__pyx_t_18 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-    if (__pyx_t_18) {
-      __pyx_t_12 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_12);
-      __pyx_t_11 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__sysconf_names); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_11);
-      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-      __pyx_t_23 = (__Pyx_PySequence_Contains(((PyObject *)__pyx_n_s__SC_PHYS_PAGES), __pyx_t_11, Py_EQ)); if (unlikely(__pyx_t_23 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-      __pyx_t_25 = __pyx_t_23;
-    } else {
-      __pyx_t_25 = __pyx_t_18;
-    }
-    __pyx_t_18 = __pyx_t_25;
-  } else {
-    __pyx_t_18 = __pyx_t_14;
-  }
-  if (__pyx_t_18) {
+  __pyx_t_3 = PyObject_RichCompare(__pyx_v_bins1, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  if (__pyx_t_4) {
 
-    /* "splitBBoxLUT.pyx":531
- *         lut_nbytes = bins0 * bins1 * lut_size * sizeof(lut_point)
- *         if (os.name == "posix") and ("SC_PAGE_SIZE" in os.sysconf_names) and ("SC_PHYS_PAGES" in os.sysconf_names):
- *             memsize =  os.sysconf("SC_PAGE_SIZE")*os.sysconf("SC_PHYS_PAGES")             # <<<<<<<<<<<<<<
- *             if memsize <  lut_nbytes:
- *                 raise MemoryError("Lookup-table (%i, %i, %i) is %.3fGB whereas the memory of the system is only %s"%(bins0, bins1, lut_size, lut_nbytes, memsize))
+    /* "splitBBoxLUT.pyx":470
+ *             bins0 = 1
+ *         if bins1 <= 0:
+ *             bins1 = 1             # <<<<<<<<<<<<<<
+ *         self.bins = (int(bins0),int(bins1))
+ *         self.lut_size = 0
  */
-    __pyx_t_11 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_11);
-    __pyx_t_12 = PyObject_GetAttr(__pyx_t_11, __pyx_n_s__sysconf); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_12);
-    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
-    __pyx_t_11 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_k_tuple_5), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_11);
-    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-    __pyx_t_12 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_INCREF(__pyx_int_1);
+    __Pyx_DECREF_SET(__pyx_v_bins1, __pyx_int_1);
+    goto __pyx_L16;
+  }
+  __pyx_L16:;
+
+  /* "splitBBoxLUT.pyx":471
+ *         if bins1 <= 0:
+ *             bins1 = 1
+ *         self.bins = (int(bins0),int(bins1))             # <<<<<<<<<<<<<<
+ *         self.lut_size = 0
+ *         if  mask is not None:
+ */
+  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_INCREF(__pyx_v_bins0);
+  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_bins0);
+  __Pyx_GIVEREF(__pyx_v_bins0);
+  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_INCREF(__pyx_v_bins1);
+  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_bins1);
+  __Pyx_GIVEREF(__pyx_v_bins1);
+  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __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);
+  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
+  __Pyx_GIVEREF(__pyx_t_2);
+  __pyx_t_1 = 0;
+  __pyx_t_2 = 0;
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__bins, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+
+  /* "splitBBoxLUT.pyx":472
+ *             bins1 = 1
+ *         self.bins = (int(bins0),int(bins1))
+ *         self.lut_size = 0             # <<<<<<<<<<<<<<
+ *         if  mask is not None:
+ *             assert mask.size == self.size
+ */
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__lut_size, __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "splitBBoxLUT.pyx":473
+ *         self.bins = (int(bins0),int(bins1))
+ *         self.lut_size = 0
+ *         if  mask is not None:             # <<<<<<<<<<<<<<
+ *             assert mask.size == self.size
+ *             self.check_mask = True
+ */
+  __pyx_t_4 = (__pyx_v_mask != Py_None);
+  __pyx_t_11 = (__pyx_t_4 != 0);
+  if (__pyx_t_11) {
+
+    /* "splitBBoxLUT.pyx":474
+ *         self.lut_size = 0
+ *         if  mask is not None:
+ *             assert mask.size == self.size             # <<<<<<<<<<<<<<
+ *             self.check_mask = True
+ *             self.cmask = numpy.ascontiguousarray(mask.ravel(), dtype=numpy.int8)
+ */
+    #ifndef CYTHON_WITHOUT_ASSERTIONS
+    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_mask, __pyx_n_s__size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __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 = 474; __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_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    if (unlikely(!__pyx_t_11)) {
+      PyErr_SetNone(PyExc_AssertionError);
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    }
+    #endif
+
+    /* "splitBBoxLUT.pyx":475
+ *         if  mask is not None:
+ *             assert mask.size == self.size
+ *             self.check_mask = True             # <<<<<<<<<<<<<<
+ *             self.cmask = numpy.ascontiguousarray(mask.ravel(), dtype=numpy.int8)
+ *             if mask_checksum:
+ */
+    __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__check_mask, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+    /* "splitBBoxLUT.pyx":476
+ *             assert mask.size == self.size
+ *             self.check_mask = True
+ *             self.cmask = numpy.ascontiguousarray(mask.ravel(), dtype=numpy.int8)             # <<<<<<<<<<<<<<
+ *             if mask_checksum:
+ *                 self.mask_checksum = mask_checksum
+ */
+    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_mask, __pyx_n_s__ravel); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __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 = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __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);
+    __pyx_t_3 = 0;
+    __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+    __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_9);
+    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s__int8); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_12);
-    __pyx_t_10 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__sysconf); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_10);
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-    __pyx_t_12 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_12 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_12);
-    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-    __pyx_t_10 = PyNumber_Multiply(__pyx_t_11, __pyx_t_12); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_10);
-    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__cmask, __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-    __pyx_v_memsize = __pyx_t_10;
-    __pyx_t_10 = 0;
 
-    /* "splitBBoxLUT.pyx":532
- *         if (os.name == "posix") and ("SC_PAGE_SIZE" in os.sysconf_names) and ("SC_PHYS_PAGES" in os.sysconf_names):
- *             memsize =  os.sysconf("SC_PAGE_SIZE")*os.sysconf("SC_PHYS_PAGES")
- *             if memsize <  lut_nbytes:             # <<<<<<<<<<<<<<
- *                 raise MemoryError("Lookup-table (%i, %i, %i) is %.3fGB whereas the memory of the system is only %s"%(bins0, bins1, lut_size, lut_nbytes, memsize))
- *         #else hope we have enough memory
+    /* "splitBBoxLUT.pyx":477
+ *             self.check_mask = True
+ *             self.cmask = numpy.ascontiguousarray(mask.ravel(), dtype=numpy.int8)
+ *             if mask_checksum:             # <<<<<<<<<<<<<<
+ *                 self.mask_checksum = mask_checksum
+ *             else:
  */
-    __pyx_t_10 = __Pyx_PyInt_FromSize_t(__pyx_v_lut_nbytes); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_10);
-    __pyx_t_12 = PyObject_RichCompare(__pyx_v_memsize, __pyx_t_10, Py_LT); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-    __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_18 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-    if (__pyx_t_18) {
+    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_v_mask_checksum); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (__pyx_t_11) {
 
-      /* "splitBBoxLUT.pyx":533
- *             memsize =  os.sysconf("SC_PAGE_SIZE")*os.sysconf("SC_PHYS_PAGES")
- *             if memsize <  lut_nbytes:
- *                 raise MemoryError("Lookup-table (%i, %i, %i) is %.3fGB whereas the memory of the system is only %s"%(bins0, bins1, lut_size, lut_nbytes, memsize))             # <<<<<<<<<<<<<<
- *         #else hope we have enough memory
- *         lut = numpy.recarray(shape=(bins0, bins1, lut_size),dtype=[("idx",numpy.int32),("coef",numpy.float32)])
+      /* "splitBBoxLUT.pyx":478
+ *             self.cmask = numpy.ascontiguousarray(mask.ravel(), dtype=numpy.int8)
+ *             if mask_checksum:
+ *                 self.mask_checksum = mask_checksum             # <<<<<<<<<<<<<<
+ *             else:
+ *                 self.mask_checksum = crc32(mask)
+ */
+      if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__mask_checksum, __pyx_v_mask_checksum) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      goto __pyx_L18;
+    }
+    /*else*/ {
+
+      /* "splitBBoxLUT.pyx":480
+ *                 self.mask_checksum = mask_checksum
+ *             else:
+ *                 self.mask_checksum = crc32(mask)             # <<<<<<<<<<<<<<
+ *         else:
+ *             self.check_mask = False
  */
-      __pyx_t_12 = PyInt_FromLong(__pyx_v_bins0); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s__crc32); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_12);
-      __pyx_t_10 = PyInt_FromLong(__pyx_v_bins1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_10);
-      __pyx_t_11 = __Pyx_PyInt_to_py_npy_int32(__pyx_v_lut_size); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_11);
-      __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_lut_nbytes); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_12);
-      __Pyx_GIVEREF(__pyx_t_12);
-      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_10);
-      __Pyx_GIVEREF(__pyx_t_10);
-      PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_11);
-      __Pyx_GIVEREF(__pyx_t_11);
-      PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_3);
-      __Pyx_GIVEREF(__pyx_t_3);
-      __Pyx_INCREF(__pyx_v_memsize);
-      PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_v_memsize);
-      __Pyx_GIVEREF(__pyx_v_memsize);
-      __pyx_t_12 = 0;
-      __pyx_t_10 = 0;
-      __pyx_t_11 = 0;
-      __pyx_t_3 = 0;
-      __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_7), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-      __Pyx_DECREF(((PyObject *)__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 = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_INCREF(__pyx_v_mask);
+      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_mask);
+      __Pyx_GIVEREF(__pyx_v_mask);
+      __pyx_t_1 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
-      PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_3));
-      __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
-      __pyx_t_3 = 0;
-      __pyx_t_3 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      goto __pyx_L21;
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+      if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__mask_checksum, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     }
-    __pyx_L21:;
-    goto __pyx_L20;
+    __pyx_L18:;
+    goto __pyx_L17;
   }
-  __pyx_L20:;
+  /*else*/ {
 
-  /* "splitBBoxLUT.pyx":535
- *                 raise MemoryError("Lookup-table (%i, %i, %i) is %.3fGB whereas the memory of the system is only %s"%(bins0, bins1, lut_size, lut_nbytes, memsize))
- *         #else hope we have enough memory
- *         lut = numpy.recarray(shape=(bins0, bins1, lut_size),dtype=[("idx",numpy.int32),("coef",numpy.float32)])             # <<<<<<<<<<<<<<
- *         memset(&lut[0,0,0], 0, lut_nbytes)
- *         with nogil:
+    /* "splitBBoxLUT.pyx":482
+ *                 self.mask_checksum = crc32(mask)
+ *         else:
+ *             self.check_mask = False             # <<<<<<<<<<<<<<
+ *             self.mask_checksum = None
+ * 
+ */
+    __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__check_mask, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+    /* "splitBBoxLUT.pyx":483
+ *         else:
+ *             self.check_mask = False
+ *             self.mask_checksum = None             # <<<<<<<<<<<<<<
+ * 
+ *         self.cpos0 = numpy.ascontiguousarray(pos0.ravel(), dtype=numpy.float32)
+ */
+    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__mask_checksum, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  }
+  __pyx_L17:;
+
+  /* "splitBBoxLUT.pyx":485
+ *             self.mask_checksum = None
+ * 
+ *         self.cpos0 = numpy.ascontiguousarray(pos0.ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
+ *         self.dpos0 = numpy.ascontiguousarray(delta_pos0.ravel(), dtype=numpy.float32)
+ *         self.cpos0_sup = numpy.empty_like(self.cpos0)
  */
-  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __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 = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__recarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_pos0, __pyx_n_s__ravel); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-  __pyx_t_11 = PyInt_FromLong(__pyx_v_bins0); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_11);
-  __pyx_t_10 = PyInt_FromLong(__pyx_v_bins1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_10);
-  __pyx_t_12 = __Pyx_PyInt_to_py_npy_int32(__pyx_v_lut_size); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_12 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_12);
-  __pyx_t_32 = PyTuple_New(3); if (unlikely(!__pyx_t_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_32);
-  PyTuple_SET_ITEM(__pyx_t_32, 0, __pyx_t_11);
-  __Pyx_GIVEREF(__pyx_t_11);
-  PyTuple_SET_ITEM(__pyx_t_32, 1, __pyx_t_10);
-  __Pyx_GIVEREF(__pyx_t_10);
-  PyTuple_SET_ITEM(__pyx_t_32, 2, __pyx_t_12);
+  __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 = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_12);
   __Pyx_GIVEREF(__pyx_t_12);
-  __pyx_t_11 = 0;
-  __pyx_t_10 = 0;
   __pyx_t_12 = 0;
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__shape), ((PyObject *)__pyx_t_32)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(((PyObject *)__pyx_t_32)); __pyx_t_32 = 0;
-  __pyx_t_32 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_32);
-  __pyx_t_12 = PyObject_GetAttr(__pyx_t_32, __pyx_n_s__int32); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_12));
+  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__float32); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_9);
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__dtype), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+  __pyx_t_9 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_9);
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__cpos0, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+
+  /* "splitBBoxLUT.pyx":486
+ * 
+ *         self.cpos0 = numpy.ascontiguousarray(pos0.ravel(), dtype=numpy.float32)
+ *         self.dpos0 = numpy.ascontiguousarray(delta_pos0.ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
+ *         self.cpos0_sup = numpy.empty_like(self.cpos0)
+ *         self.cpos0_inf = numpy.empty_like(self.cpos0)
+ */
+  __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_9);
+  __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_12);
-  __Pyx_DECREF(__pyx_t_32); __pyx_t_32 = 0;
-  __pyx_t_32 = PyTuple_New(2); if (unlikely(!__pyx_t_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_32);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
-  PyTuple_SET_ITEM(__pyx_t_32, 0, ((PyObject *)__pyx_n_s__idx));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx));
-  PyTuple_SET_ITEM(__pyx_t_32, 1, __pyx_t_12);
-  __Pyx_GIVEREF(__pyx_t_12);
-  __pyx_t_12 = 0;
-  __pyx_t_12 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_12);
-  __pyx_t_10 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__float32); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_10);
+  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_delta_pos0, __pyx_n_s__ravel); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __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 = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+  __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_9);
+  PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_1);
+  __Pyx_GIVEREF(__pyx_t_1);
+  __pyx_t_1 = 0;
+  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __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 = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__float32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_2 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_t_9), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
-  __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_12);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__coef));
-  PyTuple_SET_ITEM(__pyx_t_12, 0, ((PyObject *)__pyx_n_s__coef));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__coef));
-  PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_10);
-  __Pyx_GIVEREF(__pyx_t_10);
-  __pyx_t_10 = 0;
-  __pyx_t_10 = PyList_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_10);
-  PyList_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_t_32));
-  __Pyx_GIVEREF(((PyObject *)__pyx_t_32));
-  PyList_SET_ITEM(__pyx_t_10, 1, ((PyObject *)__pyx_t_12));
-  __Pyx_GIVEREF(((PyObject *)__pyx_t_12));
-  __pyx_t_32 = 0;
-  __pyx_t_12 = 0;
-  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_t_10)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
-  __pyx_t_10 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_10);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-  if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_33 = ((PyArrayObject *)__pyx_t_10);
-  {
-    __Pyx_BufFmt_StackElem __pyx_stack[2];
-    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lut.rcbuffer->pybuffer);
-    __pyx_t_4 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lut.rcbuffer->pybuffer, (PyObject*)__pyx_t_33, &__Pyx_TypeInfo_nn_struct___pyx_t_12splitBBoxLUT_lut_point, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack);
-    if (unlikely(__pyx_t_4 < 0)) {
-      PyErr_Fetch(&__pyx_t_34, &__pyx_t_35, &__pyx_t_36);
-      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lut.rcbuffer->pybuffer, (PyObject*)__pyx_v_lut, &__Pyx_TypeInfo_nn_struct___pyx_t_12splitBBoxLUT_lut_point, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {
-        Py_XDECREF(__pyx_t_34); Py_XDECREF(__pyx_t_35); Py_XDECREF(__pyx_t_36);
-        __Pyx_RaiseBufferFallbackError();
-      } else {
-        PyErr_Restore(__pyx_t_34, __pyx_t_35, __pyx_t_36);
-      }
-    }
-    __pyx_pybuffernd_lut.diminfo[0].strides = __pyx_pybuffernd_lut.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lut.diminfo[0].shape = __pyx_pybuffernd_lut.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_lut.diminfo[1].strides = __pyx_pybuffernd_lut.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_lut.diminfo[1].shape = __pyx_pybuffernd_lut.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_lut.diminfo[2].strides = __pyx_pybuffernd_lut.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_lut.dimin [...]
-    if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  }
-  __pyx_t_33 = 0;
-  __pyx_v_lut = ((PyArrayObject *)__pyx_t_10);
-  __pyx_t_10 = 0;
-
-  /* "splitBBoxLUT.pyx":536
- *         #else hope we have enough memory
- *         lut = numpy.recarray(shape=(bins0, bins1, lut_size),dtype=[("idx",numpy.int32),("coef",numpy.float32)])
- *         memset(&lut[0,0,0], 0, lut_nbytes)             # <<<<<<<<<<<<<<
- *         with nogil:
- *             for idx in range(size):
- */
-  __pyx_t_37 = 0;
-  __pyx_t_38 = 0;
-  __pyx_t_39 = 0;
-  memset((&(*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_38, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_39, __pyx_pybuffernd_lut.diminfo[2].strides))), 0, __pyx_v_lut_nbytes);
+  __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__dpos0, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-  /* "splitBBoxLUT.pyx":537
- *         lut = numpy.recarray(shape=(bins0, bins1, lut_size),dtype=[("idx",numpy.int32),("coef",numpy.float32)])
- *         memset(&lut[0,0,0], 0, lut_nbytes)
- *         with nogil:             # <<<<<<<<<<<<<<
- *             for idx in range(size):
- *                 if (check_mask) and cmask[idx]:
+  /* "splitBBoxLUT.pyx":487
+ *         self.cpos0 = numpy.ascontiguousarray(pos0.ravel(), dtype=numpy.float32)
+ *         self.dpos0 = numpy.ascontiguousarray(delta_pos0.ravel(), dtype=numpy.float32)
+ *         self.cpos0_sup = numpy.empty_like(self.cpos0)             # <<<<<<<<<<<<<<
+ *         self.cpos0_inf = numpy.empty_like(self.cpos0)
+ *         self.pos0Range = pos0Range
  */
-  {
-      #ifdef WITH_THREAD
-      PyThreadState *_save = NULL;
-      #endif
-      Py_UNBLOCK_THREADS
-      /*try:*/ {
+  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__empty_like); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__cpos0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_9);
+  PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2);
+  __Pyx_GIVEREF(__pyx_t_2);
+  __pyx_t_2 = 0;
+  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__cpos0_sup, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-        /* "splitBBoxLUT.pyx":538
- *         memset(&lut[0,0,0], 0, lut_nbytes)
- *         with nogil:
- *             for idx in range(size):             # <<<<<<<<<<<<<<
- *                 if (check_mask) and cmask[idx]:
- *                     continue
+  /* "splitBBoxLUT.pyx":488
+ *         self.dpos0 = numpy.ascontiguousarray(delta_pos0.ravel(), dtype=numpy.float32)
+ *         self.cpos0_sup = numpy.empty_like(self.cpos0)
+ *         self.cpos0_inf = numpy.empty_like(self.cpos0)             # <<<<<<<<<<<<<<
+ *         self.pos0Range = pos0Range
+ *         self.pos1Range = pos1Range
  */
-        __pyx_t_5 = __pyx_v_size;
-        for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_5; __pyx_t_16+=1) {
-          __pyx_v_idx = __pyx_t_16;
+  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__empty_like); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_9);
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__cpos0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __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 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__cpos0_inf, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-          /* "splitBBoxLUT.pyx":539
- *         with nogil:
- *             for idx in range(size):
- *                 if (check_mask) and cmask[idx]:             # <<<<<<<<<<<<<<
- *                     continue
+  /* "splitBBoxLUT.pyx":489
+ *         self.cpos0_sup = numpy.empty_like(self.cpos0)
+ *         self.cpos0_inf = numpy.empty_like(self.cpos0)
+ *         self.pos0Range = pos0Range             # <<<<<<<<<<<<<<
+ *         self.pos1Range = pos1Range
  * 
  */
-          __pyx_t_18 = __pyx_v_check_mask;
-          if (__pyx_t_18) {
-            if (unlikely(!__pyx_v_cmask.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cmask"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L23;} }
-            __pyx_t_27 = __pyx_v_idx;
-            __pyx_t_14 = (*((__pyx_t_5numpy_int8_t *) ( /* dim=0 */ (__pyx_v_cmask.data + __pyx_t_27 * __pyx_v_cmask.strides[0]) )));
-          } else {
-            __pyx_t_14 = __pyx_t_18;
-          }
-          if (__pyx_t_14) {
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__pos0Range, __pyx_v_pos0Range) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-            /* "splitBBoxLUT.pyx":540
- *             for idx in range(size):
- *                 if (check_mask) and cmask[idx]:
- *                     continue             # <<<<<<<<<<<<<<
+  /* "splitBBoxLUT.pyx":490
+ *         self.cpos0_inf = numpy.empty_like(self.cpos0)
+ *         self.pos0Range = pos0Range
+ *         self.pos1Range = pos1Range             # <<<<<<<<<<<<<<
  * 
- *                 min0 = cpos0_inf[idx]
+ *         self.cpos1 = numpy.ascontiguousarray((pos1).ravel(), dtype=numpy.float32)
  */
-            goto __pyx_L25_continue;
-            goto __pyx_L27;
-          }
-          __pyx_L27:;
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__pos1Range, __pyx_v_pos1Range) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-          /* "splitBBoxLUT.pyx":542
- *                     continue
+  /* "splitBBoxLUT.pyx":492
+ *         self.pos1Range = pos1Range
  * 
- *                 min0 = cpos0_inf[idx]             # <<<<<<<<<<<<<<
- *                 max0 = cpos0_sup[idx]
- *                 min1 = cpos1_inf[idx]
+ *         self.cpos1 = numpy.ascontiguousarray((pos1).ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
+ *         self.dpos1 = numpy.ascontiguousarray((delta_pos1).ravel(), dtype=numpy.float32)
+ *         self.cpos1_sup = numpy.empty_like(self.cpos1)
  */
-          __pyx_t_29 = __pyx_v_idx;
-          __pyx_v_min0 = (*((float *) ( /* dim=0 */ (__pyx_v_cpos0_inf.data + __pyx_t_29 * __pyx_v_cpos0_inf.strides[0]) )));
+  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_pos1, __pyx_n_s__ravel); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_9 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_9);
+  __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 = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_9);
+  __Pyx_GIVEREF(__pyx_t_9);
+  __pyx_t_9 = 0;
+  __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_9));
+  __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_12);
+  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s__float32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+  if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __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_2), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__cpos1, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
-          /* "splitBBoxLUT.pyx":543
+  /* "splitBBoxLUT.pyx":493
  * 
- *                 min0 = cpos0_inf[idx]
- *                 max0 = cpos0_sup[idx]             # <<<<<<<<<<<<<<
- *                 min1 = cpos1_inf[idx]
- *                 max1 = cpos1_sup[idx]
+ *         self.cpos1 = numpy.ascontiguousarray((pos1).ravel(), dtype=numpy.float32)
+ *         self.dpos1 = numpy.ascontiguousarray((delta_pos1).ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
+ *         self.cpos1_sup = numpy.empty_like(self.cpos1)
+ *         self.cpos1_inf = numpy.empty_like(self.cpos1)
  */
-          __pyx_t_40 = __pyx_v_idx;
-          __pyx_v_max0 = (*((float *) ( /* dim=0 */ (__pyx_v_cpos0_sup.data + __pyx_t_40 * __pyx_v_cpos0_sup.strides[0]) )));
+  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_9);
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_delta_pos1, __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
+  __Pyx_GIVEREF(__pyx_t_2);
+  __pyx_t_2 = 0;
+  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__float32); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_12);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+  __pyx_t_12 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_12);
+  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__dpos1, __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
 
-          /* "splitBBoxLUT.pyx":544
- *                 min0 = cpos0_inf[idx]
- *                 max0 = cpos0_sup[idx]
- *                 min1 = cpos1_inf[idx]             # <<<<<<<<<<<<<<
- *                 max1 = cpos1_sup[idx]
- * 
+  /* "splitBBoxLUT.pyx":494
+ *         self.cpos1 = numpy.ascontiguousarray((pos1).ravel(), dtype=numpy.float32)
+ *         self.dpos1 = numpy.ascontiguousarray((delta_pos1).ravel(), dtype=numpy.float32)
+ *         self.cpos1_sup = numpy.empty_like(self.cpos1)             # <<<<<<<<<<<<<<
+ *         self.cpos1_inf = numpy.empty_like(self.cpos1)
+ *         self.calc_boundaries(pos0Range, pos1Range)
  */
-          __pyx_t_41 = __pyx_v_idx;
-          __pyx_v_min1 = (*((float *) ( /* dim=0 */ (__pyx_v_cpos1_inf.data + __pyx_t_41 * __pyx_v_cpos1_inf.strides[0]) )));
+  __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_12);
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s__empty_like); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+  __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__cpos1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_12);
+  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_12);
+  __Pyx_GIVEREF(__pyx_t_12);
+  __pyx_t_12 = 0;
+  __pyx_t_12 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_12);
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__cpos1_sup, __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
 
-          /* "splitBBoxLUT.pyx":545
- *                 max0 = cpos0_sup[idx]
- *                 min1 = cpos1_inf[idx]
- *                 max1 = cpos1_sup[idx]             # <<<<<<<<<<<<<<
- * 
- *                 fbin0_min = getBinNr(min0, pos0_min, delta0)
+  /* "splitBBoxLUT.pyx":495
+ *         self.dpos1 = numpy.ascontiguousarray((delta_pos1).ravel(), dtype=numpy.float32)
+ *         self.cpos1_sup = numpy.empty_like(self.cpos1)
+ *         self.cpos1_inf = numpy.empty_like(self.cpos1)             # <<<<<<<<<<<<<<
+ *         self.calc_boundaries(pos0Range, pos1Range)
+ *         self.delta0 = (self.pos0_max - self.pos0_min) / float(bins0)
  */
-          __pyx_t_42 = __pyx_v_idx;
-          __pyx_v_max1 = (*((float *) ( /* dim=0 */ (__pyx_v_cpos1_sup.data + __pyx_t_42 * __pyx_v_cpos1_sup.strides[0]) )));
+  __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_12);
+  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s__empty_like); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+  __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__cpos1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_12);
+  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_12);
+  __Pyx_GIVEREF(__pyx_t_12);
+  __pyx_t_12 = 0;
+  __pyx_t_12 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_12);
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__cpos1_inf, __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
 
-          /* "splitBBoxLUT.pyx":547
- *                 max1 = cpos1_sup[idx]
- * 
- *                 fbin0_min = getBinNr(min0, pos0_min, delta0)             # <<<<<<<<<<<<<<
- *                 fbin0_max = getBinNr(max0, pos0_min, delta0)
- *                 fbin1_min = getBinNr(min1, pos1_min, delta1)
+  /* "splitBBoxLUT.pyx":496
+ *         self.cpos1_sup = numpy.empty_like(self.cpos1)
+ *         self.cpos1_inf = numpy.empty_like(self.cpos1)
+ *         self.calc_boundaries(pos0Range, pos1Range)             # <<<<<<<<<<<<<<
+ *         self.delta0 = (self.pos0_max - self.pos0_min) / float(bins0)
+ *         self.delta1 = (self.pos1_max - self.pos1_min) / float(bins1)
  */
-          __pyx_v_fbin0_min = __pyx_f_12splitBBoxLUT_getBinNr(__pyx_v_min0, __pyx_v_pos0_min, __pyx_v_delta0);
+  __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__calc_boundaries); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_12);
+  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_INCREF(__pyx_v_pos0Range);
+  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_pos0Range);
+  __Pyx_GIVEREF(__pyx_v_pos0Range);
+  __Pyx_INCREF(__pyx_v_pos1Range);
+  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_pos1Range);
+  __Pyx_GIVEREF(__pyx_v_pos1Range);
+  __pyx_t_3 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
-          /* "splitBBoxLUT.pyx":548
- * 
- *                 fbin0_min = getBinNr(min0, pos0_min, delta0)
- *                 fbin0_max = getBinNr(max0, pos0_min, delta0)             # <<<<<<<<<<<<<<
- *                 fbin1_min = getBinNr(min1, pos1_min, delta1)
- *                 fbin1_max = getBinNr(max1, pos1_min, delta1)
+  /* "splitBBoxLUT.pyx":497
+ *         self.cpos1_inf = numpy.empty_like(self.cpos1)
+ *         self.calc_boundaries(pos0Range, pos1Range)
+ *         self.delta0 = (self.pos0_max - self.pos0_min) / float(bins0)             # <<<<<<<<<<<<<<
+ *         self.delta1 = (self.pos1_max - self.pos1_min) / float(bins1)
+ *         self.lut_max_idx = self.calc_lut()
  */
-          __pyx_v_fbin0_max = __pyx_f_12splitBBoxLUT_getBinNr(__pyx_v_max0, __pyx_v_pos0_min, __pyx_v_delta0);
-
-          /* "splitBBoxLUT.pyx":549
- *                 fbin0_min = getBinNr(min0, pos0_min, delta0)
- *                 fbin0_max = getBinNr(max0, pos0_min, delta0)
- *                 fbin1_min = getBinNr(min1, pos1_min, delta1)             # <<<<<<<<<<<<<<
- *                 fbin1_max = getBinNr(max1, pos1_min, delta1)
- * 
- */
-          __pyx_v_fbin1_min = __pyx_f_12splitBBoxLUT_getBinNr(__pyx_v_min1, __pyx_v_pos1_min, __pyx_v_delta1);
-
-          /* "splitBBoxLUT.pyx":550
- *                 fbin0_max = getBinNr(max0, pos0_min, delta0)
- *                 fbin1_min = getBinNr(min1, pos1_min, delta1)
- *                 fbin1_max = getBinNr(max1, pos1_min, delta1)             # <<<<<<<<<<<<<<
- * 
- *                 bin0_min = <int> fbin0_min
- */
-          __pyx_v_fbin1_max = __pyx_f_12splitBBoxLUT_getBinNr(__pyx_v_max1, __pyx_v_pos1_min, __pyx_v_delta1);
-
-          /* "splitBBoxLUT.pyx":552
- *                 fbin1_max = getBinNr(max1, pos1_min, delta1)
- * 
- *                 bin0_min = <int> fbin0_min             # <<<<<<<<<<<<<<
- *                 bin0_max = <int> fbin0_max
- *                 bin1_min = <int> fbin1_min
- */
-          __pyx_v_bin0_min = ((int)__pyx_v_fbin0_min);
+  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__pos0_max); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__pos0_min); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_12 = PyNumber_Subtract(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_12);
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_13 = __Pyx_PyObject_AsDouble(__pyx_v_bins0); if (unlikely(__pyx_t_13 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyFloat_FromDouble(__pyx_t_13); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_12, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__delta0, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
-          /* "splitBBoxLUT.pyx":553
- * 
- *                 bin0_min = <int> fbin0_min
- *                 bin0_max = <int> fbin0_max             # <<<<<<<<<<<<<<
- *                 bin1_min = <int> fbin1_min
- *                 bin1_max = <int> fbin1_max
+  /* "splitBBoxLUT.pyx":498
+ *         self.calc_boundaries(pos0Range, pos1Range)
+ *         self.delta0 = (self.pos0_max - self.pos0_min) / float(bins0)
+ *         self.delta1 = (self.pos1_max - self.pos1_min) / float(bins1)             # <<<<<<<<<<<<<<
+ *         self.lut_max_idx = self.calc_lut()
+ *         self.outPos0 = numpy.linspace(self.pos0_min+0.5*self.delta0, self.pos0_maxin-0.5*self.delta0, bins0)
  */
-          __pyx_v_bin0_max = ((int)__pyx_v_fbin0_max);
+  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__pos1_max); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__pos1_min); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_12 = PyNumber_Subtract(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_12);
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_13 = __Pyx_PyObject_AsDouble(__pyx_v_bins1); if (unlikely(__pyx_t_13 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyFloat_FromDouble(__pyx_t_13); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_12, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__delta1, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
-          /* "splitBBoxLUT.pyx":554
- *                 bin0_min = <int> fbin0_min
- *                 bin0_max = <int> fbin0_max
- *                 bin1_min = <int> fbin1_min             # <<<<<<<<<<<<<<
- *                 bin1_max = <int> fbin1_max
- * 
+  /* "splitBBoxLUT.pyx":499
+ *         self.delta0 = (self.pos0_max - self.pos0_min) / float(bins0)
+ *         self.delta1 = (self.pos1_max - self.pos1_min) / float(bins1)
+ *         self.lut_max_idx = self.calc_lut()             # <<<<<<<<<<<<<<
+ *         self.outPos0 = numpy.linspace(self.pos0_min+0.5*self.delta0, self.pos0_maxin-0.5*self.delta0, bins0)
+ *         self.outPos1 = numpy.linspace(self.pos1_min+0.5*self.delta1, self.pos1_maxin-0.5*self.delta1, bins1)
  */
-          __pyx_v_bin1_min = ((int)__pyx_v_fbin1_min);
+  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__calc_lut); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__lut_max_idx, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-          /* "splitBBoxLUT.pyx":555
- *                 bin0_max = <int> fbin0_max
- *                 bin1_min = <int> fbin1_min
- *                 bin1_max = <int> fbin1_max             # <<<<<<<<<<<<<<
- * 
- *                 if (bin0_max < 0) or (bin0_min >= bins0) or (bin1_max < 0) or (bin1_min >= bins1):
+  /* "splitBBoxLUT.pyx":500
+ *         self.delta1 = (self.pos1_max - self.pos1_min) / float(bins1)
+ *         self.lut_max_idx = self.calc_lut()
+ *         self.outPos0 = numpy.linspace(self.pos0_min+0.5*self.delta0, self.pos0_maxin-0.5*self.delta0, bins0)             # <<<<<<<<<<<<<<
+ *         self.outPos1 = numpy.linspace(self.pos1_min+0.5*self.delta1, self.pos1_maxin-0.5*self.delta1, bins1)
+ *         self.unit=unit
  */
-          __pyx_v_bin1_max = ((int)__pyx_v_fbin1_max);
+  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__linspace); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __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_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__pos0_min); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_12 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_12);
+  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__delta0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_9);
+  __pyx_t_1 = PyNumber_Multiply(__pyx_t_12, __pyx_t_9); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+  __pyx_t_9 = PyNumber_Add(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_9);
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__pos0_maxin); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_2 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__delta0); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_12);
+  __pyx_t_14 = PyNumber_Multiply(__pyx_t_2, __pyx_t_12); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_14);
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+  __pyx_t_12 = PyNumber_Subtract(__pyx_t_1, __pyx_t_14); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_12);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+  __pyx_t_14 = PyTuple_New(3); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_14);
+  PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_9);
+  __Pyx_GIVEREF(__pyx_t_9);
+  PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_12);
+  __Pyx_GIVEREF(__pyx_t_12);
+  __Pyx_INCREF(__pyx_v_bins0);
+  PyTuple_SET_ITEM(__pyx_t_14, 2, __pyx_v_bins0);
+  __Pyx_GIVEREF(__pyx_v_bins0);
+  __pyx_t_9 = 0;
+  __pyx_t_12 = 0;
+  __pyx_t_12 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_12);
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0;
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__outPos0, __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
 
-          /* "splitBBoxLUT.pyx":557
- *                 bin1_max = <int> fbin1_max
- * 
- *                 if (bin0_max < 0) or (bin0_min >= bins0) or (bin1_max < 0) or (bin1_min >= bins1):             # <<<<<<<<<<<<<<
- *                     continue
- * 
+  /* "splitBBoxLUT.pyx":501
+ *         self.lut_max_idx = self.calc_lut()
+ *         self.outPos0 = numpy.linspace(self.pos0_min+0.5*self.delta0, self.pos0_maxin-0.5*self.delta0, bins0)
+ *         self.outPos1 = numpy.linspace(self.pos1_min+0.5*self.delta1, self.pos1_maxin-0.5*self.delta1, bins1)             # <<<<<<<<<<<<<<
+ *         self.unit=unit
+ *         self.lut.shape = -1, self.lut_size #this makes integration look like a 1D integration
  */
-          __pyx_t_14 = (__pyx_v_bin0_max < 0);
-          if (!__pyx_t_14) {
-            __pyx_t_18 = (__pyx_v_bin0_min >= __pyx_v_bins0);
-            if (!__pyx_t_18) {
-              __pyx_t_25 = (__pyx_v_bin1_max < 0);
-              if (!__pyx_t_25) {
-                __pyx_t_23 = (__pyx_v_bin1_min >= __pyx_v_bins1);
-                __pyx_t_24 = __pyx_t_23;
-              } else {
-                __pyx_t_24 = __pyx_t_25;
-              }
-              __pyx_t_25 = __pyx_t_24;
-            } else {
-              __pyx_t_25 = __pyx_t_18;
-            }
-            __pyx_t_18 = __pyx_t_25;
-          } else {
-            __pyx_t_18 = __pyx_t_14;
-          }
-          if (__pyx_t_18) {
+  __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_12);
+  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s__linspace); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_14);
+  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+  __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__pos1_min); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_12);
+  __pyx_t_3 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__delta1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_9);
+  __pyx_t_1 = PyNumber_Multiply(__pyx_t_3, __pyx_t_9); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+  __pyx_t_9 = PyNumber_Add(__pyx_t_12, __pyx_t_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_9);
+  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__pos1_maxin); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_12 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_12);
+  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__delta1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_2 = PyNumber_Multiply(__pyx_t_12, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_9);
+  __Pyx_GIVEREF(__pyx_t_9);
+  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
+  __Pyx_GIVEREF(__pyx_t_3);
+  __Pyx_INCREF(__pyx_v_bins1);
+  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_bins1);
+  __Pyx_GIVEREF(__pyx_v_bins1);
+  __pyx_t_9 = 0;
+  __pyx_t_3 = 0;
+  __pyx_t_3 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__outPos1, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
-            /* "splitBBoxLUT.pyx":558
- * 
- *                 if (bin0_max < 0) or (bin0_min >= bins0) or (bin1_max < 0) or (bin1_min >= bins1):
- *                     continue             # <<<<<<<<<<<<<<
- * 
- *                 if bin0_max >= bins0 :
+  /* "splitBBoxLUT.pyx":502
+ *         self.outPos0 = numpy.linspace(self.pos0_min+0.5*self.delta0, self.pos0_maxin-0.5*self.delta0, bins0)
+ *         self.outPos1 = numpy.linspace(self.pos1_min+0.5*self.delta1, self.pos1_maxin-0.5*self.delta1, bins1)
+ *         self.unit=unit             # <<<<<<<<<<<<<<
+ *         self.lut.shape = -1, self.lut_size #this makes integration look like a 1D integration
+ *         self.lut_checksum = crc32(self.lut)
  */
-            goto __pyx_L25_continue;
-            goto __pyx_L28;
-          }
-          __pyx_L28:;
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__unit, __pyx_v_unit) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-          /* "splitBBoxLUT.pyx":560
- *                     continue
+  /* "splitBBoxLUT.pyx":503
+ *         self.outPos1 = numpy.linspace(self.pos1_min+0.5*self.delta1, self.pos1_maxin-0.5*self.delta1, bins1)
+ *         self.unit=unit
+ *         self.lut.shape = -1, self.lut_size #this makes integration look like a 1D integration             # <<<<<<<<<<<<<<
+ *         self.lut_checksum = crc32(self.lut)
  * 
- *                 if bin0_max >= bins0 :             # <<<<<<<<<<<<<<
- *                     bin0_max = bins0 - 1
- *                 if  bin0_min < 0:
  */
-          __pyx_t_18 = (__pyx_v_bin0_max >= __pyx_v_bins0);
-          if (__pyx_t_18) {
+  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__lut_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_INCREF(__pyx_int_neg_1);
+  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_neg_1);
+  __Pyx_GIVEREF(__pyx_int_neg_1);
+  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
+  __Pyx_GIVEREF(__pyx_t_3);
+  __pyx_t_3 = 0;
+  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__lut); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  if (__Pyx_PyObject_SetAttrStr(__pyx_t_3, __pyx_n_s__shape, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
-            /* "splitBBoxLUT.pyx":561
+  /* "splitBBoxLUT.pyx":504
+ *         self.unit=unit
+ *         self.lut.shape = -1, self.lut_size #this makes integration look like a 1D integration
+ *         self.lut_checksum = crc32(self.lut)             # <<<<<<<<<<<<<<
  * 
- *                 if bin0_max >= bins0 :
- *                     bin0_max = bins0 - 1             # <<<<<<<<<<<<<<
- *                 if  bin0_min < 0:
- *                     bin0_min = 0
- */
-            __pyx_v_bin0_max = (__pyx_v_bins0 - 1);
-            goto __pyx_L29;
-          }
-          __pyx_L29:;
-
-          /* "splitBBoxLUT.pyx":562
- *                 if bin0_max >= bins0 :
- *                     bin0_max = bins0 - 1
- *                 if  bin0_min < 0:             # <<<<<<<<<<<<<<
- *                     bin0_min = 0
- *                 if bin1_max >= bins1 :
- */
-          __pyx_t_18 = (__pyx_v_bin0_min < 0);
-          if (__pyx_t_18) {
-
-            /* "splitBBoxLUT.pyx":563
- *                     bin0_max = bins0 - 1
- *                 if  bin0_min < 0:
- *                     bin0_min = 0             # <<<<<<<<<<<<<<
- *                 if bin1_max >= bins1 :
- *                     bin1_max = bins1 - 1
+ *     @cython.boundscheck(False)
  */
-            __pyx_v_bin0_min = 0;
-            goto __pyx_L30;
-          }
-          __pyx_L30:;
+  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__crc32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__lut); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_14);
+  PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_2);
+  __Pyx_GIVEREF(__pyx_t_2);
+  __pyx_t_2 = 0;
+  __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0;
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__lut_checksum, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-          /* "splitBBoxLUT.pyx":564
- *                 if  bin0_min < 0:
- *                     bin0_min = 0
- *                 if bin1_max >= bins1 :             # <<<<<<<<<<<<<<
- *                     bin1_max = bins1 - 1
- *                 if  bin1_min < 0:
- */
-          __pyx_t_18 = (__pyx_v_bin1_max >= __pyx_v_bins1);
-          if (__pyx_t_18) {
+  __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_12);
+  __Pyx_XDECREF(__pyx_t_14);
+  __Pyx_AddTraceback("splitBBoxLUT.HistoBBox2d.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __pyx_r = NULL;
+  __pyx_L0:;
+  __Pyx_XDECREF(__pyx_v_bins0);
+  __Pyx_XDECREF(__pyx_v_bins1);
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
 
-            /* "splitBBoxLUT.pyx":565
- *                     bin0_min = 0
- *                 if bin1_max >= bins1 :
- *                     bin1_max = bins1 - 1             # <<<<<<<<<<<<<<
- *                 if  bin1_min < 0:
- *                     bin1_min = 0
+/* Python wrapper */
+static PyObject *__pyx_pw_12splitBBoxLUT_11HistoBBox2d_3calc_boundaries(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_12splitBBoxLUT_11HistoBBox2d_3calc_boundaries = {__Pyx_NAMESTR("calc_boundaries"), (PyCFunction)__pyx_pw_12splitBBoxLUT_11HistoBBox2d_3calc_boundaries, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pw_12splitBBoxLUT_11HistoBBox2d_3calc_boundaries(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  PyObject *__pyx_v_self = 0;
+  PyObject *__pyx_v_pos0Range = 0;
+  PyObject *__pyx_v_pos1Range = 0;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  PyObject *__pyx_r = 0;
+  __Pyx_RefNannyDeclarations
+  __Pyx_RefNannySetupContext("calc_boundaries (wrapper)", 0);
+  {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__pos0Range,&__pyx_n_s__pos1Range,0};
+    PyObject* values[3] = {0,0,0};
+    if (unlikely(__pyx_kwds)) {
+      Py_ssize_t kw_args;
+      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+      switch (pos_args) {
+        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+        case  0: break;
+        default: goto __pyx_L5_argtuple_error;
+      }
+      kw_args = PyDict_Size(__pyx_kwds);
+      switch (pos_args) {
+        case  0:
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
+        else goto __pyx_L5_argtuple_error;
+        case  1:
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos0Range)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("calc_boundaries", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+        case  2:
+        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos1Range)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("calc_boundaries", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+      }
+      if (unlikely(kw_args > 0)) {
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calc_boundaries") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      }
+    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
+      goto __pyx_L5_argtuple_error;
+    } else {
+      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+    }
+    __pyx_v_self = values[0];
+    __pyx_v_pos0Range = values[1];
+    __pyx_v_pos1Range = values[2];
+  }
+  goto __pyx_L4_argument_unpacking_done;
+  __pyx_L5_argtuple_error:;
+  __Pyx_RaiseArgtupleInvalid("calc_boundaries", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __pyx_L3_error:;
+  __Pyx_AddTraceback("splitBBoxLUT.HistoBBox2d.calc_boundaries", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_RefNannyFinishContext();
+  return NULL;
+  __pyx_L4_argument_unpacking_done:;
+  __pyx_r = __pyx_pf_12splitBBoxLUT_11HistoBBox2d_2calc_boundaries(__pyx_self, __pyx_v_self, __pyx_v_pos0Range, __pyx_v_pos1Range);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "splitBBoxLUT.pyx":508
+ *     @cython.boundscheck(False)
+ *     @cython.wraparound(False)
+ *     def calc_boundaries(self, pos0Range, pos1Range):             # <<<<<<<<<<<<<<
+ *         cdef int size = self.cpos0.size
+ *         cdef bint check_mask = self.check_mask
  */
-            __pyx_v_bin1_max = (__pyx_v_bins1 - 1);
-            goto __pyx_L31;
-          }
-          __pyx_L31:;
 
-          /* "splitBBoxLUT.pyx":566
- *                 if bin1_max >= bins1 :
- *                     bin1_max = bins1 - 1
- *                 if  bin1_min < 0:             # <<<<<<<<<<<<<<
- *                     bin1_min = 0
+static PyObject *__pyx_pf_12splitBBoxLUT_11HistoBBox2d_2calc_boundaries(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_pos0Range, PyObject *__pyx_v_pos1Range) {
+  int __pyx_v_size;
+  int __pyx_v_check_mask;
+  __Pyx_memviewslice __pyx_v_cmask = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_cpos0 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_dpos0 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_cpos0_sup = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_cpos0_inf = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_cpos1 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_dpos1 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_cpos1_sup = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_cpos1_inf = { 0, 0, { 0 }, { 0 }, { 0 } };
+  float __pyx_v_upper0;
+  float __pyx_v_lower0;
+  float __pyx_v_pos0_max;
+  float __pyx_v_pos0_min;
+  float __pyx_v_c0;
+  float __pyx_v_d0;
+  float __pyx_v_upper1;
+  float __pyx_v_lower1;
+  float __pyx_v_pos1_max;
+  float __pyx_v_pos1_min;
+  float __pyx_v_c1;
+  float __pyx_v_d1;
+  int __pyx_v_allow_pos0_neg;
+  int __pyx_v_chiDiscAtPi;
+  int __pyx_v_idx;
+  PyObject *__pyx_r = NULL;
+  __Pyx_RefNannyDeclarations
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  int __pyx_t_3;
+  int __pyx_t_4;
+  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  Py_ssize_t __pyx_t_7;
+  Py_ssize_t __pyx_t_8;
+  Py_ssize_t __pyx_t_9;
+  Py_ssize_t __pyx_t_10;
+  __Pyx_memviewslice __pyx_t_11 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  int __pyx_t_12;
+  int __pyx_t_13;
+  int __pyx_t_14;
+  int __pyx_t_15;
+  int __pyx_t_16;
+  int __pyx_t_17;
+  int __pyx_t_18;
+  int __pyx_t_19;
+  int __pyx_t_20;
+  int __pyx_t_21;
+  int __pyx_t_22;
+  int __pyx_t_23;
+  Py_ssize_t __pyx_t_24;
+  PyObject *__pyx_t_25 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("calc_boundaries", 0);
+
+  /* "splitBBoxLUT.pyx":509
+ *     @cython.wraparound(False)
+ *     def calc_boundaries(self, pos0Range, pos1Range):
+ *         cdef int size = self.cpos0.size             # <<<<<<<<<<<<<<
+ *         cdef bint check_mask = self.check_mask
+ *         cdef numpy.int8_t[:] cmask
+ */
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__cpos0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_v_size = __pyx_t_3;
+
+  /* "splitBBoxLUT.pyx":510
+ *     def calc_boundaries(self, pos0Range, pos1Range):
+ *         cdef int size = self.cpos0.size
+ *         cdef bint check_mask = self.check_mask             # <<<<<<<<<<<<<<
+ *         cdef numpy.int8_t[:] cmask
+ *         cdef float[:] cpos0, dpos0, cpos0_sup, cpos0_inf
+ */
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__check_mask); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_v_check_mask = __pyx_t_4;
+
+  /* "splitBBoxLUT.pyx":516
+ *         cdef float upper0, lower0, pos0_max, pos0_min, c0, d0
+ *         cdef float upper1, lower1, pos1_max, pos1_min, c1, d1
+ *         cdef bint allow_pos0_neg=self.allow_pos0_neg             # <<<<<<<<<<<<<<
+ *         cdef bint chiDiscAtPi = self.chiDiscAtPi
  * 
  */
-          __pyx_t_18 = (__pyx_v_bin1_min < 0);
-          if (__pyx_t_18) {
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__allow_pos0_neg); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_v_allow_pos0_neg = __pyx_t_4;
 
-            /* "splitBBoxLUT.pyx":567
- *                     bin1_max = bins1 - 1
- *                 if  bin1_min < 0:
- *                     bin1_min = 0             # <<<<<<<<<<<<<<
+  /* "splitBBoxLUT.pyx":517
+ *         cdef float upper1, lower1, pos1_max, pos1_min, c1, d1
+ *         cdef bint allow_pos0_neg=self.allow_pos0_neg
+ *         cdef bint chiDiscAtPi = self.chiDiscAtPi             # <<<<<<<<<<<<<<
  * 
- *                 if bin0_min == bin0_max:
+ *         cpos0_sup = self.cpos0_sup
  */
-            __pyx_v_bin1_min = 0;
-            goto __pyx_L32;
-          }
-          __pyx_L32:;
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__chiDiscAtPi); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_v_chiDiscAtPi = __pyx_t_4;
 
-          /* "splitBBoxLUT.pyx":569
- *                     bin1_min = 0
+  /* "splitBBoxLUT.pyx":519
+ *         cdef bint chiDiscAtPi = self.chiDiscAtPi
  * 
- *                 if bin0_min == bin0_max:             # <<<<<<<<<<<<<<
- *                     if bin1_min == bin1_max:
- *                         #All pixel is within a single bin
+ *         cpos0_sup = self.cpos0_sup             # <<<<<<<<<<<<<<
+ *         cpos0_inf = self.cpos0_inf
+ *         cpos0 = self.cpos0
  */
-          __pyx_t_18 = (__pyx_v_bin0_min == __pyx_v_bin0_max);
-          if (__pyx_t_18) {
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__cpos0_sup); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_2);
+  if (unlikely(!__pyx_t_5.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_v_cpos0_sup = __pyx_t_5;
+  __pyx_t_5.memview = NULL;
+  __pyx_t_5.data = NULL;
 
-            /* "splitBBoxLUT.pyx":570
+  /* "splitBBoxLUT.pyx":520
  * 
- *                 if bin0_min == bin0_max:
- *                     if bin1_min == bin1_max:             # <<<<<<<<<<<<<<
- *                         #All pixel is within a single bin
- *                         k = outMax[bin0_min, bin1_min]
+ *         cpos0_sup = self.cpos0_sup
+ *         cpos0_inf = self.cpos0_inf             # <<<<<<<<<<<<<<
+ *         cpos0 = self.cpos0
+ *         dpos0 = self.dpos0
  */
-            __pyx_t_18 = (__pyx_v_bin1_min == __pyx_v_bin1_max);
-            if (__pyx_t_18) {
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__cpos0_inf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_2);
+  if (unlikely(!__pyx_t_5.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_v_cpos0_inf = __pyx_t_5;
+  __pyx_t_5.memview = NULL;
+  __pyx_t_5.data = NULL;
+
+  /* "splitBBoxLUT.pyx":521
+ *         cpos0_sup = self.cpos0_sup
+ *         cpos0_inf = self.cpos0_inf
+ *         cpos0 = self.cpos0             # <<<<<<<<<<<<<<
+ *         dpos0 = self.dpos0
+ *         cpos1_sup = self.cpos1_sup
+ */
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__cpos0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_2);
+  if (unlikely(!__pyx_t_5.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_v_cpos0 = __pyx_t_5;
+  __pyx_t_5.memview = NULL;
+  __pyx_t_5.data = NULL;
 
-              /* "splitBBoxLUT.pyx":572
- *                     if bin1_min == bin1_max:
- *                         #All pixel is within a single bin
- *                         k = outMax[bin0_min, bin1_min]             # <<<<<<<<<<<<<<
- *                         lut[bin0_min, bin1_min, k].idx = idx
- *                         lut[bin0_min, bin1_min, k].coef = 1.0
+  /* "splitBBoxLUT.pyx":522
+ *         cpos0_inf = self.cpos0_inf
+ *         cpos0 = self.cpos0
+ *         dpos0 = self.dpos0             # <<<<<<<<<<<<<<
+ *         cpos1_sup = self.cpos1_sup
+ *         cpos1_inf = self.cpos1_inf
  */
-              __pyx_t_4 = __pyx_v_bin0_min;
-              __pyx_t_43 = __pyx_v_bin1_min;
-              __pyx_v_k = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_43, __pyx_pybuffernd_outMax.diminfo[1].strides));
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__dpos0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_2);
+  if (unlikely(!__pyx_t_5.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_v_dpos0 = __pyx_t_5;
+  __pyx_t_5.memview = NULL;
+  __pyx_t_5.data = NULL;
+
+  /* "splitBBoxLUT.pyx":523
+ *         cpos0 = self.cpos0
+ *         dpos0 = self.dpos0
+ *         cpos1_sup = self.cpos1_sup             # <<<<<<<<<<<<<<
+ *         cpos1_inf = self.cpos1_inf
+ *         cpos1 = self.cpos1
+ */
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__cpos1_sup); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_2);
+  if (unlikely(!__pyx_t_6.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_v_cpos1_sup = __pyx_t_6;
+  __pyx_t_6.memview = NULL;
+  __pyx_t_6.data = NULL;
 
-              /* "splitBBoxLUT.pyx":573
- *                         #All pixel is within a single bin
- *                         k = outMax[bin0_min, bin1_min]
- *                         lut[bin0_min, bin1_min, k].idx = idx             # <<<<<<<<<<<<<<
- *                         lut[bin0_min, bin1_min, k].coef = 1.0
- *                         outMax[bin0_min, bin1_min]= k+1
+  /* "splitBBoxLUT.pyx":524
+ *         dpos0 = self.dpos0
+ *         cpos1_sup = self.cpos1_sup
+ *         cpos1_inf = self.cpos1_inf             # <<<<<<<<<<<<<<
+ *         cpos1 = self.cpos1
+ *         dpos1 = self.dpos1
  */
-              __pyx_t_44 = __pyx_v_bin0_min;
-              __pyx_t_45 = __pyx_v_bin1_min;
-              __pyx_t_46 = __pyx_v_k;
-              (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_45, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_46, __pyx_pybuffernd_lut.diminfo[2].strides)).idx = __pyx_v_idx;
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__cpos1_inf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_2);
+  if (unlikely(!__pyx_t_6.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_v_cpos1_inf = __pyx_t_6;
+  __pyx_t_6.memview = NULL;
+  __pyx_t_6.data = NULL;
 
-              /* "splitBBoxLUT.pyx":574
- *                         k = outMax[bin0_min, bin1_min]
- *                         lut[bin0_min, bin1_min, k].idx = idx
- *                         lut[bin0_min, bin1_min, k].coef = 1.0             # <<<<<<<<<<<<<<
- *                         outMax[bin0_min, bin1_min]= k+1
- * 
+  /* "splitBBoxLUT.pyx":525
+ *         cpos1_sup = self.cpos1_sup
+ *         cpos1_inf = self.cpos1_inf
+ *         cpos1 = self.cpos1             # <<<<<<<<<<<<<<
+ *         dpos1 = self.dpos1
+ *         pos0_min=cpos0[0]
  */
-              __pyx_t_47 = __pyx_v_bin0_min;
-              __pyx_t_48 = __pyx_v_bin1_min;
-              __pyx_t_49 = __pyx_v_k;
-              (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_47, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_48, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_49, __pyx_pybuffernd_lut.diminfo[2].strides)).coef = 1.0;
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__cpos1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_2);
+  if (unlikely(!__pyx_t_6.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_v_cpos1 = __pyx_t_6;
+  __pyx_t_6.memview = NULL;
+  __pyx_t_6.data = NULL;
 
-              /* "splitBBoxLUT.pyx":575
- *                         lut[bin0_min, bin1_min, k].idx = idx
- *                         lut[bin0_min, bin1_min, k].coef = 1.0
- *                         outMax[bin0_min, bin1_min]= k+1             # <<<<<<<<<<<<<<
- * 
- *                     else:
+  /* "splitBBoxLUT.pyx":526
+ *         cpos1_inf = self.cpos1_inf
+ *         cpos1 = self.cpos1
+ *         dpos1 = self.dpos1             # <<<<<<<<<<<<<<
+ *         pos0_min=cpos0[0]
+ *         pos0_max=cpos0[0]
  */
-              __pyx_t_50 = __pyx_v_bin0_min;
-              __pyx_t_51 = __pyx_v_bin1_min;
-              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_50, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_51, __pyx_pybuffernd_outMax.diminfo[1].strides) = (__pyx_v_k + 1);
-              goto __pyx_L34;
-            }
-            /*else*/ {
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__dpos1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_2);
+  if (unlikely(!__pyx_t_6.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_v_dpos1 = __pyx_t_6;
+  __pyx_t_6.memview = NULL;
+  __pyx_t_6.data = NULL;
 
-              /* "splitBBoxLUT.pyx":579
- *                     else:
- *                         #spread on more than 2 bins
- *                         deltaD = (< float > (bin1_min + 1)) - fbin1_min             # <<<<<<<<<<<<<<
- *                         deltaU = fbin1_max - ( bin1_max)
- *                         deltaA = 1.0 / (fbin1_max - fbin1_min)
+  /* "splitBBoxLUT.pyx":527
+ *         cpos1 = self.cpos1
+ *         dpos1 = self.dpos1
+ *         pos0_min=cpos0[0]             # <<<<<<<<<<<<<<
+ *         pos0_max=cpos0[0]
+ *         pos1_min=cpos1[0]
  */
-              __pyx_v_deltaD = (((float)(__pyx_v_bin1_min + 1)) - __pyx_v_fbin1_min);
+  __pyx_t_7 = 0;
+  __pyx_v_pos0_min = (*((float *) ( /* dim=0 */ (__pyx_v_cpos0.data + __pyx_t_7 * __pyx_v_cpos0.strides[0]) )));
 
-              /* "splitBBoxLUT.pyx":580
- *                         #spread on more than 2 bins
- *                         deltaD = (< float > (bin1_min + 1)) - fbin1_min
- *                         deltaU = fbin1_max - ( bin1_max)             # <<<<<<<<<<<<<<
- *                         deltaA = 1.0 / (fbin1_max - fbin1_min)
- * 
+  /* "splitBBoxLUT.pyx":528
+ *         dpos1 = self.dpos1
+ *         pos0_min=cpos0[0]
+ *         pos0_max=cpos0[0]             # <<<<<<<<<<<<<<
+ *         pos1_min=cpos1[0]
+ *         pos1_max=cpos1[0]
  */
-              __pyx_v_deltaU = (__pyx_v_fbin1_max - __pyx_v_bin1_max);
+  __pyx_t_8 = 0;
+  __pyx_v_pos0_max = (*((float *) ( /* dim=0 */ (__pyx_v_cpos0.data + __pyx_t_8 * __pyx_v_cpos0.strides[0]) )));
 
-              /* "splitBBoxLUT.pyx":581
- *                         deltaD = (< float > (bin1_min + 1)) - fbin1_min
- *                         deltaU = fbin1_max - ( bin1_max)
- *                         deltaA = 1.0 / (fbin1_max - fbin1_min)             # <<<<<<<<<<<<<<
+  /* "splitBBoxLUT.pyx":529
+ *         pos0_min=cpos0[0]
+ *         pos0_max=cpos0[0]
+ *         pos1_min=cpos1[0]             # <<<<<<<<<<<<<<
+ *         pos1_max=cpos1[0]
  * 
- *                         k = outMax[bin0_min, bin1_min]
  */
-              __pyx_v_deltaA = (1.0 / (__pyx_v_fbin1_max - __pyx_v_fbin1_min));
+  __pyx_t_9 = 0;
+  __pyx_v_pos1_min = (*((float *) ( /* dim=0 */ (__pyx_v_cpos1.data + __pyx_t_9 * __pyx_v_cpos1.strides[0]) )));
 
-              /* "splitBBoxLUT.pyx":583
- *                         deltaA = 1.0 / (fbin1_max - fbin1_min)
+  /* "splitBBoxLUT.pyx":530
+ *         pos0_max=cpos0[0]
+ *         pos1_min=cpos1[0]
+ *         pos1_max=cpos1[0]             # <<<<<<<<<<<<<<
  * 
- *                         k = outMax[bin0_min, bin1_min]             # <<<<<<<<<<<<<<
- *                         lut[bin0_min, bin1_min, k].idx = idx
- *                         lut[bin0_min, bin1_min, k].coef =  deltaA * deltaD
+ *         if check_mask:
  */
-              __pyx_t_52 = __pyx_v_bin0_min;
-              __pyx_t_53 = __pyx_v_bin1_min;
-              __pyx_v_k = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_52, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_53, __pyx_pybuffernd_outMax.diminfo[1].strides));
+  __pyx_t_10 = 0;
+  __pyx_v_pos1_max = (*((float *) ( /* dim=0 */ (__pyx_v_cpos1.data + __pyx_t_10 * __pyx_v_cpos1.strides[0]) )));
 
-              /* "splitBBoxLUT.pyx":584
+  /* "splitBBoxLUT.pyx":532
+ *         pos1_max=cpos1[0]
  * 
- *                         k = outMax[bin0_min, bin1_min]
- *                         lut[bin0_min, bin1_min, k].idx = idx             # <<<<<<<<<<<<<<
- *                         lut[bin0_min, bin1_min, k].coef =  deltaA * deltaD
- *                         outMax[bin0_min, bin1_min] = k + 1
+ *         if check_mask:             # <<<<<<<<<<<<<<
+ *             cmask = self.cmask
+ *         with nogil:
  */
-              __pyx_t_54 = __pyx_v_bin0_min;
-              __pyx_t_55 = __pyx_v_bin1_min;
-              __pyx_t_56 = __pyx_v_k;
-              (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_54, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_55, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_56, __pyx_pybuffernd_lut.diminfo[2].strides)).idx = __pyx_v_idx;
+  __pyx_t_4 = (__pyx_v_check_mask != 0);
+  if (__pyx_t_4) {
 
-              /* "splitBBoxLUT.pyx":585
- *                         k = outMax[bin0_min, bin1_min]
- *                         lut[bin0_min, bin1_min, k].idx = idx
- *                         lut[bin0_min, bin1_min, k].coef =  deltaA * deltaD             # <<<<<<<<<<<<<<
- *                         outMax[bin0_min, bin1_min] = k + 1
+    /* "splitBBoxLUT.pyx":533
  * 
+ *         if check_mask:
+ *             cmask = self.cmask             # <<<<<<<<<<<<<<
+ *         with nogil:
+ *             for idx in range(size):
  */
-              __pyx_t_57 = __pyx_v_bin0_min;
-              __pyx_t_58 = __pyx_v_bin1_min;
-              __pyx_t_59 = __pyx_v_k;
-              (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_57, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_58, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_59, __pyx_pybuffernd_lut.diminfo[2].strides)).coef = (__pyx_v_deltaA * __pyx_v_deltaD);
+    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__cmask); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int8_t(__pyx_t_2);
+    if (unlikely(!__pyx_t_11.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __pyx_v_cmask = __pyx_t_11;
+    __pyx_t_11.memview = NULL;
+    __pyx_t_11.data = NULL;
+    goto __pyx_L3;
+  }
+  __pyx_L3:;
 
-              /* "splitBBoxLUT.pyx":586
- *                         lut[bin0_min, bin1_min, k].idx = idx
- *                         lut[bin0_min, bin1_min, k].coef =  deltaA * deltaD
- *                         outMax[bin0_min, bin1_min] = k + 1             # <<<<<<<<<<<<<<
- * 
- *                         k = outMax[bin0_min, bin1_max]
+  /* "splitBBoxLUT.pyx":534
+ *         if check_mask:
+ *             cmask = self.cmask
+ *         with nogil:             # <<<<<<<<<<<<<<
+ *             for idx in range(size):
+ *                 c0 = cpos0[idx]
  */
-              __pyx_t_60 = __pyx_v_bin0_min;
-              __pyx_t_61 = __pyx_v_bin1_min;
-              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_60, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_61, __pyx_pybuffernd_outMax.diminfo[1].strides) = (__pyx_v_k + 1);
+  {
+      #ifdef WITH_THREAD
+      PyThreadState *_save;
+      Py_UNBLOCK_THREADS
+      #endif
+      /*try:*/ {
 
-              /* "splitBBoxLUT.pyx":588
- *                         outMax[bin0_min, bin1_min] = k + 1
- * 
- *                         k = outMax[bin0_min, bin1_max]             # <<<<<<<<<<<<<<
- *                         lut[bin0_min, bin1_max, k].idx = idx
- *                         lut[bin0_min, bin1_max, k].coef =  deltaA * deltaU
+        /* "splitBBoxLUT.pyx":535
+ *             cmask = self.cmask
+ *         with nogil:
+ *             for idx in range(size):             # <<<<<<<<<<<<<<
+ *                 c0 = cpos0[idx]
+ *                 d0 = dpos0[idx]
  */
-              __pyx_t_62 = __pyx_v_bin0_min;
-              __pyx_t_63 = __pyx_v_bin1_max;
-              __pyx_v_k = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_62, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_63, __pyx_pybuffernd_outMax.diminfo[1].strides));
+        __pyx_t_3 = __pyx_v_size;
+        for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_3; __pyx_t_12+=1) {
+          __pyx_v_idx = __pyx_t_12;
 
-              /* "splitBBoxLUT.pyx":589
- * 
- *                         k = outMax[bin0_min, bin1_max]
- *                         lut[bin0_min, bin1_max, k].idx = idx             # <<<<<<<<<<<<<<
- *                         lut[bin0_min, bin1_max, k].coef =  deltaA * deltaU
- *                         outMax[bin0_min, bin1_max] = k + 1
+          /* "splitBBoxLUT.pyx":536
+ *         with nogil:
+ *             for idx in range(size):
+ *                 c0 = cpos0[idx]             # <<<<<<<<<<<<<<
+ *                 d0 = dpos0[idx]
+ *                 lower0 = c0 - d0
  */
-              __pyx_t_64 = __pyx_v_bin0_min;
-              __pyx_t_65 = __pyx_v_bin1_max;
-              __pyx_t_66 = __pyx_v_k;
-              (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_64, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_65, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_66, __pyx_pybuffernd_lut.diminfo[2].strides)).idx = __pyx_v_idx;
+          __pyx_t_13 = __pyx_v_idx;
+          __pyx_v_c0 = (*((float *) ( /* dim=0 */ (__pyx_v_cpos0.data + __pyx_t_13 * __pyx_v_cpos0.strides[0]) )));
 
-              /* "splitBBoxLUT.pyx":590
- *                         k = outMax[bin0_min, bin1_max]
- *                         lut[bin0_min, bin1_max, k].idx = idx
- *                         lut[bin0_min, bin1_max, k].coef =  deltaA * deltaU             # <<<<<<<<<<<<<<
- *                         outMax[bin0_min, bin1_max] = k + 1
- * 
+          /* "splitBBoxLUT.pyx":537
+ *             for idx in range(size):
+ *                 c0 = cpos0[idx]
+ *                 d0 = dpos0[idx]             # <<<<<<<<<<<<<<
+ *                 lower0 = c0 - d0
+ *                 upper0 = c0 + d0
  */
-              __pyx_t_67 = __pyx_v_bin0_min;
-              __pyx_t_68 = __pyx_v_bin1_max;
-              __pyx_t_69 = __pyx_v_k;
-              (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_67, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_68, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_69, __pyx_pybuffernd_lut.diminfo[2].strides)).coef = (__pyx_v_deltaA * __pyx_v_deltaU);
+          __pyx_t_14 = __pyx_v_idx;
+          __pyx_v_d0 = (*((float *) ( /* dim=0 */ (__pyx_v_dpos0.data + __pyx_t_14 * __pyx_v_dpos0.strides[0]) )));
 
-              /* "splitBBoxLUT.pyx":591
- *                         lut[bin0_min, bin1_max, k].idx = idx
- *                         lut[bin0_min, bin1_max, k].coef =  deltaA * deltaU
- *                         outMax[bin0_min, bin1_max] = k + 1             # <<<<<<<<<<<<<<
- * 
- *                         for j in range(bin1_min + 1, bin1_max):
+          /* "splitBBoxLUT.pyx":538
+ *                 c0 = cpos0[idx]
+ *                 d0 = dpos0[idx]
+ *                 lower0 = c0 - d0             # <<<<<<<<<<<<<<
+ *                 upper0 = c0 + d0
+ *                 c1 = cpos1[idx]
  */
-              __pyx_t_70 = __pyx_v_bin0_min;
-              __pyx_t_71 = __pyx_v_bin1_max;
-              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_70, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_71, __pyx_pybuffernd_outMax.diminfo[1].strides) = (__pyx_v_k + 1);
+          __pyx_v_lower0 = (__pyx_v_c0 - __pyx_v_d0);
 
-              /* "splitBBoxLUT.pyx":593
- *                         outMax[bin0_min, bin1_max] = k + 1
- * 
- *                         for j in range(bin1_min + 1, bin1_max):             # <<<<<<<<<<<<<<
- *                             k = outMax[bin0_min, j]
- *                             lut[bin0_min, j, k].idx = idx
+          /* "splitBBoxLUT.pyx":539
+ *                 d0 = dpos0[idx]
+ *                 lower0 = c0 - d0
+ *                 upper0 = c0 + d0             # <<<<<<<<<<<<<<
+ *                 c1 = cpos1[idx]
+ *                 d1 = dpos1[idx]
+ */
+          __pyx_v_upper0 = (__pyx_v_c0 + __pyx_v_d0);
+
+          /* "splitBBoxLUT.pyx":540
+ *                 lower0 = c0 - d0
+ *                 upper0 = c0 + d0
+ *                 c1 = cpos1[idx]             # <<<<<<<<<<<<<<
+ *                 d1 = dpos1[idx]
+ *                 lower1 = c1 - d1
+ */
+          __pyx_t_15 = __pyx_v_idx;
+          __pyx_v_c1 = (*((float *) ( /* dim=0 */ (__pyx_v_cpos1.data + __pyx_t_15 * __pyx_v_cpos1.strides[0]) )));
+
+          /* "splitBBoxLUT.pyx":541
+ *                 upper0 = c0 + d0
+ *                 c1 = cpos1[idx]
+ *                 d1 = dpos1[idx]             # <<<<<<<<<<<<<<
+ *                 lower1 = c1 - d1
+ *                 upper1 = c1 + d1
+ */
+          __pyx_t_16 = __pyx_v_idx;
+          __pyx_v_d1 = (*((float *) ( /* dim=0 */ (__pyx_v_dpos1.data + __pyx_t_16 * __pyx_v_dpos1.strides[0]) )));
+
+          /* "splitBBoxLUT.pyx":542
+ *                 c1 = cpos1[idx]
+ *                 d1 = dpos1[idx]
+ *                 lower1 = c1 - d1             # <<<<<<<<<<<<<<
+ *                 upper1 = c1 + d1
+ *                 if not allow_pos0_neg and lower0<0:
  */
-              __pyx_t_72 = __pyx_v_bin1_max;
-              for (__pyx_t_73 = (__pyx_v_bin1_min + 1); __pyx_t_73 < __pyx_t_72; __pyx_t_73+=1) {
-                __pyx_v_j = __pyx_t_73;
+          __pyx_v_lower1 = (__pyx_v_c1 - __pyx_v_d1);
 
-                /* "splitBBoxLUT.pyx":594
- * 
- *                         for j in range(bin1_min + 1, bin1_max):
- *                             k = outMax[bin0_min, j]             # <<<<<<<<<<<<<<
- *                             lut[bin0_min, j, k].idx = idx
- *                             lut[bin0_min, j, k].coef =  deltaA
+          /* "splitBBoxLUT.pyx":543
+ *                 d1 = dpos1[idx]
+ *                 lower1 = c1 - d1
+ *                 upper1 = c1 + d1             # <<<<<<<<<<<<<<
+ *                 if not allow_pos0_neg and lower0<0:
+ *                     lower0=0
  */
-                __pyx_t_74 = __pyx_v_bin0_min;
-                __pyx_t_75 = __pyx_v_j;
-                __pyx_v_k = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_74, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_75, __pyx_pybuffernd_outMax.diminfo[1].strides));
+          __pyx_v_upper1 = (__pyx_v_c1 + __pyx_v_d1);
 
-                /* "splitBBoxLUT.pyx":595
- *                         for j in range(bin1_min + 1, bin1_max):
- *                             k = outMax[bin0_min, j]
- *                             lut[bin0_min, j, k].idx = idx             # <<<<<<<<<<<<<<
- *                             lut[bin0_min, j, k].coef =  deltaA
- *                             outMax[bin0_min, j] = k + 1
+          /* "splitBBoxLUT.pyx":544
+ *                 lower1 = c1 - d1
+ *                 upper1 = c1 + d1
+ *                 if not allow_pos0_neg and lower0<0:             # <<<<<<<<<<<<<<
+ *                     lower0=0
+ *                 if upper1 > (2-chiDiscAtPi)*pi:
+ */
+          __pyx_t_4 = ((!(__pyx_v_allow_pos0_neg != 0)) != 0);
+          if (__pyx_t_4) {
+            __pyx_t_17 = ((__pyx_v_lower0 < 0.0) != 0);
+            __pyx_t_18 = __pyx_t_17;
+          } else {
+            __pyx_t_18 = __pyx_t_4;
+          }
+          if (__pyx_t_18) {
+
+            /* "splitBBoxLUT.pyx":545
+ *                 upper1 = c1 + d1
+ *                 if not allow_pos0_neg and lower0<0:
+ *                     lower0=0             # <<<<<<<<<<<<<<
+ *                 if upper1 > (2-chiDiscAtPi)*pi:
+ *                     upper1 = (2-chiDiscAtPi)*pi
  */
-                __pyx_t_76 = __pyx_v_bin0_min;
-                __pyx_t_77 = __pyx_v_j;
-                __pyx_t_78 = __pyx_v_k;
-                (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_76, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_77, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_78, __pyx_pybuffernd_lut.diminfo[2].strides)).idx = __pyx_v_idx;
+            __pyx_v_lower0 = 0.0;
+            goto __pyx_L9;
+          }
+          __pyx_L9:;
 
-                /* "splitBBoxLUT.pyx":596
- *                             k = outMax[bin0_min, j]
- *                             lut[bin0_min, j, k].idx = idx
- *                             lut[bin0_min, j, k].coef =  deltaA             # <<<<<<<<<<<<<<
- *                             outMax[bin0_min, j] = k + 1
- * 
+          /* "splitBBoxLUT.pyx":546
+ *                 if not allow_pos0_neg and lower0<0:
+ *                     lower0=0
+ *                 if upper1 > (2-chiDiscAtPi)*pi:             # <<<<<<<<<<<<<<
+ *                     upper1 = (2-chiDiscAtPi)*pi
+ *                 if lower1 < (-chiDiscAtPi)*pi:
  */
-                __pyx_t_79 = __pyx_v_bin0_min;
-                __pyx_t_80 = __pyx_v_j;
-                __pyx_t_81 = __pyx_v_k;
-                (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_79, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_80, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_81, __pyx_pybuffernd_lut.diminfo[2].strides)).coef = __pyx_v_deltaA;
+          __pyx_t_18 = ((__pyx_v_upper1 > ((2 - __pyx_v_chiDiscAtPi) * __pyx_v_12splitBBoxLUT_pi)) != 0);
+          if (__pyx_t_18) {
 
-                /* "splitBBoxLUT.pyx":597
- *                             lut[bin0_min, j, k].idx = idx
- *                             lut[bin0_min, j, k].coef =  deltaA
- *                             outMax[bin0_min, j] = k + 1             # <<<<<<<<<<<<<<
- * 
- *                 else: #spread on more than 2 bins in dim 0
+            /* "splitBBoxLUT.pyx":547
+ *                     lower0=0
+ *                 if upper1 > (2-chiDiscAtPi)*pi:
+ *                     upper1 = (2-chiDiscAtPi)*pi             # <<<<<<<<<<<<<<
+ *                 if lower1 < (-chiDiscAtPi)*pi:
+ *                     lower1 = (-chiDiscAtPi)*pi
  */
-                __pyx_t_82 = __pyx_v_bin0_min;
-                __pyx_t_83 = __pyx_v_j;
-                *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_82, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_83, __pyx_pybuffernd_outMax.diminfo[1].strides) = (__pyx_v_k + 1);
-              }
-            }
-            __pyx_L34:;
-            goto __pyx_L33;
+            __pyx_v_upper1 = ((2 - __pyx_v_chiDiscAtPi) * __pyx_v_12splitBBoxLUT_pi);
+            goto __pyx_L10;
           }
-          /*else*/ {
+          __pyx_L10:;
 
-            /* "splitBBoxLUT.pyx":600
- * 
- *                 else: #spread on more than 2 bins in dim 0
- *                     if bin1_min == bin1_max:             # <<<<<<<<<<<<<<
- *                         #All pixel fall on 1 bins in dim 1
- *                         deltaA = 1.0 / (fbin0_max - fbin0_min)
+          /* "splitBBoxLUT.pyx":548
+ *                 if upper1 > (2-chiDiscAtPi)*pi:
+ *                     upper1 = (2-chiDiscAtPi)*pi
+ *                 if lower1 < (-chiDiscAtPi)*pi:             # <<<<<<<<<<<<<<
+ *                     lower1 = (-chiDiscAtPi)*pi
+ *                 cpos0_sup[idx] = upper0
  */
-            __pyx_t_18 = (__pyx_v_bin1_min == __pyx_v_bin1_max);
-            if (__pyx_t_18) {
+          __pyx_t_18 = ((__pyx_v_lower1 < ((-__pyx_v_chiDiscAtPi) * __pyx_v_12splitBBoxLUT_pi)) != 0);
+          if (__pyx_t_18) {
 
-              /* "splitBBoxLUT.pyx":602
- *                     if bin1_min == bin1_max:
- *                         #All pixel fall on 1 bins in dim 1
- *                         deltaA = 1.0 / (fbin0_max - fbin0_min)             # <<<<<<<<<<<<<<
- *                         deltaL = (< float > (bin0_min + 1)) - fbin0_min
- * 
+            /* "splitBBoxLUT.pyx":549
+ *                     upper1 = (2-chiDiscAtPi)*pi
+ *                 if lower1 < (-chiDiscAtPi)*pi:
+ *                     lower1 = (-chiDiscAtPi)*pi             # <<<<<<<<<<<<<<
+ *                 cpos0_sup[idx] = upper0
+ *                 cpos0_inf[idx] = lower0
  */
-              __pyx_v_deltaA = (1.0 / (__pyx_v_fbin0_max - __pyx_v_fbin0_min));
+            __pyx_v_lower1 = ((-__pyx_v_chiDiscAtPi) * __pyx_v_12splitBBoxLUT_pi);
+            goto __pyx_L11;
+          }
+          __pyx_L11:;
 
-              /* "splitBBoxLUT.pyx":603
- *                         #All pixel fall on 1 bins in dim 1
- *                         deltaA = 1.0 / (fbin0_max - fbin0_min)
- *                         deltaL = (< float > (bin0_min + 1)) - fbin0_min             # <<<<<<<<<<<<<<
- * 
- *                         k = outMax[bin0_min, bin1_min]
+          /* "splitBBoxLUT.pyx":550
+ *                 if lower1 < (-chiDiscAtPi)*pi:
+ *                     lower1 = (-chiDiscAtPi)*pi
+ *                 cpos0_sup[idx] = upper0             # <<<<<<<<<<<<<<
+ *                 cpos0_inf[idx] = lower0
+ *                 cpos1_sup[idx] = upper1
  */
-              __pyx_v_deltaL = (((float)(__pyx_v_bin0_min + 1)) - __pyx_v_fbin0_min);
+          __pyx_t_19 = __pyx_v_idx;
+          *((float *) ( /* dim=0 */ (__pyx_v_cpos0_sup.data + __pyx_t_19 * __pyx_v_cpos0_sup.strides[0]) )) = __pyx_v_upper0;
 
-              /* "splitBBoxLUT.pyx":605
- *                         deltaL = (< float > (bin0_min + 1)) - fbin0_min
- * 
- *                         k = outMax[bin0_min, bin1_min]             # <<<<<<<<<<<<<<
- *                         lut[bin0_min, bin1_min, k].idx = idx
- *                         lut[bin0_min, bin1_min, k].coef =  deltaA * deltaL
+          /* "splitBBoxLUT.pyx":551
+ *                     lower1 = (-chiDiscAtPi)*pi
+ *                 cpos0_sup[idx] = upper0
+ *                 cpos0_inf[idx] = lower0             # <<<<<<<<<<<<<<
+ *                 cpos1_sup[idx] = upper1
+ *                 cpos1_inf[idx] = lower1
  */
-              __pyx_t_72 = __pyx_v_bin0_min;
-              __pyx_t_84 = __pyx_v_bin1_min;
-              __pyx_v_k = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_72, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_84, __pyx_pybuffernd_outMax.diminfo[1].strides));
+          __pyx_t_20 = __pyx_v_idx;
+          *((float *) ( /* dim=0 */ (__pyx_v_cpos0_inf.data + __pyx_t_20 * __pyx_v_cpos0_inf.strides[0]) )) = __pyx_v_lower0;
 
-              /* "splitBBoxLUT.pyx":606
- * 
- *                         k = outMax[bin0_min, bin1_min]
- *                         lut[bin0_min, bin1_min, k].idx = idx             # <<<<<<<<<<<<<<
- *                         lut[bin0_min, bin1_min, k].coef =  deltaA * deltaL
- *                         outMax[bin0_min, bin1_min] = k+1
+          /* "splitBBoxLUT.pyx":552
+ *                 cpos0_sup[idx] = upper0
+ *                 cpos0_inf[idx] = lower0
+ *                 cpos1_sup[idx] = upper1             # <<<<<<<<<<<<<<
+ *                 cpos1_inf[idx] = lower1
+ *                 if not (check_mask and cmask[idx]):
  */
-              __pyx_t_85 = __pyx_v_bin0_min;
-              __pyx_t_86 = __pyx_v_bin1_min;
-              __pyx_t_73 = __pyx_v_k;
-              (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_85, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_86, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_73, __pyx_pybuffernd_lut.diminfo[2].strides)).idx = __pyx_v_idx;
+          __pyx_t_21 = __pyx_v_idx;
+          *((float *) ( /* dim=0 */ (__pyx_v_cpos1_sup.data + __pyx_t_21 * __pyx_v_cpos1_sup.strides[0]) )) = __pyx_v_upper1;
 
-              /* "splitBBoxLUT.pyx":607
- *                         k = outMax[bin0_min, bin1_min]
- *                         lut[bin0_min, bin1_min, k].idx = idx
- *                         lut[bin0_min, bin1_min, k].coef =  deltaA * deltaL             # <<<<<<<<<<<<<<
- *                         outMax[bin0_min, bin1_min] = k+1
- * 
+          /* "splitBBoxLUT.pyx":553
+ *                 cpos0_inf[idx] = lower0
+ *                 cpos1_sup[idx] = upper1
+ *                 cpos1_inf[idx] = lower1             # <<<<<<<<<<<<<<
+ *                 if not (check_mask and cmask[idx]):
+ *                     if upper0>pos0_max:
  */
-              __pyx_t_87 = __pyx_v_bin0_min;
-              __pyx_t_88 = __pyx_v_bin1_min;
-              __pyx_t_89 = __pyx_v_k;
-              (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_87, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_88, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_89, __pyx_pybuffernd_lut.diminfo[2].strides)).coef = (__pyx_v_deltaA * __pyx_v_deltaL);
+          __pyx_t_22 = __pyx_v_idx;
+          *((float *) ( /* dim=0 */ (__pyx_v_cpos1_inf.data + __pyx_t_22 * __pyx_v_cpos1_inf.strides[0]) )) = __pyx_v_lower1;
 
-              /* "splitBBoxLUT.pyx":608
- *                         lut[bin0_min, bin1_min, k].idx = idx
- *                         lut[bin0_min, bin1_min, k].coef =  deltaA * deltaL
- *                         outMax[bin0_min, bin1_min] = k+1             # <<<<<<<<<<<<<<
- * 
- *                         deltaR = fbin0_max - (< float > bin0_max)
+          /* "splitBBoxLUT.pyx":554
+ *                 cpos1_sup[idx] = upper1
+ *                 cpos1_inf[idx] = lower1
+ *                 if not (check_mask and cmask[idx]):             # <<<<<<<<<<<<<<
+ *                     if upper0>pos0_max:
+ *                         pos0_max = upper0
  */
-              __pyx_t_90 = __pyx_v_bin0_min;
-              __pyx_t_91 = __pyx_v_bin1_min;
-              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_90, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_91, __pyx_pybuffernd_outMax.diminfo[1].strides) = (__pyx_v_k + 1);
+          __pyx_t_18 = __pyx_v_check_mask;
+          if (__pyx_t_18) {
+            if (unlikely(!__pyx_v_cmask.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cmask"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L5;} }
+            __pyx_t_23 = __pyx_v_idx;
+            __pyx_t_4 = ((*((__pyx_t_5numpy_int8_t *) ( /* dim=0 */ (__pyx_v_cmask.data + __pyx_t_23 * __pyx_v_cmask.strides[0]) ))) != 0);
+          } else {
+            __pyx_t_4 = __pyx_t_18;
+          }
+          __pyx_t_18 = ((!__pyx_t_4) != 0);
+          if (__pyx_t_18) {
 
-              /* "splitBBoxLUT.pyx":610
- *                         outMax[bin0_min, bin1_min] = k+1
- * 
- *                         deltaR = fbin0_max - (< float > bin0_max)             # <<<<<<<<<<<<<<
- * 
- *                         k = outMax[bin0_max, bin1_min]
+            /* "splitBBoxLUT.pyx":555
+ *                 cpos1_inf[idx] = lower1
+ *                 if not (check_mask and cmask[idx]):
+ *                     if upper0>pos0_max:             # <<<<<<<<<<<<<<
+ *                         pos0_max = upper0
+ *                     if lower0<pos0_min:
  */
-              __pyx_v_deltaR = (__pyx_v_fbin0_max - ((float)__pyx_v_bin0_max));
+            __pyx_t_18 = ((__pyx_v_upper0 > __pyx_v_pos0_max) != 0);
+            if (__pyx_t_18) {
 
-              /* "splitBBoxLUT.pyx":612
- *                         deltaR = fbin0_max - (< float > bin0_max)
- * 
- *                         k = outMax[bin0_max, bin1_min]             # <<<<<<<<<<<<<<
- *                         lut[bin0_max, bin1_min, k].idx = idx
- *                         lut[bin0_max, bin1_min, k].coef =  deltaA * deltaR
+              /* "splitBBoxLUT.pyx":556
+ *                 if not (check_mask and cmask[idx]):
+ *                     if upper0>pos0_max:
+ *                         pos0_max = upper0             # <<<<<<<<<<<<<<
+ *                     if lower0<pos0_min:
+ *                         pos0_min = lower0
  */
-              __pyx_t_92 = __pyx_v_bin0_max;
-              __pyx_t_93 = __pyx_v_bin1_min;
-              __pyx_v_k = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_92, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_93, __pyx_pybuffernd_outMax.diminfo[1].strides));
+              __pyx_v_pos0_max = __pyx_v_upper0;
+              goto __pyx_L13;
+            }
+            __pyx_L13:;
 
-              /* "splitBBoxLUT.pyx":613
- * 
- *                         k = outMax[bin0_max, bin1_min]
- *                         lut[bin0_max, bin1_min, k].idx = idx             # <<<<<<<<<<<<<<
- *                         lut[bin0_max, bin1_min, k].coef =  deltaA * deltaR
- *                         outMax[bin0_max, bin1_min] = k + 1
+            /* "splitBBoxLUT.pyx":557
+ *                     if upper0>pos0_max:
+ *                         pos0_max = upper0
+ *                     if lower0<pos0_min:             # <<<<<<<<<<<<<<
+ *                         pos0_min = lower0
+ *                     if upper1>pos1_max:
  */
-              __pyx_t_94 = __pyx_v_bin0_max;
-              __pyx_t_95 = __pyx_v_bin1_min;
-              __pyx_t_96 = __pyx_v_k;
-              (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_94, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_95, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_96, __pyx_pybuffernd_lut.diminfo[2].strides)).idx = __pyx_v_idx;
+            __pyx_t_18 = ((__pyx_v_lower0 < __pyx_v_pos0_min) != 0);
+            if (__pyx_t_18) {
 
-              /* "splitBBoxLUT.pyx":614
- *                         k = outMax[bin0_max, bin1_min]
- *                         lut[bin0_max, bin1_min, k].idx = idx
- *                         lut[bin0_max, bin1_min, k].coef =  deltaA * deltaR             # <<<<<<<<<<<<<<
- *                         outMax[bin0_max, bin1_min] = k + 1
- * 
+              /* "splitBBoxLUT.pyx":558
+ *                         pos0_max = upper0
+ *                     if lower0<pos0_min:
+ *                         pos0_min = lower0             # <<<<<<<<<<<<<<
+ *                     if upper1>pos1_max:
+ *                         pos1_max = upper1
  */
-              __pyx_t_97 = __pyx_v_bin0_max;
-              __pyx_t_98 = __pyx_v_bin1_min;
-              __pyx_t_99 = __pyx_v_k;
-              (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_97, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_98, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_99, __pyx_pybuffernd_lut.diminfo[2].strides)).coef = (__pyx_v_deltaA * __pyx_v_deltaR);
+              __pyx_v_pos0_min = __pyx_v_lower0;
+              goto __pyx_L14;
+            }
+            __pyx_L14:;
 
-              /* "splitBBoxLUT.pyx":615
- *                         lut[bin0_max, bin1_min, k].idx = idx
- *                         lut[bin0_max, bin1_min, k].coef =  deltaA * deltaR
- *                         outMax[bin0_max, bin1_min] = k + 1             # <<<<<<<<<<<<<<
- * 
- *                         for i in range(bin0_min + 1, bin0_max):
+            /* "splitBBoxLUT.pyx":559
+ *                     if lower0<pos0_min:
+ *                         pos0_min = lower0
+ *                     if upper1>pos1_max:             # <<<<<<<<<<<<<<
+ *                         pos1_max = upper1
+ *                     if lower1<pos1_min:
  */
-              __pyx_t_100 = __pyx_v_bin0_max;
-              __pyx_t_101 = __pyx_v_bin1_min;
-              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_100, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_101, __pyx_pybuffernd_outMax.diminfo[1].strides) = (__pyx_v_k + 1);
+            __pyx_t_18 = ((__pyx_v_upper1 > __pyx_v_pos1_max) != 0);
+            if (__pyx_t_18) {
 
-              /* "splitBBoxLUT.pyx":617
- *                         outMax[bin0_max, bin1_min] = k + 1
- * 
- *                         for i in range(bin0_min + 1, bin0_max):             # <<<<<<<<<<<<<<
- *                             k = outMax[i, bin1_min]
- *                             lut[i, bin1_min ,k].idx = idx
+              /* "splitBBoxLUT.pyx":560
+ *                         pos0_min = lower0
+ *                     if upper1>pos1_max:
+ *                         pos1_max = upper1             # <<<<<<<<<<<<<<
+ *                     if lower1<pos1_min:
+ *                         pos1_min = lower1
  */
-              __pyx_t_102 = __pyx_v_bin0_max;
-              for (__pyx_t_103 = (__pyx_v_bin0_min + 1); __pyx_t_103 < __pyx_t_102; __pyx_t_103+=1) {
-                __pyx_v_i = __pyx_t_103;
+              __pyx_v_pos1_max = __pyx_v_upper1;
+              goto __pyx_L15;
+            }
+            __pyx_L15:;
 
-                /* "splitBBoxLUT.pyx":618
+            /* "splitBBoxLUT.pyx":561
+ *                     if upper1>pos1_max:
+ *                         pos1_max = upper1
+ *                     if lower1<pos1_min:             # <<<<<<<<<<<<<<
+ *                         pos1_min = lower1
  * 
- *                         for i in range(bin0_min + 1, bin0_max):
- *                             k = outMax[i, bin1_min]             # <<<<<<<<<<<<<<
- *                             lut[i, bin1_min ,k].idx = idx
- *                             lut[i, bin1_min, k].coef =  deltaA
  */
-                __pyx_t_104 = __pyx_v_i;
-                __pyx_t_105 = __pyx_v_bin1_min;
-                __pyx_v_k = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_104, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_105, __pyx_pybuffernd_outMax.diminfo[1].strides));
-
-                /* "splitBBoxLUT.pyx":619
- *                         for i in range(bin0_min + 1, bin0_max):
- *                             k = outMax[i, bin1_min]
- *                             lut[i, bin1_min ,k].idx = idx             # <<<<<<<<<<<<<<
- *                             lut[i, bin1_min, k].coef =  deltaA
- *                             outMax[i, bin1_min] = k + 1
- */
-                __pyx_t_106 = __pyx_v_i;
-                __pyx_t_107 = __pyx_v_bin1_min;
-                __pyx_t_108 = __pyx_v_k;
-                (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_106, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_107, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_108, __pyx_pybuffernd_lut.diminfo[2].strides)).idx = __pyx_v_idx;
+            __pyx_t_18 = ((__pyx_v_lower1 < __pyx_v_pos1_min) != 0);
+            if (__pyx_t_18) {
 
-                /* "splitBBoxLUT.pyx":620
- *                             k = outMax[i, bin1_min]
- *                             lut[i, bin1_min ,k].idx = idx
- *                             lut[i, bin1_min, k].coef =  deltaA             # <<<<<<<<<<<<<<
- *                             outMax[i, bin1_min] = k + 1
+              /* "splitBBoxLUT.pyx":562
+ *                         pos1_max = upper1
+ *                     if lower1<pos1_min:
+ *                         pos1_min = lower1             # <<<<<<<<<<<<<<
  * 
+ *         if pos0Range is not None and len(pos0Range) > 1:
  */
-                __pyx_t_109 = __pyx_v_i;
-                __pyx_t_110 = __pyx_v_bin1_min;
-                __pyx_t_111 = __pyx_v_k;
-                (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_109, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_110, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_111, __pyx_pybuffernd_lut.diminfo[2].strides)).coef = __pyx_v_deltaA;
+              __pyx_v_pos1_min = __pyx_v_lower1;
+              goto __pyx_L16;
+            }
+            __pyx_L16:;
+            goto __pyx_L12;
+          }
+          __pyx_L12:;
+        }
+      }
 
-                /* "splitBBoxLUT.pyx":621
- *                             lut[i, bin1_min ,k].idx = idx
- *                             lut[i, bin1_min, k].coef =  deltaA
- *                             outMax[i, bin1_min] = k + 1             # <<<<<<<<<<<<<<
- * 
- *                     else:
+      /* "splitBBoxLUT.pyx":534
+ *         if check_mask:
+ *             cmask = self.cmask
+ *         with nogil:             # <<<<<<<<<<<<<<
+ *             for idx in range(size):
+ *                 c0 = cpos0[idx]
  */
-                __pyx_t_112 = __pyx_v_i;
-                __pyx_t_113 = __pyx_v_bin1_min;
-                *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_112, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_113, __pyx_pybuffernd_outMax.diminfo[1].strides) = (__pyx_v_k + 1);
-              }
-              goto __pyx_L37;
-            }
-            /*else*/ {
+      /*finally:*/ {
+        int __pyx_why;
+        __pyx_why = 0; goto __pyx_L6;
+        __pyx_L5: __pyx_why = 4; goto __pyx_L6;
+        __pyx_L6:;
+        #ifdef WITH_THREAD
+        Py_BLOCK_THREADS
+        #endif
+        switch (__pyx_why) {
+          case 4: goto __pyx_L1_error;
+        }
+      }
+  }
 
-              /* "splitBBoxLUT.pyx":625
- *                     else:
- *                         #spread on n pix in dim0 and m pixel in dim1:
- *                         deltaL = (< float > (bin0_min + 1)) - fbin0_min             # <<<<<<<<<<<<<<
- *                         deltaR = fbin0_max - (< float > bin0_max)
- *                         deltaD = (< float > (bin1_min + 1)) - fbin1_min
+  /* "splitBBoxLUT.pyx":564
+ *                         pos1_min = lower1
+ * 
+ *         if pos0Range is not None and len(pos0Range) > 1:             # <<<<<<<<<<<<<<
+ *             self.pos0_min = min(pos0Range)
+ *             self.pos0_maxin = max(pos0Range)
  */
-              __pyx_v_deltaL = (((float)(__pyx_v_bin0_min + 1)) - __pyx_v_fbin0_min);
+  __pyx_t_18 = (__pyx_v_pos0Range != Py_None);
+  if ((__pyx_t_18 != 0)) {
+    __pyx_t_24 = PyObject_Length(__pyx_v_pos0Range); if (unlikely(__pyx_t_24 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = ((__pyx_t_24 > 1) != 0);
+    __pyx_t_17 = __pyx_t_4;
+  } else {
+    __pyx_t_17 = (__pyx_t_18 != 0);
+  }
+  if (__pyx_t_17) {
 
-              /* "splitBBoxLUT.pyx":626
- *                         #spread on n pix in dim0 and m pixel in dim1:
- *                         deltaL = (< float > (bin0_min + 1)) - fbin0_min
- *                         deltaR = fbin0_max - (< float > bin0_max)             # <<<<<<<<<<<<<<
- *                         deltaD = (< float > (bin1_min + 1)) - fbin1_min
- *                         deltaU = fbin1_max - (< float > bin1_max)
+    /* "splitBBoxLUT.pyx":565
+ * 
+ *         if pos0Range is not None and len(pos0Range) > 1:
+ *             self.pos0_min = min(pos0Range)             # <<<<<<<<<<<<<<
+ *             self.pos0_maxin = max(pos0Range)
+ *         else:
  */
-              __pyx_v_deltaR = (__pyx_v_fbin0_max - ((float)__pyx_v_bin0_max));
+    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_INCREF(__pyx_v_pos0Range);
+    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_pos0Range);
+    __Pyx_GIVEREF(__pyx_v_pos0Range);
+    __pyx_t_1 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__pos0_min, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-              /* "splitBBoxLUT.pyx":627
- *                         deltaL = (< float > (bin0_min + 1)) - fbin0_min
- *                         deltaR = fbin0_max - (< float > bin0_max)
- *                         deltaD = (< float > (bin1_min + 1)) - fbin1_min             # <<<<<<<<<<<<<<
- *                         deltaU = fbin1_max - (< float > bin1_max)
- *                         deltaA = 1.0 / ((fbin0_max - fbin0_min) * (fbin1_max - fbin1_min))
+    /* "splitBBoxLUT.pyx":566
+ *         if pos0Range is not None and len(pos0Range) > 1:
+ *             self.pos0_min = min(pos0Range)
+ *             self.pos0_maxin = max(pos0Range)             # <<<<<<<<<<<<<<
+ *         else:
+ *             self.pos0_min = pos0_min
  */
-              __pyx_v_deltaD = (((float)(__pyx_v_bin1_min + 1)) - __pyx_v_fbin1_min);
+    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_INCREF(__pyx_v_pos0Range);
+    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_pos0Range);
+    __Pyx_GIVEREF(__pyx_v_pos0Range);
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_max, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__pos0_maxin, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    goto __pyx_L18;
+  }
+  /*else*/ {
 
-              /* "splitBBoxLUT.pyx":628
- *                         deltaR = fbin0_max - (< float > bin0_max)
- *                         deltaD = (< float > (bin1_min + 1)) - fbin1_min
- *                         deltaU = fbin1_max - (< float > bin1_max)             # <<<<<<<<<<<<<<
- *                         deltaA = 1.0 / ((fbin0_max - fbin0_min) * (fbin1_max - fbin1_min))
+    /* "splitBBoxLUT.pyx":568
+ *             self.pos0_maxin = max(pos0Range)
+ *         else:
+ *             self.pos0_min = pos0_min             # <<<<<<<<<<<<<<
+ *             self.pos0_maxin = pos0_max
  * 
  */
-              __pyx_v_deltaU = (__pyx_v_fbin1_max - ((float)__pyx_v_bin1_max));
+    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_pos0_min); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__pos0_min, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-              /* "splitBBoxLUT.pyx":629
- *                         deltaD = (< float > (bin1_min + 1)) - fbin1_min
- *                         deltaU = fbin1_max - (< float > bin1_max)
- *                         deltaA = 1.0 / ((fbin0_max - fbin0_min) * (fbin1_max - fbin1_min))             # <<<<<<<<<<<<<<
+    /* "splitBBoxLUT.pyx":569
+ *         else:
+ *             self.pos0_min = pos0_min
+ *             self.pos0_maxin = pos0_max             # <<<<<<<<<<<<<<
+ * 
  * 
- *                         k = outMax[bin0_min, bin1_min]
  */
-              __pyx_v_deltaA = (1.0 / ((__pyx_v_fbin0_max - __pyx_v_fbin0_min) * (__pyx_v_fbin1_max - __pyx_v_fbin1_min)));
+    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_pos0_max); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__pos0_maxin, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  }
+  __pyx_L18:;
 
-              /* "splitBBoxLUT.pyx":631
- *                         deltaA = 1.0 / ((fbin0_max - fbin0_min) * (fbin1_max - fbin1_min))
+  /* "splitBBoxLUT.pyx":572
  * 
- *                         k = outMax[bin0_min, bin1_min]             # <<<<<<<<<<<<<<
- *                         lut[bin0_min, bin1_min ,k].idx = idx
- *                         lut[bin0_min, bin1_min, k].coef =  deltaA * deltaL * deltaD
+ * 
+ *         if pos1Range is not None and len(pos1Range) > 1:             # <<<<<<<<<<<<<<
+ *             self.pos1_min = min(pos1Range)
+ *             self.pos1_maxin = max(pos1Range)
  */
-              __pyx_t_102 = __pyx_v_bin0_min;
-              __pyx_t_114 = __pyx_v_bin1_min;
-              __pyx_v_k = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_102, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_114, __pyx_pybuffernd_outMax.diminfo[1].strides));
+  __pyx_t_17 = (__pyx_v_pos1Range != Py_None);
+  if ((__pyx_t_17 != 0)) {
+    __pyx_t_24 = PyObject_Length(__pyx_v_pos1Range); if (unlikely(__pyx_t_24 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_18 = ((__pyx_t_24 > 1) != 0);
+    __pyx_t_4 = __pyx_t_18;
+  } else {
+    __pyx_t_4 = (__pyx_t_17 != 0);
+  }
+  if (__pyx_t_4) {
 
-              /* "splitBBoxLUT.pyx":632
+    /* "splitBBoxLUT.pyx":573
  * 
- *                         k = outMax[bin0_min, bin1_min]
- *                         lut[bin0_min, bin1_min ,k].idx = idx             # <<<<<<<<<<<<<<
- *                         lut[bin0_min, bin1_min, k].coef =  deltaA * deltaL * deltaD
- *                         outMax[bin0_min, bin1_min] = k + 1
+ *         if pos1Range is not None and len(pos1Range) > 1:
+ *             self.pos1_min = min(pos1Range)             # <<<<<<<<<<<<<<
+ *             self.pos1_maxin = max(pos1Range)
+ *         else:
  */
-              __pyx_t_115 = __pyx_v_bin0_min;
-              __pyx_t_116 = __pyx_v_bin1_min;
-              __pyx_t_103 = __pyx_v_k;
-              (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_115, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_116, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_103, __pyx_pybuffernd_lut.diminfo[2].strides)).idx = __pyx_v_idx;
+    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_INCREF(__pyx_v_pos1Range);
+    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_pos1Range);
+    __Pyx_GIVEREF(__pyx_v_pos1Range);
+    __pyx_t_1 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__pos1_min, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-              /* "splitBBoxLUT.pyx":633
- *                         k = outMax[bin0_min, bin1_min]
- *                         lut[bin0_min, bin1_min ,k].idx = idx
- *                         lut[bin0_min, bin1_min, k].coef =  deltaA * deltaL * deltaD             # <<<<<<<<<<<<<<
- *                         outMax[bin0_min, bin1_min] = k + 1
- * 
+    /* "splitBBoxLUT.pyx":574
+ *         if pos1Range is not None and len(pos1Range) > 1:
+ *             self.pos1_min = min(pos1Range)
+ *             self.pos1_maxin = max(pos1Range)             # <<<<<<<<<<<<<<
+ *         else:
+ *             self.pos1_min = pos1_min
  */
-              __pyx_t_117 = __pyx_v_bin0_min;
-              __pyx_t_118 = __pyx_v_bin1_min;
-              __pyx_t_119 = __pyx_v_k;
-              (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_117, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_118, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_119, __pyx_pybuffernd_lut.diminfo[2].strides)).coef = ((__pyx_v_deltaA * __pyx_v_deltaL) * __pyx_v_deltaD);
+    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_INCREF(__pyx_v_pos1Range);
+    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_pos1Range);
+    __Pyx_GIVEREF(__pyx_v_pos1Range);
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_max, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__pos1_maxin, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    goto __pyx_L19;
+  }
+  /*else*/ {
 
-              /* "splitBBoxLUT.pyx":634
- *                         lut[bin0_min, bin1_min ,k].idx = idx
- *                         lut[bin0_min, bin1_min, k].coef =  deltaA * deltaL * deltaD
- *                         outMax[bin0_min, bin1_min] = k + 1             # <<<<<<<<<<<<<<
+    /* "splitBBoxLUT.pyx":576
+ *             self.pos1_maxin = max(pos1Range)
+ *         else:
+ *             self.pos1_min = pos1_min             # <<<<<<<<<<<<<<
+ *             self.pos1_maxin = pos1_max
  * 
- *                         k = outMax[bin0_min, bin1_max]
  */
-              __pyx_t_120 = __pyx_v_bin0_min;
-              __pyx_t_121 = __pyx_v_bin1_min;
-              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_120, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_121, __pyx_pybuffernd_outMax.diminfo[1].strides) = (__pyx_v_k + 1);
+    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_pos1_min); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__pos1_min, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-              /* "splitBBoxLUT.pyx":636
- *                         outMax[bin0_min, bin1_min] = k + 1
+    /* "splitBBoxLUT.pyx":577
+ *         else:
+ *             self.pos1_min = pos1_min
+ *             self.pos1_maxin = pos1_max             # <<<<<<<<<<<<<<
  * 
- *                         k = outMax[bin0_min, bin1_max]             # <<<<<<<<<<<<<<
- *                         lut[bin0_min, bin1_max, k].idx = idx
- *                         lut[bin0_min, bin1_max, k].coef =  deltaA * deltaL * deltaU
+ *         if (not allow_pos0_neg) and self.pos0_min < 0:
  */
-              __pyx_t_122 = __pyx_v_bin0_min;
-              __pyx_t_123 = __pyx_v_bin1_max;
-              __pyx_v_k = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_122, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_123, __pyx_pybuffernd_outMax.diminfo[1].strides));
+    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_pos1_max); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__pos1_maxin, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  }
+  __pyx_L19:;
 
-              /* "splitBBoxLUT.pyx":637
+  /* "splitBBoxLUT.pyx":579
+ *             self.pos1_maxin = pos1_max
  * 
- *                         k = outMax[bin0_min, bin1_max]
- *                         lut[bin0_min, bin1_max, k].idx = idx             # <<<<<<<<<<<<<<
- *                         lut[bin0_min, bin1_max, k].coef =  deltaA * deltaL * deltaU
- *                         outMax[bin0_min, bin1_max] = k + 1
+ *         if (not allow_pos0_neg) and self.pos0_min < 0:             # <<<<<<<<<<<<<<
+ *             self.pos0_min = 0
+ *         self.pos0_max = self.pos0_maxin * EPS32
  */
-              __pyx_t_124 = __pyx_v_bin0_min;
-              __pyx_t_125 = __pyx_v_bin1_max;
-              __pyx_t_126 = __pyx_v_k;
-              (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_124, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_125, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_126, __pyx_pybuffernd_lut.diminfo[2].strides)).idx = __pyx_v_idx;
+  __pyx_t_4 = (!(__pyx_v_allow_pos0_neg != 0));
+  if (__pyx_t_4) {
+    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__pos0_min); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_17 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_18 = __pyx_t_17;
+  } else {
+    __pyx_t_18 = __pyx_t_4;
+  }
+  if (__pyx_t_18) {
 
-              /* "splitBBoxLUT.pyx":638
- *                         k = outMax[bin0_min, bin1_max]
- *                         lut[bin0_min, bin1_max, k].idx = idx
- *                         lut[bin0_min, bin1_max, k].coef =  deltaA * deltaL * deltaU             # <<<<<<<<<<<<<<
- *                         outMax[bin0_min, bin1_max] = k + 1
+    /* "splitBBoxLUT.pyx":580
  * 
+ *         if (not allow_pos0_neg) and self.pos0_min < 0:
+ *             self.pos0_min = 0             # <<<<<<<<<<<<<<
+ *         self.pos0_max = self.pos0_maxin * EPS32
+ *         self.cpos0_sup = cpos0_sup
  */
-              __pyx_t_127 = __pyx_v_bin0_min;
-              __pyx_t_128 = __pyx_v_bin1_max;
-              __pyx_t_129 = __pyx_v_k;
-              (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_127, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_128, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_129, __pyx_pybuffernd_lut.diminfo[2].strides)).coef = ((__pyx_v_deltaA * __pyx_v_deltaL) * __pyx_v_deltaU);
+    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__pos0_min, __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    goto __pyx_L20;
+  }
+  __pyx_L20:;
 
-              /* "splitBBoxLUT.pyx":639
- *                         lut[bin0_min, bin1_max, k].idx = idx
- *                         lut[bin0_min, bin1_max, k].coef =  deltaA * deltaL * deltaU
- *                         outMax[bin0_min, bin1_max] = k + 1             # <<<<<<<<<<<<<<
- * 
- *                         k = outMax[bin0_max, bin1_min]
+  /* "splitBBoxLUT.pyx":581
+ *         if (not allow_pos0_neg) and self.pos0_min < 0:
+ *             self.pos0_min = 0
+ *         self.pos0_max = self.pos0_maxin * EPS32             # <<<<<<<<<<<<<<
+ *         self.cpos0_sup = cpos0_sup
+ *         self.cpos0_inf = cpos0_inf
  */
-              __pyx_t_130 = __pyx_v_bin0_min;
-              __pyx_t_131 = __pyx_v_bin1_max;
-              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_130, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_131, __pyx_pybuffernd_outMax.diminfo[1].strides) = (__pyx_v_k + 1);
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__pos0_maxin); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__EPS32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_25 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_25);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__pos0_max, __pyx_t_25) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
 
-              /* "splitBBoxLUT.pyx":641
- *                         outMax[bin0_min, bin1_max] = k + 1
+  /* "splitBBoxLUT.pyx":582
+ *             self.pos0_min = 0
+ *         self.pos0_max = self.pos0_maxin * EPS32
+ *         self.cpos0_sup = cpos0_sup             # <<<<<<<<<<<<<<
+ *         self.cpos0_inf = cpos0_inf
+ *         self.pos1_max = self.pos1_maxin * EPS32
+ */
+  __pyx_t_25 = __pyx_memoryview_fromslice(__pyx_v_cpos0_sup, 1, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_25);
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__cpos0_sup, __pyx_t_25) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
+
+  /* "splitBBoxLUT.pyx":583
+ *         self.pos0_max = self.pos0_maxin * EPS32
+ *         self.cpos0_sup = cpos0_sup
+ *         self.cpos0_inf = cpos0_inf             # <<<<<<<<<<<<<<
+ *         self.pos1_max = self.pos1_maxin * EPS32
+ *         self.cpos1_sup = cpos1_sup
+ */
+  __pyx_t_25 = __pyx_memoryview_fromslice(__pyx_v_cpos0_inf, 1, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_25);
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__cpos0_inf, __pyx_t_25) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
+
+  /* "splitBBoxLUT.pyx":584
+ *         self.cpos0_sup = cpos0_sup
+ *         self.cpos0_inf = cpos0_inf
+ *         self.pos1_max = self.pos1_maxin * EPS32             # <<<<<<<<<<<<<<
+ *         self.cpos1_sup = cpos1_sup
+ *         self.cpos1_inf = cpos1_inf
+ */
+  __pyx_t_25 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__pos1_maxin); if (unlikely(!__pyx_t_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_25);
+  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__EPS32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_1 = PyNumber_Multiply(__pyx_t_25, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__pos1_max, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+  /* "splitBBoxLUT.pyx":585
+ *         self.cpos0_inf = cpos0_inf
+ *         self.pos1_max = self.pos1_maxin * EPS32
+ *         self.cpos1_sup = cpos1_sup             # <<<<<<<<<<<<<<
+ *         self.cpos1_inf = cpos1_inf
  * 
- *                         k = outMax[bin0_max, bin1_min]             # <<<<<<<<<<<<<<
- *                         lut[bin0_max, bin1_min, k].idx = idx
- *                         lut[bin0_max, bin1_min, k].coef =  deltaA * deltaR * deltaD
  */
-              __pyx_t_132 = __pyx_v_bin0_max;
-              __pyx_t_133 = __pyx_v_bin1_min;
-              __pyx_v_k = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_132, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_133, __pyx_pybuffernd_outMax.diminfo[1].strides));
+  __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_cpos1_sup, 1, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__cpos1_sup, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-              /* "splitBBoxLUT.pyx":642
+  /* "splitBBoxLUT.pyx":586
+ *         self.pos1_max = self.pos1_maxin * EPS32
+ *         self.cpos1_sup = cpos1_sup
+ *         self.cpos1_inf = cpos1_inf             # <<<<<<<<<<<<<<
  * 
- *                         k = outMax[bin0_max, bin1_min]
- *                         lut[bin0_max, bin1_min, k].idx = idx             # <<<<<<<<<<<<<<
- *                         lut[bin0_max, bin1_min, k].coef =  deltaA * deltaR * deltaD
- *                         outMax[bin0_max, bin1_min] = k + 1
- */
-              __pyx_t_134 = __pyx_v_bin0_max;
-              __pyx_t_135 = __pyx_v_bin1_min;
-              __pyx_t_136 = __pyx_v_k;
-              (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_134, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_135, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_136, __pyx_pybuffernd_lut.diminfo[2].strides)).idx = __pyx_v_idx;
-
-              /* "splitBBoxLUT.pyx":643
- *                         k = outMax[bin0_max, bin1_min]
- *                         lut[bin0_max, bin1_min, k].idx = idx
- *                         lut[bin0_max, bin1_min, k].coef =  deltaA * deltaR * deltaD             # <<<<<<<<<<<<<<
- *                         outMax[bin0_max, bin1_min] = k + 1
- * 
- */
-              __pyx_t_137 = __pyx_v_bin0_max;
-              __pyx_t_138 = __pyx_v_bin1_min;
-              __pyx_t_139 = __pyx_v_k;
-              (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_137, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_138, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_139, __pyx_pybuffernd_lut.diminfo[2].strides)).coef = ((__pyx_v_deltaA * __pyx_v_deltaR) * __pyx_v_deltaD);
-
-              /* "splitBBoxLUT.pyx":644
- *                         lut[bin0_max, bin1_min, k].idx = idx
- *                         lut[bin0_max, bin1_min, k].coef =  deltaA * deltaR * deltaD
- *                         outMax[bin0_max, bin1_min] = k + 1             # <<<<<<<<<<<<<<
- * 
- *                         k = outMax[bin0_max, bin1_max]
- */
-              __pyx_t_140 = __pyx_v_bin0_max;
-              __pyx_t_141 = __pyx_v_bin1_min;
-              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_140, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_141, __pyx_pybuffernd_outMax.diminfo[1].strides) = (__pyx_v_k + 1);
-
-              /* "splitBBoxLUT.pyx":646
- *                         outMax[bin0_max, bin1_min] = k + 1
- * 
- *                         k = outMax[bin0_max, bin1_max]             # <<<<<<<<<<<<<<
- *                         lut[bin0_max, bin1_max, k].idx = idx
- *                         lut[bin0_max, bin1_max, k].coef =  deltaA * deltaR * deltaU
- */
-              __pyx_t_142 = __pyx_v_bin0_max;
-              __pyx_t_143 = __pyx_v_bin1_max;
-              __pyx_v_k = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_142, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_143, __pyx_pybuffernd_outMax.diminfo[1].strides));
-
-              /* "splitBBoxLUT.pyx":647
- * 
- *                         k = outMax[bin0_max, bin1_max]
- *                         lut[bin0_max, bin1_max, k].idx = idx             # <<<<<<<<<<<<<<
- *                         lut[bin0_max, bin1_max, k].coef =  deltaA * deltaR * deltaU
- *                         outMax[bin0_max, bin1_max] = k + 1
- */
-              __pyx_t_144 = __pyx_v_bin0_max;
-              __pyx_t_145 = __pyx_v_bin1_max;
-              __pyx_t_146 = __pyx_v_k;
-              (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_144, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_145, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_146, __pyx_pybuffernd_lut.diminfo[2].strides)).idx = __pyx_v_idx;
-
-              /* "splitBBoxLUT.pyx":648
- *                         k = outMax[bin0_max, bin1_max]
- *                         lut[bin0_max, bin1_max, k].idx = idx
- *                         lut[bin0_max, bin1_max, k].coef =  deltaA * deltaR * deltaU             # <<<<<<<<<<<<<<
- *                         outMax[bin0_max, bin1_max] = k + 1
- * 
- */
-              __pyx_t_147 = __pyx_v_bin0_max;
-              __pyx_t_148 = __pyx_v_bin1_max;
-              __pyx_t_149 = __pyx_v_k;
-              (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_147, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_148, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_149, __pyx_pybuffernd_lut.diminfo[2].strides)).coef = ((__pyx_v_deltaA * __pyx_v_deltaR) * __pyx_v_deltaU);
-
-              /* "splitBBoxLUT.pyx":649
- *                         lut[bin0_max, bin1_max, k].idx = idx
- *                         lut[bin0_max, bin1_max, k].coef =  deltaA * deltaR * deltaU
- *                         outMax[bin0_max, bin1_max] = k + 1             # <<<<<<<<<<<<<<
- * 
- *                         for i in range(bin0_min + 1, bin0_max):
- */
-              __pyx_t_150 = __pyx_v_bin0_max;
-              __pyx_t_151 = __pyx_v_bin1_max;
-              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_150, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_151, __pyx_pybuffernd_outMax.diminfo[1].strides) = (__pyx_v_k + 1);
-
-              /* "splitBBoxLUT.pyx":651
- *                         outMax[bin0_max, bin1_max] = k + 1
- * 
- *                         for i in range(bin0_min + 1, bin0_max):             # <<<<<<<<<<<<<<
- *                             k = outMax[i, bin1_min]
- *                             lut[i, bin1_min, k].idx = idx
- */
-              __pyx_t_152 = __pyx_v_bin0_max;
-              for (__pyx_t_153 = (__pyx_v_bin0_min + 1); __pyx_t_153 < __pyx_t_152; __pyx_t_153+=1) {
-                __pyx_v_i = __pyx_t_153;
-
-                /* "splitBBoxLUT.pyx":652
- * 
- *                         for i in range(bin0_min + 1, bin0_max):
- *                             k = outMax[i, bin1_min]             # <<<<<<<<<<<<<<
- *                             lut[i, bin1_min, k].idx = idx
- *                             lut[i, bin1_min, k].coef =  deltaA * deltaD
- */
-                __pyx_t_154 = __pyx_v_i;
-                __pyx_t_155 = __pyx_v_bin1_min;
-                __pyx_v_k = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_154, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_155, __pyx_pybuffernd_outMax.diminfo[1].strides));
-
-                /* "splitBBoxLUT.pyx":653
- *                         for i in range(bin0_min + 1, bin0_max):
- *                             k = outMax[i, bin1_min]
- *                             lut[i, bin1_min, k].idx = idx             # <<<<<<<<<<<<<<
- *                             lut[i, bin1_min, k].coef =  deltaA * deltaD
- *                             outMax[i, bin1_min] = k + 1
- */
-                __pyx_t_156 = __pyx_v_i;
-                __pyx_t_157 = __pyx_v_bin1_min;
-                __pyx_t_158 = __pyx_v_k;
-                (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_156, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_157, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_158, __pyx_pybuffernd_lut.diminfo[2].strides)).idx = __pyx_v_idx;
-
-                /* "splitBBoxLUT.pyx":654
- *                             k = outMax[i, bin1_min]
- *                             lut[i, bin1_min, k].idx = idx
- *                             lut[i, bin1_min, k].coef =  deltaA * deltaD             # <<<<<<<<<<<<<<
- *                             outMax[i, bin1_min] = k + 1
- * 
- */
-                __pyx_t_159 = __pyx_v_i;
-                __pyx_t_160 = __pyx_v_bin1_min;
-                __pyx_t_161 = __pyx_v_k;
-                (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_159, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_160, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_161, __pyx_pybuffernd_lut.diminfo[2].strides)).coef = (__pyx_v_deltaA * __pyx_v_deltaD);
-
-                /* "splitBBoxLUT.pyx":655
- *                             lut[i, bin1_min, k].idx = idx
- *                             lut[i, bin1_min, k].coef =  deltaA * deltaD
- *                             outMax[i, bin1_min] = k + 1             # <<<<<<<<<<<<<<
- * 
- *                             for j in range(bin1_min + 1, bin1_max):
- */
-                __pyx_t_162 = __pyx_v_i;
-                __pyx_t_163 = __pyx_v_bin1_min;
-                *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_162, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_163, __pyx_pybuffernd_outMax.diminfo[1].strides) = (__pyx_v_k + 1);
-
-                /* "splitBBoxLUT.pyx":657
- *                             outMax[i, bin1_min] = k + 1
- * 
- *                             for j in range(bin1_min + 1, bin1_max):             # <<<<<<<<<<<<<<
- *                                 k = outMax[i, j]
- *                                 lut[i, j, k].idx = idx
- */
-                __pyx_t_164 = __pyx_v_bin1_max;
-                for (__pyx_t_165 = (__pyx_v_bin1_min + 1); __pyx_t_165 < __pyx_t_164; __pyx_t_165+=1) {
-                  __pyx_v_j = __pyx_t_165;
-
-                  /* "splitBBoxLUT.pyx":658
- * 
- *                             for j in range(bin1_min + 1, bin1_max):
- *                                 k = outMax[i, j]             # <<<<<<<<<<<<<<
- *                                 lut[i, j, k].idx = idx
- *                                 lut[i, j, k].coef =  deltaA
- */
-                  __pyx_t_166 = __pyx_v_i;
-                  __pyx_t_167 = __pyx_v_j;
-                  __pyx_v_k = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_166, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_167, __pyx_pybuffernd_outMax.diminfo[1].strides));
-
-                  /* "splitBBoxLUT.pyx":659
- *                             for j in range(bin1_min + 1, bin1_max):
- *                                 k = outMax[i, j]
- *                                 lut[i, j, k].idx = idx             # <<<<<<<<<<<<<<
- *                                 lut[i, j, k].coef =  deltaA
- *                                 outMax[i, j] = k + 1
- */
-                  __pyx_t_168 = __pyx_v_i;
-                  __pyx_t_169 = __pyx_v_j;
-                  __pyx_t_170 = __pyx_v_k;
-                  (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_168, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_169, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_170, __pyx_pybuffernd_lut.diminfo[2].strides)).idx = __pyx_v_idx;
-
-                  /* "splitBBoxLUT.pyx":660
- *                                 k = outMax[i, j]
- *                                 lut[i, j, k].idx = idx
- *                                 lut[i, j, k].coef =  deltaA             # <<<<<<<<<<<<<<
- *                                 outMax[i, j] = k + 1
  * 
  */
-                  __pyx_t_171 = __pyx_v_i;
-                  __pyx_t_172 = __pyx_v_j;
-                  __pyx_t_173 = __pyx_v_k;
-                  (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_171, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_172, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_173, __pyx_pybuffernd_lut.diminfo[2].strides)).coef = __pyx_v_deltaA;
-
-                  /* "splitBBoxLUT.pyx":661
- *                                 lut[i, j, k].idx = idx
- *                                 lut[i, j, k].coef =  deltaA
- *                                 outMax[i, j] = k + 1             # <<<<<<<<<<<<<<
- * 
- *                             k = outMax[i, bin1_max]
- */
-                  __pyx_t_174 = __pyx_v_i;
-                  __pyx_t_175 = __pyx_v_j;
-                  *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_174, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_175, __pyx_pybuffernd_outMax.diminfo[1].strides) = (__pyx_v_k + 1);
-                }
-
-                /* "splitBBoxLUT.pyx":663
- *                                 outMax[i, j] = k + 1
- * 
- *                             k = outMax[i, bin1_max]             # <<<<<<<<<<<<<<
- *                             lut[i, bin1_max, k].idx = idx
- *                             lut[i, bin1_max, k].coef =  deltaA * deltaU
- */
-                __pyx_t_165 = __pyx_v_i;
-                __pyx_t_164 = __pyx_v_bin1_max;
-                __pyx_v_k = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_165, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_164, __pyx_pybuffernd_outMax.diminfo[1].strides));
-
-                /* "splitBBoxLUT.pyx":664
- * 
- *                             k = outMax[i, bin1_max]
- *                             lut[i, bin1_max, k].idx = idx             # <<<<<<<<<<<<<<
- *                             lut[i, bin1_max, k].coef =  deltaA * deltaU
- *                             outMax[i, bin1_max] = k + 1
- */
-                __pyx_t_176 = __pyx_v_i;
-                __pyx_t_177 = __pyx_v_bin1_max;
-                __pyx_t_178 = __pyx_v_k;
-                (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_176, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_177, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_178, __pyx_pybuffernd_lut.diminfo[2].strides)).idx = __pyx_v_idx;
+  __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_cpos1_inf, 1, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__cpos1_inf, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-                /* "splitBBoxLUT.pyx":665
- *                             k = outMax[i, bin1_max]
- *                             lut[i, bin1_max, k].idx = idx
- *                             lut[i, bin1_max, k].coef =  deltaA * deltaU             # <<<<<<<<<<<<<<
- *                             outMax[i, bin1_max] = k + 1
- * 
- */
-                __pyx_t_179 = __pyx_v_i;
-                __pyx_t_180 = __pyx_v_bin1_max;
-                __pyx_t_181 = __pyx_v_k;
-                (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_179, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_180, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_181, __pyx_pybuffernd_lut.diminfo[2].strides)).coef = (__pyx_v_deltaA * __pyx_v_deltaU);
+  __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_XDEC_MEMVIEW(&__pyx_t_5, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
+  __Pyx_XDECREF(__pyx_t_25);
+  __Pyx_AddTraceback("splitBBoxLUT.HistoBBox2d.calc_boundaries", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __pyx_r = NULL;
+  __pyx_L0:;
+  __PYX_XDEC_MEMVIEW(&__pyx_v_cmask, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_cpos0, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_dpos0, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_cpos0_sup, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_cpos0_inf, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_cpos1, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_dpos1, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_cpos1_sup, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_cpos1_inf, 1);
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
 
-                /* "splitBBoxLUT.pyx":666
- *                             lut[i, bin1_max, k].idx = idx
- *                             lut[i, bin1_max, k].coef =  deltaA * deltaU
- *                             outMax[i, bin1_max] = k + 1             # <<<<<<<<<<<<<<
- * 
- *                         for j in range(bin1_min + 1, bin1_max):
- */
-                __pyx_t_182 = __pyx_v_i;
-                __pyx_t_183 = __pyx_v_bin1_max;
-                *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_182, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_183, __pyx_pybuffernd_outMax.diminfo[1].strides) = (__pyx_v_k + 1);
-              }
+/* Python wrapper */
+static PyObject *__pyx_pw_12splitBBoxLUT_11HistoBBox2d_5calc_lut(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_12splitBBoxLUT_11HistoBBox2d_4calc_lut[] = "calculate the max number of elements in the LUT and populate it";
+static PyMethodDef __pyx_mdef_12splitBBoxLUT_11HistoBBox2d_5calc_lut = {__Pyx_NAMESTR("calc_lut"), (PyCFunction)__pyx_pw_12splitBBoxLUT_11HistoBBox2d_5calc_lut, METH_O, __Pyx_DOCSTR(__pyx_doc_12splitBBoxLUT_11HistoBBox2d_4calc_lut)};
+static PyObject *__pyx_pw_12splitBBoxLUT_11HistoBBox2d_5calc_lut(PyObject *__pyx_self, PyObject *__pyx_v_self) {
+  PyObject *__pyx_r = 0;
+  __Pyx_RefNannyDeclarations
+  __Pyx_RefNannySetupContext("calc_lut (wrapper)", 0);
+  __pyx_r = __pyx_pf_12splitBBoxLUT_11HistoBBox2d_4calc_lut(__pyx_self, ((PyObject *)__pyx_v_self));
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
 
-              /* "splitBBoxLUT.pyx":668
- *                             outMax[i, bin1_max] = k + 1
- * 
- *                         for j in range(bin1_min + 1, bin1_max):             # <<<<<<<<<<<<<<
- *                             k = outMax[bin0_min, j]
- *                             lut[bin0_min, j, k].idx = idx
+/* "splitBBoxLUT.pyx":592
+ *     @cython.wraparound(False)
+ *     @cython.cdivision(True)
+ *     def calc_lut(self):             # <<<<<<<<<<<<<<
+ *         'calculate the max number of elements in the LUT and populate it'
+ *         cdef float delta0=self.delta0, pos0_min=self.pos0_min, min0, max0, fbin0_min, fbin0_max
  */
-              __pyx_t_152 = __pyx_v_bin1_max;
-              for (__pyx_t_153 = (__pyx_v_bin1_min + 1); __pyx_t_153 < __pyx_t_152; __pyx_t_153+=1) {
-                __pyx_v_j = __pyx_t_153;
 
-                /* "splitBBoxLUT.pyx":669
- * 
- *                         for j in range(bin1_min + 1, bin1_max):
- *                             k = outMax[bin0_min, j]             # <<<<<<<<<<<<<<
- *                             lut[bin0_min, j, k].idx = idx
- *                             lut[bin0_min, j, k].coef =  deltaA * deltaL
- */
-                __pyx_t_184 = __pyx_v_bin0_min;
-                __pyx_t_185 = __pyx_v_j;
-                __pyx_v_k = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_184, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_185, __pyx_pybuffernd_outMax.diminfo[1].strides));
-
-                /* "splitBBoxLUT.pyx":670
- *                         for j in range(bin1_min + 1, bin1_max):
- *                             k = outMax[bin0_min, j]
- *                             lut[bin0_min, j, k].idx = idx             # <<<<<<<<<<<<<<
- *                             lut[bin0_min, j, k].coef =  deltaA * deltaL
- *                             outMax[bin0_min, j] = k + 1
- */
-                __pyx_t_186 = __pyx_v_bin0_min;
-                __pyx_t_187 = __pyx_v_j;
-                __pyx_t_188 = __pyx_v_k;
-                (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_186, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_187, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_188, __pyx_pybuffernd_lut.diminfo[2].strides)).idx = __pyx_v_idx;
-
-                /* "splitBBoxLUT.pyx":671
- *                             k = outMax[bin0_min, j]
- *                             lut[bin0_min, j, k].idx = idx
- *                             lut[bin0_min, j, k].coef =  deltaA * deltaL             # <<<<<<<<<<<<<<
- *                             outMax[bin0_min, j] = k + 1
- * 
- */
-                __pyx_t_189 = __pyx_v_bin0_min;
-                __pyx_t_190 = __pyx_v_j;
-                __pyx_t_191 = __pyx_v_k;
-                (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_189, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_190, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_191, __pyx_pybuffernd_lut.diminfo[2].strides)).coef = (__pyx_v_deltaA * __pyx_v_deltaL);
-
-                /* "splitBBoxLUT.pyx":672
- *                             lut[bin0_min, j, k].idx = idx
- *                             lut[bin0_min, j, k].coef =  deltaA * deltaL
- *                             outMax[bin0_min, j] = k + 1             # <<<<<<<<<<<<<<
- * 
- *                             k = outMax[bin0_max, j]
- */
-                __pyx_t_192 = __pyx_v_bin0_min;
-                __pyx_t_193 = __pyx_v_j;
-                *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_192, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_193, __pyx_pybuffernd_outMax.diminfo[1].strides) = (__pyx_v_k + 1);
-
-                /* "splitBBoxLUT.pyx":674
- *                             outMax[bin0_min, j] = k + 1
- * 
- *                             k = outMax[bin0_max, j]             # <<<<<<<<<<<<<<
- *                             lut[bin0_max, j, k].idx = idx
- *                             lut[bin0_max, j, k].coef =  deltaA * deltaR
- */
-                __pyx_t_194 = __pyx_v_bin0_max;
-                __pyx_t_195 = __pyx_v_j;
-                __pyx_v_k = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_194, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_195, __pyx_pybuffernd_outMax.diminfo[1].strides));
-
-                /* "splitBBoxLUT.pyx":675
- * 
- *                             k = outMax[bin0_max, j]
- *                             lut[bin0_max, j, k].idx = idx             # <<<<<<<<<<<<<<
- *                             lut[bin0_max, j, k].coef =  deltaA * deltaR
- *                             outMax[bin0_max, j] = k + 1
- */
-                __pyx_t_196 = __pyx_v_bin0_max;
-                __pyx_t_197 = __pyx_v_j;
-                __pyx_t_198 = __pyx_v_k;
-                (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_196, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_197, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_198, __pyx_pybuffernd_lut.diminfo[2].strides)).idx = __pyx_v_idx;
-
-                /* "splitBBoxLUT.pyx":676
- *                             k = outMax[bin0_max, j]
- *                             lut[bin0_max, j, k].idx = idx
- *                             lut[bin0_max, j, k].coef =  deltaA * deltaR             # <<<<<<<<<<<<<<
- *                             outMax[bin0_max, j] = k + 1
- * 
- */
-                __pyx_t_199 = __pyx_v_bin0_max;
-                __pyx_t_200 = __pyx_v_j;
-                __pyx_t_201 = __pyx_v_k;
-                (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_199, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_200, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_201, __pyx_pybuffernd_lut.diminfo[2].strides)).coef = (__pyx_v_deltaA * __pyx_v_deltaR);
-
-                /* "splitBBoxLUT.pyx":677
- *                             lut[bin0_max, j, k].idx = idx
- *                             lut[bin0_max, j, k].coef =  deltaA * deltaR
- *                             outMax[bin0_max, j] = k + 1             # <<<<<<<<<<<<<<
- * 
- *         self.lut=lut
- */
-                __pyx_t_202 = __pyx_v_bin0_max;
-                __pyx_t_203 = __pyx_v_j;
-                *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_202, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_203, __pyx_pybuffernd_outMax.diminfo[1].strides) = (__pyx_v_k + 1);
-              }
-            }
-            __pyx_L37:;
-          }
-          __pyx_L33:;
-          __pyx_L25_continue:;
-        }
-      }
-
-      /* "splitBBoxLUT.pyx":537
- *         lut = numpy.recarray(shape=(bins0, bins1, lut_size),dtype=[("idx",numpy.int32),("coef",numpy.float32)])
- *         memset(&lut[0,0,0], 0, lut_nbytes)
- *         with nogil:             # <<<<<<<<<<<<<<
- *             for idx in range(size):
- *                 if (check_mask) and cmask[idx]:
- */
-      /*finally:*/ {
-        int __pyx_why;
-        __pyx_why = 0; goto __pyx_L24;
-        __pyx_L23: __pyx_why = 4; goto __pyx_L24;
-        __pyx_L24:;
-        Py_BLOCK_THREADS
-        switch (__pyx_why) {
-          case 4: goto __pyx_L1_error;
-        }
-      }
-  }
-
-  /* "splitBBoxLUT.pyx":679
- *                             outMax[bin0_max, j] = k + 1
- * 
- *         self.lut=lut             # <<<<<<<<<<<<<<
- *         return outMax
- * 
- */
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__lut, ((PyObject *)__pyx_v_lut)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
-  /* "splitBBoxLUT.pyx":680
- * 
- *         self.lut=lut
- *         return outMax             # <<<<<<<<<<<<<<
- * 
- *     @cython.cdivision(True)
- */
-  __Pyx_XDECREF(__pyx_r);
-  __Pyx_INCREF(((PyObject *)__pyx_v_outMax));
-  __pyx_r = ((PyObject *)__pyx_v_outMax);
-  goto __pyx_L0;
-
-  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_3);
-  __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
-  __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
-  __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
-  __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1);
-  __Pyx_XDECREF(__pyx_t_10);
-  __Pyx_XDECREF(__pyx_t_11);
-  __Pyx_XDECREF(__pyx_t_12);
-  __PYX_XDEC_MEMVIEW(&__pyx_t_15, 1);
-  __Pyx_XDECREF(__pyx_t_32);
-  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
-    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
-    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lut.rcbuffer->pybuffer);
-    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outMax.rcbuffer->pybuffer);
-  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
-  __Pyx_AddTraceback("splitBBoxLUT.HistoBBox2d.calc_lut", __pyx_clineno, __pyx_lineno, __pyx_filename);
-  __pyx_r = NULL;
-  goto __pyx_L2;
-  __pyx_L0:;
-  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lut.rcbuffer->pybuffer);
-  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outMax.rcbuffer->pybuffer);
-  __pyx_L2:;
-  __PYX_XDEC_MEMVIEW(&__pyx_v_cpos0_sup, 1);
-  __PYX_XDEC_MEMVIEW(&__pyx_v_cpos0_inf, 1);
-  __PYX_XDEC_MEMVIEW(&__pyx_v_cpos1_inf, 1);
-  __PYX_XDEC_MEMVIEW(&__pyx_v_cpos1_sup, 1);
-  __Pyx_XDECREF((PyObject *)__pyx_v_outMax);
-  __Pyx_XDECREF((PyObject *)__pyx_v_lut);
-  __PYX_XDEC_MEMVIEW(&__pyx_v_cmask, 1);
-  __Pyx_XDECREF(__pyx_v_memsize);
-  __Pyx_XGIVEREF(__pyx_r);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* Python wrapper */
-static PyObject *__pyx_pw_12splitBBoxLUT_11HistoBBox2d_5integrate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_12splitBBoxLUT_11HistoBBox2d_4integrate[] = "\n        Actually perform the 2D integration which in this case looks more like a matrix-vector product\n        \n        @param weights: input image \n        @type weights: ndarray\n        @param dummy: value for dead pixels (optional)\n        @type dummy: float\n        @param delta_dummy: precision for dead-pixel value in dynamic masking\n        @type delta_dummy: float\n        @param dark: array with the dark-c [...]
-static PyMethodDef __pyx_mdef_12splitBBoxLUT_11HistoBBox2d_5integrate = {__Pyx_NAMESTR("integrate"), (PyCFunction)__pyx_pw_12splitBBoxLUT_11HistoBBox2d_5integrate, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_12splitBBoxLUT_11HistoBBox2d_4integrate)};
-static PyObject *__pyx_pw_12splitBBoxLUT_11HistoBBox2d_5integrate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
-  PyObject *__pyx_v_self = 0;
-  PyObject *__pyx_v_weights = 0;
-  PyObject *__pyx_v_dummy = 0;
-  PyObject *__pyx_v_delta_dummy = 0;
-  PyObject *__pyx_v_dark = 0;
-  PyObject *__pyx_v_flat = 0;
-  PyObject *__pyx_v_solidAngle = 0;
-  PyObject *__pyx_v_polarization = 0;
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("integrate (wrapper)", 0);
-  {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__weights,&__pyx_n_s__dummy,&__pyx_n_s__delta_dummy,&__pyx_n_s__dark,&__pyx_n_s__flat,&__pyx_n_s__solidAngle,&__pyx_n_s__polarization,0};
-    PyObject* values[8] = {0,0,0,0,0,0,0,0};
-
-    /* "splitBBoxLUT.pyx":685
- *     @cython.boundscheck(False)
- *     @cython.wraparound(False)
- *     def integrate(self, weights, dummy=None, delta_dummy=None, dark=None, flat=None, solidAngle=None, polarization=None):             # <<<<<<<<<<<<<<
- *         """
- *         Actually perform the 2D integration which in this case looks more like a matrix-vector product
- */
-    values[2] = ((PyObject *)((PyObject *)Py_None));
-    values[3] = ((PyObject *)((PyObject *)Py_None));
-    values[4] = ((PyObject *)((PyObject *)Py_None));
-    values[5] = ((PyObject *)((PyObject *)Py_None));
-    values[6] = ((PyObject *)((PyObject *)Py_None));
-    values[7] = ((PyObject *)((PyObject *)Py_None));
-    if (unlikely(__pyx_kwds)) {
-      Py_ssize_t kw_args;
-      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
-      switch (pos_args) {
-        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
-        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
-        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
-        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
-        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
-        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
-        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
-        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
-        case  0: break;
-        default: goto __pyx_L5_argtuple_error;
-      }
-      kw_args = PyDict_Size(__pyx_kwds);
-      switch (pos_args) {
-        case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 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("integrate", 0, 2, 8, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-        }
-        case  2:
-        if (kw_args > 0) {
-          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dummy);
-          if (value) { values[2] = value; kw_args--; }
-        }
-        case  3:
-        if (kw_args > 0) {
-          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__delta_dummy);
-          if (value) { values[3] = value; kw_args--; }
-        }
-        case  4:
-        if (kw_args > 0) {
-          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dark);
-          if (value) { values[4] = value; kw_args--; }
-        }
-        case  5:
-        if (kw_args > 0) {
-          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flat);
-          if (value) { values[5] = value; kw_args--; }
-        }
-        case  6:
-        if (kw_args > 0) {
-          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__solidAngle);
-          if (value) { values[6] = value; kw_args--; }
-        }
-        case  7:
-        if (kw_args > 0) {
-          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__polarization);
-          if (value) { values[7] = value; kw_args--; }
-        }
-      }
-      if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "integrate") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-      }
-    } else {
-      switch (PyTuple_GET_SIZE(__pyx_args)) {
-        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
-        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
-        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
-        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
-        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
-        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
-        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
-        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
-        break;
-        default: goto __pyx_L5_argtuple_error;
-      }
-    }
-    __pyx_v_self = values[0];
-    __pyx_v_weights = values[1];
-    __pyx_v_dummy = values[2];
-    __pyx_v_delta_dummy = values[3];
-    __pyx_v_dark = values[4];
-    __pyx_v_flat = values[5];
-    __pyx_v_solidAngle = values[6];
-    __pyx_v_polarization = values[7];
-  }
-  goto __pyx_L4_argument_unpacking_done;
-  __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("integrate", 0, 2, 8, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-  __pyx_L3_error:;
-  __Pyx_AddTraceback("splitBBoxLUT.HistoBBox2d.integrate", __pyx_clineno, __pyx_lineno, __pyx_filename);
-  __Pyx_RefNannyFinishContext();
-  return NULL;
-  __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_12splitBBoxLUT_11HistoBBox2d_4integrate(__pyx_self, __pyx_v_self, __pyx_v_weights, __pyx_v_dummy, __pyx_v_delta_dummy, __pyx_v_dark, __pyx_v_flat, __pyx_v_solidAngle, __pyx_v_polarization);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-static PyObject *__pyx_pf_12splitBBoxLUT_11HistoBBox2d_4integrate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_weights, PyObject *__pyx_v_dummy, PyObject *__pyx_v_delta_dummy, PyObject *__pyx_v_dark, PyObject *__pyx_v_flat, PyObject *__pyx_v_solidAngle, PyObject *__pyx_v_polarization) {
-  int __pyx_v_i;
-  int __pyx_v_j;
-  int __pyx_v_idx;
-  int __pyx_v_bins0;
-  int __pyx_v_bins1;
-  CYTHON_UNUSED int __pyx_v_bins;
-  int __pyx_v_lut_size;
-  int __pyx_v_size;
-  double __pyx_v_sum_data;
-  double __pyx_v_sum_count;
-  double __pyx_v_epsilon;
-  float __pyx_v_data;
-  float __pyx_v_coef;
-  float __pyx_v_cdummy;
-  float __pyx_v_cddummy;
-  int __pyx_v_do_dummy;
-  int __pyx_v_do_dark;
-  int __pyx_v_do_flat;
-  int __pyx_v_do_polarization;
-  int __pyx_v_do_solidAngle;
-  PyArrayObject *__pyx_v_outData = 0;
-  PyArrayObject *__pyx_v_outCount = 0;
-  PyArrayObject *__pyx_v_outMerge = 0;
-  PyArrayObject *__pyx_v_outData_1d = 0;
-  PyArrayObject *__pyx_v_outCount_1d = 0;
-  PyArrayObject *__pyx_v_outMerge_1d = 0;
-  __Pyx_memviewslice __pyx_v_lut = { 0, 0, { 0 }, { 0 }, { 0 } };
-  __Pyx_memviewslice __pyx_v_cdata = { 0, 0, { 0 }, { 0 }, { 0 } };
-  __Pyx_memviewslice __pyx_v_tdata = { 0, 0, { 0 }, { 0 }, { 0 } };
-  __Pyx_memviewslice __pyx_v_cflat = { 0, 0, { 0 }, { 0 }, { 0 } };
-  __Pyx_memviewslice __pyx_v_cdark = { 0, 0, { 0 }, { 0 }, { 0 } };
-  __Pyx_memviewslice __pyx_v_csolidAngle = { 0, 0, { 0 }, { 0 }, { 0 } };
-  __Pyx_memviewslice __pyx_v_cpolarization = { 0, 0, { 0 }, { 0 }, { 0 } };
-  __Pyx_LocalBuf_ND __pyx_pybuffernd_outCount;
-  __Pyx_Buffer __pyx_pybuffer_outCount;
-  __Pyx_LocalBuf_ND __pyx_pybuffernd_outCount_1d;
-  __Pyx_Buffer __pyx_pybuffer_outCount_1d;
-  __Pyx_LocalBuf_ND __pyx_pybuffernd_outData;
-  __Pyx_Buffer __pyx_pybuffer_outData;
-  __Pyx_LocalBuf_ND __pyx_pybuffernd_outData_1d;
-  __Pyx_Buffer __pyx_pybuffer_outData_1d;
-  __Pyx_LocalBuf_ND __pyx_pybuffernd_outMerge;
-  __Pyx_Buffer __pyx_pybuffer_outMerge;
-  __Pyx_LocalBuf_ND __pyx_pybuffernd_outMerge_1d;
-  __Pyx_Buffer __pyx_pybuffer_outMerge_1d;
-  PyObject *__pyx_r = NULL;
-  __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
-  PyObject *__pyx_t_2 = NULL;
-  int __pyx_t_3;
-  PyObject *__pyx_t_4 = NULL;
-  PyObject *__pyx_t_5 = NULL;
-  PyObject *__pyx_t_6 = NULL;
-  PyArrayObject *__pyx_t_7 = NULL;
-  PyArrayObject *__pyx_t_8 = NULL;
-  PyArrayObject *__pyx_t_9 = NULL;
-  PyArrayObject *__pyx_t_10 = NULL;
-  PyArrayObject *__pyx_t_11 = NULL;
-  PyArrayObject *__pyx_t_12 = NULL;
-  __Pyx_memviewslice __pyx_t_13 = { 0, 0, { 0 }, { 0 }, { 0 } };
-  int __pyx_t_14;
-  double __pyx_t_15;
-  __Pyx_memviewslice __pyx_t_16 = { 0, 0, { 0 }, { 0 }, { 0 } };
-  int __pyx_t_17;
-  int __pyx_t_18;
-  int __pyx_t_19;
-  int __pyx_t_20;
-  int __pyx_t_21;
-  int __pyx_t_22;
-  int __pyx_t_23;
-  int __pyx_t_24;
-  int __pyx_t_25;
-  int __pyx_t_26;
-  int __pyx_t_27;
-  int __pyx_t_28;
-  int __pyx_t_29;
-  int __pyx_t_30;
-  int __pyx_t_31;
-  int __pyx_t_32;
-  int __pyx_t_33;
-  int __pyx_t_34;
-  int __pyx_t_35;
-  int __pyx_t_36;
-  int __pyx_t_37;
-  int __pyx_t_38;
-  int __pyx_t_39;
-  int __pyx_t_40;
-  int __pyx_t_41;
-  __pyx_t_5numpy_int32_t __pyx_t_42;
-  int __pyx_t_43;
-  int __pyx_t_44;
-  __pyx_t_5numpy_float32_t __pyx_t_45;
-  int __pyx_t_46;
-  int __pyx_t_47;
-  int __pyx_t_48;
-  PyObject *__pyx_t_49 = NULL;
-  int __pyx_lineno = 0;
-  const char *__pyx_filename = NULL;
-  int __pyx_clineno = 0;
-  __Pyx_RefNannySetupContext("integrate", 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_outData_1d.pybuffer.buf = NULL;
-  __pyx_pybuffer_outData_1d.refcount = 0;
-  __pyx_pybuffernd_outData_1d.data = NULL;
-  __pyx_pybuffernd_outData_1d.rcbuffer = &__pyx_pybuffer_outData_1d;
-  __pyx_pybuffer_outCount_1d.pybuffer.buf = NULL;
-  __pyx_pybuffer_outCount_1d.refcount = 0;
-  __pyx_pybuffernd_outCount_1d.data = NULL;
-  __pyx_pybuffernd_outCount_1d.rcbuffer = &__pyx_pybuffer_outCount_1d;
-  __pyx_pybuffer_outMerge_1d.pybuffer.buf = NULL;
-  __pyx_pybuffer_outMerge_1d.refcount = 0;
-  __pyx_pybuffernd_outMerge_1d.data = NULL;
-  __pyx_pybuffernd_outMerge_1d.rcbuffer = &__pyx_pybuffer_outMerge_1d;
-
-  /* "splitBBoxLUT.pyx":707
- * 
- *         """
- *         cdef int i=0, j=0, idx=0, bins0=self.bins[0], bins1=self.bins[1], bins=bins0*bins1, lut_size=self.lut_size, size=self.size             # <<<<<<<<<<<<<<
- *         cdef double sum_data=0, sum_count=0, epsilon=1e-10
- *         cdef float data=0, coef=0, cdummy=0, cddummy=0
- */
-  __pyx_v_i = 0;
-  __pyx_v_j = 0;
-  __pyx_v_idx = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__bins); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_v_bins0 = __pyx_t_3;
-  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__bins); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_v_bins1 = __pyx_t_3;
-  __pyx_v_bins = (__pyx_v_bins0 * __pyx_v_bins1);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__lut_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_v_lut_size = __pyx_t_3;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_v_size = __pyx_t_3;
-
-  /* "splitBBoxLUT.pyx":708
- *         """
- *         cdef int i=0, j=0, idx=0, bins0=self.bins[0], bins1=self.bins[1], bins=bins0*bins1, lut_size=self.lut_size, size=self.size
- *         cdef double sum_data=0, sum_count=0, epsilon=1e-10             # <<<<<<<<<<<<<<
- *         cdef float data=0, coef=0, cdummy=0, cddummy=0
- *         cdef bint do_dummy=False, do_dark=False, do_flat=False, do_polarization=False, do_solidAngle=False
- */
-  __pyx_v_sum_data = 0.0;
-  __pyx_v_sum_count = 0.0;
-  __pyx_v_epsilon = 1e-10;
-
-  /* "splitBBoxLUT.pyx":709
- *         cdef int i=0, j=0, idx=0, bins0=self.bins[0], bins1=self.bins[1], bins=bins0*bins1, lut_size=self.lut_size, size=self.size
- *         cdef double sum_data=0, sum_count=0, epsilon=1e-10
- *         cdef float data=0, coef=0, cdummy=0, cddummy=0             # <<<<<<<<<<<<<<
- *         cdef bint do_dummy=False, do_dark=False, do_flat=False, do_polarization=False, do_solidAngle=False
- *         cdef numpy.ndarray[numpy.float64_t, ndim = 2] outData = numpy.zeros(self.bins, dtype=numpy.float64)
- */
-  __pyx_v_data = 0.0;
-  __pyx_v_coef = 0.0;
-  __pyx_v_cdummy = 0.0;
-  __pyx_v_cddummy = 0.0;
-
-  /* "splitBBoxLUT.pyx":710
- *         cdef double sum_data=0, sum_count=0, epsilon=1e-10
- *         cdef float data=0, coef=0, cdummy=0, cddummy=0
- *         cdef bint do_dummy=False, do_dark=False, do_flat=False, do_polarization=False, do_solidAngle=False             # <<<<<<<<<<<<<<
- *         cdef numpy.ndarray[numpy.float64_t, ndim = 2] outData = numpy.zeros(self.bins, dtype=numpy.float64)
- *         cdef numpy.ndarray[numpy.float64_t, ndim = 2] outCount = numpy.zeros(self.bins, dtype=numpy.float64)
- */
-  __pyx_v_do_dummy = 0;
-  __pyx_v_do_dark = 0;
-  __pyx_v_do_flat = 0;
-  __pyx_v_do_polarization = 0;
-  __pyx_v_do_solidAngle = 0;
-
-  /* "splitBBoxLUT.pyx":711
- *         cdef float data=0, coef=0, cdummy=0, cddummy=0
- *         cdef bint do_dummy=False, do_dark=False, do_flat=False, do_polarization=False, do_solidAngle=False
- *         cdef numpy.ndarray[numpy.float64_t, ndim = 2] outData = numpy.zeros(self.bins, dtype=numpy.float64)             # <<<<<<<<<<<<<<
- *         cdef numpy.ndarray[numpy.float64_t, ndim = 2] outCount = numpy.zeros(self.bins, dtype=numpy.float64)
- *         cdef numpy.ndarray[numpy.float32_t, ndim = 2] outMerge = numpy.zeros(self.bins, dtype=numpy.float32)
- */
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__bins); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
-  __Pyx_GIVEREF(__pyx_t_1);
-  __pyx_t_1 = 0;
-  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__float64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-  __pyx_t_6 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-  if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_7 = ((PyArrayObject *)__pyx_t_6);
-  {
-    __Pyx_BufFmt_StackElem __pyx_stack[1];
-    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outData.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 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 = 711; __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_7 = 0;
-  __pyx_v_outData = ((PyArrayObject *)__pyx_t_6);
-  __pyx_t_6 = 0;
-
-  /* "splitBBoxLUT.pyx":712
- *         cdef bint do_dummy=False, do_dark=False, do_flat=False, do_polarization=False, do_solidAngle=False
- *         cdef numpy.ndarray[numpy.float64_t, ndim = 2] outData = numpy.zeros(self.bins, dtype=numpy.float64)
- *         cdef numpy.ndarray[numpy.float64_t, ndim = 2] outCount = numpy.zeros(self.bins, dtype=numpy.float64)             # <<<<<<<<<<<<<<
- *         cdef numpy.ndarray[numpy.float32_t, ndim = 2] outMerge = numpy.zeros(self.bins, dtype=numpy.float32)
- *         cdef numpy.ndarray[numpy.float64_t, ndim = 1] outData_1d = outData.ravel()
- */
-  __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-  __pyx_t_6 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__bins); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
-  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  PyTuple_SET_ITEM(__pyx_t_4, 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 = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_6));
-  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__float64); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
-  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_8 = ((PyArrayObject *)__pyx_t_5);
-  {
-    __Pyx_BufFmt_StackElem __pyx_stack[1];
-    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outCount.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 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 = 712; __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_8 = 0;
-  __pyx_v_outCount = ((PyArrayObject *)__pyx_t_5);
-  __pyx_t_5 = 0;
-
-  /* "splitBBoxLUT.pyx":713
- *         cdef numpy.ndarray[numpy.float64_t, ndim = 2] outData = numpy.zeros(self.bins, dtype=numpy.float64)
- *         cdef numpy.ndarray[numpy.float64_t, ndim = 2] outCount = numpy.zeros(self.bins, dtype=numpy.float64)
- *         cdef numpy.ndarray[numpy.float32_t, ndim = 2] outMerge = numpy.zeros(self.bins, dtype=numpy.float32)             # <<<<<<<<<<<<<<
- *         cdef numpy.ndarray[numpy.float64_t, ndim = 1] outData_1d = outData.ravel()
- *         cdef numpy.ndarray[numpy.float64_t, ndim = 1] outCount_1d = outCount.ravel()
- */
-  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__zeros); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__bins); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
-  __Pyx_GIVEREF(__pyx_t_5);
-  __pyx_t_5 = 0;
-  __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
-  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_9 = ((PyArrayObject *)__pyx_t_2);
-  {
-    __Pyx_BufFmt_StackElem __pyx_stack[1];
-    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outMerge.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 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 = 713; __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_9 = 0;
-  __pyx_v_outMerge = ((PyArrayObject *)__pyx_t_2);
-  __pyx_t_2 = 0;
-
-  /* "splitBBoxLUT.pyx":714
- *         cdef numpy.ndarray[numpy.float64_t, ndim = 2] outCount = numpy.zeros(self.bins, dtype=numpy.float64)
- *         cdef numpy.ndarray[numpy.float32_t, ndim = 2] outMerge = numpy.zeros(self.bins, dtype=numpy.float32)
- *         cdef numpy.ndarray[numpy.float64_t, ndim = 1] outData_1d = outData.ravel()             # <<<<<<<<<<<<<<
- *         cdef numpy.ndarray[numpy.float64_t, ndim = 1] outCount_1d = outCount.ravel()
- *         cdef numpy.ndarray[numpy.float32_t, ndim = 1] outMerge_1d = outMerge.ravel()
- */
-  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_outData), __pyx_n_s__ravel); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_10 = ((PyArrayObject *)__pyx_t_5);
-  {
-    __Pyx_BufFmt_StackElem __pyx_stack[1];
-    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outData_1d.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_1d = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_outData_1d.rcbuffer->pybuffer.buf = NULL;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    } else {__pyx_pybuffernd_outData_1d.diminfo[0].strides = __pyx_pybuffernd_outData_1d.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outData_1d.diminfo[0].shape = __pyx_pybuffernd_outData_1d.rcbuffer->pybuffer.shape[0];
-    }
-  }
-  __pyx_t_10 = 0;
-  __pyx_v_outData_1d = ((PyArrayObject *)__pyx_t_5);
-  __pyx_t_5 = 0;
-
-  /* "splitBBoxLUT.pyx":715
- *         cdef numpy.ndarray[numpy.float32_t, ndim = 2] outMerge = numpy.zeros(self.bins, dtype=numpy.float32)
- *         cdef numpy.ndarray[numpy.float64_t, ndim = 1] outData_1d = outData.ravel()
- *         cdef numpy.ndarray[numpy.float64_t, ndim = 1] outCount_1d = outCount.ravel()             # <<<<<<<<<<<<<<
- *         cdef numpy.ndarray[numpy.float32_t, ndim = 1] outMerge_1d = outMerge.ravel()
- * 
- */
-  __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_outCount), __pyx_n_s__ravel); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_11 = ((PyArrayObject *)__pyx_t_2);
-  {
-    __Pyx_BufFmt_StackElem __pyx_stack[1];
-    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outCount_1d.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_1d = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_outCount_1d.rcbuffer->pybuffer.buf = NULL;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    } else {__pyx_pybuffernd_outCount_1d.diminfo[0].strides = __pyx_pybuffernd_outCount_1d.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outCount_1d.diminfo[0].shape = __pyx_pybuffernd_outCount_1d.rcbuffer->pybuffer.shape[0];
-    }
-  }
-  __pyx_t_11 = 0;
-  __pyx_v_outCount_1d = ((PyArrayObject *)__pyx_t_2);
-  __pyx_t_2 = 0;
-
-  /* "splitBBoxLUT.pyx":716
- *         cdef numpy.ndarray[numpy.float64_t, ndim = 1] outData_1d = outData.ravel()
- *         cdef numpy.ndarray[numpy.float64_t, ndim = 1] outCount_1d = outCount.ravel()
- *         cdef numpy.ndarray[numpy.float32_t, ndim = 1] outMerge_1d = outMerge.ravel()             # <<<<<<<<<<<<<<
- * 
- *         cdef lut_point[:,:] lut = self.lut
- */
-  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_outMerge), __pyx_n_s__ravel); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_12 = ((PyArrayObject *)__pyx_t_5);
-  {
-    __Pyx_BufFmt_StackElem __pyx_stack[1];
-    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outMerge_1d.rcbuffer->pybuffer, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
-      __pyx_v_outMerge_1d = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_outMerge_1d.rcbuffer->pybuffer.buf = NULL;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    } else {__pyx_pybuffernd_outMerge_1d.diminfo[0].strides = __pyx_pybuffernd_outMerge_1d.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outMerge_1d.diminfo[0].shape = __pyx_pybuffernd_outMerge_1d.rcbuffer->pybuffer.shape[0];
-    }
-  }
-  __pyx_t_12 = 0;
-  __pyx_v_outMerge_1d = ((PyArrayObject *)__pyx_t_5);
-  __pyx_t_5 = 0;
-
-  /* "splitBBoxLUT.pyx":718
- *         cdef numpy.ndarray[numpy.float32_t, ndim = 1] outMerge_1d = outMerge.ravel()
- * 
- *         cdef lut_point[:,:] lut = self.lut             # <<<<<<<<<<<<<<
- *         cdef float[:] cdata, tdata, cflat, cdark, csolidAngle, cpolarization
- * 
- */
-  __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__lut); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_13 = __Pyx_PyObject_to_MemoryviewSlice_dsds_nn_struct___pyx_t_12splitBBoxLUT_lut_point(__pyx_t_5);
-  if (unlikely(!__pyx_t_13.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __pyx_v_lut = __pyx_t_13;
-  __pyx_t_13.memview = NULL;
-  __pyx_t_13.data = NULL;
-
-  /* "splitBBoxLUT.pyx":721
- *         cdef float[:] cdata, tdata, cflat, cdark, csolidAngle, cpolarization
- * 
- *         assert size == weights.size             # <<<<<<<<<<<<<<
- * 
- *         if dummy is not None:
- */
-  #ifndef CYTHON_WITHOUT_ASSERTIONS
-  __pyx_t_5 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_v_weights, __pyx_n_s__size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (unlikely(!__pyx_t_14)) {
-    PyErr_SetNone(PyExc_AssertionError);
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  }
-  #endif
-
-  /* "splitBBoxLUT.pyx":723
- *         assert size == weights.size
- * 
- *         if dummy is not None:             # <<<<<<<<<<<<<<
- *             do_dummy = True
- *             cdummy =  <float>float(dummy)
- */
-  __pyx_t_14 = (__pyx_v_dummy != Py_None);
-  if (__pyx_t_14) {
-
-    /* "splitBBoxLUT.pyx":724
- * 
- *         if dummy is not None:
- *             do_dummy = True             # <<<<<<<<<<<<<<
- *             cdummy =  <float>float(dummy)
- *             if delta_dummy is None:
- */
-    __pyx_v_do_dummy = 1;
-
-    /* "splitBBoxLUT.pyx":725
- *         if dummy is not None:
- *             do_dummy = True
- *             cdummy =  <float>float(dummy)             # <<<<<<<<<<<<<<
- *             if delta_dummy is None:
- *                 cddummy = <float>0.0
- */
-    __pyx_t_15 = __Pyx_PyObject_AsDouble(__pyx_v_dummy); if (unlikely(__pyx_t_15 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_v_cdummy = ((float)__pyx_t_15);
-
-    /* "splitBBoxLUT.pyx":726
- *             do_dummy = True
- *             cdummy =  <float>float(dummy)
- *             if delta_dummy is None:             # <<<<<<<<<<<<<<
- *                 cddummy = <float>0.0
- *             else:
- */
-    __pyx_t_14 = (__pyx_v_delta_dummy == Py_None);
-    if (__pyx_t_14) {
-
-      /* "splitBBoxLUT.pyx":727
- *             cdummy =  <float>float(dummy)
- *             if delta_dummy is None:
- *                 cddummy = <float>0.0             # <<<<<<<<<<<<<<
- *             else:
- *                 cddummy = <float>float(delta_dummy)
- */
-      __pyx_v_cddummy = ((float)0.0);
-      goto __pyx_L4;
-    }
-    /*else*/ {
-
-      /* "splitBBoxLUT.pyx":729
- *                 cddummy = <float>0.0
- *             else:
- *                 cddummy = <float>float(delta_dummy)             # <<<<<<<<<<<<<<
- * 
- *         if flat is not None:
- */
-      __pyx_t_15 = __Pyx_PyObject_AsDouble(__pyx_v_delta_dummy); if (unlikely(__pyx_t_15 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_v_cddummy = ((float)__pyx_t_15);
-    }
-    __pyx_L4:;
-    goto __pyx_L3;
-  }
-  __pyx_L3:;
-
-  /* "splitBBoxLUT.pyx":731
- *                 cddummy = <float>float(delta_dummy)
- * 
- *         if flat is not None:             # <<<<<<<<<<<<<<
- *             do_flat = True
- *             assert flat.size == size
- */
-  __pyx_t_14 = (__pyx_v_flat != Py_None);
-  if (__pyx_t_14) {
-
-    /* "splitBBoxLUT.pyx":732
- * 
- *         if flat is not None:
- *             do_flat = True             # <<<<<<<<<<<<<<
- *             assert flat.size == size
- *             cflat = numpy.ascontiguousarray(flat.ravel(), dtype=numpy.float32)
- */
-    __pyx_v_do_flat = 1;
-
-    /* "splitBBoxLUT.pyx":733
- *         if flat is not None:
- *             do_flat = True
- *             assert flat.size == size             # <<<<<<<<<<<<<<
- *             cflat = numpy.ascontiguousarray(flat.ravel(), dtype=numpy.float32)
- *         if dark is not None:
- */
-    #ifndef CYTHON_WITHOUT_ASSERTIONS
-    __pyx_t_4 = PyObject_GetAttr(__pyx_v_flat, __pyx_n_s__size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_2 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    if (unlikely(!__pyx_t_14)) {
-      PyErr_SetNone(PyExc_AssertionError);
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    }
-    #endif
-
-    /* "splitBBoxLUT.pyx":734
- *             do_flat = True
- *             assert flat.size == size
- *             cflat = numpy.ascontiguousarray(flat.ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
- *         if dark is not None:
- *             do_dark = True
- */
-    __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_5 = PyObject_GetAttr(__pyx_v_flat, __pyx_n_s__ravel); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
-    __Pyx_GIVEREF(__pyx_t_4);
-    __pyx_t_4 = 0;
-    __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-    __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_1 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__float32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-    __pyx_t_16 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_1);
-    if (unlikely(!__pyx_t_16.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_v_cflat = __pyx_t_16;
-    __pyx_t_16.memview = NULL;
-    __pyx_t_16.data = NULL;
-    goto __pyx_L5;
-  }
-  __pyx_L5:;
-
-  /* "splitBBoxLUT.pyx":735
- *             assert flat.size == size
- *             cflat = numpy.ascontiguousarray(flat.ravel(), dtype=numpy.float32)
- *         if dark is not None:             # <<<<<<<<<<<<<<
- *             do_dark = True
- *             assert dark.size == size
- */
-  __pyx_t_14 = (__pyx_v_dark != Py_None);
-  if (__pyx_t_14) {
-
-    /* "splitBBoxLUT.pyx":736
- *             cflat = numpy.ascontiguousarray(flat.ravel(), dtype=numpy.float32)
- *         if dark is not None:
- *             do_dark = True             # <<<<<<<<<<<<<<
- *             assert dark.size == size
- *             cdark = numpy.ascontiguousarray(dark.ravel(), dtype=numpy.float32)
- */
-    __pyx_v_do_dark = 1;
-
-    /* "splitBBoxLUT.pyx":737
- *         if dark is not None:
- *             do_dark = True
- *             assert dark.size == size             # <<<<<<<<<<<<<<
- *             cdark = numpy.ascontiguousarray(dark.ravel(), dtype=numpy.float32)
- *         if solidAngle is not None:
- */
-    #ifndef CYTHON_WITHOUT_ASSERTIONS
-    __pyx_t_1 = PyObject_GetAttr(__pyx_v_dark, __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_4 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_5 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    if (unlikely(!__pyx_t_14)) {
-      PyErr_SetNone(PyExc_AssertionError);
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    }
-    #endif
-
-    /* "splitBBoxLUT.pyx":738
- *             do_dark = True
- *             assert dark.size == size
- *             cdark = numpy.ascontiguousarray(dark.ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
- *         if solidAngle is not None:
- *             do_solidAngle = True
- */
-    __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_5 = PyObject_GetAttr(__pyx_v_dark, __pyx_n_s__ravel); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
-    __Pyx_GIVEREF(__pyx_t_1);
-    __pyx_t_1 = 0;
-    __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_6 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__float32); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __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_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-    __pyx_t_16 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_6);
-    if (unlikely(!__pyx_t_16.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_v_cdark = __pyx_t_16;
-    __pyx_t_16.memview = NULL;
-    __pyx_t_16.data = NULL;
-    goto __pyx_L6;
-  }
-  __pyx_L6:;
-
-  /* "splitBBoxLUT.pyx":739
- *             assert dark.size == size
- *             cdark = numpy.ascontiguousarray(dark.ravel(), dtype=numpy.float32)
- *         if solidAngle is not None:             # <<<<<<<<<<<<<<
- *             do_solidAngle = True
- *             assert solidAngle.size == size
- */
-  __pyx_t_14 = (__pyx_v_solidAngle != Py_None);
-  if (__pyx_t_14) {
-
-    /* "splitBBoxLUT.pyx":740
- *             cdark = numpy.ascontiguousarray(dark.ravel(), dtype=numpy.float32)
- *         if solidAngle is not None:
- *             do_solidAngle = True             # <<<<<<<<<<<<<<
- *             assert solidAngle.size == size
- *             csolidAngle = numpy.ascontiguousarray(solidAngle.ravel(), dtype=numpy.float32)
- */
-    __pyx_v_do_solidAngle = 1;
-
-    /* "splitBBoxLUT.pyx":741
- *         if solidAngle is not None:
- *             do_solidAngle = True
- *             assert solidAngle.size == size             # <<<<<<<<<<<<<<
- *             csolidAngle = numpy.ascontiguousarray(solidAngle.ravel(), dtype=numpy.float32)
- *         if polarization is not None:
- */
-    #ifndef CYTHON_WITHOUT_ASSERTIONS
-    __pyx_t_6 = PyObject_GetAttr(__pyx_v_solidAngle, __pyx_n_s__size); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_1 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_5 = PyObject_RichCompare(__pyx_t_6, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    if (unlikely(!__pyx_t_14)) {
-      PyErr_SetNone(PyExc_AssertionError);
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    }
-    #endif
-
-    /* "splitBBoxLUT.pyx":742
- *             do_solidAngle = True
- *             assert solidAngle.size == size
- *             csolidAngle = numpy.ascontiguousarray(solidAngle.ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
- *         if polarization is not None:
- *             do_polarization = True
- */
-    __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_5 = PyObject_GetAttr(__pyx_v_solidAngle, __pyx_n_s__ravel); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    PyTuple_SET_ITEM(__pyx_t_5, 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 = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
-    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__float32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
-    __pyx_t_16 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_2);
-    if (unlikely(!__pyx_t_16.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_v_csolidAngle = __pyx_t_16;
-    __pyx_t_16.memview = NULL;
-    __pyx_t_16.data = NULL;
-    goto __pyx_L7;
-  }
-  __pyx_L7:;
-
-  /* "splitBBoxLUT.pyx":743
- *             assert solidAngle.size == size
- *             csolidAngle = numpy.ascontiguousarray(solidAngle.ravel(), dtype=numpy.float32)
- *         if polarization is not None:             # <<<<<<<<<<<<<<
- *             do_polarization = True
- *             assert polarization.size == size
- */
-  __pyx_t_14 = (__pyx_v_polarization != Py_None);
-  if (__pyx_t_14) {
-
-    /* "splitBBoxLUT.pyx":744
- *             csolidAngle = numpy.ascontiguousarray(solidAngle.ravel(), dtype=numpy.float32)
- *         if polarization is not None:
- *             do_polarization = True             # <<<<<<<<<<<<<<
- *             assert polarization.size == size
- *             cpolarization = numpy.ascontiguousarray(polarization.ravel(), dtype=numpy.float32)
- */
-    __pyx_v_do_polarization = 1;
-
-    /* "splitBBoxLUT.pyx":745
- *         if polarization is not None:
- *             do_polarization = True
- *             assert polarization.size == size             # <<<<<<<<<<<<<<
- *             cpolarization = numpy.ascontiguousarray(polarization.ravel(), dtype=numpy.float32)
- * 
- */
-    #ifndef CYTHON_WITHOUT_ASSERTIONS
-    __pyx_t_2 = PyObject_GetAttr(__pyx_v_polarization, __pyx_n_s__size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_6 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    if (unlikely(!__pyx_t_14)) {
-      PyErr_SetNone(PyExc_AssertionError);
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    }
-    #endif
-
-    /* "splitBBoxLUT.pyx":746
- *             do_polarization = True
- *             assert polarization.size == size
- *             cpolarization = numpy.ascontiguousarray(polarization.ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
- * 
- *         if (do_dark + do_flat + do_polarization + do_solidAngle):
- */
-    __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_5 = PyObject_GetAttr(__pyx_v_polarization, __pyx_n_s__ravel); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    PyTuple_SET_ITEM(__pyx_t_5, 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 = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_4 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-    __pyx_t_16 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_4);
-    if (unlikely(!__pyx_t_16.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_v_cpolarization = __pyx_t_16;
-    __pyx_t_16.memview = NULL;
-    __pyx_t_16.data = NULL;
-    goto __pyx_L8;
-  }
-  __pyx_L8:;
-
-  /* "splitBBoxLUT.pyx":748
- *             cpolarization = numpy.ascontiguousarray(polarization.ravel(), dtype=numpy.float32)
- * 
- *         if (do_dark + do_flat + do_polarization + do_solidAngle):             # <<<<<<<<<<<<<<
- *             tdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)
- *             cdata = numpy.zeros(size,dtype=numpy.float32)
- */
-  __pyx_t_3 = (((__pyx_v_do_dark + __pyx_v_do_flat) + __pyx_v_do_polarization) + __pyx_v_do_solidAngle);
-  if (__pyx_t_3) {
-
-    /* "splitBBoxLUT.pyx":749
- * 
- *         if (do_dark + do_flat + do_polarization + do_solidAngle):
- *             tdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
- *             cdata = numpy.zeros(size,dtype=numpy.float32)
- *             if do_dummy:
- */
-    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_4 = PyObject_GetAttr(__pyx_v_weights, __pyx_n_s__ravel); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
-    __Pyx_GIVEREF(__pyx_t_5);
-    __pyx_t_5 = 0;
-    __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
-    __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_1 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__float32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
-    __pyx_t_16 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_1);
-    if (unlikely(!__pyx_t_16.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_v_tdata = __pyx_t_16;
-    __pyx_t_16.memview = NULL;
-    __pyx_t_16.data = NULL;
-
-    /* "splitBBoxLUT.pyx":750
- *         if (do_dark + do_flat + do_polarization + do_solidAngle):
- *             tdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)
- *             cdata = numpy.zeros(size,dtype=numpy.float32)             # <<<<<<<<<<<<<<
- *             if do_dummy:
- *                 for i in prange(size, nogil=True, schedule="static"):
- */
-    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_1 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
-    __Pyx_GIVEREF(__pyx_t_1);
-    __pyx_t_1 = 0;
-    __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_6 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__float32); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; __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_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-    __pyx_t_16 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_6);
-    if (unlikely(!__pyx_t_16.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_v_cdata = __pyx_t_16;
-    __pyx_t_16.memview = NULL;
-    __pyx_t_16.data = NULL;
-
-    /* "splitBBoxLUT.pyx":751
- *             tdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)
- *             cdata = numpy.zeros(size,dtype=numpy.float32)
- *             if do_dummy:             # <<<<<<<<<<<<<<
- *                 for i in prange(size, nogil=True, schedule="static"):
- *                     data = tdata[i]
- */
-    if (__pyx_v_do_dummy) {
-
-      /* "splitBBoxLUT.pyx":752
- *             cdata = numpy.zeros(size,dtype=numpy.float32)
- *             if do_dummy:
- *                 for i in prange(size, nogil=True, schedule="static"):             # <<<<<<<<<<<<<<
- *                     data = tdata[i]
- *                     if ((cddummy!=0) and (fabs(data-cdummy) > cddummy)) or ((cddummy==0) and (data!=cdummy)):
- */
-      {
-          #ifdef WITH_THREAD
-          PyThreadState *_save = NULL;
-          #endif
-          Py_UNBLOCK_THREADS
-          /*try:*/ {
-            __pyx_t_3 = __pyx_v_size;
-            if (1 == 0) abort();
-            {
-                float __pyx_parallel_temp0 = __PYX_NAN;
-                int __pyx_parallel_temp1 = 0xbad0bad0;
-                const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0;
-                PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL;
-                int __pyx_parallel_why;
-                __pyx_parallel_why = 0;
-                #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_18 = (__pyx_t_3 - 0) / 1;
-                if (__pyx_t_18 > 0)
-                {
-                    #ifdef _OPENMP
-                    #pragma omp parallel private(__pyx_t_14, __pyx_t_26, __pyx_t_28, __pyx_t_23, __pyx_t_27, __pyx_t_20, __pyx_t_24, __pyx_t_21, __pyx_t_25, __pyx_t_19, __pyx_t_22) private(__pyx_filename, __pyx_lineno, __pyx_clineno) shared(__pyx_parallel_why, __pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb)
-                    #endif /* _OPENMP */
-                    {
-                        #ifdef _OPENMP
-                        #ifdef WITH_THREAD
-                        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
-                        #endif
-                        Py_BEGIN_ALLOW_THREADS
-                        #endif /* _OPENMP */
-                        #ifdef _OPENMP
-                        #pragma omp for lastprivate(__pyx_v_data) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) schedule(static)
-                        #endif /* _OPENMP */
-                        for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_18; __pyx_t_17++){
-                            if (__pyx_parallel_why < 2)
-                            {
-                                __pyx_v_i = 0 + 1 * __pyx_t_17;
-                                /* Initialize private variables to invalid values */
-                                __pyx_v_data = ((float)__PYX_NAN);
-
-                                /* "splitBBoxLUT.pyx":753
- *             if do_dummy:
- *                 for i in prange(size, nogil=True, schedule="static"):
- *                     data = tdata[i]             # <<<<<<<<<<<<<<
- *                     if ((cddummy!=0) and (fabs(data-cdummy) > cddummy)) or ((cddummy==0) and (data!=cdummy)):
- *                         #Nota: -= and /= operatore are seen as reduction in cython parallel.
- */
-                                __pyx_t_19 = __pyx_v_i;
-                                __pyx_v_data = (*((float *) ( /* dim=0 */ (__pyx_v_tdata.data + __pyx_t_19 * __pyx_v_tdata.strides[0]) )));
-
-                                /* "splitBBoxLUT.pyx":754
- *                 for i in prange(size, nogil=True, schedule="static"):
- *                     data = tdata[i]
- *                     if ((cddummy!=0) and (fabs(data-cdummy) > cddummy)) or ((cddummy==0) and (data!=cdummy)):             # <<<<<<<<<<<<<<
- *                         #Nota: -= and /= operatore are seen as reduction in cython parallel.
- *                         if do_dark:
- */
-                                __pyx_t_14 = (__pyx_v_cddummy != 0.0);
-                                if (__pyx_t_14) {
-                                  __pyx_t_20 = (fabs((__pyx_v_data - __pyx_v_cdummy)) > __pyx_v_cddummy);
-                                  __pyx_t_21 = __pyx_t_20;
-                                } else {
-                                  __pyx_t_21 = __pyx_t_14;
-                                }
-                                if (!__pyx_t_21) {
-                                  __pyx_t_14 = (__pyx_v_cddummy == 0.0);
-                                  if (__pyx_t_14) {
-                                    __pyx_t_20 = (__pyx_v_data != __pyx_v_cdummy);
-                                    __pyx_t_22 = __pyx_t_20;
-                                  } else {
-                                    __pyx_t_22 = __pyx_t_14;
-                                  }
-                                  __pyx_t_14 = __pyx_t_22;
-                                } else {
-                                  __pyx_t_14 = __pyx_t_21;
-                                }
-                                if (__pyx_t_14) {
-
-                                  /* "splitBBoxLUT.pyx":756
- *                     if ((cddummy!=0) and (fabs(data-cdummy) > cddummy)) or ((cddummy==0) and (data!=cdummy)):
- *                         #Nota: -= and /= operatore are seen as reduction in cython parallel.
- *                         if do_dark:             # <<<<<<<<<<<<<<
- *                             data = data - cdark[i]
- *                         if do_flat:
- */
-                                  if (__pyx_v_do_dark) {
-
-                                    /* "splitBBoxLUT.pyx":757
- *                         #Nota: -= and /= operatore are seen as reduction in cython parallel.
- *                         if do_dark:
- *                             data = data - cdark[i]             # <<<<<<<<<<<<<<
- *                         if do_flat:
- *                             data = data / cflat[i]
- */
-                                    if (unlikely(!__pyx_v_cdark.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cdark"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L16_error;} }
-                                    __pyx_t_23 = __pyx_v_i;
-                                    __pyx_v_data = (__pyx_v_data - (*((float *) ( /* dim=0 */ (__pyx_v_cdark.data + __pyx_t_23 * __pyx_v_cdark.strides[0]) ))));
-                                    goto __pyx_L19;
-                                  }
-                                  __pyx_L19:;
-
-                                  /* "splitBBoxLUT.pyx":758
- *                         if do_dark:
- *                             data = data - cdark[i]
- *                         if do_flat:             # <<<<<<<<<<<<<<
- *                             data = data / cflat[i]
- *                         if do_polarization:
- */
-                                  if (__pyx_v_do_flat) {
-
-                                    /* "splitBBoxLUT.pyx":759
- *                             data = data - cdark[i]
- *                         if do_flat:
- *                             data = data / cflat[i]             # <<<<<<<<<<<<<<
- *                         if do_polarization:
- *                             data = data / cpolarization[i]
- */
-                                    if (unlikely(!__pyx_v_cflat.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cflat"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L16_error;} }
-                                    __pyx_t_24 = __pyx_v_i;
-                                    __pyx_v_data = (__pyx_v_data / (*((float *) ( /* dim=0 */ (__pyx_v_cflat.data + __pyx_t_24 * __pyx_v_cflat.strides[0]) ))));
-                                    goto __pyx_L20;
-                                  }
-                                  __pyx_L20:;
-
-                                  /* "splitBBoxLUT.pyx":760
- *                         if do_flat:
- *                             data = data / cflat[i]
- *                         if do_polarization:             # <<<<<<<<<<<<<<
- *                             data = data / cpolarization[i]
- *                         if do_solidAngle:
- */
-                                  if (__pyx_v_do_polarization) {
-
-                                    /* "splitBBoxLUT.pyx":761
- *                             data = data / cflat[i]
- *                         if do_polarization:
- *                             data = data / cpolarization[i]             # <<<<<<<<<<<<<<
- *                         if do_solidAngle:
- *                             data = data / csolidAngle[i]
- */
-                                    if (unlikely(!__pyx_v_cpolarization.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cpolarization"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; __pyx_clineno = __LINE__; goto __pyx_L16_error;} }
-                                    __pyx_t_25 = __pyx_v_i;
-                                    __pyx_v_data = (__pyx_v_data / (*((float *) ( /* dim=0 */ (__pyx_v_cpolarization.data + __pyx_t_25 * __pyx_v_cpolarization.strides[0]) ))));
-                                    goto __pyx_L21;
-                                  }
-                                  __pyx_L21:;
-
-                                  /* "splitBBoxLUT.pyx":762
- *                         if do_polarization:
- *                             data = data / cpolarization[i]
- *                         if do_solidAngle:             # <<<<<<<<<<<<<<
- *                             data = data / csolidAngle[i]
- *                         cdata[i]+=data
- */
-                                  if (__pyx_v_do_solidAngle) {
-
-                                    /* "splitBBoxLUT.pyx":763
- *                             data = data / cpolarization[i]
- *                         if do_solidAngle:
- *                             data = data / csolidAngle[i]             # <<<<<<<<<<<<<<
- *                         cdata[i]+=data
- *                     else: #set all dummy_like values to cdummy. simplifies further processing
- */
-                                    if (unlikely(!__pyx_v_csolidAngle.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("csolidAngle"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L16_error;} }
-                                    __pyx_t_26 = __pyx_v_i;
-                                    __pyx_v_data = (__pyx_v_data / (*((float *) ( /* dim=0 */ (__pyx_v_csolidAngle.data + __pyx_t_26 * __pyx_v_csolidAngle.strides[0]) ))));
-                                    goto __pyx_L22;
-                                  }
-                                  __pyx_L22:;
-
-                                  /* "splitBBoxLUT.pyx":764
- *                         if do_solidAngle:
- *                             data = data / csolidAngle[i]
- *                         cdata[i]+=data             # <<<<<<<<<<<<<<
- *                     else: #set all dummy_like values to cdummy. simplifies further processing
- *                         cdata[i]+=cdummy
- */
-                                  __pyx_t_27 = __pyx_v_i;
-                                  *((float *) ( /* dim=0 */ (__pyx_v_cdata.data + __pyx_t_27 * __pyx_v_cdata.strides[0]) )) += __pyx_v_data;
-                                  goto __pyx_L18;
-                                }
-                                /*else*/ {
-
-                                  /* "splitBBoxLUT.pyx":766
- *                         cdata[i]+=data
- *                     else: #set all dummy_like values to cdummy. simplifies further processing
- *                         cdata[i]+=cdummy             # <<<<<<<<<<<<<<
- *             else:
- *                 for i in prange(size, nogil=True, schedule="static"):
- */
-                                  __pyx_t_28 = __pyx_v_i;
-                                  *((float *) ( /* dim=0 */ (__pyx_v_cdata.data + __pyx_t_28 * __pyx_v_cdata.strides[0]) )) += __pyx_v_cdummy;
-                                }
-                                __pyx_L18:;
-                                goto __pyx_L24;
-                                __pyx_L16_error:;
-                                {
-                                    #ifdef WITH_THREAD
-                                    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
-                                    #endif
-                                    #ifdef _OPENMP
-                                    #pragma omp flush(__pyx_parallel_exc_type)
-                                    #endif /* _OPENMP */
-                                    if (!__pyx_parallel_exc_type) {
-                                      __Pyx_ErrFetch(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb);
-                                      __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno;
-                                      __Pyx_GOTREF(__pyx_parallel_exc_type);
-                                    }
-                                    #ifdef WITH_THREAD
-                                    PyGILState_Release(__pyx_gilstate_save);
-                                    #endif
-                                }
-                                __pyx_parallel_why = 4;
-                                goto __pyx_L23;
-                                __pyx_L23:;
-                                #ifdef _OPENMP
-                                #pragma omp critical(__pyx_parallel_lastprivates2)
-                                #endif /* _OPENMP */
-                                {
-                                    __pyx_parallel_temp0 = __pyx_v_data;
-                                    __pyx_parallel_temp1 = __pyx_v_i;
-                                }
-                                __pyx_L24:;
-                                #ifdef _OPENMP
-                                #pragma omp flush(__pyx_parallel_why)
-                                #endif /* _OPENMP */
-                            }
-                        }
-                        #ifdef _OPENMP
-                        Py_END_ALLOW_THREADS
-                        #else
-{
-#ifdef WITH_THREAD
-                        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
-                        #endif
-                        #endif /* _OPENMP */
-                        /* Clean up any temporaries */
-                        #ifdef WITH_THREAD
-                        PyGILState_Release(__pyx_gilstate_save);
-                        #endif
-                        #ifndef _OPENMP
-}
-#endif /* _OPENMP */
-                    }
-                }
-                if (__pyx_parallel_exc_type) {
-                  /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */
-                  __pyx_parallel_why = 4;
-                }
-                if (__pyx_parallel_why) {
-                  __pyx_v_data = __pyx_parallel_temp0;
-                  __pyx_v_i = __pyx_parallel_temp1;
-                  switch (__pyx_parallel_why) {
-                        case 3: goto __pyx_L11;
-                        case 4:
-                    {
-                        #ifdef WITH_THREAD
-                        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
-                        #endif
-                        __Pyx_ErrRestore(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb);
-                        __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno;
-                        __Pyx_GIVEREF(__pyx_parallel_exc_type);
-                        #ifdef WITH_THREAD
-                        PyGILState_Release(__pyx_gilstate_save);
-                        #endif
-                    }
-                    goto __pyx_L12;
-                  }
-                }
-            }
-            #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
-          }
-
-          /* "splitBBoxLUT.pyx":752
- *             cdata = numpy.zeros(size,dtype=numpy.float32)
- *             if do_dummy:
- *                 for i in prange(size, nogil=True, schedule="static"):             # <<<<<<<<<<<<<<
- *                     data = tdata[i]
- *                     if ((cddummy!=0) and (fabs(data-cdummy) > cddummy)) or ((cddummy==0) and (data!=cdummy)):
- */
-          /*finally:*/ {
-            int __pyx_why;
-            __pyx_why = 0; goto __pyx_L13;
-            __pyx_L11: __pyx_why = 3; goto __pyx_L13;
-            __pyx_L12: __pyx_why = 4; goto __pyx_L13;
-            __pyx_L13:;
-            Py_BLOCK_THREADS
-            switch (__pyx_why) {
-              case 3: goto __pyx_L0;
-              case 4: goto __pyx_L1_error;
-            }
-          }
-      }
-      goto __pyx_L10;
-    }
-    /*else*/ {
-
-      /* "splitBBoxLUT.pyx":768
- *                         cdata[i]+=cdummy
- *             else:
- *                 for i in prange(size, nogil=True, schedule="static"):             # <<<<<<<<<<<<<<
- *                     data = tdata[i]
- *                     if do_dark:
- */
-      {
-          #ifdef WITH_THREAD
-          PyThreadState *_save = NULL;
-          #endif
-          Py_UNBLOCK_THREADS
-          /*try:*/ {
-            __pyx_t_18 = __pyx_v_size;
-            if (1 == 0) abort();
-            {
-                float __pyx_parallel_temp0 = __PYX_NAN;
-                int __pyx_parallel_temp1 = 0xbad0bad0;
-                const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0;
-                PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL;
-                int __pyx_parallel_why;
-                __pyx_parallel_why = 0;
-                #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_3 = (__pyx_t_18 - 0) / 1;
-                if (__pyx_t_3 > 0)
-                {
-                    #ifdef _OPENMP
-                    #pragma omp parallel private(__pyx_t_31, __pyx_t_34, __pyx_t_30, __pyx_t_29, __pyx_t_33, __pyx_t_32) private(__pyx_filename, __pyx_lineno, __pyx_clineno) shared(__pyx_parallel_why, __pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb)
-                    #endif /* _OPENMP */
-                    {
-                        #ifdef _OPENMP
-                        #ifdef WITH_THREAD
-                        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
-                        #endif
-                        Py_BEGIN_ALLOW_THREADS
-                        #endif /* _OPENMP */
-                        #ifdef _OPENMP
-                        #pragma omp for lastprivate(__pyx_v_data) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) schedule(static)
-                        #endif /* _OPENMP */
-                        for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_3; __pyx_t_17++){
-                            if (__pyx_parallel_why < 2)
-                            {
-                                __pyx_v_i = 0 + 1 * __pyx_t_17;
-                                /* Initialize private variables to invalid values */
-                                __pyx_v_data = ((float)__PYX_NAN);
-
-                                /* "splitBBoxLUT.pyx":769
- *             else:
- *                 for i in prange(size, nogil=True, schedule="static"):
- *                     data = tdata[i]             # <<<<<<<<<<<<<<
- *                     if do_dark:
- *                         data = data - cdark[i]
- */
-                                __pyx_t_29 = __pyx_v_i;
-                                __pyx_v_data = (*((float *) ( /* dim=0 */ (__pyx_v_tdata.data + __pyx_t_29 * __pyx_v_tdata.strides[0]) )));
-
-                                /* "splitBBoxLUT.pyx":770
- *                 for i in prange(size, nogil=True, schedule="static"):
- *                     data = tdata[i]
- *                     if do_dark:             # <<<<<<<<<<<<<<
- *                         data = data - cdark[i]
- *                     if do_flat:
- */
-                                if (__pyx_v_do_dark) {
-
-                                  /* "splitBBoxLUT.pyx":771
- *                     data = tdata[i]
- *                     if do_dark:
- *                         data = data - cdark[i]             # <<<<<<<<<<<<<<
- *                     if do_flat:
- *                         data = data / cflat[i]
- */
-                                  if (unlikely(!__pyx_v_cdark.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cdark"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L31_error;} }
-                                  __pyx_t_30 = __pyx_v_i;
-                                  __pyx_v_data = (__pyx_v_data - (*((float *) ( /* dim=0 */ (__pyx_v_cdark.data + __pyx_t_30 * __pyx_v_cdark.strides[0]) ))));
-                                  goto __pyx_L33;
-                                }
-                                __pyx_L33:;
-
-                                /* "splitBBoxLUT.pyx":772
- *                     if do_dark:
- *                         data = data - cdark[i]
- *                     if do_flat:             # <<<<<<<<<<<<<<
- *                         data = data / cflat[i]
- *                     if do_polarization:
- */
-                                if (__pyx_v_do_flat) {
-
-                                  /* "splitBBoxLUT.pyx":773
- *                         data = data - cdark[i]
- *                     if do_flat:
- *                         data = data / cflat[i]             # <<<<<<<<<<<<<<
- *                     if do_polarization:
- *                         data = data / cpolarization[i]
- */
-                                  if (unlikely(!__pyx_v_cflat.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cflat"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L31_error;} }
-                                  __pyx_t_31 = __pyx_v_i;
-                                  __pyx_v_data = (__pyx_v_data / (*((float *) ( /* dim=0 */ (__pyx_v_cflat.data + __pyx_t_31 * __pyx_v_cflat.strides[0]) ))));
-                                  goto __pyx_L34;
-                                }
-                                __pyx_L34:;
-
-                                /* "splitBBoxLUT.pyx":774
- *                     if do_flat:
- *                         data = data / cflat[i]
- *                     if do_polarization:             # <<<<<<<<<<<<<<
- *                         data = data / cpolarization[i]
- *                     if do_solidAngle:
- */
-                                if (__pyx_v_do_polarization) {
-
-                                  /* "splitBBoxLUT.pyx":775
- *                         data = data / cflat[i]
- *                     if do_polarization:
- *                         data = data / cpolarization[i]             # <<<<<<<<<<<<<<
- *                     if do_solidAngle:
- *                         data = data / csolidAngle[i]
- */
-                                  if (unlikely(!__pyx_v_cpolarization.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cpolarization"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L31_error;} }
-                                  __pyx_t_32 = __pyx_v_i;
-                                  __pyx_v_data = (__pyx_v_data / (*((float *) ( /* dim=0 */ (__pyx_v_cpolarization.data + __pyx_t_32 * __pyx_v_cpolarization.strides[0]) ))));
-                                  goto __pyx_L35;
-                                }
-                                __pyx_L35:;
-
-                                /* "splitBBoxLUT.pyx":776
- *                     if do_polarization:
- *                         data = data / cpolarization[i]
- *                     if do_solidAngle:             # <<<<<<<<<<<<<<
- *                         data = data / csolidAngle[i]
- *                     cdata[i]+=data
- */
-                                if (__pyx_v_do_solidAngle) {
-
-                                  /* "splitBBoxLUT.pyx":777
- *                         data = data / cpolarization[i]
- *                     if do_solidAngle:
- *                         data = data / csolidAngle[i]             # <<<<<<<<<<<<<<
- *                     cdata[i]+=data
- *         else:
- */
-                                  if (unlikely(!__pyx_v_csolidAngle.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("csolidAngle"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L31_error;} }
-                                  __pyx_t_33 = __pyx_v_i;
-                                  __pyx_v_data = (__pyx_v_data / (*((float *) ( /* dim=0 */ (__pyx_v_csolidAngle.data + __pyx_t_33 * __pyx_v_csolidAngle.strides[0]) ))));
-                                  goto __pyx_L36;
-                                }
-                                __pyx_L36:;
-
-                                /* "splitBBoxLUT.pyx":778
- *                     if do_solidAngle:
- *                         data = data / csolidAngle[i]
- *                     cdata[i]+=data             # <<<<<<<<<<<<<<
- *         else:
- *             if do_dummy:
- */
-                                __pyx_t_34 = __pyx_v_i;
-                                *((float *) ( /* dim=0 */ (__pyx_v_cdata.data + __pyx_t_34 * __pyx_v_cdata.strides[0]) )) += __pyx_v_data;
-                                goto __pyx_L38;
-                                __pyx_L31_error:;
-                                {
-                                    #ifdef WITH_THREAD
-                                    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
-                                    #endif
-                                    #ifdef _OPENMP
-                                    #pragma omp flush(__pyx_parallel_exc_type)
-                                    #endif /* _OPENMP */
-                                    if (!__pyx_parallel_exc_type) {
-                                      __Pyx_ErrFetch(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb);
-                                      __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno;
-                                      __Pyx_GOTREF(__pyx_parallel_exc_type);
-                                    }
-                                    #ifdef WITH_THREAD
-                                    PyGILState_Release(__pyx_gilstate_save);
-                                    #endif
-                                }
-                                __pyx_parallel_why = 4;
-                                goto __pyx_L37;
-                                __pyx_L37:;
-                                #ifdef _OPENMP
-                                #pragma omp critical(__pyx_parallel_lastprivates3)
-                                #endif /* _OPENMP */
-                                {
-                                    __pyx_parallel_temp0 = __pyx_v_data;
-                                    __pyx_parallel_temp1 = __pyx_v_i;
-                                }
-                                __pyx_L38:;
-                                #ifdef _OPENMP
-                                #pragma omp flush(__pyx_parallel_why)
-                                #endif /* _OPENMP */
-                            }
-                        }
-                        #ifdef _OPENMP
-                        Py_END_ALLOW_THREADS
-                        #else
-{
-#ifdef WITH_THREAD
-                        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
-                        #endif
-                        #endif /* _OPENMP */
-                        /* Clean up any temporaries */
-                        #ifdef WITH_THREAD
-                        PyGILState_Release(__pyx_gilstate_save);
-                        #endif
-                        #ifndef _OPENMP
-}
-#endif /* _OPENMP */
-                    }
-                }
-                if (__pyx_parallel_exc_type) {
-                  /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */
-                  __pyx_parallel_why = 4;
-                }
-                if (__pyx_parallel_why) {
-                  __pyx_v_data = __pyx_parallel_temp0;
-                  __pyx_v_i = __pyx_parallel_temp1;
-                  switch (__pyx_parallel_why) {
-                        case 3: goto __pyx_L26;
-                        case 4:
-                    {
-                        #ifdef WITH_THREAD
-                        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
-                        #endif
-                        __Pyx_ErrRestore(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb);
-                        __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno;
-                        __Pyx_GIVEREF(__pyx_parallel_exc_type);
-                        #ifdef WITH_THREAD
-                        PyGILState_Release(__pyx_gilstate_save);
-                        #endif
-                    }
-                    goto __pyx_L27;
-                  }
-                }
-            }
-            #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
-          }
-
-          /* "splitBBoxLUT.pyx":768
- *                         cdata[i]+=cdummy
- *             else:
- *                 for i in prange(size, nogil=True, schedule="static"):             # <<<<<<<<<<<<<<
- *                     data = tdata[i]
- *                     if do_dark:
- */
-          /*finally:*/ {
-            int __pyx_why;
-            __pyx_why = 0; goto __pyx_L28;
-            __pyx_L26: __pyx_why = 3; goto __pyx_L28;
-            __pyx_L27: __pyx_why = 4; goto __pyx_L28;
-            __pyx_L28:;
-            Py_BLOCK_THREADS
-            switch (__pyx_why) {
-              case 3: goto __pyx_L0;
-              case 4: goto __pyx_L1_error;
-            }
-          }
-      }
-    }
-    __pyx_L10:;
-    goto __pyx_L9;
-  }
-  /*else*/ {
-
-    /* "splitBBoxLUT.pyx":780
- *                     cdata[i]+=data
- *         else:
- *             if do_dummy:             # <<<<<<<<<<<<<<
- *                 tdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)
- *                 cdata = numpy.zeros(size,dtype=numpy.float32)
- */
-    if (__pyx_v_do_dummy) {
-
-      /* "splitBBoxLUT.pyx":781
- *         else:
- *             if do_dummy:
- *                 tdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
- *                 cdata = numpy.zeros(size,dtype=numpy.float32)
- *                 for i in prange(size, nogil=True, schedule="static"):
- */
-      __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_6);
-      __pyx_t_1 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-      __pyx_t_6 = PyObject_GetAttr(__pyx_v_weights, __pyx_n_s__ravel); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_6);
-      __pyx_t_4 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_6);
-      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
-      __Pyx_GIVEREF(__pyx_t_4);
-      __pyx_t_4 = 0;
-      __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-      __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
-      __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__float32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
-      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-      __pyx_t_16 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_2);
-      if (unlikely(!__pyx_t_16.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __pyx_v_tdata = __pyx_t_16;
-      __pyx_t_16.memview = NULL;
-      __pyx_t_16.data = NULL;
-
-      /* "splitBBoxLUT.pyx":782
- *             if do_dummy:
- *                 tdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)
- *                 cdata = numpy.zeros(size,dtype=numpy.float32)             # <<<<<<<<<<<<<<
- *                 for i in prange(size, nogil=True, schedule="static"):
- *                     data = tdata[i]
- */
-      __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __pyx_t_2 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_6);
-      PyTuple_SET_ITEM(__pyx_t_6, 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 = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-      __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
-      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-      __pyx_t_16 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_5);
-      if (unlikely(!__pyx_t_16.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __pyx_v_cdata = __pyx_t_16;
-      __pyx_t_16.memview = NULL;
-      __pyx_t_16.data = NULL;
-
-      /* "splitBBoxLUT.pyx":783
- *                 tdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)
- *                 cdata = numpy.zeros(size,dtype=numpy.float32)
- *                 for i in prange(size, nogil=True, schedule="static"):             # <<<<<<<<<<<<<<
- *                     data = tdata[i]
- *                     if ((cddummy!=0) and (fabs(data-cdummy) > cddummy)) or ((cddummy==0) and (data!=cdummy)):
- */
-      {
-          #ifdef WITH_THREAD
-          PyThreadState *_save = NULL;
-          #endif
-          Py_UNBLOCK_THREADS
-          /*try:*/ {
-            __pyx_t_3 = __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_18 = (__pyx_t_3 - 0) / 1;
-                if (__pyx_t_18 > 0)
-                {
-                    #ifdef _OPENMP
-                    #pragma omp parallel private(__pyx_t_14, __pyx_t_37, __pyx_t_20, __pyx_t_21, __pyx_t_35, __pyx_t_22, __pyx_t_36)
-                    #endif /* _OPENMP */
-                    {
-                        #ifdef _OPENMP
-                        #pragma omp for lastprivate(__pyx_v_data) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) schedule(static)
-                        #endif /* _OPENMP */
-                        for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_18; __pyx_t_17++){
-                            {
-                                __pyx_v_i = 0 + 1 * __pyx_t_17;
-                                /* Initialize private variables to invalid values */
-                                __pyx_v_data = ((float)__PYX_NAN);
-
-                                /* "splitBBoxLUT.pyx":784
- *                 cdata = numpy.zeros(size,dtype=numpy.float32)
- *                 for i in prange(size, nogil=True, schedule="static"):
- *                     data = tdata[i]             # <<<<<<<<<<<<<<
- *                     if ((cddummy!=0) and (fabs(data-cdummy) > cddummy)) or ((cddummy==0) and (data!=cdummy)):
- *                         cdata[i]+=data
- */
-                                __pyx_t_35 = __pyx_v_i;
-                                __pyx_v_data = (*((float *) ( /* dim=0 */ (__pyx_v_tdata.data + __pyx_t_35 * __pyx_v_tdata.strides[0]) )));
-
-                                /* "splitBBoxLUT.pyx":785
- *                 for i in prange(size, nogil=True, schedule="static"):
- *                     data = tdata[i]
- *                     if ((cddummy!=0) and (fabs(data-cdummy) > cddummy)) or ((cddummy==0) and (data!=cdummy)):             # <<<<<<<<<<<<<<
- *                         cdata[i]+=data
- *                     else:
- */
-                                __pyx_t_14 = (__pyx_v_cddummy != 0.0);
-                                if (__pyx_t_14) {
-                                  __pyx_t_21 = (fabs((__pyx_v_data - __pyx_v_cdummy)) > __pyx_v_cddummy);
-                                  __pyx_t_22 = __pyx_t_21;
-                                } else {
-                                  __pyx_t_22 = __pyx_t_14;
-                                }
-                                if (!__pyx_t_22) {
-                                  __pyx_t_14 = (__pyx_v_cddummy == 0.0);
-                                  if (__pyx_t_14) {
-                                    __pyx_t_21 = (__pyx_v_data != __pyx_v_cdummy);
-                                    __pyx_t_20 = __pyx_t_21;
-                                  } else {
-                                    __pyx_t_20 = __pyx_t_14;
-                                  }
-                                  __pyx_t_14 = __pyx_t_20;
-                                } else {
-                                  __pyx_t_14 = __pyx_t_22;
-                                }
-                                if (__pyx_t_14) {
-
-                                  /* "splitBBoxLUT.pyx":786
- *                     data = tdata[i]
- *                     if ((cddummy!=0) and (fabs(data-cdummy) > cddummy)) or ((cddummy==0) and (data!=cdummy)):
- *                         cdata[i]+=data             # <<<<<<<<<<<<<<
- *                     else:
- *                         cdata[i]+=cdummy
- */
-                                  __pyx_t_36 = __pyx_v_i;
-                                  *((float *) ( /* dim=0 */ (__pyx_v_cdata.data + __pyx_t_36 * __pyx_v_cdata.strides[0]) )) += __pyx_v_data;
-                                  goto __pyx_L48;
-                                }
-                                /*else*/ {
-
-                                  /* "splitBBoxLUT.pyx":788
- *                         cdata[i]+=data
- *                     else:
- *                         cdata[i]+=cdummy             # <<<<<<<<<<<<<<
- *             else:
- *                 cdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)
- */
-                                  __pyx_t_37 = __pyx_v_i;
-                                  *((float *) ( /* dim=0 */ (__pyx_v_cdata.data + __pyx_t_37 * __pyx_v_cdata.strides[0]) )) += __pyx_v_cdummy;
-                                }
-                                __pyx_L48:;
-                            }
-                        }
-                    }
-                }
-            }
-            #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
-          }
-
-          /* "splitBBoxLUT.pyx":783
- *                 tdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)
- *                 cdata = numpy.zeros(size,dtype=numpy.float32)
- *                 for i in prange(size, nogil=True, schedule="static"):             # <<<<<<<<<<<<<<
- *                     data = tdata[i]
- *                     if ((cddummy!=0) and (fabs(data-cdummy) > cddummy)) or ((cddummy==0) and (data!=cdummy)):
- */
-          /*finally:*/ {
-            Py_BLOCK_THREADS
-          }
-      }
-      goto __pyx_L40;
-    }
-    /*else*/ {
-
-      /* "splitBBoxLUT.pyx":790
- *                         cdata[i]+=cdummy
- *             else:
- *                 cdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
- * 
- *         for i in prange(bins, nogil=True, schedule="guided"):
- */
-      __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
-      __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __pyx_t_5 = PyObject_GetAttr(__pyx_v_weights, __pyx_n_s__ravel); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
-      __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_6);
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
-      PyTuple_SET_ITEM(__pyx_t_5, 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 = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
-      __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__float32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
-      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
-      __pyx_t_16 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_1);
-      if (unlikely(!__pyx_t_16.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __pyx_v_cdata = __pyx_t_16;
-      __pyx_t_16.memview = NULL;
-      __pyx_t_16.data = NULL;
-    }
-    __pyx_L40:;
-  }
-  __pyx_L9:;
-
-  /* "splitBBoxLUT.pyx":792
- *                 cdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)
- * 
- *         for i in prange(bins, nogil=True, schedule="guided"):             # <<<<<<<<<<<<<<
- *             sum_data = 0.0
- *             sum_count = 0.0
- */
-  {
-      #ifdef WITH_THREAD
-      PyThreadState *_save = NULL;
-      #endif
-      Py_UNBLOCK_THREADS
-      /*try:*/ {
-        __pyx_t_18 = __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_3 = (__pyx_t_18 - 0) / 1;
-            if (__pyx_t_3 > 0)
-            {
-                #ifdef _OPENMP
-                #pragma omp parallel private(__pyx_t_42, __pyx_t_14, __pyx_t_38, __pyx_t_47, __pyx_t_43, __pyx_t_48, __pyx_t_20, __pyx_t_44, __pyx_t_40, __pyx_t_45, __pyx_t_39, __pyx_t_41, __pyx_t_46, __pyx_t_22)
-                #endif /* _OPENMP */
-                {
-                    #ifdef _OPENMP
-                    #pragma omp for lastprivate(__pyx_v_data) lastprivate(__pyx_v_sum_count) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_idx) lastprivate(__pyx_v_coef) lastprivate(__pyx_v_sum_data) schedule(guided)
-                    #endif /* _OPENMP */
-                    for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_3; __pyx_t_17++){
-                        {
-                            __pyx_v_i = 0 + 1 * __pyx_t_17;
-                            /* Initialize private variables to invalid values */
-                            __pyx_v_data = ((float)__PYX_NAN);
-                            __pyx_v_sum_count = ((double)__PYX_NAN);
-                            __pyx_v_j = ((int)0xbad0bad0);
-                            __pyx_v_idx = ((int)0xbad0bad0);
-                            __pyx_v_coef = ((float)__PYX_NAN);
-                            __pyx_v_sum_data = ((double)__PYX_NAN);
-
-                            /* "splitBBoxLUT.pyx":793
- * 
- *         for i in prange(bins, nogil=True, schedule="guided"):
- *             sum_data = 0.0             # <<<<<<<<<<<<<<
- *             sum_count = 0.0
- *             for j in range(lut_size):
- */
-                            __pyx_v_sum_data = 0.0;
-
-                            /* "splitBBoxLUT.pyx":794
- *         for i in prange(bins, nogil=True, schedule="guided"):
- *             sum_data = 0.0
- *             sum_count = 0.0             # <<<<<<<<<<<<<<
- *             for j in range(lut_size):
- *                 idx = lut[i, j].idx
- */
-                            __pyx_v_sum_count = 0.0;
-
-                            /* "splitBBoxLUT.pyx":795
- *             sum_data = 0.0
- *             sum_count = 0.0
- *             for j in range(lut_size):             # <<<<<<<<<<<<<<
- *                 idx = lut[i, j].idx
- *                 coef = lut[i, j].coef
- */
-                            __pyx_t_38 = __pyx_v_lut_size;
-                            for (__pyx_t_39 = 0; __pyx_t_39 < __pyx_t_38; __pyx_t_39+=1) {
-                              __pyx_v_j = __pyx_t_39;
-
-                              /* "splitBBoxLUT.pyx":796
- *             sum_count = 0.0
- *             for j in range(lut_size):
- *                 idx = lut[i, j].idx             # <<<<<<<<<<<<<<
- *                 coef = lut[i, j].coef
- *                 if idx <= 0 and coef <= 0.0:
- */
-                              __pyx_t_40 = __pyx_v_i;
-                              __pyx_t_41 = __pyx_v_j;
-                              __pyx_t_42 = (*((struct __pyx_t_12splitBBoxLUT_lut_point *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_lut.data + __pyx_t_40 * __pyx_v_lut.strides[0]) ) + __pyx_t_41 * __pyx_v_lut.strides[1]) ))).idx;
-                              __pyx_v_idx = __pyx_t_42;
-
-                              /* "splitBBoxLUT.pyx":797
- *             for j in range(lut_size):
- *                 idx = lut[i, j].idx
- *                 coef = lut[i, j].coef             # <<<<<<<<<<<<<<
- *                 if idx <= 0 and coef <= 0.0:
- *                     break
- */
-                              __pyx_t_43 = __pyx_v_i;
-                              __pyx_t_44 = __pyx_v_j;
-                              __pyx_t_45 = (*((struct __pyx_t_12splitBBoxLUT_lut_point *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_lut.data + __pyx_t_43 * __pyx_v_lut.strides[0]) ) + __pyx_t_44 * __pyx_v_lut.strides[1]) ))).coef;
-                              __pyx_v_coef = __pyx_t_45;
-
-                              /* "splitBBoxLUT.pyx":798
- *                 idx = lut[i, j].idx
- *                 coef = lut[i, j].coef
- *                 if idx <= 0 and coef <= 0.0:             # <<<<<<<<<<<<<<
- *                     break
- *                 data = cdata[idx]
- */
-                              __pyx_t_14 = (__pyx_v_idx <= 0);
-                              if (__pyx_t_14) {
-                                __pyx_t_22 = (__pyx_v_coef <= 0.0);
-                                __pyx_t_20 = __pyx_t_22;
-                              } else {
-                                __pyx_t_20 = __pyx_t_14;
-                              }
-                              if (__pyx_t_20) {
-
-                                /* "splitBBoxLUT.pyx":799
- *                 coef = lut[i, j].coef
- *                 if idx <= 0 and coef <= 0.0:
- *                     break             # <<<<<<<<<<<<<<
- *                 data = cdata[idx]
- *                 if do_dummy and data==cdummy:
- */
-                                goto __pyx_L59_break;
-                                goto __pyx_L60;
-                              }
-                              __pyx_L60:;
-
-                              /* "splitBBoxLUT.pyx":800
- *                 if idx <= 0 and coef <= 0.0:
- *                     break
- *                 data = cdata[idx]             # <<<<<<<<<<<<<<
- *                 if do_dummy and data==cdummy:
- *                     continue
- */
-                              __pyx_t_46 = __pyx_v_idx;
-                              __pyx_v_data = (*((float *) ( /* dim=0 */ (__pyx_v_cdata.data + __pyx_t_46 * __pyx_v_cdata.strides[0]) )));
-
-                              /* "splitBBoxLUT.pyx":801
- *                     break
- *                 data = cdata[idx]
- *                 if do_dummy and data==cdummy:             # <<<<<<<<<<<<<<
- *                     continue
- * 
- */
-                              if (__pyx_v_do_dummy) {
-                                __pyx_t_20 = (__pyx_v_data == __pyx_v_cdummy);
-                                __pyx_t_14 = __pyx_t_20;
-                              } else {
-                                __pyx_t_14 = __pyx_v_do_dummy;
-                              }
-                              if (__pyx_t_14) {
-
-                                /* "splitBBoxLUT.pyx":802
- *                 data = cdata[idx]
- *                 if do_dummy and data==cdummy:
- *                     continue             # <<<<<<<<<<<<<<
- * 
- *                 sum_data = sum_data + coef * data
- */
-                                goto __pyx_L58_continue;
-                                goto __pyx_L61;
-                              }
-                              __pyx_L61:;
-
-                              /* "splitBBoxLUT.pyx":804
- *                     continue
- * 
- *                 sum_data = sum_data + coef * data             # <<<<<<<<<<<<<<
- *                 sum_count = sum_count + coef
- *             outData_1d[i] += sum_data
- */
-                              __pyx_v_sum_data = (__pyx_v_sum_data + (__pyx_v_coef * __pyx_v_data));
-
-                              /* "splitBBoxLUT.pyx":805
- * 
- *                 sum_data = sum_data + coef * data
- *                 sum_count = sum_count + coef             # <<<<<<<<<<<<<<
- *             outData_1d[i] += sum_data
- *             outCount_1d[i] += sum_count
- */
-                              __pyx_v_sum_count = (__pyx_v_sum_count + __pyx_v_coef);
-                              __pyx_L58_continue:;
-                            }
-                            __pyx_L59_break:;
-
-                            /* "splitBBoxLUT.pyx":806
- *                 sum_data = sum_data + coef * data
- *                 sum_count = sum_count + coef
- *             outData_1d[i] += sum_data             # <<<<<<<<<<<<<<
- *             outCount_1d[i] += sum_count
- *             if sum_count > epsilon:
- */
-                            __pyx_t_38 = __pyx_v_i;
-                            *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData_1d.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_outData_1d.diminfo[0].strides) += __pyx_v_sum_data;
-
-                            /* "splitBBoxLUT.pyx":807
- *                 sum_count = sum_count + coef
- *             outData_1d[i] += sum_data
- *             outCount_1d[i] += sum_count             # <<<<<<<<<<<<<<
- *             if sum_count > epsilon:
- *                 outMerge_1d[i] += sum_data / sum_count
- */
-                            __pyx_t_39 = __pyx_v_i;
-                            *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount_1d.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_outCount_1d.diminfo[0].strides) += __pyx_v_sum_count;
-
-                            /* "splitBBoxLUT.pyx":808
- *             outData_1d[i] += sum_data
- *             outCount_1d[i] += sum_count
- *             if sum_count > epsilon:             # <<<<<<<<<<<<<<
- *                 outMerge_1d[i] += sum_data / sum_count
- *             else:
- */
-                            __pyx_t_14 = (__pyx_v_sum_count > __pyx_v_epsilon);
-                            if (__pyx_t_14) {
-
-                              /* "splitBBoxLUT.pyx":809
- *             outCount_1d[i] += sum_count
- *             if sum_count > epsilon:
- *                 outMerge_1d[i] += sum_data / sum_count             # <<<<<<<<<<<<<<
- *             else:
- *                 outMerge_1d[i] += cdummy
- */
-                              __pyx_t_47 = __pyx_v_i;
-                              *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_outMerge_1d.rcbuffer->pybuffer.buf, __pyx_t_47, __pyx_pybuffernd_outMerge_1d.diminfo[0].strides) += (__pyx_v_sum_data / __pyx_v_sum_count);
-                              goto __pyx_L62;
-                            }
-                            /*else*/ {
-
-                              /* "splitBBoxLUT.pyx":811
- *                 outMerge_1d[i] += sum_data / sum_count
- *             else:
- *                 outMerge_1d[i] += cdummy             # <<<<<<<<<<<<<<
- *         return  outMerge.T, self.outPos0, self.outPos1, outData.T, outCount.T
- * 
- */
-                              __pyx_t_48 = __pyx_v_i;
-                              *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_outMerge_1d.rcbuffer->pybuffer.buf, __pyx_t_48, __pyx_pybuffernd_outMerge_1d.diminfo[0].strides) += __pyx_v_cdummy;
-                            }
-                            __pyx_L62:;
-                        }
-                    }
-                }
-            }
-        }
-        #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
-      }
-
-      /* "splitBBoxLUT.pyx":792
- *                 cdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)
- * 
- *         for i in prange(bins, nogil=True, schedule="guided"):             # <<<<<<<<<<<<<<
- *             sum_data = 0.0
- *             sum_count = 0.0
- */
-      /*finally:*/ {
-        Py_BLOCK_THREADS
-      }
-  }
-
-  /* "splitBBoxLUT.pyx":812
- *             else:
- *                 outMerge_1d[i] += cdummy
- *         return  outMerge.T, self.outPos0, self.outPos1, outData.T, outCount.T             # <<<<<<<<<<<<<<
- * 
- * @cython.cdivision(True)
- */
-  __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_outMerge), __pyx_n_s__T); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_6 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__outPos0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
-  __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__outPos1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_outData), __pyx_n_s__T); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_outCount), __pyx_n_s__T); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_49 = PyTuple_New(5); if (unlikely(!__pyx_t_49)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_49);
-  PyTuple_SET_ITEM(__pyx_t_49, 0, __pyx_t_1);
-  __Pyx_GIVEREF(__pyx_t_1);
-  PyTuple_SET_ITEM(__pyx_t_49, 1, __pyx_t_6);
-  __Pyx_GIVEREF(__pyx_t_6);
-  PyTuple_SET_ITEM(__pyx_t_49, 2, __pyx_t_5);
-  __Pyx_GIVEREF(__pyx_t_5);
-  PyTuple_SET_ITEM(__pyx_t_49, 3, __pyx_t_2);
-  __Pyx_GIVEREF(__pyx_t_2);
-  PyTuple_SET_ITEM(__pyx_t_49, 4, __pyx_t_4);
-  __Pyx_GIVEREF(__pyx_t_4);
-  __pyx_t_1 = 0;
-  __pyx_t_6 = 0;
-  __pyx_t_5 = 0;
-  __pyx_t_2 = 0;
-  __pyx_t_4 = 0;
-  __pyx_r = ((PyObject *)__pyx_t_49);
-  __pyx_t_49 = 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_4);
-  __Pyx_XDECREF(__pyx_t_5);
-  __Pyx_XDECREF(__pyx_t_6);
-  __PYX_XDEC_MEMVIEW(&__pyx_t_13, 1);
-  __PYX_XDEC_MEMVIEW(&__pyx_t_16, 1);
-  __Pyx_XDECREF(__pyx_t_49);
-  { 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_outCount_1d.rcbuffer->pybuffer);
-    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outData.rcbuffer->pybuffer);
-    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outData_1d.rcbuffer->pybuffer);
-    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outMerge.rcbuffer->pybuffer);
-    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outMerge_1d.rcbuffer->pybuffer);
-  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
-  __Pyx_AddTraceback("splitBBoxLUT.HistoBBox2d.integrate", __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_outCount_1d.rcbuffer->pybuffer);
-  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outData.rcbuffer->pybuffer);
-  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outData_1d.rcbuffer->pybuffer);
-  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outMerge.rcbuffer->pybuffer);
-  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outMerge_1d.rcbuffer->pybuffer);
-  __pyx_L2:;
-  __Pyx_XDECREF((PyObject *)__pyx_v_outData);
-  __Pyx_XDECREF((PyObject *)__pyx_v_outCount);
-  __Pyx_XDECREF((PyObject *)__pyx_v_outMerge);
-  __Pyx_XDECREF((PyObject *)__pyx_v_outData_1d);
-  __Pyx_XDECREF((PyObject *)__pyx_v_outCount_1d);
-  __Pyx_XDECREF((PyObject *)__pyx_v_outMerge_1d);
-  __PYX_XDEC_MEMVIEW(&__pyx_v_lut, 1);
-  __PYX_XDEC_MEMVIEW(&__pyx_v_cdata, 1);
-  __PYX_XDEC_MEMVIEW(&__pyx_v_tdata, 1);
-  __PYX_XDEC_MEMVIEW(&__pyx_v_cflat, 1);
-  __PYX_XDEC_MEMVIEW(&__pyx_v_cdark, 1);
-  __PYX_XDEC_MEMVIEW(&__pyx_v_csolidAngle, 1);
-  __PYX_XDEC_MEMVIEW(&__pyx_v_cpolarization, 1);
-  __Pyx_XGIVEREF(__pyx_r);
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* Python wrapper */
-static PyObject *__pyx_pw_12splitBBoxLUT_1histoBBox2d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_12splitBBoxLUT_histoBBox2d[] = "\n    Calculate 2D histogram of pos0(tth),pos1(chi) weighted by weights\n\n    Splitting is done on the pixel's bounding box like fit2D\n\n\n    @param weights: array with intensities\n    @param pos0: 1D array with pos0: tth or q_vect\n    @param delta_pos0: 1D array with delta pos0: max center-corner distance\n    @param pos1: 1D array with pos1: chi\n    @param delta_pos1: 1D array with max pos1: max center-corner distance, unused  [...]
-static PyMethodDef __pyx_mdef_12splitBBoxLUT_1histoBBox2d = {__Pyx_NAMESTR("histoBBox2d"), (PyCFunction)__pyx_pw_12splitBBoxLUT_1histoBBox2d, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_12splitBBoxLUT_histoBBox2d)};
-static PyObject *__pyx_pw_12splitBBoxLUT_1histoBBox2d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
-  PyArrayObject *__pyx_v_weights = 0;
-  PyArrayObject *__pyx_v_pos0 = 0;
-  PyArrayObject *__pyx_v_delta_pos0 = 0;
-  PyArrayObject *__pyx_v_pos1 = 0;
-  PyArrayObject *__pyx_v_delta_pos1 = 0;
-  PyObject *__pyx_v_bins = 0;
-  PyObject *__pyx_v_pos0Range = 0;
-  PyObject *__pyx_v_pos1Range = 0;
-  PyObject *__pyx_v_dummy = 0;
-  PyObject *__pyx_v_delta_dummy = 0;
-  PyObject *__pyx_v_mask = 0;
-  PyObject *__pyx_v_dark = 0;
-  PyObject *__pyx_v_flat = 0;
-  PyObject *__pyx_v_solidangle = 0;
-  PyObject *__pyx_v_polarization = 0;
-  PyObject *__pyx_r = 0;
-  __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("histoBBox2d (wrapper)", 0);
-  {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__weights,&__pyx_n_s__pos0,&__pyx_n_s__delta_pos0,&__pyx_n_s__pos1,&__pyx_n_s__delta_pos1,&__pyx_n_s__bins,&__pyx_n_s__pos0Range,&__pyx_n_s__pos1Range,&__pyx_n_s__dummy,&__pyx_n_s__delta_dummy,&__pyx_n_s__mask,&__pyx_n_s__dark,&__pyx_n_s__flat,&__pyx_n_s__solidangle,&__pyx_n_s__polarization,0};
-    PyObject* values[15] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
-
-    /* "splitBBoxLUT.pyx":822
- *                 numpy.ndarray pos1 not None,
- *                 numpy.ndarray delta_pos1 not None,
- *                 bins=(100, 36),             # <<<<<<<<<<<<<<
- *                 pos0Range=None,
- *                 pos1Range=None,
- */
-    values[5] = ((PyObject *)__pyx_k_tuple_8);
-
-    /* "splitBBoxLUT.pyx":823
- *                 numpy.ndarray delta_pos1 not None,
- *                 bins=(100, 36),
- *                 pos0Range=None,             # <<<<<<<<<<<<<<
- *                 pos1Range=None,
- *                 dummy=None,
- */
-    values[6] = ((PyObject *)Py_None);
-
-    /* "splitBBoxLUT.pyx":824
- *                 bins=(100, 36),
- *                 pos0Range=None,
- *                 pos1Range=None,             # <<<<<<<<<<<<<<
- *                 dummy=None,
- *                 delta_dummy=None,
- */
-    values[7] = ((PyObject *)Py_None);
-
-    /* "splitBBoxLUT.pyx":825
- *                 pos0Range=None,
- *                 pos1Range=None,
- *                 dummy=None,             # <<<<<<<<<<<<<<
- *                 delta_dummy=None,
- *                 mask=None,
- */
-    values[8] = ((PyObject *)Py_None);
-
-    /* "splitBBoxLUT.pyx":826
- *                 pos1Range=None,
- *                 dummy=None,
- *                 delta_dummy=None,             # <<<<<<<<<<<<<<
- *                 mask=None,
- *                 dark=None,
- */
-    values[9] = ((PyObject *)Py_None);
-
-    /* "splitBBoxLUT.pyx":827
- *                 dummy=None,
- *                 delta_dummy=None,
- *                 mask=None,             # <<<<<<<<<<<<<<
- *                 dark=None,
- *                 flat=None,
- */
-    values[10] = ((PyObject *)Py_None);
-
-    /* "splitBBoxLUT.pyx":828
- *                 delta_dummy=None,
- *                 mask=None,
- *                 dark=None,             # <<<<<<<<<<<<<<
- *                 flat=None,
- *                 solidangle=None,
- */
-    values[11] = ((PyObject *)Py_None);
-
-    /* "splitBBoxLUT.pyx":829
- *                 mask=None,
- *                 dark=None,
- *                 flat=None,             # <<<<<<<<<<<<<<
- *                 solidangle=None,
- *                 polarization=None):
- */
-    values[12] = ((PyObject *)Py_None);
-
-    /* "splitBBoxLUT.pyx":830
- *                 dark=None,
- *                 flat=None,
- *                 solidangle=None,             # <<<<<<<<<<<<<<
- *                 polarization=None):
- *     """
- */
-    values[13] = ((PyObject *)Py_None);
-
-    /* "splitBBoxLUT.pyx":831
- *                 flat=None,
- *                 solidangle=None,
- *                 polarization=None):             # <<<<<<<<<<<<<<
- *     """
- *     Calculate 2D histogram of pos0(tth),pos1(chi) weighted by weights
- */
-    values[14] = ((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 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
-        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
-        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
-        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
-        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
-        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
-        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
-        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
-        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
-        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
-        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
-        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
-        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
-        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
-        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
-        case  0: break;
-        default: goto __pyx_L5_argtuple_error;
-      }
-      kw_args = PyDict_Size(__pyx_kwds);
-      switch (pos_args) {
-        case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__weights)) != 0)) kw_args--;
-        else goto __pyx_L5_argtuple_error;
-        case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos0)) != 0)) kw_args--;
-        else {
-          __Pyx_RaiseArgtupleInvalid("histoBBox2d", 0, 5, 15, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-        }
-        case  2:
-        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__delta_pos0)) != 0)) kw_args--;
-        else {
-          __Pyx_RaiseArgtupleInvalid("histoBBox2d", 0, 5, 15, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-        }
-        case  3:
-        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos1)) != 0)) kw_args--;
-        else {
-          __Pyx_RaiseArgtupleInvalid("histoBBox2d", 0, 5, 15, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-        }
-        case  4:
-        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__delta_pos1)) != 0)) kw_args--;
-        else {
-          __Pyx_RaiseArgtupleInvalid("histoBBox2d", 0, 5, 15, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-        }
-        case  5:
-        if (kw_args > 0) {
-          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bins);
-          if (value) { values[5] = value; kw_args--; }
-        }
-        case  6:
-        if (kw_args > 0) {
-          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos0Range);
-          if (value) { values[6] = value; kw_args--; }
-        }
-        case  7:
-        if (kw_args > 0) {
-          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos1Range);
-          if (value) { values[7] = value; kw_args--; }
-        }
-        case  8:
-        if (kw_args > 0) {
-          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dummy);
-          if (value) { values[8] = value; kw_args--; }
-        }
-        case  9:
-        if (kw_args > 0) {
-          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__delta_dummy);
-          if (value) { values[9] = value; kw_args--; }
-        }
-        case 10:
-        if (kw_args > 0) {
-          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mask);
-          if (value) { values[10] = value; kw_args--; }
-        }
-        case 11:
-        if (kw_args > 0) {
-          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dark);
-          if (value) { values[11] = value; kw_args--; }
-        }
-        case 12:
-        if (kw_args > 0) {
-          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flat);
-          if (value) { values[12] = value; kw_args--; }
-        }
-        case 13:
-        if (kw_args > 0) {
-          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__solidangle);
-          if (value) { values[13] = value; kw_args--; }
-        }
-        case 14:
-        if (kw_args > 0) {
-          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__polarization);
-          if (value) { values[14] = value; kw_args--; }
-        }
-      }
-      if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "histoBBox2d") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-      }
-    } else {
-      switch (PyTuple_GET_SIZE(__pyx_args)) {
-        case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
-        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
-        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
-        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
-        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
-        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
-        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
-        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
-        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
-        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
-        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
-        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
-        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
-        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
-        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
-        break;
-        default: goto __pyx_L5_argtuple_error;
-      }
-    }
-    __pyx_v_weights = ((PyArrayObject *)values[0]);
-    __pyx_v_pos0 = ((PyArrayObject *)values[1]);
-    __pyx_v_delta_pos0 = ((PyArrayObject *)values[2]);
-    __pyx_v_pos1 = ((PyArrayObject *)values[3]);
-    __pyx_v_delta_pos1 = ((PyArrayObject *)values[4]);
-    __pyx_v_bins = values[5];
-    __pyx_v_pos0Range = values[6];
-    __pyx_v_pos1Range = values[7];
-    __pyx_v_dummy = values[8];
-    __pyx_v_delta_dummy = values[9];
-    __pyx_v_mask = values[10];
-    __pyx_v_dark = values[11];
-    __pyx_v_flat = values[12];
-    __pyx_v_solidangle = values[13];
-    __pyx_v_polarization = values[14];
-  }
-  goto __pyx_L4_argument_unpacking_done;
-  __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("histoBBox2d", 0, 5, 15, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-  __pyx_L3_error:;
-  __Pyx_AddTraceback("splitBBoxLUT.histoBBox2d", __pyx_clineno, __pyx_lineno, __pyx_filename);
-  __Pyx_RefNannyFinishContext();
-  return NULL;
-  __pyx_L4_argument_unpacking_done:;
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weights), __pyx_ptype_5numpy_ndarray, 0, "weights", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos0), __pyx_ptype_5numpy_ndarray, 0, "pos0", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_delta_pos0), __pyx_ptype_5numpy_ndarray, 0, "delta_pos0", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 819; __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 = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_delta_pos1), __pyx_ptype_5numpy_ndarray, 0, "delta_pos1", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_r = __pyx_pf_12splitBBoxLUT_histoBBox2d(__pyx_self, __pyx_v_weights, __pyx_v_pos0, __pyx_v_delta_pos0, __pyx_v_pos1, __pyx_v_delta_pos1, __pyx_v_bins, __pyx_v_pos0Range, __pyx_v_pos1Range, __pyx_v_dummy, __pyx_v_delta_dummy, __pyx_v_mask, __pyx_v_dark, __pyx_v_flat, __pyx_v_solidangle, __pyx_v_polarization);
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __pyx_r = NULL;
-  __pyx_L0:;
-  __Pyx_RefNannyFinishContext();
-  return __pyx_r;
-}
-
-/* "splitBBoxLUT.pyx":817
- * @cython.boundscheck(False)
- * @cython.wraparound(False)
- * def histoBBox2d(numpy.ndarray weights not None,             # <<<<<<<<<<<<<<
- *                 numpy.ndarray pos0 not None,
- *                 numpy.ndarray delta_pos0 not None,
- */
-
-static PyObject *__pyx_pf_12splitBBoxLUT_histoBBox2d(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_weights, PyArrayObject *__pyx_v_pos0, PyArrayObject *__pyx_v_delta_pos0, PyArrayObject *__pyx_v_pos1, PyArrayObject *__pyx_v_delta_pos1, PyObject *__pyx_v_bins, PyObject *__pyx_v_pos0Range, PyObject *__pyx_v_pos1Range, PyObject *__pyx_v_dummy, PyObject *__pyx_v_delta_dummy, PyObject *__pyx_v_mask, PyObject *__pyx_v_dark, PyObject *__pyx_v_flat, PyObject *__pyx_v_solidangle, PyO [...]
-  int __pyx_v_bins0;
-  int __pyx_v_bins1;
-  int __pyx_v_i;
-  int __pyx_v_j;
-  int __pyx_v_idx;
-  size_t __pyx_v_size;
-  PyArrayObject *__pyx_v_cdata = 0;
-  PyArrayObject *__pyx_v_cpos0 = 0;
-  PyArrayObject *__pyx_v_dpos0 = 0;
-  PyArrayObject *__pyx_v_cpos1 = 0;
-  PyArrayObject *__pyx_v_dpos1 = 0;
-  PyArrayObject *__pyx_v_cpos0_upper = 0;
-  PyArrayObject *__pyx_v_cpos0_lower = 0;
-  PyArrayObject *__pyx_v_outData = 0;
-  PyArrayObject *__pyx_v_outCount = 0;
-  PyArrayObject *__pyx_v_outMerge = 0;
-  float __pyx_v_min0;
-  float __pyx_v_max0;
-  float __pyx_v_min1;
-  float __pyx_v_max1;
-  float __pyx_v_deltaR;
-  float __pyx_v_deltaL;
-  float __pyx_v_deltaU;
-  float __pyx_v_deltaD;
-  float __pyx_v_deltaA;
+static PyObject *__pyx_pf_12splitBBoxLUT_11HistoBBox2d_4calc_lut(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
   float __pyx_v_delta0;
-  float __pyx_v_delta1;
   float __pyx_v_pos0_min;
-  float __pyx_v_pos0_max;
-  float __pyx_v_pos1_min;
-  float __pyx_v_pos1_max;
-  float __pyx_v_pos0_maxin;
-  float __pyx_v_pos1_maxin;
+  float __pyx_v_min0;
+  float __pyx_v_max0;
   float __pyx_v_fbin0_min;
   float __pyx_v_fbin0_max;
+  float __pyx_v_delta1;
+  float __pyx_v_pos1_min;
+  float __pyx_v_min1;
+  float __pyx_v_max1;
   float __pyx_v_fbin1_min;
   float __pyx_v_fbin1_max;
-  float __pyx_v_data;
-  float __pyx_v_epsilon;
-  float __pyx_v_cdummy;
-  float __pyx_v_ddummy;
-  int __pyx_v_bin0_max;
   int __pyx_v_bin0_min;
-  int __pyx_v_bin1_max;
+  int __pyx_v_bin0_max;
+  int __pyx_v_bins0;
   int __pyx_v_bin1_min;
+  int __pyx_v_bin1_max;
+  int __pyx_v_bins1;
+  __pyx_t_5numpy_int32_t __pyx_v_k;
+  __pyx_t_5numpy_int32_t __pyx_v_idx;
+  __pyx_t_5numpy_int32_t __pyx_v_lut_size;
+  __pyx_t_5numpy_int32_t __pyx_v_i;
+  __pyx_t_5numpy_int32_t __pyx_v_j;
+  __pyx_t_5numpy_int32_t __pyx_v_size;
   int __pyx_v_check_mask;
-  int __pyx_v_check_dummy;
-  int __pyx_v_do_dark;
-  int __pyx_v_do_flat;
-  int __pyx_v_do_polarization;
-  int __pyx_v_do_solidangle;
+  __Pyx_memviewslice __pyx_v_cpos0_sup = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_cpos0_inf = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_cpos1_inf = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_cpos1_sup = { 0, 0, { 0 }, { 0 }, { 0 } };
+  PyArrayObject *__pyx_v_outMax = 0;
+  PyArrayObject *__pyx_v_lut = 0;
   __Pyx_memviewslice __pyx_v_cmask = { 0, 0, { 0 }, { 0 }, { 0 } };
-  __Pyx_memviewslice __pyx_v_cflat = { 0, 0, { 0 }, { 0 }, { 0 } };
-  __Pyx_memviewslice __pyx_v_cdark = { 0, 0, { 0 }, { 0 }, { 0 } };
-  __Pyx_memviewslice __pyx_v_cpolarization = { 0, 0, { 0 }, { 0 }, { 0 } };
-  __Pyx_memviewslice __pyx_v_csolidangle = { 0, 0, { 0 }, { 0 }, { 0 } };
-  PyObject *__pyx_v_edges0 = NULL;
-  PyObject *__pyx_v_edges1 = NULL;
-  __Pyx_LocalBuf_ND __pyx_pybuffernd_cdata;
-  __Pyx_Buffer __pyx_pybuffer_cdata;
-  __Pyx_LocalBuf_ND __pyx_pybuffernd_cpos0;
-  __Pyx_Buffer __pyx_pybuffer_cpos0;
-  __Pyx_LocalBuf_ND __pyx_pybuffernd_cpos0_lower;
-  __Pyx_Buffer __pyx_pybuffer_cpos0_lower;
-  __Pyx_LocalBuf_ND __pyx_pybuffernd_cpos0_upper;
-  __Pyx_Buffer __pyx_pybuffer_cpos0_upper;
-  __Pyx_LocalBuf_ND __pyx_pybuffernd_cpos1;
-  __Pyx_Buffer __pyx_pybuffer_cpos1;
-  __Pyx_LocalBuf_ND __pyx_pybuffernd_dpos0;
-  __Pyx_Buffer __pyx_pybuffer_dpos0;
-  __Pyx_LocalBuf_ND __pyx_pybuffernd_dpos1;
-  __Pyx_Buffer __pyx_pybuffer_dpos1;
-  __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;
+  size_t __pyx_v_lut_nbytes;
+  PyObject *__pyx_v_memsize = NULL;
+  double __pyx_v_deltaD;
+  double __pyx_v_deltaU;
+  double __pyx_v_deltaA;
+  double __pyx_v_deltaL;
+  double __pyx_v_deltaR;
+  __Pyx_LocalBuf_ND __pyx_pybuffernd_lut;
+  __Pyx_Buffer __pyx_pybuffer_lut;
+  __Pyx_LocalBuf_ND __pyx_pybuffernd_outMax;
+  __Pyx_Buffer __pyx_pybuffer_outMax;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
-  size_t __pyx_t_2;
+  float __pyx_t_2;
   PyObject *__pyx_t_3 = NULL;
-  PyObject *__pyx_t_4 = NULL;
-  int __pyx_t_5;
-  PyObject *__pyx_t_6 = NULL;
-  PyObject *__pyx_t_7 = NULL;
-  PyObject *__pyx_t_8 = NULL;
-  PyObject *__pyx_t_9 = NULL;
-  PyObject *(*__pyx_t_10)(PyObject *);
-  int __pyx_t_11;
-  int __pyx_t_12;
-  PyObject *__pyx_t_13 = NULL;
-  PyArrayObject *__pyx_t_14 = NULL;
-  PyArrayObject *__pyx_t_15 = NULL;
-  PyArrayObject *__pyx_t_16 = NULL;
-  PyArrayObject *__pyx_t_17 = NULL;
-  PyArrayObject *__pyx_t_18 = NULL;
-  PyArrayObject *__pyx_t_19 = NULL;
-  PyArrayObject *__pyx_t_20 = NULL;
-  PyArrayObject *__pyx_t_21 = NULL;
-  PyArrayObject *__pyx_t_22 = NULL;
-  PyArrayObject *__pyx_t_23 = NULL;
-  __Pyx_memviewslice __pyx_t_24 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  int __pyx_t_4;
+  __pyx_t_5numpy_int32_t __pyx_t_5;
+  __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_t_9 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  PyObject *__pyx_t_10 = NULL;
+  PyObject *__pyx_t_11 = NULL;
+  PyObject *__pyx_t_12 = NULL;
+  PyArrayObject *__pyx_t_13 = NULL;
+  int __pyx_t_14;
+  __Pyx_memviewslice __pyx_t_15 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __pyx_t_5numpy_int32_t __pyx_t_16;
+  __pyx_t_5numpy_int32_t __pyx_t_17;
+  int __pyx_t_18;
+  __pyx_t_5numpy_int32_t __pyx_t_19;
+  __pyx_t_5numpy_int32_t __pyx_t_20;
+  __pyx_t_5numpy_int32_t __pyx_t_21;
+  __pyx_t_5numpy_int32_t __pyx_t_22;
+  int __pyx_t_23;
+  int __pyx_t_24;
   int __pyx_t_25;
-  int __pyx_t_26;
-  double __pyx_t_27;
-  __Pyx_memviewslice __pyx_t_28 = { 0, 0, { 0 }, { 0 }, { 0 } };
-  long __pyx_t_29;
-  long __pyx_t_30;
-  int __pyx_t_31;
-  int __pyx_t_32;
-  int __pyx_t_33;
-  int __pyx_t_34;
-  int __pyx_t_35;
-  Py_ssize_t __pyx_t_36;
-  float __pyx_t_37;
-  int __pyx_t_38;
-  int __pyx_t_39;
-  int __pyx_t_40;
-  int __pyx_t_41;
-  int __pyx_t_42;
+  long __pyx_t_26;
+  __pyx_t_5numpy_int32_t __pyx_t_27;
+  long __pyx_t_28;
+  __pyx_t_5numpy_int32_t __pyx_t_29;
+  __pyx_t_5numpy_int32_t __pyx_t_30;
+  __pyx_t_5numpy_int32_t __pyx_t_31;
+  PyObject *__pyx_t_32 = NULL;
+  PyArrayObject *__pyx_t_33 = NULL;
+  PyObject *__pyx_t_34 = NULL;
+  PyObject *__pyx_t_35 = NULL;
+  PyObject *__pyx_t_36 = NULL;
+  long __pyx_t_37;
+  long __pyx_t_38;
+  long __pyx_t_39;
+  __pyx_t_5numpy_int32_t __pyx_t_40;
+  __pyx_t_5numpy_int32_t __pyx_t_41;
+  __pyx_t_5numpy_int32_t __pyx_t_42;
   int __pyx_t_43;
   int __pyx_t_44;
   int __pyx_t_45;
-  int __pyx_t_46;
+  __pyx_t_5numpy_int32_t __pyx_t_46;
   int __pyx_t_47;
   int __pyx_t_48;
-  int __pyx_t_49;
+  __pyx_t_5numpy_int32_t __pyx_t_49;
   int __pyx_t_50;
   int __pyx_t_51;
   int __pyx_t_52;
   int __pyx_t_53;
   int __pyx_t_54;
   int __pyx_t_55;
-  int __pyx_t_56;
+  __pyx_t_5numpy_int32_t __pyx_t_56;
   int __pyx_t_57;
   int __pyx_t_58;
-  int __pyx_t_59;
+  __pyx_t_5numpy_int32_t __pyx_t_59;
   int __pyx_t_60;
   int __pyx_t_61;
   int __pyx_t_62;
   int __pyx_t_63;
   int __pyx_t_64;
   int __pyx_t_65;
-  int __pyx_t_66;
+  __pyx_t_5numpy_int32_t __pyx_t_66;
   int __pyx_t_67;
   int __pyx_t_68;
-  int __pyx_t_69;
+  __pyx_t_5numpy_int32_t __pyx_t_69;
   int __pyx_t_70;
   int __pyx_t_71;
   int __pyx_t_72;
-  int __pyx_t_73;
+  __pyx_t_5numpy_int32_t __pyx_t_73;
   int __pyx_t_74;
-  int __pyx_t_75;
+  __pyx_t_5numpy_int32_t __pyx_t_75;
   int __pyx_t_76;
-  int __pyx_t_77;
-  int __pyx_t_78;
+  __pyx_t_5numpy_int32_t __pyx_t_77;
+  __pyx_t_5numpy_int32_t __pyx_t_78;
   int __pyx_t_79;
-  int __pyx_t_80;
-  int __pyx_t_81;
+  __pyx_t_5numpy_int32_t __pyx_t_80;
+  __pyx_t_5numpy_int32_t __pyx_t_81;
   int __pyx_t_82;
-  int __pyx_t_83;
+  __pyx_t_5numpy_int32_t __pyx_t_83;
   int __pyx_t_84;
   int __pyx_t_85;
   int __pyx_t_86;
   int __pyx_t_87;
   int __pyx_t_88;
-  int __pyx_t_89;
+  __pyx_t_5numpy_int32_t __pyx_t_89;
   int __pyx_t_90;
   int __pyx_t_91;
   int __pyx_t_92;
   int __pyx_t_93;
   int __pyx_t_94;
   int __pyx_t_95;
-  int __pyx_t_96;
+  __pyx_t_5numpy_int32_t __pyx_t_96;
   int __pyx_t_97;
   int __pyx_t_98;
-  int __pyx_t_99;
+  __pyx_t_5numpy_int32_t __pyx_t_99;
   int __pyx_t_100;
   int __pyx_t_101;
   int __pyx_t_102;
-  int __pyx_t_103;
-  int __pyx_t_104;
+  __pyx_t_5numpy_int32_t __pyx_t_103;
+  __pyx_t_5numpy_int32_t __pyx_t_104;
   int __pyx_t_105;
-  int __pyx_t_106;
+  __pyx_t_5numpy_int32_t __pyx_t_106;
   int __pyx_t_107;
-  int __pyx_t_108;
-  int __pyx_t_109;
+  __pyx_t_5numpy_int32_t __pyx_t_108;
+  __pyx_t_5numpy_int32_t __pyx_t_109;
   int __pyx_t_110;
-  int __pyx_t_111;
-  int __pyx_t_112;
+  __pyx_t_5numpy_int32_t __pyx_t_111;
+  __pyx_t_5numpy_int32_t __pyx_t_112;
   int __pyx_t_113;
   int __pyx_t_114;
   int __pyx_t_115;
   int __pyx_t_116;
   int __pyx_t_117;
   int __pyx_t_118;
-  int __pyx_t_119;
+  __pyx_t_5numpy_int32_t __pyx_t_119;
   int __pyx_t_120;
   int __pyx_t_121;
   int __pyx_t_122;
   int __pyx_t_123;
   int __pyx_t_124;
   int __pyx_t_125;
-  int __pyx_t_126;
+  __pyx_t_5numpy_int32_t __pyx_t_126;
   int __pyx_t_127;
   int __pyx_t_128;
+  __pyx_t_5numpy_int32_t __pyx_t_129;
+  int __pyx_t_130;
+  int __pyx_t_131;
+  int __pyx_t_132;
+  int __pyx_t_133;
+  int __pyx_t_134;
+  int __pyx_t_135;
+  __pyx_t_5numpy_int32_t __pyx_t_136;
+  int __pyx_t_137;
+  int __pyx_t_138;
+  __pyx_t_5numpy_int32_t __pyx_t_139;
+  int __pyx_t_140;
+  int __pyx_t_141;
+  int __pyx_t_142;
+  int __pyx_t_143;
+  int __pyx_t_144;
+  int __pyx_t_145;
+  __pyx_t_5numpy_int32_t __pyx_t_146;
+  int __pyx_t_147;
+  int __pyx_t_148;
+  __pyx_t_5numpy_int32_t __pyx_t_149;
+  int __pyx_t_150;
+  int __pyx_t_151;
+  int __pyx_t_152;
+  __pyx_t_5numpy_int32_t __pyx_t_153;
+  __pyx_t_5numpy_int32_t __pyx_t_154;
+  int __pyx_t_155;
+  __pyx_t_5numpy_int32_t __pyx_t_156;
+  int __pyx_t_157;
+  __pyx_t_5numpy_int32_t __pyx_t_158;
+  __pyx_t_5numpy_int32_t __pyx_t_159;
+  int __pyx_t_160;
+  __pyx_t_5numpy_int32_t __pyx_t_161;
+  __pyx_t_5numpy_int32_t __pyx_t_162;
+  int __pyx_t_163;
+  int __pyx_t_164;
+  __pyx_t_5numpy_int32_t __pyx_t_165;
+  __pyx_t_5numpy_int32_t __pyx_t_166;
+  __pyx_t_5numpy_int32_t __pyx_t_167;
+  __pyx_t_5numpy_int32_t __pyx_t_168;
+  __pyx_t_5numpy_int32_t __pyx_t_169;
+  __pyx_t_5numpy_int32_t __pyx_t_170;
+  __pyx_t_5numpy_int32_t __pyx_t_171;
+  __pyx_t_5numpy_int32_t __pyx_t_172;
+  __pyx_t_5numpy_int32_t __pyx_t_173;
+  __pyx_t_5numpy_int32_t __pyx_t_174;
+  __pyx_t_5numpy_int32_t __pyx_t_175;
+  __pyx_t_5numpy_int32_t __pyx_t_176;
+  int __pyx_t_177;
+  __pyx_t_5numpy_int32_t __pyx_t_178;
+  __pyx_t_5numpy_int32_t __pyx_t_179;
+  int __pyx_t_180;
+  __pyx_t_5numpy_int32_t __pyx_t_181;
+  __pyx_t_5numpy_int32_t __pyx_t_182;
+  int __pyx_t_183;
+  int __pyx_t_184;
+  __pyx_t_5numpy_int32_t __pyx_t_185;
+  int __pyx_t_186;
+  __pyx_t_5numpy_int32_t __pyx_t_187;
+  __pyx_t_5numpy_int32_t __pyx_t_188;
+  int __pyx_t_189;
+  __pyx_t_5numpy_int32_t __pyx_t_190;
+  __pyx_t_5numpy_int32_t __pyx_t_191;
+  int __pyx_t_192;
+  __pyx_t_5numpy_int32_t __pyx_t_193;
+  int __pyx_t_194;
+  __pyx_t_5numpy_int32_t __pyx_t_195;
+  int __pyx_t_196;
+  __pyx_t_5numpy_int32_t __pyx_t_197;
+  __pyx_t_5numpy_int32_t __pyx_t_198;
+  int __pyx_t_199;
+  __pyx_t_5numpy_int32_t __pyx_t_200;
+  __pyx_t_5numpy_int32_t __pyx_t_201;
+  int __pyx_t_202;
+  __pyx_t_5numpy_int32_t __pyx_t_203;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
-  __Pyx_RefNannySetupContext("histoBBox2d", 0);
-  __pyx_pybuffer_cdata.pybuffer.buf = NULL;
-  __pyx_pybuffer_cdata.refcount = 0;
-  __pyx_pybuffernd_cdata.data = NULL;
-  __pyx_pybuffernd_cdata.rcbuffer = &__pyx_pybuffer_cdata;
-  __pyx_pybuffer_cpos0.pybuffer.buf = NULL;
-  __pyx_pybuffer_cpos0.refcount = 0;
-  __pyx_pybuffernd_cpos0.data = NULL;
-  __pyx_pybuffernd_cpos0.rcbuffer = &__pyx_pybuffer_cpos0;
-  __pyx_pybuffer_dpos0.pybuffer.buf = NULL;
-  __pyx_pybuffer_dpos0.refcount = 0;
-  __pyx_pybuffernd_dpos0.data = NULL;
-  __pyx_pybuffernd_dpos0.rcbuffer = &__pyx_pybuffer_dpos0;
-  __pyx_pybuffer_cpos1.pybuffer.buf = NULL;
-  __pyx_pybuffer_cpos1.refcount = 0;
-  __pyx_pybuffernd_cpos1.data = NULL;
-  __pyx_pybuffernd_cpos1.rcbuffer = &__pyx_pybuffer_cpos1;
-  __pyx_pybuffer_dpos1.pybuffer.buf = NULL;
-  __pyx_pybuffer_dpos1.refcount = 0;
-  __pyx_pybuffernd_dpos1.data = NULL;
-  __pyx_pybuffernd_dpos1.rcbuffer = &__pyx_pybuffer_dpos1;
-  __pyx_pybuffer_cpos0_upper.pybuffer.buf = NULL;
-  __pyx_pybuffer_cpos0_upper.refcount = 0;
-  __pyx_pybuffernd_cpos0_upper.data = NULL;
-  __pyx_pybuffernd_cpos0_upper.rcbuffer = &__pyx_pybuffer_cpos0_upper;
-  __pyx_pybuffer_cpos0_lower.pybuffer.buf = NULL;
-  __pyx_pybuffer_cpos0_lower.refcount = 0;
-  __pyx_pybuffernd_cpos0_lower.data = NULL;
-  __pyx_pybuffernd_cpos0_lower.rcbuffer = &__pyx_pybuffer_cpos0_lower;
-  __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_RefNannySetupContext("calc_lut", 0);
+  __pyx_pybuffer_outMax.pybuffer.buf = NULL;
+  __pyx_pybuffer_outMax.refcount = 0;
+  __pyx_pybuffernd_outMax.data = NULL;
+  __pyx_pybuffernd_outMax.rcbuffer = &__pyx_pybuffer_outMax;
+  __pyx_pybuffer_lut.pybuffer.buf = NULL;
+  __pyx_pybuffer_lut.refcount = 0;
+  __pyx_pybuffernd_lut.data = NULL;
+  __pyx_pybuffernd_lut.rcbuffer = &__pyx_pybuffer_lut;
 
-  /* "splitBBoxLUT.pyx":858
- * 
- *     cdef int bins0, bins1, i, j, idx
- *     cdef size_t size = weights.size             # <<<<<<<<<<<<<<
- *     assert pos0.size == size
- *     assert pos1.size == size
+  /* "splitBBoxLUT.pyx":594
+ *     def calc_lut(self):
+ *         'calculate the max number of elements in the LUT and populate it'
+ *         cdef float delta0=self.delta0, pos0_min=self.pos0_min, min0, max0, fbin0_min, fbin0_max             # <<<<<<<<<<<<<<
+ *         cdef float delta1=self.delta1, pos1_min=self.pos1_min, min1, max1, fbin1_min, fbin1_max
+ *         cdef int bin0_min, bin0_max, bins0 = self.bins[0]
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_weights), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__delta0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_PyInt_AsSize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_2 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_v_size = __pyx_t_2;
+  __pyx_v_delta0 = __pyx_t_2;
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__pos0_min); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_2 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_2 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_v_pos0_min = __pyx_t_2;
 
-  /* "splitBBoxLUT.pyx":859
- *     cdef int bins0, bins1, i, j, idx
- *     cdef size_t size = weights.size
- *     assert pos0.size == size             # <<<<<<<<<<<<<<
- *     assert pos1.size == size
- *     assert delta_pos0.size == size
+  /* "splitBBoxLUT.pyx":595
+ *         'calculate the max number of elements in the LUT and populate it'
+ *         cdef float delta0=self.delta0, pos0_min=self.pos0_min, min0, max0, fbin0_min, fbin0_max
+ *         cdef float delta1=self.delta1, pos1_min=self.pos1_min, min1, max1, fbin1_min, fbin1_max             # <<<<<<<<<<<<<<
+ *         cdef int bin0_min, bin0_max, bins0 = self.bins[0]
+ *         cdef int bin1_min, bin1_max, bins1 = self.bins[1]
  */
-  #ifndef CYTHON_WITHOUT_ASSERTIONS
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_pos0), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__delta1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_2 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_2 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_v_delta1 = __pyx_t_2;
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__pos1_min); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_2 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_2 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_v_pos1_min = __pyx_t_2;
+
+  /* "splitBBoxLUT.pyx":596
+ *         cdef float delta0=self.delta0, pos0_min=self.pos0_min, min0, max0, fbin0_min, fbin0_max
+ *         cdef float delta1=self.delta1, pos1_min=self.pos1_min, min1, max1, fbin1_min, fbin1_max
+ *         cdef int bin0_min, bin0_max, bins0 = self.bins[0]             # <<<<<<<<<<<<<<
+ *         cdef int bin1_min, bin1_max, bins1 = self.bins[1]
+ *         cdef numpy.int32_t k, idx, lut_size, i, j, size=self.size
+ */
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__bins); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (unlikely(!__pyx_t_5)) {
-    PyErr_SetNone(PyExc_AssertionError);
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  }
-  #endif
+  __pyx_v_bins0 = __pyx_t_4;
+
+  /* "splitBBoxLUT.pyx":597
+ *         cdef float delta1=self.delta1, pos1_min=self.pos1_min, min1, max1, fbin1_min, fbin1_max
+ *         cdef int bin0_min, bin0_max, bins0 = self.bins[0]
+ *         cdef int bin1_min, bin1_max, bins1 = self.bins[1]             # <<<<<<<<<<<<<<
+ *         cdef numpy.int32_t k, idx, lut_size, i, j, size=self.size
+ *         cdef bint check_mask
+ */
+  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__bins); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, 1, sizeof(long), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_v_bins1 = __pyx_t_4;
+
+  /* "splitBBoxLUT.pyx":598
+ *         cdef int bin0_min, bin0_max, bins0 = self.bins[0]
+ *         cdef int bin1_min, bin1_max, bins1 = self.bins[1]
+ *         cdef numpy.int32_t k, idx, lut_size, i, j, size=self.size             # <<<<<<<<<<<<<<
+ *         cdef bint check_mask
+ *         cdef float[:] cpos0_sup = self.cpos0_sup
+ */
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_5 = __Pyx_PyInt_from_py_npy_int32(__pyx_t_1); if (unlikely((__pyx_t_5 == (npy_int32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_v_size = __pyx_t_5;
+
+  /* "splitBBoxLUT.pyx":600
+ *         cdef numpy.int32_t k, idx, lut_size, i, j, size=self.size
+ *         cdef bint check_mask
+ *         cdef float[:] cpos0_sup = self.cpos0_sup             # <<<<<<<<<<<<<<
+ *         cdef float[:] cpos0_inf = self.cpos0_inf
+ *         cdef float[:] cpos1_inf = self.cpos1_inf
+ */
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__cpos0_sup); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_1);
+  if (unlikely(!__pyx_t_6.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_v_cpos0_sup = __pyx_t_6;
+  __pyx_t_6.memview = NULL;
+  __pyx_t_6.data = NULL;
+
+  /* "splitBBoxLUT.pyx":601
+ *         cdef bint check_mask
+ *         cdef float[:] cpos0_sup = self.cpos0_sup
+ *         cdef float[:] cpos0_inf = self.cpos0_inf             # <<<<<<<<<<<<<<
+ *         cdef float[:] cpos1_inf = self.cpos1_inf
+ *         cdef float[:] cpos1_sup = self.cpos1_sup
+ */
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__cpos0_inf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_1);
+  if (unlikely(!__pyx_t_7.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_v_cpos0_inf = __pyx_t_7;
+  __pyx_t_7.memview = NULL;
+  __pyx_t_7.data = NULL;
 
-  /* "splitBBoxLUT.pyx":860
- *     cdef size_t size = weights.size
- *     assert pos0.size == size
- *     assert pos1.size == size             # <<<<<<<<<<<<<<
- *     assert delta_pos0.size == size
- *     assert delta_pos1.size == size
+  /* "splitBBoxLUT.pyx":602
+ *         cdef float[:] cpos0_sup = self.cpos0_sup
+ *         cdef float[:] cpos0_inf = self.cpos0_inf
+ *         cdef float[:] cpos1_inf = self.cpos1_inf             # <<<<<<<<<<<<<<
+ *         cdef float[:] cpos1_sup = self.cpos1_sup
+ *         cdef numpy.ndarray[numpy.int32_t, ndim = 2] outMax = numpy.zeros((bins0,bins1), dtype=numpy.int32)
  */
-  #ifndef CYTHON_WITHOUT_ASSERTIONS
-  __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_pos1), __pyx_n_s__size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__cpos1_inf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_1);
+  if (unlikely(!__pyx_t_8.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (unlikely(!__pyx_t_5)) {
-    PyErr_SetNone(PyExc_AssertionError);
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  }
-  #endif
+  __pyx_v_cpos1_inf = __pyx_t_8;
+  __pyx_t_8.memview = NULL;
+  __pyx_t_8.data = NULL;
 
-  /* "splitBBoxLUT.pyx":861
- *     assert pos0.size == size
- *     assert pos1.size == size
- *     assert delta_pos0.size == size             # <<<<<<<<<<<<<<
- *     assert delta_pos1.size == size
- *     try:
+  /* "splitBBoxLUT.pyx":603
+ *         cdef float[:] cpos0_inf = self.cpos0_inf
+ *         cdef float[:] cpos1_inf = self.cpos1_inf
+ *         cdef float[:] cpos1_sup = self.cpos1_sup             # <<<<<<<<<<<<<<
+ *         cdef numpy.ndarray[numpy.int32_t, ndim = 2] outMax = numpy.zeros((bins0,bins1), dtype=numpy.int32)
+ *         cdef numpy.ndarray[lut_point, ndim = 3] lut
  */
-  #ifndef CYTHON_WITHOUT_ASSERTIONS
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_delta_pos0), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__cpos1_sup); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_1);
+  if (unlikely(!__pyx_t_9.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (unlikely(!__pyx_t_5)) {
-    PyErr_SetNone(PyExc_AssertionError);
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  }
-  #endif
+  __pyx_v_cpos1_sup = __pyx_t_9;
+  __pyx_t_9.memview = NULL;
+  __pyx_t_9.data = NULL;
 
-  /* "splitBBoxLUT.pyx":862
- *     assert pos1.size == size
- *     assert delta_pos0.size == size
- *     assert delta_pos1.size == size             # <<<<<<<<<<<<<<
- *     try:
- *         bins0, bins1 = tuple(bins)
+  /* "splitBBoxLUT.pyx":604
+ *         cdef float[:] cpos1_inf = self.cpos1_inf
+ *         cdef float[:] cpos1_sup = self.cpos1_sup
+ *         cdef numpy.ndarray[numpy.int32_t, ndim = 2] outMax = numpy.zeros((bins0,bins1), dtype=numpy.int32)             # <<<<<<<<<<<<<<
+ *         cdef numpy.ndarray[lut_point, ndim = 3] lut
+ *         cdef numpy.int8_t[:] cmask
  */
-  #ifndef CYTHON_WITHOUT_ASSERTIONS
-  __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_delta_pos1), __pyx_n_s__size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (unlikely(!__pyx_t_5)) {
-    PyErr_SetNone(PyExc_AssertionError);
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyInt_FromLong(__pyx_v_bins0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_10 = PyInt_FromLong(__pyx_v_bins1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_10);
+  __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_11);
+  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_1);
+  __Pyx_GIVEREF(__pyx_t_1);
+  PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_10);
+  __Pyx_GIVEREF(__pyx_t_10);
+  __pyx_t_1 = 0;
+  __pyx_t_10 = 0;
+  __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_10);
+  PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_t_11));
+  __Pyx_GIVEREF(((PyObject *)__pyx_t_11));
+  __pyx_t_11 = 0;
+  __pyx_t_11 = PyDict_New(); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_11));
+  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__int32); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_12);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  if (PyDict_SetItem(__pyx_t_11, ((PyObject *)__pyx_n_s__dtype), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+  __pyx_t_12 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_10), ((PyObject *)__pyx_t_11)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_12);
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
+  if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_13 = ((PyArrayObject *)__pyx_t_12);
+  {
+    __Pyx_BufFmt_StackElem __pyx_stack[1];
+    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outMax.rcbuffer->pybuffer, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
+      __pyx_v_outMax = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf = NULL;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    } else {__pyx_pybuffernd_outMax.diminfo[0].strides = __pyx_pybuffernd_outMax.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outMax.diminfo[0].shape = __pyx_pybuffernd_outMax.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_outMax.diminfo[1].strides = __pyx_pybuffernd_outMax.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_outMax.diminfo[1].shape = __pyx_pybuffernd_outMax.rcbuffer->pybuffer.shape[1];
+    }
   }
-  #endif
+  __pyx_t_13 = 0;
+  __pyx_v_outMax = ((PyArrayObject *)__pyx_t_12);
+  __pyx_t_12 = 0;
 
-  /* "splitBBoxLUT.pyx":863
- *     assert delta_pos0.size == size
- *     assert delta_pos1.size == size
- *     try:             # <<<<<<<<<<<<<<
- *         bins0, bins1 = tuple(bins)
- *     except:
+  /* "splitBBoxLUT.pyx":607
+ *         cdef numpy.ndarray[lut_point, ndim = 3] lut
+ *         cdef numpy.int8_t[:] cmask
+ *         if self.check_mask:             # <<<<<<<<<<<<<<
+ *             cmask = self.cmask
+ *             check_mask = True
  */
-  {
-    __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:*/ {
+  __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__check_mask); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_12);
+  __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+  if (__pyx_t_14) {
 
-      /* "splitBBoxLUT.pyx":864
- *     assert delta_pos1.size == size
- *     try:
- *         bins0, bins1 = tuple(bins)             # <<<<<<<<<<<<<<
- *     except:
- *         bins0 = bins1 = bins
+    /* "splitBBoxLUT.pyx":608
+ *         cdef numpy.int8_t[:] cmask
+ *         if self.check_mask:
+ *             cmask = self.cmask             # <<<<<<<<<<<<<<
+ *             check_mask = True
+ *         else:
  */
-      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __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_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-      if (1) {
-        PyObject* sequence = __pyx_t_3;
-        #if CYTHON_COMPILING_IN_CPYTHON
-        Py_ssize_t size = Py_SIZE(sequence);
-        #else
-        Py_ssize_t size = PySequence_Size(sequence);
-        #endif
-        if (unlikely(size != 2)) {
-          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
-          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
-          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-        }
-        #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
-        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
-        __Pyx_INCREF(__pyx_t_1);
-        __Pyx_INCREF(__pyx_t_4);
-        #else
-        __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-        __Pyx_GOTREF(__pyx_t_1);
-        __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-        __Pyx_GOTREF(__pyx_t_4);
-        #endif
-        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      } else if (1) {
-        __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-      } else
-      {
-        Py_ssize_t index = -1;
-        __pyx_t_9 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-        __Pyx_GOTREF(__pyx_t_9);
-        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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_4 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_4)) goto __pyx_L11_unpacking_failed;
-        __Pyx_GOTREF(__pyx_t_4);
-        if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __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 = 864; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-        __pyx_L12_unpacking_done:;
-      }
-      __pyx_t_11 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __pyx_t_12 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __pyx_v_bins0 = __pyx_t_11;
-      __pyx_v_bins1 = __pyx_t_12;
-    }
-    __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_4); __pyx_t_4 = 0;
-    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__cmask); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_12);
+    __pyx_t_15 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int8_t(__pyx_t_12);
+    if (unlikely(!__pyx_t_15.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+    __pyx_v_cmask = __pyx_t_15;
+    __pyx_t_15.memview = NULL;
+    __pyx_t_15.data = NULL;
 
-    /* "splitBBoxLUT.pyx":865
- *     try:
- *         bins0, bins1 = tuple(bins)
- *     except:             # <<<<<<<<<<<<<<
- *         bins0 = bins1 = bins
- *     if bins0 <= 0:
+    /* "splitBBoxLUT.pyx":609
+ *         if self.check_mask:
+ *             cmask = self.cmask
+ *             check_mask = True             # <<<<<<<<<<<<<<
+ *         else:
+ *             check_mask = False
  */
-    /*except:*/ {
-      __Pyx_AddTraceback("splitBBoxLUT.histoBBox2d", __pyx_clineno, __pyx_lineno, __pyx_filename);
-      if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_4, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __Pyx_GOTREF(__pyx_t_4);
-      __Pyx_GOTREF(__pyx_t_1);
-
-      /* "splitBBoxLUT.pyx":866
- *         bins0, bins1 = tuple(bins)
- *     except:
- *         bins0 = bins1 = bins             # <<<<<<<<<<<<<<
- *     if bins0 <= 0:
- *         bins0 = 1
- */
-      __pyx_t_12 = __Pyx_PyInt_AsInt(__pyx_v_bins); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
-      __pyx_v_bins0 = __pyx_t_12;
-      __pyx_t_12 = __Pyx_PyInt_AsInt(__pyx_v_bins); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
-      __pyx_v_bins1 = __pyx_t_12;
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      goto __pyx_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:;
+    __pyx_v_check_mask = 1;
+    goto __pyx_L3;
   }
+  /*else*/ {
 
-  /* "splitBBoxLUT.pyx":867
- *     except:
- *         bins0 = bins1 = bins
- *     if bins0 <= 0:             # <<<<<<<<<<<<<<
- *         bins0 = 1
- *     if bins1 <= 0:
- */
-  __pyx_t_5 = (__pyx_v_bins0 <= 0);
-  if (__pyx_t_5) {
-
-    /* "splitBBoxLUT.pyx":868
- *         bins0 = bins1 = bins
- *     if bins0 <= 0:
- *         bins0 = 1             # <<<<<<<<<<<<<<
- *     if bins1 <= 0:
- *         bins1 = 1
+    /* "splitBBoxLUT.pyx":611
+ *             check_mask = True
+ *         else:
+ *             check_mask = False             # <<<<<<<<<<<<<<
+ * 
+ * #NOGIL
  */
-    __pyx_v_bins0 = 1;
-    goto __pyx_L15;
+    __pyx_v_check_mask = 0;
   }
-  __pyx_L15:;
+  __pyx_L3:;
 
-  /* "splitBBoxLUT.pyx":869
- *     if bins0 <= 0:
- *         bins0 = 1
- *     if bins1 <= 0:             # <<<<<<<<<<<<<<
- *         bins1 = 1
- *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cdata = numpy.ascontiguousarray(weights.ravel(),dtype=numpy.float32)
+  /* "splitBBoxLUT.pyx":614
+ * 
+ * #NOGIL
+ *         with nogil:             # <<<<<<<<<<<<<<
+ *             for idx in range(size):
+ *                 if (check_mask) and (cmask[idx]):
  */
-  __pyx_t_5 = (__pyx_v_bins1 <= 0);
-  if (__pyx_t_5) {
+  {
+      #ifdef WITH_THREAD
+      PyThreadState *_save;
+      Py_UNBLOCK_THREADS
+      #endif
+      /*try:*/ {
 
-    /* "splitBBoxLUT.pyx":870
- *         bins0 = 1
- *     if bins1 <= 0:
- *         bins1 = 1             # <<<<<<<<<<<<<<
- *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cdata = numpy.ascontiguousarray(weights.ravel(),dtype=numpy.float32)
- *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos0 = numpy.ascontiguousarray(pos0.ravel(),dtype=numpy.float32)
+        /* "splitBBoxLUT.pyx":615
+ * #NOGIL
+ *         with nogil:
+ *             for idx in range(size):             # <<<<<<<<<<<<<<
+ *                 if (check_mask) and (cmask[idx]):
+ *                     continue
  */
-    __pyx_v_bins1 = 1;
-    goto __pyx_L16;
-  }
-  __pyx_L16:;
+        __pyx_t_5 = __pyx_v_size;
+        for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_5; __pyx_t_16+=1) {
+          __pyx_v_idx = __pyx_t_16;
 
-  /* "splitBBoxLUT.pyx":871
- *     if bins1 <= 0:
- *         bins1 = 1
- *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cdata = numpy.ascontiguousarray(weights.ravel(),dtype=numpy.float32)             # <<<<<<<<<<<<<<
- *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos0 = numpy.ascontiguousarray(pos0.ravel(),dtype=numpy.float32)
- *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] dpos0 = numpy.ascontiguousarray(delta_pos0.ravel(),dtype=numpy.float32)
+          /* "splitBBoxLUT.pyx":616
+ *         with nogil:
+ *             for idx in range(size):
+ *                 if (check_mask) and (cmask[idx]):             # <<<<<<<<<<<<<<
+ *                     continue
+ * 
  */
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_weights), __pyx_n_s__ravel); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __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 = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __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);
-  __pyx_t_3 = 0;
-  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-  __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
-  __pyx_t_13 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__float32); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __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_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  __pyx_t_13 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_13);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-  if (!(likely(((__pyx_t_13) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_13, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_14 = ((PyArrayObject *)__pyx_t_13);
-  {
-    __Pyx_BufFmt_StackElem __pyx_stack[1];
-    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cdata.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
-      __pyx_v_cdata = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_cdata.rcbuffer->pybuffer.buf = NULL;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    } else {__pyx_pybuffernd_cdata.diminfo[0].strides = __pyx_pybuffernd_cdata.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cdata.diminfo[0].shape = __pyx_pybuffernd_cdata.rcbuffer->pybuffer.shape[0];
-    }
-  }
-  __pyx_t_14 = 0;
-  __pyx_v_cdata = ((PyArrayObject *)__pyx_t_13);
-  __pyx_t_13 = 0;
+          __pyx_t_14 = __pyx_v_check_mask;
+          if (__pyx_t_14) {
+            if (unlikely(!__pyx_v_cmask.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cmask"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L5;} }
+            __pyx_t_17 = __pyx_v_idx;
+            __pyx_t_18 = ((*((__pyx_t_5numpy_int8_t *) ( /* dim=0 */ (__pyx_v_cmask.data + __pyx_t_17 * __pyx_v_cmask.strides[0]) ))) != 0);
+          } else {
+            __pyx_t_18 = __pyx_t_14;
+          }
+          if (__pyx_t_18) {
+
+            /* "splitBBoxLUT.pyx":617
+ *             for idx in range(size):
+ *                 if (check_mask) and (cmask[idx]):
+ *                     continue             # <<<<<<<<<<<<<<
+ * 
+ *                 min0 = cpos0_inf[idx]
+ */
+            goto __pyx_L7_continue;
+            goto __pyx_L9;
+          }
+          __pyx_L9:;
 
-  /* "splitBBoxLUT.pyx":872
- *         bins1 = 1
- *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cdata = numpy.ascontiguousarray(weights.ravel(),dtype=numpy.float32)
- *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos0 = numpy.ascontiguousarray(pos0.ravel(),dtype=numpy.float32)             # <<<<<<<<<<<<<<
- *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] dpos0 = numpy.ascontiguousarray(delta_pos0.ravel(),dtype=numpy.float32)
- *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos1 = numpy.ascontiguousarray(pos1.ravel(),dtype=numpy.float32)
+          /* "splitBBoxLUT.pyx":619
+ *                     continue
+ * 
+ *                 min0 = cpos0_inf[idx]             # <<<<<<<<<<<<<<
+ *                 max0 = cpos0_sup[idx]
+ *                 min1 = cpos1_inf[idx]
  */
-  __pyx_t_13 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_13);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_13, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  __pyx_t_13 = PyObject_GetAttr(((PyObject *)__pyx_v_pos0), __pyx_n_s__ravel); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __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 = 872; __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 = 872; __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 = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_9 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__float32); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-  __pyx_t_9 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_13), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-  if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_15 = ((PyArrayObject *)__pyx_t_9);
-  {
-    __Pyx_BufFmt_StackElem __pyx_stack[1];
-    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cpos0.rcbuffer->pybuffer, (PyObject*)__pyx_t_15, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
-      __pyx_v_cpos0 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_cpos0.rcbuffer->pybuffer.buf = NULL;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    } else {__pyx_pybuffernd_cpos0.diminfo[0].strides = __pyx_pybuffernd_cpos0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cpos0.diminfo[0].shape = __pyx_pybuffernd_cpos0.rcbuffer->pybuffer.shape[0];
-    }
-  }
-  __pyx_t_15 = 0;
-  __pyx_v_cpos0 = ((PyArrayObject *)__pyx_t_9);
-  __pyx_t_9 = 0;
+          __pyx_t_19 = __pyx_v_idx;
+          __pyx_v_min0 = (*((float *) ( /* dim=0 */ (__pyx_v_cpos0_inf.data + __pyx_t_19 * __pyx_v_cpos0_inf.strides[0]) )));
 
-  /* "splitBBoxLUT.pyx":873
- *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cdata = numpy.ascontiguousarray(weights.ravel(),dtype=numpy.float32)
- *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos0 = numpy.ascontiguousarray(pos0.ravel(),dtype=numpy.float32)
- *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] dpos0 = numpy.ascontiguousarray(delta_pos0.ravel(),dtype=numpy.float32)             # <<<<<<<<<<<<<<
- *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos1 = numpy.ascontiguousarray(pos1.ravel(),dtype=numpy.float32)
- *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] dpos1 = numpy.ascontiguousarray(delta_pos1.ravel(),dtype=numpy.float32)
+          /* "splitBBoxLUT.pyx":620
+ * 
+ *                 min0 = cpos0_inf[idx]
+ *                 max0 = cpos0_sup[idx]             # <<<<<<<<<<<<<<
+ *                 min1 = cpos1_inf[idx]
+ *                 max1 = cpos1_sup[idx]
  */
-  __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-  __pyx_t_9 = PyObject_GetAttr(((PyObject *)__pyx_v_delta_pos0), __pyx_n_s__ravel); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; __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 = 873; __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 = 873; __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 = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_13));
-  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__float32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  if (PyDict_SetItem(__pyx_t_13, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_9), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
-  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_16 = ((PyArrayObject *)__pyx_t_4);
-  {
-    __Pyx_BufFmt_StackElem __pyx_stack[1];
-    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dpos0.rcbuffer->pybuffer, (PyObject*)__pyx_t_16, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
-      __pyx_v_dpos0 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_dpos0.rcbuffer->pybuffer.buf = NULL;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    } else {__pyx_pybuffernd_dpos0.diminfo[0].strides = __pyx_pybuffernd_dpos0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dpos0.diminfo[0].shape = __pyx_pybuffernd_dpos0.rcbuffer->pybuffer.shape[0];
-    }
-  }
-  __pyx_t_16 = 0;
-  __pyx_v_dpos0 = ((PyArrayObject *)__pyx_t_4);
-  __pyx_t_4 = 0;
+          __pyx_t_20 = __pyx_v_idx;
+          __pyx_v_max0 = (*((float *) ( /* dim=0 */ (__pyx_v_cpos0_sup.data + __pyx_t_20 * __pyx_v_cpos0_sup.strides[0]) )));
 
-  /* "splitBBoxLUT.pyx":874
- *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos0 = numpy.ascontiguousarray(pos0.ravel(),dtype=numpy.float32)
- *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] dpos0 = numpy.ascontiguousarray(delta_pos0.ravel(),dtype=numpy.float32)
- *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos1 = numpy.ascontiguousarray(pos1.ravel(),dtype=numpy.float32)             # <<<<<<<<<<<<<<
- *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] dpos1 = numpy.ascontiguousarray(delta_pos1.ravel(),dtype=numpy.float32)
- *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos0_upper = numpy.empty(size,dtype=numpy.float32)
+          /* "splitBBoxLUT.pyx":621
+ *                 min0 = cpos0_inf[idx]
+ *                 max0 = cpos0_sup[idx]
+ *                 min1 = cpos1_inf[idx]             # <<<<<<<<<<<<<<
+ *                 max1 = cpos1_sup[idx]
+ * 
  */
-  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_13 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_13);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_pos1), __pyx_n_s__ravel); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_9 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_9);
-  __Pyx_GIVEREF(__pyx_t_9);
-  __pyx_t_9 = 0;
-  __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_9));
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __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_4)); __pyx_t_4 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
-  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __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_cpos1.rcbuffer->pybuffer, (PyObject*)__pyx_t_17, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
-      __pyx_v_cpos1 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_cpos1.rcbuffer->pybuffer.buf = NULL;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    } else {__pyx_pybuffernd_cpos1.diminfo[0].strides = __pyx_pybuffernd_cpos1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cpos1.diminfo[0].shape = __pyx_pybuffernd_cpos1.rcbuffer->pybuffer.shape[0];
-    }
-  }
-  __pyx_t_17 = 0;
-  __pyx_v_cpos1 = ((PyArrayObject *)__pyx_t_3);
-  __pyx_t_3 = 0;
+          __pyx_t_21 = __pyx_v_idx;
+          __pyx_v_min1 = (*((float *) ( /* dim=0 */ (__pyx_v_cpos1_inf.data + __pyx_t_21 * __pyx_v_cpos1_inf.strides[0]) )));
 
-  /* "splitBBoxLUT.pyx":875
- *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] dpos0 = numpy.ascontiguousarray(delta_pos0.ravel(),dtype=numpy.float32)
- *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos1 = numpy.ascontiguousarray(pos1.ravel(),dtype=numpy.float32)
- *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] dpos1 = numpy.ascontiguousarray(delta_pos1.ravel(),dtype=numpy.float32)             # <<<<<<<<<<<<<<
- *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos0_upper = numpy.empty(size,dtype=numpy.float32)
- *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos0_lower = numpy.empty(size,dtype=numpy.float32)
+          /* "splitBBoxLUT.pyx":622
+ *                 max0 = cpos0_sup[idx]
+ *                 min1 = cpos1_inf[idx]
+ *                 max1 = cpos1_sup[idx]             # <<<<<<<<<<<<<<
+ * 
+ *                 bin0_min = < int > getBinNr(min0, pos0_min, delta0)
  */
-  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_9 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_delta_pos1), __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __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 = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
-  __Pyx_GIVEREF(__pyx_t_4);
-  __pyx_t_4 = 0;
-  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-  __pyx_t_13 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_13);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_13, __pyx_n_s__float32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_18 = ((PyArrayObject *)__pyx_t_1);
-  {
-    __Pyx_BufFmt_StackElem __pyx_stack[1];
-    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dpos1.rcbuffer->pybuffer, (PyObject*)__pyx_t_18, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
-      __pyx_v_dpos1 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_dpos1.rcbuffer->pybuffer.buf = NULL;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    } else {__pyx_pybuffernd_dpos1.diminfo[0].strides = __pyx_pybuffernd_dpos1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dpos1.diminfo[0].shape = __pyx_pybuffernd_dpos1.rcbuffer->pybuffer.shape[0];
-    }
-  }
-  __pyx_t_18 = 0;
-  __pyx_v_dpos1 = ((PyArrayObject *)__pyx_t_1);
-  __pyx_t_1 = 0;
+          __pyx_t_22 = __pyx_v_idx;
+          __pyx_v_max1 = (*((float *) ( /* dim=0 */ (__pyx_v_cpos1_sup.data + __pyx_t_22 * __pyx_v_cpos1_sup.strides[0]) )));
 
-  /* "splitBBoxLUT.pyx":876
- *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos1 = numpy.ascontiguousarray(pos1.ravel(),dtype=numpy.float32)
- *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] dpos1 = numpy.ascontiguousarray(delta_pos1.ravel(),dtype=numpy.float32)
- *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos0_upper = numpy.empty(size,dtype=numpy.float32)             # <<<<<<<<<<<<<<
- *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos0_lower = numpy.empty(size,dtype=numpy.float32)
- *     cdef numpy.ndarray[numpy.float64_t, ndim = 2] outData = numpy.zeros((bins0, bins1), dtype=numpy.float64)
+          /* "splitBBoxLUT.pyx":624
+ *                 max1 = cpos1_sup[idx]
+ * 
+ *                 bin0_min = < int > getBinNr(min0, pos0_min, delta0)             # <<<<<<<<<<<<<<
+ *                 bin0_max = < int > getBinNr(max0, pos0_min, delta0)
+ * 
  */
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __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 = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
-  __pyx_t_13 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__float32); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __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_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  __pyx_t_13 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_13);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-  if (!(likely(((__pyx_t_13) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_13, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_19 = ((PyArrayObject *)__pyx_t_13);
-  {
-    __Pyx_BufFmt_StackElem __pyx_stack[1];
-    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cpos0_upper.rcbuffer->pybuffer, (PyObject*)__pyx_t_19, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
-      __pyx_v_cpos0_upper = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_cpos0_upper.rcbuffer->pybuffer.buf = NULL;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    } else {__pyx_pybuffernd_cpos0_upper.diminfo[0].strides = __pyx_pybuffernd_cpos0_upper.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cpos0_upper.diminfo[0].shape = __pyx_pybuffernd_cpos0_upper.rcbuffer->pybuffer.shape[0];
-    }
-  }
-  __pyx_t_19 = 0;
-  __pyx_v_cpos0_upper = ((PyArrayObject *)__pyx_t_13);
-  __pyx_t_13 = 0;
+          __pyx_v_bin0_min = ((int)__pyx_f_12splitBBoxLUT_getBinNr(__pyx_v_min0, __pyx_v_pos0_min, __pyx_v_delta0));
 
-  /* "splitBBoxLUT.pyx":877
- *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] dpos1 = numpy.ascontiguousarray(delta_pos1.ravel(),dtype=numpy.float32)
- *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos0_upper = numpy.empty(size,dtype=numpy.float32)
- *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos0_lower = numpy.empty(size,dtype=numpy.float32)             # <<<<<<<<<<<<<<
- *     cdef numpy.ndarray[numpy.float64_t, ndim = 2] outData = numpy.zeros((bins0, bins1), dtype=numpy.float64)
- *     cdef numpy.ndarray[numpy.float64_t, ndim = 2] outCount = numpy.zeros((bins0, bins1), dtype=numpy.float64)
+          /* "splitBBoxLUT.pyx":625
+ * 
+ *                 bin0_min = < int > getBinNr(min0, pos0_min, delta0)
+ *                 bin0_max = < int > getBinNr(max0, pos0_min, delta0)             # <<<<<<<<<<<<<<
+ * 
+ *                 bin1_min = < int > getBinNr(min1, pos1_min, delta1)
  */
-  __pyx_t_13 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_13);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_13, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  __pyx_t_13 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_13);
-  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __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);
-  __pyx_t_13 = 0;
-  __pyx_t_13 = PyDict_New(); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_13));
-  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_9 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__float32); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyDict_SetItem(__pyx_t_13, ((PyObject *)__pyx_n_s__dtype), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-  __pyx_t_9 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 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 = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_20 = ((PyArrayObject *)__pyx_t_9);
-  {
-    __Pyx_BufFmt_StackElem __pyx_stack[1];
-    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cpos0_lower.rcbuffer->pybuffer, (PyObject*)__pyx_t_20, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
-      __pyx_v_cpos0_lower = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_cpos0_lower.rcbuffer->pybuffer.buf = NULL;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    } else {__pyx_pybuffernd_cpos0_lower.diminfo[0].strides = __pyx_pybuffernd_cpos0_lower.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cpos0_lower.diminfo[0].shape = __pyx_pybuffernd_cpos0_lower.rcbuffer->pybuffer.shape[0];
-    }
-  }
-  __pyx_t_20 = 0;
-  __pyx_v_cpos0_lower = ((PyArrayObject *)__pyx_t_9);
-  __pyx_t_9 = 0;
+          __pyx_v_bin0_max = ((int)__pyx_f_12splitBBoxLUT_getBinNr(__pyx_v_max0, __pyx_v_pos0_min, __pyx_v_delta0));
 
-  /* "splitBBoxLUT.pyx":878
- *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos0_upper = numpy.empty(size,dtype=numpy.float32)
- *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos0_lower = numpy.empty(size,dtype=numpy.float32)
- *     cdef numpy.ndarray[numpy.float64_t, ndim = 2] outData = numpy.zeros((bins0, bins1), dtype=numpy.float64)             # <<<<<<<<<<<<<<
- *     cdef numpy.ndarray[numpy.float64_t, ndim = 2] outCount = numpy.zeros((bins0, bins1), dtype=numpy.float64)
- *     cdef numpy.ndarray[numpy.float32_t, ndim = 2] outMerge = numpy.zeros((bins0, bins1), dtype=numpy.float32)
+          /* "splitBBoxLUT.pyx":627
+ *                 bin0_max = < int > getBinNr(max0, pos0_min, delta0)
+ * 
+ *                 bin1_min = < int > getBinNr(min1, pos1_min, delta1)             # <<<<<<<<<<<<<<
+ *                 bin1_max = < int > getBinNr(max1, pos1_min, delta1)
+ * 
  */
-  __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
-  __pyx_t_13 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__zeros); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_13);
-  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-  __pyx_t_9 = PyInt_FromLong(__pyx_v_bins0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
-  __pyx_t_3 = PyInt_FromLong(__pyx_v_bins1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9);
-  __Pyx_GIVEREF(__pyx_t_9);
-  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
-  __Pyx_GIVEREF(__pyx_t_3);
-  __pyx_t_9 = 0;
-  __pyx_t_3 = 0;
-  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
-  __pyx_t_1 = 0;
-  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__float64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_t_4 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_21 = ((PyArrayObject *)__pyx_t_4);
-  {
-    __Pyx_BufFmt_StackElem __pyx_stack[1];
-    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outData.rcbuffer->pybuffer, (PyObject*)__pyx_t_21, &__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 = 878; __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_21 = 0;
-  __pyx_v_outData = ((PyArrayObject *)__pyx_t_4);
-  __pyx_t_4 = 0;
+          __pyx_v_bin1_min = ((int)__pyx_f_12splitBBoxLUT_getBinNr(__pyx_v_min1, __pyx_v_pos1_min, __pyx_v_delta1));
 
-  /* "splitBBoxLUT.pyx":879
- *     cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos0_lower = numpy.empty(size,dtype=numpy.float32)
- *     cdef numpy.ndarray[numpy.float64_t, ndim = 2] outData = numpy.zeros((bins0, bins1), dtype=numpy.float64)
- *     cdef numpy.ndarray[numpy.float64_t, ndim = 2] outCount = numpy.zeros((bins0, bins1), dtype=numpy.float64)             # <<<<<<<<<<<<<<
- *     cdef numpy.ndarray[numpy.float32_t, ndim = 2] outMerge = numpy.zeros((bins0, bins1), dtype=numpy.float32)
+          /* "splitBBoxLUT.pyx":628
+ * 
+ *                 bin1_min = < int > getBinNr(min1, pos1_min, delta1)
+ *                 bin1_max = < int > getBinNr(max1, pos1_min, delta1)             # <<<<<<<<<<<<<<
  * 
+ *                 if (bin0_max < 0) or (bin0_min >= bins0) or (bin1_max < 0) or (bin1_min >= bins1):
  */
-  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_t_4 = PyInt_FromLong(__pyx_v_bins0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_3 = PyInt_FromLong(__pyx_v_bins1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_13);
-  PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_4);
-  __Pyx_GIVEREF(__pyx_t_4);
-  PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_3);
-  __Pyx_GIVEREF(__pyx_t_3);
-  __pyx_t_4 = 0;
-  __pyx_t_3 = 0;
-  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  PyTuple_SET_ITEM(__pyx_t_3, 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 = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_13));
-  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_9 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__float64); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyDict_SetItem(__pyx_t_13, ((PyObject *)__pyx_n_s__dtype), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-  __pyx_t_9 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 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 = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_22 = ((PyArrayObject *)__pyx_t_9);
-  {
-    __Pyx_BufFmt_StackElem __pyx_stack[1];
-    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outCount.rcbuffer->pybuffer, (PyObject*)__pyx_t_22, &__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 = 879; __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_22 = 0;
-  __pyx_v_outCount = ((PyArrayObject *)__pyx_t_9);
-  __pyx_t_9 = 0;
+          __pyx_v_bin1_max = ((int)__pyx_f_12splitBBoxLUT_getBinNr(__pyx_v_max1, __pyx_v_pos1_min, __pyx_v_delta1));
 
-  /* "splitBBoxLUT.pyx":880
- *     cdef numpy.ndarray[numpy.float64_t, ndim = 2] outData = numpy.zeros((bins0, bins1), dtype=numpy.float64)
- *     cdef numpy.ndarray[numpy.float64_t, ndim = 2] outCount = numpy.zeros((bins0, bins1), dtype=numpy.float64)
- *     cdef numpy.ndarray[numpy.float32_t, ndim = 2] outMerge = numpy.zeros((bins0, bins1), dtype=numpy.float32)             # <<<<<<<<<<<<<<
+          /* "splitBBoxLUT.pyx":630
+ *                 bin1_max = < int > getBinNr(max1, pos1_min, delta1)
+ * 
+ *                 if (bin0_max < 0) or (bin0_min >= bins0) or (bin1_max < 0) or (bin1_min >= bins1):             # <<<<<<<<<<<<<<
+ *                     continue
  * 
- *     cdef float min0, max0, min1, max1, deltaR, deltaL, deltaU, deltaD, deltaA, tmp, delta0, delta1
  */
-  __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
-  __pyx_t_13 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__zeros); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_13);
-  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-  __pyx_t_9 = PyInt_FromLong(__pyx_v_bins0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
-  __pyx_t_3 = PyInt_FromLong(__pyx_v_bins1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9);
-  __Pyx_GIVEREF(__pyx_t_9);
-  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
-  __Pyx_GIVEREF(__pyx_t_3);
-  __pyx_t_9 = 0;
-  __pyx_t_3 = 0;
-  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
-  __pyx_t_1 = 0;
-  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__float32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_t_4 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_23 = ((PyArrayObject *)__pyx_t_4);
-  {
-    __Pyx_BufFmt_StackElem __pyx_stack[1];
-    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outMerge.rcbuffer->pybuffer, (PyObject*)__pyx_t_23, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
-      __pyx_v_outMerge = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.buf = NULL;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __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_23 = 0;
-  __pyx_v_outMerge = ((PyArrayObject *)__pyx_t_4);
-  __pyx_t_4 = 0;
+          __pyx_t_18 = ((__pyx_v_bin0_max < 0) != 0);
+          if (!__pyx_t_18) {
+            __pyx_t_14 = ((__pyx_v_bin0_min >= __pyx_v_bins0) != 0);
+            if (!__pyx_t_14) {
+              __pyx_t_23 = ((__pyx_v_bin1_max < 0) != 0);
+              if (!__pyx_t_23) {
+                __pyx_t_24 = ((__pyx_v_bin1_min >= __pyx_v_bins1) != 0);
+                __pyx_t_25 = __pyx_t_24;
+              } else {
+                __pyx_t_25 = __pyx_t_23;
+              }
+              __pyx_t_23 = __pyx_t_25;
+            } else {
+              __pyx_t_23 = __pyx_t_14;
+            }
+            __pyx_t_14 = __pyx_t_23;
+          } else {
+            __pyx_t_14 = __pyx_t_18;
+          }
+          if (__pyx_t_14) {
 
-  /* "splitBBoxLUT.pyx":884
- *     cdef float min0, max0, min1, max1, deltaR, deltaL, deltaU, deltaD, deltaA, tmp, delta0, delta1
- *     cdef float pos0_min, pos0_max, pos1_min, pos1_max, pos0_maxin, pos1_maxin
- *     cdef float fbin0_min, fbin0_max, fbin1_min, fbin1_max, data, epsilon = 1e-10, cdummy, ddummy             # <<<<<<<<<<<<<<
- *     cdef int  bin0_max, bin0_min, bin1_max, bin1_min
- *     cdef bint check_mask=False, check_dummy=False, do_dark=False, do_flat=False, do_polarization=False, do_solidangle=False
+            /* "splitBBoxLUT.pyx":631
+ * 
+ *                 if (bin0_max < 0) or (bin0_min >= bins0) or (bin1_max < 0) or (bin1_min >= bins1):
+ *                     continue             # <<<<<<<<<<<<<<
+ * 
+ *                 if bin0_max >= bins0 :
  */
-  __pyx_v_epsilon = 1e-10;
+            goto __pyx_L7_continue;
+            goto __pyx_L10;
+          }
+          __pyx_L10:;
 
-  /* "splitBBoxLUT.pyx":886
- *     cdef float fbin0_min, fbin0_max, fbin1_min, fbin1_max, data, epsilon = 1e-10, cdummy, ddummy
- *     cdef int  bin0_max, bin0_min, bin1_max, bin1_min
- *     cdef bint check_mask=False, check_dummy=False, do_dark=False, do_flat=False, do_polarization=False, do_solidangle=False             # <<<<<<<<<<<<<<
- *     cdef numpy.int8_t[:] cmask
- *     cdef float[:] cflat, cdark, cpolarization, csolidangle
+          /* "splitBBoxLUT.pyx":633
+ *                     continue
+ * 
+ *                 if bin0_max >= bins0 :             # <<<<<<<<<<<<<<
+ *                     bin0_max = bins0 - 1
+ *                 if  bin0_min < 0:
  */
-  __pyx_v_check_mask = 0;
-  __pyx_v_check_dummy = 0;
-  __pyx_v_do_dark = 0;
-  __pyx_v_do_flat = 0;
-  __pyx_v_do_polarization = 0;
-  __pyx_v_do_solidangle = 0;
+          __pyx_t_14 = ((__pyx_v_bin0_max >= __pyx_v_bins0) != 0);
+          if (__pyx_t_14) {
 
-  /* "splitBBoxLUT.pyx":890
- *     cdef float[:] cflat, cdark, cpolarization, csolidangle
+            /* "splitBBoxLUT.pyx":634
  * 
- *     if  mask is not None:             # <<<<<<<<<<<<<<
- *         assert mask.size == size
- *         check_mask = True
+ *                 if bin0_max >= bins0 :
+ *                     bin0_max = bins0 - 1             # <<<<<<<<<<<<<<
+ *                 if  bin0_min < 0:
+ *                     bin0_min = 0
  */
-  __pyx_t_5 = (__pyx_v_mask != Py_None);
-  if (__pyx_t_5) {
+            __pyx_v_bin0_max = (__pyx_v_bins0 - 1);
+            goto __pyx_L11;
+          }
+          __pyx_L11:;
 
-    /* "splitBBoxLUT.pyx":891
- * 
- *     if  mask is not None:
- *         assert mask.size == size             # <<<<<<<<<<<<<<
- *         check_mask = True
- *         cmask = numpy.ascontiguousarray(mask.ravel(),dtype=numpy.int8)
+          /* "splitBBoxLUT.pyx":635
+ *                 if bin0_max >= bins0 :
+ *                     bin0_max = bins0 - 1
+ *                 if  bin0_min < 0:             # <<<<<<<<<<<<<<
+ *                     bin0_min = 0
+ *                 if bin1_max >= bins1 :
  */
-    #ifndef CYTHON_WITHOUT_ASSERTIONS
-    __pyx_t_4 = PyObject_GetAttr(__pyx_v_mask, __pyx_n_s__size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    if (unlikely(!__pyx_t_5)) {
-      PyErr_SetNone(PyExc_AssertionError);
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    }
-    #endif
+          __pyx_t_14 = ((__pyx_v_bin0_min < 0) != 0);
+          if (__pyx_t_14) {
 
-    /* "splitBBoxLUT.pyx":892
- *     if  mask is not None:
- *         assert mask.size == size
- *         check_mask = True             # <<<<<<<<<<<<<<
- *         cmask = numpy.ascontiguousarray(mask.ravel(),dtype=numpy.int8)
- * 
+            /* "splitBBoxLUT.pyx":636
+ *                     bin0_max = bins0 - 1
+ *                 if  bin0_min < 0:
+ *                     bin0_min = 0             # <<<<<<<<<<<<<<
+ *                 if bin1_max >= bins1 :
+ *                     bin1_max = bins1 - 1
  */
-    __pyx_v_check_mask = 1;
+            __pyx_v_bin0_min = 0;
+            goto __pyx_L12;
+          }
+          __pyx_L12:;
 
-    /* "splitBBoxLUT.pyx":893
- *         assert mask.size == size
- *         check_mask = True
- *         cmask = numpy.ascontiguousarray(mask.ravel(),dtype=numpy.int8)             # <<<<<<<<<<<<<<
- * 
- *     if (dummy is not None) and delta_dummy is not None:
+          /* "splitBBoxLUT.pyx":637
+ *                 if  bin0_min < 0:
+ *                     bin0_min = 0
+ *                 if bin1_max >= bins1 :             # <<<<<<<<<<<<<<
+ *                     bin1_max = bins1 - 1
+ *                 if  bin1_min < 0:
  */
-    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_3 = PyObject_GetAttr(__pyx_v_mask, __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __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 = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
-    __Pyx_GIVEREF(__pyx_t_4);
-    __pyx_t_4 = 0;
-    __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-    __pyx_t_13 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_13);
-    __pyx_t_9 = PyObject_GetAttr(__pyx_t_13, __pyx_n_s__int8); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
-    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-    if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-    __pyx_t_9 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-    __pyx_t_24 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int8_t(__pyx_t_9);
-    if (unlikely(!__pyx_t_24.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-    __pyx_v_cmask = __pyx_t_24;
-    __pyx_t_24.memview = NULL;
-    __pyx_t_24.data = NULL;
-    goto __pyx_L17;
-  }
-  __pyx_L17:;
+          __pyx_t_14 = ((__pyx_v_bin1_max >= __pyx_v_bins1) != 0);
+          if (__pyx_t_14) {
 
-  /* "splitBBoxLUT.pyx":895
- *         cmask = numpy.ascontiguousarray(mask.ravel(),dtype=numpy.int8)
- * 
- *     if (dummy is not None) and delta_dummy is not None:             # <<<<<<<<<<<<<<
- *         check_dummy = True
- *         cdummy =  float(dummy)
+            /* "splitBBoxLUT.pyx":638
+ *                     bin0_min = 0
+ *                 if bin1_max >= bins1 :
+ *                     bin1_max = bins1 - 1             # <<<<<<<<<<<<<<
+ *                 if  bin1_min < 0:
+ *                     bin1_min = 0
  */
-  __pyx_t_5 = (__pyx_v_dummy != Py_None);
-  if (__pyx_t_5) {
-    __pyx_t_25 = (__pyx_v_delta_dummy != Py_None);
-    __pyx_t_26 = __pyx_t_25;
-  } else {
-    __pyx_t_26 = __pyx_t_5;
-  }
-  if (__pyx_t_26) {
+            __pyx_v_bin1_max = (__pyx_v_bins1 - 1);
+            goto __pyx_L13;
+          }
+          __pyx_L13:;
 
-    /* "splitBBoxLUT.pyx":896
+          /* "splitBBoxLUT.pyx":639
+ *                 if bin1_max >= bins1 :
+ *                     bin1_max = bins1 - 1
+ *                 if  bin1_min < 0:             # <<<<<<<<<<<<<<
+ *                     bin1_min = 0
  * 
- *     if (dummy is not None) and delta_dummy is not None:
- *         check_dummy = True             # <<<<<<<<<<<<<<
- *         cdummy =  float(dummy)
- *         ddummy =  float(delta_dummy)
  */
-    __pyx_v_check_dummy = 1;
+          __pyx_t_14 = ((__pyx_v_bin1_min < 0) != 0);
+          if (__pyx_t_14) {
 
-    /* "splitBBoxLUT.pyx":897
- *     if (dummy is not None) and delta_dummy is not None:
- *         check_dummy = True
- *         cdummy =  float(dummy)             # <<<<<<<<<<<<<<
- *         ddummy =  float(delta_dummy)
- *     elif (dummy is not None):
+            /* "splitBBoxLUT.pyx":640
+ *                     bin1_max = bins1 - 1
+ *                 if  bin1_min < 0:
+ *                     bin1_min = 0             # <<<<<<<<<<<<<<
+ * 
+ *                 for i in range(bin0_min, bin0_max+1):
  */
-    __pyx_t_27 = __Pyx_PyObject_AsDouble(__pyx_v_dummy); if (unlikely(__pyx_t_27 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_v_cdummy = __pyx_t_27;
+            __pyx_v_bin1_min = 0;
+            goto __pyx_L14;
+          }
+          __pyx_L14:;
 
-    /* "splitBBoxLUT.pyx":898
- *         check_dummy = True
- *         cdummy =  float(dummy)
- *         ddummy =  float(delta_dummy)             # <<<<<<<<<<<<<<
- *     elif (dummy is not None):
- *         cdummy = float(dummy)
+          /* "splitBBoxLUT.pyx":642
+ *                     bin1_min = 0
+ * 
+ *                 for i in range(bin0_min, bin0_max+1):             # <<<<<<<<<<<<<<
+ *                     for j in range(bin1_min , bin1_max+1):
+ *                         outMax[i, j] +=  1
  */
-    __pyx_t_27 = __Pyx_PyObject_AsDouble(__pyx_v_delta_dummy); if (unlikely(__pyx_t_27 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_v_ddummy = __pyx_t_27;
-    goto __pyx_L18;
-  }
+          __pyx_t_26 = (__pyx_v_bin0_max + 1);
+          for (__pyx_t_27 = __pyx_v_bin0_min; __pyx_t_27 < __pyx_t_26; __pyx_t_27+=1) {
+            __pyx_v_i = __pyx_t_27;
 
-  /* "splitBBoxLUT.pyx":899
- *         cdummy =  float(dummy)
- *         ddummy =  float(delta_dummy)
- *     elif (dummy is not None):             # <<<<<<<<<<<<<<
- *         cdummy = float(dummy)
- *     else:
+            /* "splitBBoxLUT.pyx":643
+ * 
+ *                 for i in range(bin0_min, bin0_max+1):
+ *                     for j in range(bin1_min , bin1_max+1):             # <<<<<<<<<<<<<<
+ *                         outMax[i, j] +=  1
+ * 
  */
-  __pyx_t_26 = (__pyx_v_dummy != Py_None);
-  if (__pyx_t_26) {
+            __pyx_t_28 = (__pyx_v_bin1_max + 1);
+            for (__pyx_t_29 = __pyx_v_bin1_min; __pyx_t_29 < __pyx_t_28; __pyx_t_29+=1) {
+              __pyx_v_j = __pyx_t_29;
 
-    /* "splitBBoxLUT.pyx":900
- *         ddummy =  float(delta_dummy)
- *     elif (dummy is not None):
- *         cdummy = float(dummy)             # <<<<<<<<<<<<<<
- *     else:
- *         cdummy=0.0
+              /* "splitBBoxLUT.pyx":644
+ *                 for i in range(bin0_min, bin0_max+1):
+ *                     for j in range(bin1_min , bin1_max+1):
+ *                         outMax[i, j] +=  1             # <<<<<<<<<<<<<<
+ * 
+ *         self.lut_size = lut_size = outMax.max()
  */
-    __pyx_t_27 = __Pyx_PyObject_AsDouble(__pyx_v_dummy); if (unlikely(__pyx_t_27 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_v_cdummy = __pyx_t_27;
-    goto __pyx_L18;
-  }
-  /*else*/ {
+              __pyx_t_30 = __pyx_v_i;
+              __pyx_t_31 = __pyx_v_j;
+              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_31, __pyx_pybuffernd_outMax.diminfo[1].strides) += 1;
+            }
+          }
+          __pyx_L7_continue:;
+        }
+      }
 
-    /* "splitBBoxLUT.pyx":902
- *         cdummy = float(dummy)
- *     else:
- *         cdummy=0.0             # <<<<<<<<<<<<<<
+      /* "splitBBoxLUT.pyx":614
  * 
- *     if dark is not None:
+ * #NOGIL
+ *         with nogil:             # <<<<<<<<<<<<<<
+ *             for idx in range(size):
+ *                 if (check_mask) and (cmask[idx]):
  */
-    __pyx_v_cdummy = 0.0;
+      /*finally:*/ {
+        int __pyx_why;
+        __pyx_why = 0; goto __pyx_L6;
+        __pyx_L5: __pyx_why = 4; goto __pyx_L6;
+        __pyx_L6:;
+        #ifdef WITH_THREAD
+        Py_BLOCK_THREADS
+        #endif
+        switch (__pyx_why) {
+          case 4: goto __pyx_L1_error;
+        }
+      }
   }
-  __pyx_L18:;
 
-  /* "splitBBoxLUT.pyx":904
- *         cdummy=0.0
+  /* "splitBBoxLUT.pyx":646
+ *                         outMax[i, j] +=  1
  * 
- *     if dark is not None:             # <<<<<<<<<<<<<<
- *         assert dark.size == size
- *         do_dark = True
+ *         self.lut_size = lut_size = outMax.max()             # <<<<<<<<<<<<<<
+ *         #just recycle the outMax array
+ *         #outMax = numpy.zeros((bins0,bins1), dtype=numpy.int32)
  */
-  __pyx_t_26 = (__pyx_v_dark != Py_None);
-  if (__pyx_t_26) {
+  __pyx_t_12 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_outMax), __pyx_n_s__max); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_12);
+  __pyx_t_11 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_11);
+  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__lut_size, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __Pyx_PyInt_from_py_npy_int32(__pyx_t_11); if (unlikely((__pyx_t_5 == (npy_int32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_v_lut_size = __pyx_t_5;
+  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
 
-    /* "splitBBoxLUT.pyx":905
+  /* "splitBBoxLUT.pyx":649
+ *         #just recycle the outMax array
+ *         #outMax = numpy.zeros((bins0,bins1), dtype=numpy.int32)
+ *         memset(&outMax[0,0], 0, bins0*bins1*sizeof(numpy.int32_t))             # <<<<<<<<<<<<<<
  * 
- *     if dark is not None:
- *         assert dark.size == size             # <<<<<<<<<<<<<<
- *         do_dark = True
- *         cdark = numpy.ascontiguousarray(dark.ravel(),dtype=numpy.float32)
+ *         lut_nbytes = bins0 * bins1 * lut_size * sizeof(lut_point)
  */
-    #ifndef CYTHON_WITHOUT_ASSERTIONS
-    __pyx_t_9 = PyObject_GetAttr(__pyx_v_dark, __pyx_n_s__size); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
-    __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_3 = PyObject_RichCompare(__pyx_t_9, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_26 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_26 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    if (unlikely(!__pyx_t_26)) {
-      PyErr_SetNone(PyExc_AssertionError);
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    }
-    #endif
+  __pyx_t_26 = 0;
+  __pyx_t_28 = 0;
+  memset((&(*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_outMax.diminfo[1].strides))), 0, ((__pyx_v_bins0 * __pyx_v_bins1) * (sizeof(__pyx_t_5numpy_int32_t))));
 
-    /* "splitBBoxLUT.pyx":906
- *     if dark is not None:
- *         assert dark.size == size
- *         do_dark = True             # <<<<<<<<<<<<<<
- *         cdark = numpy.ascontiguousarray(dark.ravel(),dtype=numpy.float32)
- *     if flat is not None:
+  /* "splitBBoxLUT.pyx":651
+ *         memset(&outMax[0,0], 0, bins0*bins1*sizeof(numpy.int32_t))
+ * 
+ *         lut_nbytes = bins0 * bins1 * lut_size * sizeof(lut_point)             # <<<<<<<<<<<<<<
+ *         if (os.name == "posix") and ("SC_PAGE_SIZE" in os.sysconf_names) and ("SC_PHYS_PAGES" in os.sysconf_names):
+ *             memsize =  os.sysconf("SC_PAGE_SIZE")*os.sysconf("SC_PHYS_PAGES")
  */
-    __pyx_v_do_dark = 1;
+  __pyx_v_lut_nbytes = (((__pyx_v_bins0 * __pyx_v_bins1) * __pyx_v_lut_size) * (sizeof(struct __pyx_t_12splitBBoxLUT_lut_point)));
 
-    /* "splitBBoxLUT.pyx":907
- *         assert dark.size == size
- *         do_dark = True
- *         cdark = numpy.ascontiguousarray(dark.ravel(),dtype=numpy.float32)             # <<<<<<<<<<<<<<
- *     if flat is not None:
- *         assert flat.size == size
+  /* "splitBBoxLUT.pyx":652
+ * 
+ *         lut_nbytes = bins0 * bins1 * lut_size * sizeof(lut_point)
+ *         if (os.name == "posix") and ("SC_PAGE_SIZE" in os.sysconf_names) and ("SC_PHYS_PAGES" in os.sysconf_names):             # <<<<<<<<<<<<<<
+ *             memsize =  os.sysconf("SC_PAGE_SIZE")*os.sysconf("SC_PHYS_PAGES")
+ *             if memsize <  lut_nbytes:
  */
-    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_3 = PyObject_GetAttr(__pyx_v_dark, __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_9 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
-    __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 = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_9);
-    __Pyx_GIVEREF(__pyx_t_9);
-    __pyx_t_9 = 0;
-    __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_9));
-    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_13 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float32); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_13);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__dtype), __pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-    __pyx_t_13 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_13);
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
-    __pyx_t_28 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_13);
-    if (unlikely(!__pyx_t_28.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-    __pyx_v_cdark = __pyx_t_28;
-    __pyx_t_28.memview = NULL;
-    __pyx_t_28.data = NULL;
-    goto __pyx_L19;
+  __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s__os); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_11);
+  __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s__name); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_12);
+  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+  __pyx_t_11 = PyObject_RichCompare(__pyx_t_12, ((PyObject *)__pyx_n_s__posix), Py_EQ); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+  __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+  if (__pyx_t_14) {
+    __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s__os); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_11);
+    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s__sysconf_names); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_12);
+    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+    __pyx_t_18 = (__Pyx_PySequence_Contains(((PyObject *)__pyx_n_s__SC_PAGE_SIZE), __pyx_t_12, Py_EQ)); if (unlikely(__pyx_t_18 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+    if (__pyx_t_18) {
+      __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s__os); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_12);
+      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s__sysconf_names); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_11);
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+      __pyx_t_23 = (__Pyx_PySequence_Contains(((PyObject *)__pyx_n_s__SC_PHYS_PAGES), __pyx_t_11, Py_EQ)); if (unlikely(__pyx_t_23 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+      __pyx_t_25 = __pyx_t_23;
+    } else {
+      __pyx_t_25 = __pyx_t_18;
+    }
+    __pyx_t_18 = __pyx_t_25;
+  } else {
+    __pyx_t_18 = __pyx_t_14;
   }
-  __pyx_L19:;
-
-  /* "splitBBoxLUT.pyx":908
- *         do_dark = True
- *         cdark = numpy.ascontiguousarray(dark.ravel(),dtype=numpy.float32)
- *     if flat is not None:             # <<<<<<<<<<<<<<
- *         assert flat.size == size
- *         do_flat = True
- */
-  __pyx_t_26 = (__pyx_v_flat != Py_None);
-  if (__pyx_t_26) {
+  if (__pyx_t_18) {
 
-    /* "splitBBoxLUT.pyx":909
- *         cdark = numpy.ascontiguousarray(dark.ravel(),dtype=numpy.float32)
- *     if flat is not None:
- *         assert flat.size == size             # <<<<<<<<<<<<<<
- *         do_flat = True
- *         cflat = numpy.ascontiguousarray(flat.ravel(),dtype=numpy.float32)
+    /* "splitBBoxLUT.pyx":653
+ *         lut_nbytes = bins0 * bins1 * lut_size * sizeof(lut_point)
+ *         if (os.name == "posix") and ("SC_PAGE_SIZE" in os.sysconf_names) and ("SC_PHYS_PAGES" in os.sysconf_names):
+ *             memsize =  os.sysconf("SC_PAGE_SIZE")*os.sysconf("SC_PHYS_PAGES")             # <<<<<<<<<<<<<<
+ *             if memsize <  lut_nbytes:
+ *                 raise MemoryError("Lookup-table (%i, %i, %i) is %.3fGB whereas the memory of the system is only %s"%(bins0, bins1, lut_size, lut_nbytes, memsize))
  */
-    #ifndef CYTHON_WITHOUT_ASSERTIONS
-    __pyx_t_13 = PyObject_GetAttr(__pyx_v_flat, __pyx_n_s__size); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_13);
-    __pyx_t_9 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
-    __pyx_t_3 = PyObject_RichCompare(__pyx_t_13, __pyx_t_9, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-    __pyx_t_26 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_26 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    if (unlikely(!__pyx_t_26)) {
-      PyErr_SetNone(PyExc_AssertionError);
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    }
-    #endif
+    __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s__os); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_11);
+    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s__sysconf); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_12);
+    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+    __pyx_t_11 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_k_tuple_5), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_11);
+    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+    __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s__os); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_12);
+    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s__sysconf); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_10);
+    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+    __pyx_t_12 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_12);
+    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+    __pyx_t_10 = PyNumber_Multiply(__pyx_t_11, __pyx_t_12); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_10);
+    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+    __pyx_v_memsize = __pyx_t_10;
+    __pyx_t_10 = 0;
 
-    /* "splitBBoxLUT.pyx":910
- *     if flat is not None:
- *         assert flat.size == size
- *         do_flat = True             # <<<<<<<<<<<<<<
- *         cflat = numpy.ascontiguousarray(flat.ravel(),dtype=numpy.float32)
- *     if polarization is not None:
+    /* "splitBBoxLUT.pyx":654
+ *         if (os.name == "posix") and ("SC_PAGE_SIZE" in os.sysconf_names) and ("SC_PHYS_PAGES" in os.sysconf_names):
+ *             memsize =  os.sysconf("SC_PAGE_SIZE")*os.sysconf("SC_PHYS_PAGES")
+ *             if memsize <  lut_nbytes:             # <<<<<<<<<<<<<<
+ *                 raise MemoryError("Lookup-table (%i, %i, %i) is %.3fGB whereas the memory of the system is only %s"%(bins0, bins1, lut_size, lut_nbytes, memsize))
+ *         #else hope we have enough memory
  */
-    __pyx_v_do_flat = 1;
+    __pyx_t_10 = __Pyx_PyInt_FromSize_t(__pyx_v_lut_nbytes); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_10);
+    __pyx_t_12 = PyObject_RichCompare(__pyx_v_memsize, __pyx_t_10, Py_LT); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+    __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_18 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+    if (__pyx_t_18) {
 
-    /* "splitBBoxLUT.pyx":911
- *         assert flat.size == size
- *         do_flat = True
- *         cflat = numpy.ascontiguousarray(flat.ravel(),dtype=numpy.float32)             # <<<<<<<<<<<<<<
- *     if polarization is not None:
- *         do_polarization = True
+      /* "splitBBoxLUT.pyx":655
+ *             memsize =  os.sysconf("SC_PAGE_SIZE")*os.sysconf("SC_PHYS_PAGES")
+ *             if memsize <  lut_nbytes:
+ *                 raise MemoryError("Lookup-table (%i, %i, %i) is %.3fGB whereas the memory of the system is only %s"%(bins0, bins1, lut_size, lut_nbytes, memsize))             # <<<<<<<<<<<<<<
+ *         #else hope we have enough memory
+ *         lut = numpy.recarray(shape=(bins0, bins1, lut_size),dtype=[("idx",numpy.int32),("coef",numpy.float32)])
  */
-    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_9 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_3 = PyObject_GetAttr(__pyx_v_flat, __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_13 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_13);
-    __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 = 911; __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);
-    __pyx_t_13 = 0;
-    __pyx_t_13 = PyDict_New(); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_13));
-    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__float32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    if (PyDict_SetItem(__pyx_t_13, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_1 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
-    __pyx_t_28 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_1);
-    if (unlikely(!__pyx_t_28.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_v_cflat = __pyx_t_28;
-    __pyx_t_28.memview = NULL;
-    __pyx_t_28.data = NULL;
+      __pyx_t_12 = PyInt_FromLong(__pyx_v_bins0); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_12);
+      __pyx_t_10 = PyInt_FromLong(__pyx_v_bins1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_10);
+      __pyx_t_11 = __Pyx_PyInt_to_py_npy_int32(__pyx_v_lut_size); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_11);
+      __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_lut_nbytes); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
+      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_12);
+      __Pyx_GIVEREF(__pyx_t_12);
+      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_10);
+      __Pyx_GIVEREF(__pyx_t_10);
+      PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_11);
+      __Pyx_GIVEREF(__pyx_t_11);
+      PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_3);
+      __Pyx_GIVEREF(__pyx_t_3);
+      __Pyx_INCREF(__pyx_v_memsize);
+      PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_v_memsize);
+      __Pyx_GIVEREF(__pyx_v_memsize);
+      __pyx_t_12 = 0;
+      __pyx_t_10 = 0;
+      __pyx_t_11 = 0;
+      __pyx_t_3 = 0;
+      __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_7), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+      __Pyx_DECREF(((PyObject *)__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 = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
+      PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_3));
+      __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
+      __pyx_t_3 = 0;
+      __pyx_t_3 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      goto __pyx_L21;
+    }
+    __pyx_L21:;
     goto __pyx_L20;
   }
   __pyx_L20:;
 
-  /* "splitBBoxLUT.pyx":912
- *         do_flat = True
- *         cflat = numpy.ascontiguousarray(flat.ravel(),dtype=numpy.float32)
- *     if polarization is not None:             # <<<<<<<<<<<<<<
- *         do_polarization = True
- *         assert polarization.size == size
- */
-  __pyx_t_26 = (__pyx_v_polarization != Py_None);
-  if (__pyx_t_26) {
-
-    /* "splitBBoxLUT.pyx":913
- *         cflat = numpy.ascontiguousarray(flat.ravel(),dtype=numpy.float32)
- *     if polarization is not None:
- *         do_polarization = True             # <<<<<<<<<<<<<<
- *         assert polarization.size == size
- *         cpolarization = numpy.ascontiguousarray(polarization.ravel(), dtype=numpy.float32)
- */
-    __pyx_v_do_polarization = 1;
-
-    /* "splitBBoxLUT.pyx":914
- *     if polarization is not None:
- *         do_polarization = True
- *         assert polarization.size == size             # <<<<<<<<<<<<<<
- *         cpolarization = numpy.ascontiguousarray(polarization.ravel(), dtype=numpy.float32)
- *     if solidangle is not None:
+  /* "splitBBoxLUT.pyx":657
+ *                 raise MemoryError("Lookup-table (%i, %i, %i) is %.3fGB whereas the memory of the system is only %s"%(bins0, bins1, lut_size, lut_nbytes, memsize))
+ *         #else hope we have enough memory
+ *         lut = numpy.recarray(shape=(bins0, bins1, lut_size),dtype=[("idx",numpy.int32),("coef",numpy.float32)])             # <<<<<<<<<<<<<<
+ *         memset(&lut[0,0,0], 0, lut_nbytes)
+ *         with nogil:
  */
-    #ifndef CYTHON_WITHOUT_ASSERTIONS
-    __pyx_t_1 = PyObject_GetAttr(__pyx_v_polarization, __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_13 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_13);
-    __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_13, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-    __pyx_t_26 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_26 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    if (unlikely(!__pyx_t_26)) {
-      PyErr_SetNone(PyExc_AssertionError);
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__recarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+  __pyx_t_11 = PyInt_FromLong(__pyx_v_bins0); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_11);
+  __pyx_t_10 = PyInt_FromLong(__pyx_v_bins1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_10);
+  __pyx_t_12 = __Pyx_PyInt_to_py_npy_int32(__pyx_v_lut_size); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_12);
+  __pyx_t_32 = PyTuple_New(3); if (unlikely(!__pyx_t_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_32);
+  PyTuple_SET_ITEM(__pyx_t_32, 0, __pyx_t_11);
+  __Pyx_GIVEREF(__pyx_t_11);
+  PyTuple_SET_ITEM(__pyx_t_32, 1, __pyx_t_10);
+  __Pyx_GIVEREF(__pyx_t_10);
+  PyTuple_SET_ITEM(__pyx_t_32, 2, __pyx_t_12);
+  __Pyx_GIVEREF(__pyx_t_12);
+  __pyx_t_11 = 0;
+  __pyx_t_10 = 0;
+  __pyx_t_12 = 0;
+  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__shape), ((PyObject *)__pyx_t_32)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_32)); __pyx_t_32 = 0;
+  __pyx_t_32 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_32);
+  __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_32, __pyx_n_s__int32); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_12);
+  __Pyx_DECREF(__pyx_t_32); __pyx_t_32 = 0;
+  __pyx_t_32 = PyTuple_New(2); if (unlikely(!__pyx_t_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_32);
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
+  PyTuple_SET_ITEM(__pyx_t_32, 0, ((PyObject *)__pyx_n_s__idx));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx));
+  PyTuple_SET_ITEM(__pyx_t_32, 1, __pyx_t_12);
+  __Pyx_GIVEREF(__pyx_t_12);
+  __pyx_t_12 = 0;
+  __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_12);
+  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s__float32); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_10);
+  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+  __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_12);
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__coef));
+  PyTuple_SET_ITEM(__pyx_t_12, 0, ((PyObject *)__pyx_n_s__coef));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__coef));
+  PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_10);
+  __Pyx_GIVEREF(__pyx_t_10);
+  __pyx_t_10 = 0;
+  __pyx_t_10 = PyList_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_10);
+  PyList_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_t_32));
+  __Pyx_GIVEREF(((PyObject *)__pyx_t_32));
+  PyList_SET_ITEM(__pyx_t_10, 1, ((PyObject *)__pyx_t_12));
+  __Pyx_GIVEREF(((PyObject *)__pyx_t_12));
+  __pyx_t_32 = 0;
+  __pyx_t_12 = 0;
+  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_t_10)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
+  __pyx_t_10 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_10);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+  if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_33 = ((PyArrayObject *)__pyx_t_10);
+  {
+    __Pyx_BufFmt_StackElem __pyx_stack[2];
+    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lut.rcbuffer->pybuffer);
+    __pyx_t_4 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lut.rcbuffer->pybuffer, (PyObject*)__pyx_t_33, &__Pyx_TypeInfo_nn_struct___pyx_t_12splitBBoxLUT_lut_point, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack);
+    if (unlikely(__pyx_t_4 < 0)) {
+      PyErr_Fetch(&__pyx_t_34, &__pyx_t_35, &__pyx_t_36);
+      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lut.rcbuffer->pybuffer, (PyObject*)__pyx_v_lut, &__Pyx_TypeInfo_nn_struct___pyx_t_12splitBBoxLUT_lut_point, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {
+        Py_XDECREF(__pyx_t_34); Py_XDECREF(__pyx_t_35); Py_XDECREF(__pyx_t_36);
+        __Pyx_RaiseBufferFallbackError();
+      } else {
+        PyErr_Restore(__pyx_t_34, __pyx_t_35, __pyx_t_36);
+      }
     }
-    #endif
-
-    /* "splitBBoxLUT.pyx":915
- *         do_polarization = True
- *         assert polarization.size == size
- *         cpolarization = numpy.ascontiguousarray(polarization.ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
- *     if solidangle is not None:
- *         do_solidangle = True
- */
-    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_13 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_13);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_3 = PyObject_GetAttr(__pyx_v_polarization, __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; __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 = 915; __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 = 915; __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 = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-    __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
-    __pyx_t_4 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__float32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-    if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_4 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-    __pyx_t_28 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_4);
-    if (unlikely(!__pyx_t_28.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_v_cpolarization = __pyx_t_28;
-    __pyx_t_28.memview = NULL;
-    __pyx_t_28.data = NULL;
-    goto __pyx_L21;
+    __pyx_pybuffernd_lut.diminfo[0].strides = __pyx_pybuffernd_lut.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lut.diminfo[0].shape = __pyx_pybuffernd_lut.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_lut.diminfo[1].strides = __pyx_pybuffernd_lut.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_lut.diminfo[1].shape = __pyx_pybuffernd_lut.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_lut.diminfo[2].strides = __pyx_pybuffernd_lut.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_lut.dimin [...]
+    if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
-  __pyx_L21:;
-
-  /* "splitBBoxLUT.pyx":916
- *         assert polarization.size == size
- *         cpolarization = numpy.ascontiguousarray(polarization.ravel(), dtype=numpy.float32)
- *     if solidangle is not None:             # <<<<<<<<<<<<<<
- *         do_solidangle = True
- *         assert solidangle.size == size
- */
-  __pyx_t_26 = (__pyx_v_solidangle != Py_None);
-  if (__pyx_t_26) {
+  __pyx_t_33 = 0;
+  __pyx_v_lut = ((PyArrayObject *)__pyx_t_10);
+  __pyx_t_10 = 0;
 
-    /* "splitBBoxLUT.pyx":917
- *         cpolarization = numpy.ascontiguousarray(polarization.ravel(), dtype=numpy.float32)
- *     if solidangle is not None:
- *         do_solidangle = True             # <<<<<<<<<<<<<<
- *         assert solidangle.size == size
- *         csolidangle = numpy.ascontiguousarray(solidangle.ravel(), dtype=numpy.float32)
+  /* "splitBBoxLUT.pyx":658
+ *         #else hope we have enough memory
+ *         lut = numpy.recarray(shape=(bins0, bins1, lut_size),dtype=[("idx",numpy.int32),("coef",numpy.float32)])
+ *         memset(&lut[0,0,0], 0, lut_nbytes)             # <<<<<<<<<<<<<<
+ *         with nogil:
+ *             for idx in range(size):
  */
-    __pyx_v_do_solidangle = 1;
+  __pyx_t_37 = 0;
+  __pyx_t_38 = 0;
+  __pyx_t_39 = 0;
+  memset((&(*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_38, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_39, __pyx_pybuffernd_lut.diminfo[2].strides))), 0, __pyx_v_lut_nbytes);
 
-    /* "splitBBoxLUT.pyx":918
- *     if solidangle is not None:
- *         do_solidangle = True
- *         assert solidangle.size == size             # <<<<<<<<<<<<<<
- *         csolidangle = numpy.ascontiguousarray(solidangle.ravel(), dtype=numpy.float32)
- * 
+  /* "splitBBoxLUT.pyx":659
+ *         lut = numpy.recarray(shape=(bins0, bins1, lut_size),dtype=[("idx",numpy.int32),("coef",numpy.float32)])
+ *         memset(&lut[0,0,0], 0, lut_nbytes)
+ *         with nogil:             # <<<<<<<<<<<<<<
+ *             for idx in range(size):
+ *                 if (check_mask) and cmask[idx]:
  */
-    #ifndef CYTHON_WITHOUT_ASSERTIONS
-    __pyx_t_4 = PyObject_GetAttr(__pyx_v_solidangle, __pyx_n_s__size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_26 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_26 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    if (unlikely(!__pyx_t_26)) {
-      PyErr_SetNone(PyExc_AssertionError);
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    }
-    #endif
+  {
+      #ifdef WITH_THREAD
+      PyThreadState *_save;
+      Py_UNBLOCK_THREADS
+      #endif
+      /*try:*/ {
 
-    /* "splitBBoxLUT.pyx":919
- *         do_solidangle = True
- *         assert solidangle.size == size
- *         csolidangle = numpy.ascontiguousarray(solidangle.ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
- * 
- * 
+        /* "splitBBoxLUT.pyx":660
+ *         memset(&lut[0,0,0], 0, lut_nbytes)
+ *         with nogil:
+ *             for idx in range(size):             # <<<<<<<<<<<<<<
+ *                 if (check_mask) and cmask[idx]:
+ *                     continue
  */
-    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_3 = PyObject_GetAttr(__pyx_v_solidangle, __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __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 = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
-    __Pyx_GIVEREF(__pyx_t_4);
-    __pyx_t_4 = 0;
-    __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-    __pyx_t_13 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_13);
-    __pyx_t_9 = PyObject_GetAttr(__pyx_t_13, __pyx_n_s__float32); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
-    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
-    if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-    __pyx_t_9 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-    __pyx_t_28 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_9);
-    if (unlikely(!__pyx_t_28.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-    __pyx_v_csolidangle = __pyx_t_28;
-    __pyx_t_28.memview = NULL;
-    __pyx_t_28.data = NULL;
-    goto __pyx_L22;
-  }
-  __pyx_L22:;
+        __pyx_t_5 = __pyx_v_size;
+        for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_5; __pyx_t_16+=1) {
+          __pyx_v_idx = __pyx_t_16;
 
-  /* "splitBBoxLUT.pyx":922
- * 
- * 
- *     pos0_min=cpos0[0]             # <<<<<<<<<<<<<<
- *     pos0_max=cpos0[0]
+          /* "splitBBoxLUT.pyx":661
+ *         with nogil:
+ *             for idx in range(size):
+ *                 if (check_mask) and cmask[idx]:             # <<<<<<<<<<<<<<
+ *                     continue
  * 
  */
-  __pyx_t_29 = 0;
-  __pyx_v_pos0_min = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cpos0.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_cpos0.diminfo[0].strides));
+          __pyx_t_18 = __pyx_v_check_mask;
+          if (__pyx_t_18) {
+            if (unlikely(!__pyx_v_cmask.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cmask"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L23;} }
+            __pyx_t_27 = __pyx_v_idx;
+            __pyx_t_14 = ((*((__pyx_t_5numpy_int8_t *) ( /* dim=0 */ (__pyx_v_cmask.data + __pyx_t_27 * __pyx_v_cmask.strides[0]) ))) != 0);
+          } else {
+            __pyx_t_14 = __pyx_t_18;
+          }
+          if (__pyx_t_14) {
 
-  /* "splitBBoxLUT.pyx":923
- * 
- *     pos0_min=cpos0[0]
- *     pos0_max=cpos0[0]             # <<<<<<<<<<<<<<
+            /* "splitBBoxLUT.pyx":662
+ *             for idx in range(size):
+ *                 if (check_mask) and cmask[idx]:
+ *                     continue             # <<<<<<<<<<<<<<
  * 
- *     with nogil:
+ *                 min0 = cpos0_inf[idx]
  */
-  __pyx_t_30 = 0;
-  __pyx_v_pos0_max = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cpos0.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_cpos0.diminfo[0].strides));
+            goto __pyx_L25_continue;
+            goto __pyx_L27;
+          }
+          __pyx_L27:;
 
-  /* "splitBBoxLUT.pyx":925
- *     pos0_max=cpos0[0]
+          /* "splitBBoxLUT.pyx":664
+ *                     continue
  * 
- *     with nogil:             # <<<<<<<<<<<<<<
- *         for idx in range(size):
- *             min0 = cpos0[idx] - dpos0[idx]
+ *                 min0 = cpos0_inf[idx]             # <<<<<<<<<<<<<<
+ *                 max0 = cpos0_sup[idx]
+ *                 min1 = cpos1_inf[idx]
  */
-  {
-      #ifdef WITH_THREAD
-      PyThreadState *_save = NULL;
-      #endif
-      Py_UNBLOCK_THREADS
-      /*try:*/ {
+          __pyx_t_29 = __pyx_v_idx;
+          __pyx_v_min0 = (*((float *) ( /* dim=0 */ (__pyx_v_cpos0_inf.data + __pyx_t_29 * __pyx_v_cpos0_inf.strides[0]) )));
 
-        /* "splitBBoxLUT.pyx":926
+          /* "splitBBoxLUT.pyx":665
  * 
- *     with nogil:
- *         for idx in range(size):             # <<<<<<<<<<<<<<
- *             min0 = cpos0[idx] - dpos0[idx]
- *             max0 = cpos0[idx] + dpos0[idx]
+ *                 min0 = cpos0_inf[idx]
+ *                 max0 = cpos0_sup[idx]             # <<<<<<<<<<<<<<
+ *                 min1 = cpos1_inf[idx]
+ *                 max1 = cpos1_sup[idx]
  */
-        __pyx_t_2 = __pyx_v_size;
-        for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_2; __pyx_t_12+=1) {
-          __pyx_v_idx = __pyx_t_12;
+          __pyx_t_40 = __pyx_v_idx;
+          __pyx_v_max0 = (*((float *) ( /* dim=0 */ (__pyx_v_cpos0_sup.data + __pyx_t_40 * __pyx_v_cpos0_sup.strides[0]) )));
 
-          /* "splitBBoxLUT.pyx":927
- *     with nogil:
- *         for idx in range(size):
- *             min0 = cpos0[idx] - dpos0[idx]             # <<<<<<<<<<<<<<
- *             max0 = cpos0[idx] + dpos0[idx]
- *             cpos0_upper[idx]=max0
- */
-          __pyx_t_11 = __pyx_v_idx;
-          __pyx_t_31 = __pyx_v_idx;
-          __pyx_v_min0 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cpos0.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_cpos0.diminfo[0].strides)) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_dpos0.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_dpos0.diminfo[0].strides)));
-
-          /* "splitBBoxLUT.pyx":928
- *         for idx in range(size):
- *             min0 = cpos0[idx] - dpos0[idx]
- *             max0 = cpos0[idx] + dpos0[idx]             # <<<<<<<<<<<<<<
- *             cpos0_upper[idx]=max0
- *             cpos0_lower[idx]=min0
- */
-          __pyx_t_32 = __pyx_v_idx;
-          __pyx_t_33 = __pyx_v_idx;
-          __pyx_v_max0 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cpos0.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_cpos0.diminfo[0].strides)) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_dpos0.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_dpos0.diminfo[0].strides)));
-
-          /* "splitBBoxLUT.pyx":929
- *             min0 = cpos0[idx] - dpos0[idx]
- *             max0 = cpos0[idx] + dpos0[idx]
- *             cpos0_upper[idx]=max0             # <<<<<<<<<<<<<<
- *             cpos0_lower[idx]=min0
- *             if max0>pos0_max:
+          /* "splitBBoxLUT.pyx":666
+ *                 min0 = cpos0_inf[idx]
+ *                 max0 = cpos0_sup[idx]
+ *                 min1 = cpos1_inf[idx]             # <<<<<<<<<<<<<<
+ *                 max1 = cpos1_sup[idx]
+ * 
  */
-          __pyx_t_34 = __pyx_v_idx;
-          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cpos0_upper.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_cpos0_upper.diminfo[0].strides) = __pyx_v_max0;
+          __pyx_t_41 = __pyx_v_idx;
+          __pyx_v_min1 = (*((float *) ( /* dim=0 */ (__pyx_v_cpos1_inf.data + __pyx_t_41 * __pyx_v_cpos1_inf.strides[0]) )));
 
-          /* "splitBBoxLUT.pyx":930
- *             max0 = cpos0[idx] + dpos0[idx]
- *             cpos0_upper[idx]=max0
- *             cpos0_lower[idx]=min0             # <<<<<<<<<<<<<<
- *             if max0>pos0_max:
- *                 pos0_max=max0
+          /* "splitBBoxLUT.pyx":667
+ *                 max0 = cpos0_sup[idx]
+ *                 min1 = cpos1_inf[idx]
+ *                 max1 = cpos1_sup[idx]             # <<<<<<<<<<<<<<
+ * 
+ *                 fbin0_min = getBinNr(min0, pos0_min, delta0)
  */
-          __pyx_t_35 = __pyx_v_idx;
-          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cpos0_lower.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_cpos0_lower.diminfo[0].strides) = __pyx_v_min0;
-
-          /* "splitBBoxLUT.pyx":931
- *             cpos0_upper[idx]=max0
- *             cpos0_lower[idx]=min0
- *             if max0>pos0_max:             # <<<<<<<<<<<<<<
- *                 pos0_max=max0
- *             if min0<pos0_min:
- */
-          __pyx_t_26 = (__pyx_v_max0 > __pyx_v_pos0_max);
-          if (__pyx_t_26) {
-
-            /* "splitBBoxLUT.pyx":932
- *             cpos0_lower[idx]=min0
- *             if max0>pos0_max:
- *                 pos0_max=max0             # <<<<<<<<<<<<<<
- *             if min0<pos0_min:
- *                 pos0_min=min0
- */
-            __pyx_v_pos0_max = __pyx_v_max0;
-            goto __pyx_L28;
-          }
-          __pyx_L28:;
+          __pyx_t_42 = __pyx_v_idx;
+          __pyx_v_max1 = (*((float *) ( /* dim=0 */ (__pyx_v_cpos1_sup.data + __pyx_t_42 * __pyx_v_cpos1_sup.strides[0]) )));
 
-          /* "splitBBoxLUT.pyx":933
- *             if max0>pos0_max:
- *                 pos0_max=max0
- *             if min0<pos0_min:             # <<<<<<<<<<<<<<
- *                 pos0_min=min0
+          /* "splitBBoxLUT.pyx":669
+ *                 max1 = cpos1_sup[idx]
  * 
+ *                 fbin0_min = getBinNr(min0, pos0_min, delta0)             # <<<<<<<<<<<<<<
+ *                 fbin0_max = getBinNr(max0, pos0_min, delta0)
+ *                 fbin1_min = getBinNr(min1, pos1_min, delta1)
  */
-          __pyx_t_26 = (__pyx_v_min0 < __pyx_v_pos0_min);
-          if (__pyx_t_26) {
+          __pyx_v_fbin0_min = __pyx_f_12splitBBoxLUT_getBinNr(__pyx_v_min0, __pyx_v_pos0_min, __pyx_v_delta0);
 
-            /* "splitBBoxLUT.pyx":934
- *                 pos0_max=max0
- *             if min0<pos0_min:
- *                 pos0_min=min0             # <<<<<<<<<<<<<<
+          /* "splitBBoxLUT.pyx":670
  * 
- *     if (pos0Range is not None) and (len(pos0Range) == 2):
+ *                 fbin0_min = getBinNr(min0, pos0_min, delta0)
+ *                 fbin0_max = getBinNr(max0, pos0_min, delta0)             # <<<<<<<<<<<<<<
+ *                 fbin1_min = getBinNr(min1, pos1_min, delta1)
+ *                 fbin1_max = getBinNr(max1, pos1_min, delta1)
  */
-            __pyx_v_pos0_min = __pyx_v_min0;
-            goto __pyx_L29;
-          }
-          __pyx_L29:;
-        }
-      }
+          __pyx_v_fbin0_max = __pyx_f_12splitBBoxLUT_getBinNr(__pyx_v_max0, __pyx_v_pos0_min, __pyx_v_delta0);
 
-      /* "splitBBoxLUT.pyx":925
- *     pos0_max=cpos0[0]
+          /* "splitBBoxLUT.pyx":671
+ *                 fbin0_min = getBinNr(min0, pos0_min, delta0)
+ *                 fbin0_max = getBinNr(max0, pos0_min, delta0)
+ *                 fbin1_min = getBinNr(min1, pos1_min, delta1)             # <<<<<<<<<<<<<<
+ *                 fbin1_max = getBinNr(max1, pos1_min, delta1)
  * 
- *     with nogil:             # <<<<<<<<<<<<<<
- *         for idx in range(size):
- *             min0 = cpos0[idx] - dpos0[idx]
  */
-      /*finally:*/ {
-        Py_BLOCK_THREADS
-      }
-  }
+          __pyx_v_fbin1_min = __pyx_f_12splitBBoxLUT_getBinNr(__pyx_v_min1, __pyx_v_pos1_min, __pyx_v_delta1);
 
-  /* "splitBBoxLUT.pyx":936
- *                 pos0_min=min0
+          /* "splitBBoxLUT.pyx":672
+ *                 fbin0_max = getBinNr(max0, pos0_min, delta0)
+ *                 fbin1_min = getBinNr(min1, pos1_min, delta1)
+ *                 fbin1_max = getBinNr(max1, pos1_min, delta1)             # <<<<<<<<<<<<<<
  * 
- *     if (pos0Range is not None) and (len(pos0Range) == 2):             # <<<<<<<<<<<<<<
- *         pos0_min = min(pos0Range)
- *         pos0_maxin = max(pos0Range)
+ *                 bin0_min = <int> fbin0_min
  */
-  __pyx_t_26 = (__pyx_v_pos0Range != Py_None);
-  if (__pyx_t_26) {
-    __pyx_t_36 = PyObject_Length(__pyx_v_pos0Range); if (unlikely(__pyx_t_36 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_5 = (__pyx_t_36 == 2);
-    __pyx_t_25 = __pyx_t_5;
-  } else {
-    __pyx_t_25 = __pyx_t_26;
-  }
-  if (__pyx_t_25) {
+          __pyx_v_fbin1_max = __pyx_f_12splitBBoxLUT_getBinNr(__pyx_v_max1, __pyx_v_pos1_min, __pyx_v_delta1);
 
-    /* "splitBBoxLUT.pyx":937
+          /* "splitBBoxLUT.pyx":674
+ *                 fbin1_max = getBinNr(max1, pos1_min, delta1)
  * 
- *     if (pos0Range is not None) and (len(pos0Range) == 2):
- *         pos0_min = min(pos0Range)             # <<<<<<<<<<<<<<
- *         pos0_maxin = max(pos0Range)
- *     else:
+ *                 bin0_min = <int> fbin0_min             # <<<<<<<<<<<<<<
+ *                 bin0_max = <int> fbin0_max
+ *                 bin1_min = <int> fbin1_min
  */
-    __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
-    __Pyx_INCREF(__pyx_v_pos0Range);
-    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_pos0Range);
-    __Pyx_GIVEREF(__pyx_v_pos0Range);
-    __pyx_t_4 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
-    __pyx_t_37 = __pyx_PyFloat_AsFloat(__pyx_t_4); if (unlikely((__pyx_t_37 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_v_pos0_min = __pyx_t_37;
+          __pyx_v_bin0_min = ((int)__pyx_v_fbin0_min);
 
-    /* "splitBBoxLUT.pyx":938
- *     if (pos0Range is not None) and (len(pos0Range) == 2):
- *         pos0_min = min(pos0Range)
- *         pos0_maxin = max(pos0Range)             # <<<<<<<<<<<<<<
- *     else:
- * #        pos0_min = pos0_min
+          /* "splitBBoxLUT.pyx":675
+ * 
+ *                 bin0_min = <int> fbin0_min
+ *                 bin0_max = <int> fbin0_max             # <<<<<<<<<<<<<<
+ *                 bin1_min = <int> fbin1_min
+ *                 bin1_max = <int> fbin1_max
  */
-    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_INCREF(__pyx_v_pos0Range);
-    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_pos0Range);
-    __Pyx_GIVEREF(__pyx_v_pos0Range);
-    __pyx_t_9 = PyObject_Call(__pyx_builtin_max, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_9);
-    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-    __pyx_t_37 = __pyx_PyFloat_AsFloat(__pyx_t_9); if (unlikely((__pyx_t_37 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-    __pyx_v_pos0_maxin = __pyx_t_37;
-    goto __pyx_L30;
-  }
-  /*else*/ {
+          __pyx_v_bin0_max = ((int)__pyx_v_fbin0_max);
 
-    /* "splitBBoxLUT.pyx":941
- *     else:
- * #        pos0_min = pos0_min
- *         pos0_maxin = pos0_max             # <<<<<<<<<<<<<<
- *     if pos0_min<0:
- *         pos0_min=0
+          /* "splitBBoxLUT.pyx":676
+ *                 bin0_min = <int> fbin0_min
+ *                 bin0_max = <int> fbin0_max
+ *                 bin1_min = <int> fbin1_min             # <<<<<<<<<<<<<<
+ *                 bin1_max = <int> fbin1_max
+ * 
  */
-    __pyx_v_pos0_maxin = __pyx_v_pos0_max;
-  }
-  __pyx_L30:;
+          __pyx_v_bin1_min = ((int)__pyx_v_fbin1_min);
 
-  /* "splitBBoxLUT.pyx":942
- * #        pos0_min = pos0_min
- *         pos0_maxin = pos0_max
- *     if pos0_min<0:             # <<<<<<<<<<<<<<
- *         pos0_min=0
- *     pos0_max = pos0_maxin * EPS32
+          /* "splitBBoxLUT.pyx":677
+ *                 bin0_max = <int> fbin0_max
+ *                 bin1_min = <int> fbin1_min
+ *                 bin1_max = <int> fbin1_max             # <<<<<<<<<<<<<<
+ * 
+ *                 if (bin0_max < 0) or (bin0_min >= bins0) or (bin1_max < 0) or (bin1_min >= bins1):
  */
-  __pyx_t_25 = (__pyx_v_pos0_min < 0.0);
-  if (__pyx_t_25) {
+          __pyx_v_bin1_max = ((int)__pyx_v_fbin1_max);
 
-    /* "splitBBoxLUT.pyx":943
- *         pos0_maxin = pos0_max
- *     if pos0_min<0:
- *         pos0_min=0             # <<<<<<<<<<<<<<
- *     pos0_max = pos0_maxin * EPS32
+          /* "splitBBoxLUT.pyx":679
+ *                 bin1_max = <int> fbin1_max
+ * 
+ *                 if (bin0_max < 0) or (bin0_min >= bins0) or (bin1_max < 0) or (bin1_min >= bins1):             # <<<<<<<<<<<<<<
+ *                     continue
  * 
  */
-    __pyx_v_pos0_min = 0.0;
-    goto __pyx_L31;
-  }
-  __pyx_L31:;
+          __pyx_t_14 = ((__pyx_v_bin0_max < 0) != 0);
+          if (!__pyx_t_14) {
+            __pyx_t_18 = ((__pyx_v_bin0_min >= __pyx_v_bins0) != 0);
+            if (!__pyx_t_18) {
+              __pyx_t_25 = ((__pyx_v_bin1_max < 0) != 0);
+              if (!__pyx_t_25) {
+                __pyx_t_23 = ((__pyx_v_bin1_min >= __pyx_v_bins1) != 0);
+                __pyx_t_24 = __pyx_t_23;
+              } else {
+                __pyx_t_24 = __pyx_t_25;
+              }
+              __pyx_t_25 = __pyx_t_24;
+            } else {
+              __pyx_t_25 = __pyx_t_18;
+            }
+            __pyx_t_18 = __pyx_t_25;
+          } else {
+            __pyx_t_18 = __pyx_t_14;
+          }
+          if (__pyx_t_18) {
 
-  /* "splitBBoxLUT.pyx":944
- *     if pos0_min<0:
- *         pos0_min=0
- *     pos0_max = pos0_maxin * EPS32             # <<<<<<<<<<<<<<
+            /* "splitBBoxLUT.pyx":680
+ * 
+ *                 if (bin0_max < 0) or (bin0_min >= bins0) or (bin1_max < 0) or (bin1_min >= bins1):
+ *                     continue             # <<<<<<<<<<<<<<
  * 
- *     if (pos1Range is not None) and (len(pos1Range) == 2):
+ *                 if bin0_max >= bins0 :
  */
-  __pyx_t_9 = PyFloat_FromDouble(__pyx_v_pos0_maxin); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
-  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__EPS32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_3 = PyNumber_Multiply(__pyx_t_9, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; __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_4); __pyx_t_4 = 0;
-  __pyx_t_37 = __pyx_PyFloat_AsFloat(__pyx_t_3); if (unlikely((__pyx_t_37 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_v_pos0_max = __pyx_t_37;
+            goto __pyx_L25_continue;
+            goto __pyx_L28;
+          }
+          __pyx_L28:;
 
-  /* "splitBBoxLUT.pyx":946
- *     pos0_max = pos0_maxin * EPS32
+          /* "splitBBoxLUT.pyx":682
+ *                     continue
  * 
- *     if (pos1Range is not None) and (len(pos1Range) == 2):             # <<<<<<<<<<<<<<
- *         pos1_min = min(pos1Range)
- *         pos1_maxin = max(pos1Range)
+ *                 if bin0_max >= bins0 :             # <<<<<<<<<<<<<<
+ *                     bin0_max = bins0 - 1
+ *                 if  bin0_min < 0:
  */
-  __pyx_t_25 = (__pyx_v_pos1Range != Py_None);
-  if (__pyx_t_25) {
-    __pyx_t_36 = PyObject_Length(__pyx_v_pos1Range); if (unlikely(__pyx_t_36 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_26 = (__pyx_t_36 == 2);
-    __pyx_t_5 = __pyx_t_26;
-  } else {
-    __pyx_t_5 = __pyx_t_25;
-  }
-  if (__pyx_t_5) {
+          __pyx_t_18 = ((__pyx_v_bin0_max >= __pyx_v_bins0) != 0);
+          if (__pyx_t_18) {
 
-    /* "splitBBoxLUT.pyx":947
+            /* "splitBBoxLUT.pyx":683
  * 
- *     if (pos1Range is not None) and (len(pos1Range) == 2):
- *         pos1_min = min(pos1Range)             # <<<<<<<<<<<<<<
- *         pos1_maxin = max(pos1Range)
- *     else:
+ *                 if bin0_max >= bins0 :
+ *                     bin0_max = bins0 - 1             # <<<<<<<<<<<<<<
+ *                 if  bin0_min < 0:
+ *                     bin0_min = 0
  */
-    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 947; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_INCREF(__pyx_v_pos1Range);
-    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_pos1Range);
-    __Pyx_GIVEREF(__pyx_v_pos1Range);
-    __pyx_t_4 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 947; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-    __pyx_t_37 = __pyx_PyFloat_AsFloat(__pyx_t_4); if (unlikely((__pyx_t_37 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 947; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_v_pos1_min = __pyx_t_37;
+            __pyx_v_bin0_max = (__pyx_v_bins0 - 1);
+            goto __pyx_L29;
+          }
+          __pyx_L29:;
 
-    /* "splitBBoxLUT.pyx":948
- *     if (pos1Range is not None) and (len(pos1Range) == 2):
- *         pos1_min = min(pos1Range)
- *         pos1_maxin = max(pos1Range)             # <<<<<<<<<<<<<<
- *     else:
- *         pos1_min = cpos1.min()
+          /* "splitBBoxLUT.pyx":684
+ *                 if bin0_max >= bins0 :
+ *                     bin0_max = bins0 - 1
+ *                 if  bin0_min < 0:             # <<<<<<<<<<<<<<
+ *                     bin0_min = 0
+ *                 if bin1_max >= bins1 :
  */
-    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_INCREF(__pyx_v_pos1Range);
-    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_pos1Range);
-    __Pyx_GIVEREF(__pyx_v_pos1Range);
-    __pyx_t_3 = PyObject_Call(__pyx_builtin_max, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-    __pyx_t_37 = __pyx_PyFloat_AsFloat(__pyx_t_3); if (unlikely((__pyx_t_37 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_v_pos1_maxin = __pyx_t_37;
-    goto __pyx_L32;
-  }
-  /*else*/ {
+          __pyx_t_18 = ((__pyx_v_bin0_min < 0) != 0);
+          if (__pyx_t_18) {
 
-    /* "splitBBoxLUT.pyx":950
- *         pos1_maxin = max(pos1Range)
- *     else:
- *         pos1_min = cpos1.min()             # <<<<<<<<<<<<<<
- *         pos1_maxin = cpos1.max()
- *     pos1_max = pos1_maxin * EPS32
+            /* "splitBBoxLUT.pyx":685
+ *                     bin0_max = bins0 - 1
+ *                 if  bin0_min < 0:
+ *                     bin0_min = 0             # <<<<<<<<<<<<<<
+ *                 if bin1_max >= bins1 :
+ *                     bin1_max = bins1 - 1
  */
-    __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_cpos1), __pyx_n_s__min); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_37 = __pyx_PyFloat_AsFloat(__pyx_t_4); if (unlikely((__pyx_t_37 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_v_pos1_min = __pyx_t_37;
+            __pyx_v_bin0_min = 0;
+            goto __pyx_L30;
+          }
+          __pyx_L30:;
 
-    /* "splitBBoxLUT.pyx":951
- *     else:
- *         pos1_min = cpos1.min()
- *         pos1_maxin = cpos1.max()             # <<<<<<<<<<<<<<
- *     pos1_max = pos1_maxin * EPS32
+          /* "splitBBoxLUT.pyx":686
+ *                 if  bin0_min < 0:
+ *                     bin0_min = 0
+ *                 if bin1_max >= bins1 :             # <<<<<<<<<<<<<<
+ *                     bin1_max = bins1 - 1
+ *                 if  bin1_min < 0:
+ */
+          __pyx_t_18 = ((__pyx_v_bin1_max >= __pyx_v_bins1) != 0);
+          if (__pyx_t_18) {
+
+            /* "splitBBoxLUT.pyx":687
+ *                     bin0_min = 0
+ *                 if bin1_max >= bins1 :
+ *                     bin1_max = bins1 - 1             # <<<<<<<<<<<<<<
+ *                 if  bin1_min < 0:
+ *                     bin1_min = 0
+ */
+            __pyx_v_bin1_max = (__pyx_v_bins1 - 1);
+            goto __pyx_L31;
+          }
+          __pyx_L31:;
+
+          /* "splitBBoxLUT.pyx":688
+ *                 if bin1_max >= bins1 :
+ *                     bin1_max = bins1 - 1
+ *                 if  bin1_min < 0:             # <<<<<<<<<<<<<<
+ *                     bin1_min = 0
  * 
  */
-    __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_cpos1), __pyx_n_s__max); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_37 = __pyx_PyFloat_AsFloat(__pyx_t_3); if (unlikely((__pyx_t_37 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_v_pos1_maxin = __pyx_t_37;
-  }
-  __pyx_L32:;
+          __pyx_t_18 = ((__pyx_v_bin1_min < 0) != 0);
+          if (__pyx_t_18) {
+
+            /* "splitBBoxLUT.pyx":689
+ *                     bin1_max = bins1 - 1
+ *                 if  bin1_min < 0:
+ *                     bin1_min = 0             # <<<<<<<<<<<<<<
+ * 
+ *                 if bin0_min == bin0_max:
+ */
+            __pyx_v_bin1_min = 0;
+            goto __pyx_L32;
+          }
+          __pyx_L32:;
 
-  /* "splitBBoxLUT.pyx":952
- *         pos1_min = cpos1.min()
- *         pos1_maxin = cpos1.max()
- *     pos1_max = pos1_maxin * EPS32             # <<<<<<<<<<<<<<
+          /* "splitBBoxLUT.pyx":691
+ *                     bin1_min = 0
  * 
- *     delta0 = (pos0_max - pos0_min) / (< float > (bins0))
+ *                 if bin0_min == bin0_max:             # <<<<<<<<<<<<<<
+ *                     if bin1_min == bin1_max:
+ *                         #All pixel is within a single bin
  */
-  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_pos1_maxin); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__EPS32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_9 = PyNumber_Multiply(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __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_4); __pyx_t_4 = 0;
-  __pyx_t_37 = __pyx_PyFloat_AsFloat(__pyx_t_9); if (unlikely((__pyx_t_37 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-  __pyx_v_pos1_max = __pyx_t_37;
+          __pyx_t_18 = ((__pyx_v_bin0_min == __pyx_v_bin0_max) != 0);
+          if (__pyx_t_18) {
 
-  /* "splitBBoxLUT.pyx":954
- *     pos1_max = pos1_maxin * EPS32
+            /* "splitBBoxLUT.pyx":692
  * 
- *     delta0 = (pos0_max - pos0_min) / (< float > (bins0))             # <<<<<<<<<<<<<<
- *     delta1 = (pos1_max - pos1_min) / (< float > (bins1))
- *     edges0 = numpy.linspace(pos0_min+0.5*delta0, pos0_maxin-0.5*delta0, bins0)
+ *                 if bin0_min == bin0_max:
+ *                     if bin1_min == bin1_max:             # <<<<<<<<<<<<<<
+ *                         #All pixel is within a single bin
+ *                         k = outMax[bin0_min, bin1_min]
  */
-  __pyx_v_delta0 = ((__pyx_v_pos0_max - __pyx_v_pos0_min) / ((float)__pyx_v_bins0));
+            __pyx_t_18 = ((__pyx_v_bin1_min == __pyx_v_bin1_max) != 0);
+            if (__pyx_t_18) {
 
-  /* "splitBBoxLUT.pyx":955
- * 
- *     delta0 = (pos0_max - pos0_min) / (< float > (bins0))
- *     delta1 = (pos1_max - pos1_min) / (< float > (bins1))             # <<<<<<<<<<<<<<
- *     edges0 = numpy.linspace(pos0_min+0.5*delta0, pos0_maxin-0.5*delta0, bins0)
- *     edges1 = numpy.linspace(pos1_min+0.5*delta1, pos1_maxin-0.5*delta1, bins1)
+              /* "splitBBoxLUT.pyx":694
+ *                     if bin1_min == bin1_max:
+ *                         #All pixel is within a single bin
+ *                         k = outMax[bin0_min, bin1_min]             # <<<<<<<<<<<<<<
+ *                         lut[bin0_min, bin1_min, k].idx = idx
+ *                         lut[bin0_min, bin1_min, k].coef = 1.0
  */
-  __pyx_v_delta1 = ((__pyx_v_pos1_max - __pyx_v_pos1_min) / ((float)__pyx_v_bins1));
+              __pyx_t_4 = __pyx_v_bin0_min;
+              __pyx_t_43 = __pyx_v_bin1_min;
+              __pyx_v_k = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_43, __pyx_pybuffernd_outMax.diminfo[1].strides));
 
-  /* "splitBBoxLUT.pyx":956
- *     delta0 = (pos0_max - pos0_min) / (< float > (bins0))
- *     delta1 = (pos1_max - pos1_min) / (< float > (bins1))
- *     edges0 = numpy.linspace(pos0_min+0.5*delta0, pos0_maxin-0.5*delta0, bins0)             # <<<<<<<<<<<<<<
- *     edges1 = numpy.linspace(pos1_min+0.5*delta1, pos1_maxin-0.5*delta1, bins1)
- *     with nogil:
+              /* "splitBBoxLUT.pyx":695
+ *                         #All pixel is within a single bin
+ *                         k = outMax[bin0_min, bin1_min]
+ *                         lut[bin0_min, bin1_min, k].idx = idx             # <<<<<<<<<<<<<<
+ *                         lut[bin0_min, bin1_min, k].coef = 1.0
+ *                         outMax[bin0_min, bin1_min]= k+1
  */
-  __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__linspace); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-  __pyx_t_9 = PyFloat_FromDouble((__pyx_v_pos0_min + (0.5 * __pyx_v_delta0))); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
-  __pyx_t_3 = PyFloat_FromDouble((__pyx_v_pos0_maxin - (0.5 * __pyx_v_delta0))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_1 = PyInt_FromLong(__pyx_v_bins0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_13 = PyTuple_New(3); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_13);
-  PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_9);
-  __Pyx_GIVEREF(__pyx_t_9);
-  PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_3);
-  __Pyx_GIVEREF(__pyx_t_3);
-  PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_t_1);
-  __Pyx_GIVEREF(__pyx_t_1);
-  __pyx_t_9 = 0;
-  __pyx_t_3 = 0;
-  __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
-  __pyx_v_edges0 = __pyx_t_1;
-  __pyx_t_1 = 0;
+              __pyx_t_44 = __pyx_v_bin0_min;
+              __pyx_t_45 = __pyx_v_bin1_min;
+              __pyx_t_46 = __pyx_v_k;
+              (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_45, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_46, __pyx_pybuffernd_lut.diminfo[2].strides)).idx = __pyx_v_idx;
 
-  /* "splitBBoxLUT.pyx":957
- *     delta1 = (pos1_max - pos1_min) / (< float > (bins1))
- *     edges0 = numpy.linspace(pos0_min+0.5*delta0, pos0_maxin-0.5*delta0, bins0)
- *     edges1 = numpy.linspace(pos1_min+0.5*delta1, pos1_maxin-0.5*delta1, bins1)             # <<<<<<<<<<<<<<
- *     with nogil:
- *         for idx in range(size):
+              /* "splitBBoxLUT.pyx":696
+ *                         k = outMax[bin0_min, bin1_min]
+ *                         lut[bin0_min, bin1_min, k].idx = idx
+ *                         lut[bin0_min, bin1_min, k].coef = 1.0             # <<<<<<<<<<<<<<
+ *                         outMax[bin0_min, bin1_min]= k+1
+ * 
  */
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_13 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__linspace); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_13);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyFloat_FromDouble((__pyx_v_pos1_min + (0.5 * __pyx_v_delta1))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyFloat_FromDouble((__pyx_v_pos1_maxin - (0.5 * __pyx_v_delta1))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_3 = PyInt_FromLong(__pyx_v_bins1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
-  PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_1);
-  __Pyx_GIVEREF(__pyx_t_1);
-  PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_4);
-  __Pyx_GIVEREF(__pyx_t_4);
-  PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_3);
-  __Pyx_GIVEREF(__pyx_t_3);
-  __pyx_t_1 = 0;
-  __pyx_t_4 = 0;
-  __pyx_t_3 = 0;
-  __pyx_t_3 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __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_v_edges1 = __pyx_t_3;
-  __pyx_t_3 = 0;
+              __pyx_t_47 = __pyx_v_bin0_min;
+              __pyx_t_48 = __pyx_v_bin1_min;
+              __pyx_t_49 = __pyx_v_k;
+              (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_47, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_48, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_49, __pyx_pybuffernd_lut.diminfo[2].strides)).coef = 1.0;
 
-  /* "splitBBoxLUT.pyx":958
- *     edges0 = numpy.linspace(pos0_min+0.5*delta0, pos0_maxin-0.5*delta0, bins0)
- *     edges1 = numpy.linspace(pos1_min+0.5*delta1, pos1_maxin-0.5*delta1, bins1)
- *     with nogil:             # <<<<<<<<<<<<<<
- *         for idx in range(size):
- *             if (check_mask) and cmask[idx]:
+              /* "splitBBoxLUT.pyx":697
+ *                         lut[bin0_min, bin1_min, k].idx = idx
+ *                         lut[bin0_min, bin1_min, k].coef = 1.0
+ *                         outMax[bin0_min, bin1_min]= k+1             # <<<<<<<<<<<<<<
+ * 
+ *                     else:
  */
-  {
-      #ifdef WITH_THREAD
-      PyThreadState *_save = NULL;
-      #endif
-      Py_UNBLOCK_THREADS
-      /*try:*/ {
+              __pyx_t_50 = __pyx_v_bin0_min;
+              __pyx_t_51 = __pyx_v_bin1_min;
+              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_50, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_51, __pyx_pybuffernd_outMax.diminfo[1].strides) = (__pyx_v_k + 1);
+              goto __pyx_L34;
+            }
+            /*else*/ {
 
-        /* "splitBBoxLUT.pyx":959
- *     edges1 = numpy.linspace(pos1_min+0.5*delta1, pos1_maxin-0.5*delta1, bins1)
- *     with nogil:
- *         for idx in range(size):             # <<<<<<<<<<<<<<
- *             if (check_mask) and cmask[idx]:
- *                 continue
+              /* "splitBBoxLUT.pyx":701
+ *                     else:
+ *                         #spread on more than 2 bins
+ *                         deltaD = (< float > (bin1_min + 1)) - fbin1_min             # <<<<<<<<<<<<<<
+ *                         deltaU = fbin1_max - ( bin1_max)
+ *                         deltaA = 1.0 / (fbin1_max - fbin1_min)
  */
-        __pyx_t_2 = __pyx_v_size;
-        for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_2; __pyx_t_12+=1) {
-          __pyx_v_idx = __pyx_t_12;
+              __pyx_v_deltaD = (((float)(__pyx_v_bin1_min + 1)) - __pyx_v_fbin1_min);
 
-          /* "splitBBoxLUT.pyx":960
- *     with nogil:
- *         for idx in range(size):
- *             if (check_mask) and cmask[idx]:             # <<<<<<<<<<<<<<
- *                 continue
+              /* "splitBBoxLUT.pyx":702
+ *                         #spread on more than 2 bins
+ *                         deltaD = (< float > (bin1_min + 1)) - fbin1_min
+ *                         deltaU = fbin1_max - ( bin1_max)             # <<<<<<<<<<<<<<
+ *                         deltaA = 1.0 / (fbin1_max - fbin1_min)
  * 
  */
-          __pyx_t_5 = __pyx_v_check_mask;
-          if (__pyx_t_5) {
-            if (unlikely(!__pyx_v_cmask.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cmask"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 960; __pyx_clineno = __LINE__; goto __pyx_L34;} }
-            __pyx_t_38 = __pyx_v_idx;
-            __pyx_t_25 = (*((__pyx_t_5numpy_int8_t *) ( /* dim=0 */ (__pyx_v_cmask.data + __pyx_t_38 * __pyx_v_cmask.strides[0]) )));
-          } else {
-            __pyx_t_25 = __pyx_t_5;
-          }
-          if (__pyx_t_25) {
+              __pyx_v_deltaU = (__pyx_v_fbin1_max - __pyx_v_bin1_max);
 
-            /* "splitBBoxLUT.pyx":961
- *         for idx in range(size):
- *             if (check_mask) and cmask[idx]:
- *                 continue             # <<<<<<<<<<<<<<
+              /* "splitBBoxLUT.pyx":703
+ *                         deltaD = (< float > (bin1_min + 1)) - fbin1_min
+ *                         deltaU = fbin1_max - ( bin1_max)
+ *                         deltaA = 1.0 / (fbin1_max - fbin1_min)             # <<<<<<<<<<<<<<
  * 
- *             data = cdata[idx]
+ *                         k = outMax[bin0_min, bin1_min]
  */
-            goto __pyx_L36_continue;
-            goto __pyx_L38;
-          }
-          __pyx_L38:;
+              __pyx_v_deltaA = (1.0 / (__pyx_v_fbin1_max - __pyx_v_fbin1_min));
 
-          /* "splitBBoxLUT.pyx":963
- *                 continue
+              /* "splitBBoxLUT.pyx":705
+ *                         deltaA = 1.0 / (fbin1_max - fbin1_min)
  * 
- *             data = cdata[idx]             # <<<<<<<<<<<<<<
- *             if (check_dummy) and (fabs(data-cdummy)<=ddummy):
- *                 continue
+ *                         k = outMax[bin0_min, bin1_min]             # <<<<<<<<<<<<<<
+ *                         lut[bin0_min, bin1_min, k].idx = idx
+ *                         lut[bin0_min, bin1_min, k].coef =  deltaA * deltaD
  */
-          __pyx_t_39 = __pyx_v_idx;
-          __pyx_v_data = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cdata.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_cdata.diminfo[0].strides));
+              __pyx_t_52 = __pyx_v_bin0_min;
+              __pyx_t_53 = __pyx_v_bin1_min;
+              __pyx_v_k = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_52, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_53, __pyx_pybuffernd_outMax.diminfo[1].strides));
 
-          /* "splitBBoxLUT.pyx":964
- * 
- *             data = cdata[idx]
- *             if (check_dummy) and (fabs(data-cdummy)<=ddummy):             # <<<<<<<<<<<<<<
- *                 continue
+              /* "splitBBoxLUT.pyx":706
  * 
+ *                         k = outMax[bin0_min, bin1_min]
+ *                         lut[bin0_min, bin1_min, k].idx = idx             # <<<<<<<<<<<<<<
+ *                         lut[bin0_min, bin1_min, k].coef =  deltaA * deltaD
+ *                         outMax[bin0_min, bin1_min] = k + 1
  */
-          if (__pyx_v_check_dummy) {
-            __pyx_t_25 = (fabs((__pyx_v_data - __pyx_v_cdummy)) <= __pyx_v_ddummy);
-            __pyx_t_5 = __pyx_t_25;
-          } else {
-            __pyx_t_5 = __pyx_v_check_dummy;
-          }
-          if (__pyx_t_5) {
+              __pyx_t_54 = __pyx_v_bin0_min;
+              __pyx_t_55 = __pyx_v_bin1_min;
+              __pyx_t_56 = __pyx_v_k;
+              (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_54, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_55, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_56, __pyx_pybuffernd_lut.diminfo[2].strides)).idx = __pyx_v_idx;
 
-            /* "splitBBoxLUT.pyx":965
- *             data = cdata[idx]
- *             if (check_dummy) and (fabs(data-cdummy)<=ddummy):
- *                 continue             # <<<<<<<<<<<<<<
+              /* "splitBBoxLUT.pyx":707
+ *                         k = outMax[bin0_min, bin1_min]
+ *                         lut[bin0_min, bin1_min, k].idx = idx
+ *                         lut[bin0_min, bin1_min, k].coef =  deltaA * deltaD             # <<<<<<<<<<<<<<
+ *                         outMax[bin0_min, bin1_min] = k + 1
  * 
- *             if do_dark:
  */
-            goto __pyx_L36_continue;
-            goto __pyx_L39;
-          }
-          __pyx_L39:;
+              __pyx_t_57 = __pyx_v_bin0_min;
+              __pyx_t_58 = __pyx_v_bin1_min;
+              __pyx_t_59 = __pyx_v_k;
+              (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_57, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_58, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_59, __pyx_pybuffernd_lut.diminfo[2].strides)).coef = (__pyx_v_deltaA * __pyx_v_deltaD);
 
-          /* "splitBBoxLUT.pyx":967
- *                 continue
+              /* "splitBBoxLUT.pyx":708
+ *                         lut[bin0_min, bin1_min, k].idx = idx
+ *                         lut[bin0_min, bin1_min, k].coef =  deltaA * deltaD
+ *                         outMax[bin0_min, bin1_min] = k + 1             # <<<<<<<<<<<<<<
  * 
- *             if do_dark:             # <<<<<<<<<<<<<<
- *                 data -= cdark[idx]
- *             if do_flat:
+ *                         k = outMax[bin0_min, bin1_max]
  */
-          if (__pyx_v_do_dark) {
+              __pyx_t_60 = __pyx_v_bin0_min;
+              __pyx_t_61 = __pyx_v_bin1_min;
+              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_60, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_61, __pyx_pybuffernd_outMax.diminfo[1].strides) = (__pyx_v_k + 1);
 
-            /* "splitBBoxLUT.pyx":968
+              /* "splitBBoxLUT.pyx":710
+ *                         outMax[bin0_min, bin1_min] = k + 1
  * 
- *             if do_dark:
- *                 data -= cdark[idx]             # <<<<<<<<<<<<<<
- *             if do_flat:
- *                 data /= cflat[idx]
+ *                         k = outMax[bin0_min, bin1_max]             # <<<<<<<<<<<<<<
+ *                         lut[bin0_min, bin1_max, k].idx = idx
+ *                         lut[bin0_min, bin1_max, k].coef =  deltaA * deltaU
  */
-            if (unlikely(!__pyx_v_cdark.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cdark"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L34;} }
-            __pyx_t_40 = __pyx_v_idx;
-            __pyx_v_data = (__pyx_v_data - (*((float *) ( /* dim=0 */ (__pyx_v_cdark.data + __pyx_t_40 * __pyx_v_cdark.strides[0]) ))));
-            goto __pyx_L40;
-          }
-          __pyx_L40:;
-
-          /* "splitBBoxLUT.pyx":969
- *             if do_dark:
- *                 data -= cdark[idx]
- *             if do_flat:             # <<<<<<<<<<<<<<
- *                 data /= cflat[idx]
- *             if do_polarization:
- */
-          if (__pyx_v_do_flat) {
-
-            /* "splitBBoxLUT.pyx":970
- *                 data -= cdark[idx]
- *             if do_flat:
- *                 data /= cflat[idx]             # <<<<<<<<<<<<<<
- *             if do_polarization:
- *                 data /= cpolarization[idx]
- */
-            if (unlikely(!__pyx_v_cflat.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cflat"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L34;} }
-            __pyx_t_41 = __pyx_v_idx;
-            __pyx_v_data = (__pyx_v_data / (*((float *) ( /* dim=0 */ (__pyx_v_cflat.data + __pyx_t_41 * __pyx_v_cflat.strides[0]) ))));
-            goto __pyx_L41;
-          }
-          __pyx_L41:;
-
-          /* "splitBBoxLUT.pyx":971
- *             if do_flat:
- *                 data /= cflat[idx]
- *             if do_polarization:             # <<<<<<<<<<<<<<
- *                 data /= cpolarization[idx]
- *             if do_solidangle:
- */
-          if (__pyx_v_do_polarization) {
-
-            /* "splitBBoxLUT.pyx":972
- *                 data /= cflat[idx]
- *             if do_polarization:
- *                 data /= cpolarization[idx]             # <<<<<<<<<<<<<<
- *             if do_solidangle:
- *                 data /= csolidangle[idx]
- */
-            if (unlikely(!__pyx_v_cpolarization.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cpolarization"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L34;} }
-            __pyx_t_42 = __pyx_v_idx;
-            __pyx_v_data = (__pyx_v_data / (*((float *) ( /* dim=0 */ (__pyx_v_cpolarization.data + __pyx_t_42 * __pyx_v_cpolarization.strides[0]) ))));
-            goto __pyx_L42;
-          }
-          __pyx_L42:;
+              __pyx_t_62 = __pyx_v_bin0_min;
+              __pyx_t_63 = __pyx_v_bin1_max;
+              __pyx_v_k = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_62, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_63, __pyx_pybuffernd_outMax.diminfo[1].strides));
 
-          /* "splitBBoxLUT.pyx":973
- *             if do_polarization:
- *                 data /= cpolarization[idx]
- *             if do_solidangle:             # <<<<<<<<<<<<<<
- *                 data /= csolidangle[idx]
+              /* "splitBBoxLUT.pyx":711
  * 
+ *                         k = outMax[bin0_min, bin1_max]
+ *                         lut[bin0_min, bin1_max, k].idx = idx             # <<<<<<<<<<<<<<
+ *                         lut[bin0_min, bin1_max, k].coef =  deltaA * deltaU
+ *                         outMax[bin0_min, bin1_max] = k + 1
  */
-          if (__pyx_v_do_solidangle) {
+              __pyx_t_64 = __pyx_v_bin0_min;
+              __pyx_t_65 = __pyx_v_bin1_max;
+              __pyx_t_66 = __pyx_v_k;
+              (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_64, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_65, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_66, __pyx_pybuffernd_lut.diminfo[2].strides)).idx = __pyx_v_idx;
 
-            /* "splitBBoxLUT.pyx":974
- *                 data /= cpolarization[idx]
- *             if do_solidangle:
- *                 data /= csolidangle[idx]             # <<<<<<<<<<<<<<
+              /* "splitBBoxLUT.pyx":712
+ *                         k = outMax[bin0_min, bin1_max]
+ *                         lut[bin0_min, bin1_max, k].idx = idx
+ *                         lut[bin0_min, bin1_max, k].coef =  deltaA * deltaU             # <<<<<<<<<<<<<<
+ *                         outMax[bin0_min, bin1_max] = k + 1
  * 
- *             min0 = cpos0_lower[idx]
  */
-            if (unlikely(!__pyx_v_csolidangle.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("csolidangle"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 974; __pyx_clineno = __LINE__; goto __pyx_L34;} }
-            __pyx_t_43 = __pyx_v_idx;
-            __pyx_v_data = (__pyx_v_data / (*((float *) ( /* dim=0 */ (__pyx_v_csolidangle.data + __pyx_t_43 * __pyx_v_csolidangle.strides[0]) ))));
-            goto __pyx_L43;
-          }
-          __pyx_L43:;
+              __pyx_t_67 = __pyx_v_bin0_min;
+              __pyx_t_68 = __pyx_v_bin1_max;
+              __pyx_t_69 = __pyx_v_k;
+              (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_67, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_68, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_69, __pyx_pybuffernd_lut.diminfo[2].strides)).coef = (__pyx_v_deltaA * __pyx_v_deltaU);
 
-          /* "splitBBoxLUT.pyx":976
- *                 data /= csolidangle[idx]
+              /* "splitBBoxLUT.pyx":713
+ *                         lut[bin0_min, bin1_max, k].idx = idx
+ *                         lut[bin0_min, bin1_max, k].coef =  deltaA * deltaU
+ *                         outMax[bin0_min, bin1_max] = k + 1             # <<<<<<<<<<<<<<
  * 
- *             min0 = cpos0_lower[idx]             # <<<<<<<<<<<<<<
- *             max0 = cpos0_upper[idx]
- *             min1 = cpos1[idx] - dpos1[idx]
+ *                         for j in range(bin1_min + 1, bin1_max):
  */
-          __pyx_t_44 = __pyx_v_idx;
-          __pyx_v_min0 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cpos0_lower.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_cpos0_lower.diminfo[0].strides));
+              __pyx_t_70 = __pyx_v_bin0_min;
+              __pyx_t_71 = __pyx_v_bin1_max;
+              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_70, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_71, __pyx_pybuffernd_outMax.diminfo[1].strides) = (__pyx_v_k + 1);
 
-          /* "splitBBoxLUT.pyx":977
+              /* "splitBBoxLUT.pyx":715
+ *                         outMax[bin0_min, bin1_max] = k + 1
  * 
- *             min0 = cpos0_lower[idx]
- *             max0 = cpos0_upper[idx]             # <<<<<<<<<<<<<<
- *             min1 = cpos1[idx] - dpos1[idx]
- *             max1 = cpos1[idx] + dpos1[idx]
+ *                         for j in range(bin1_min + 1, bin1_max):             # <<<<<<<<<<<<<<
+ *                             k = outMax[bin0_min, j]
+ *                             lut[bin0_min, j, k].idx = idx
  */
-          __pyx_t_45 = __pyx_v_idx;
-          __pyx_v_max0 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cpos0_upper.rcbuffer->pybuffer.buf, __pyx_t_45, __pyx_pybuffernd_cpos0_upper.diminfo[0].strides));
+              __pyx_t_72 = __pyx_v_bin1_max;
+              for (__pyx_t_73 = (__pyx_v_bin1_min + 1); __pyx_t_73 < __pyx_t_72; __pyx_t_73+=1) {
+                __pyx_v_j = __pyx_t_73;
 
-          /* "splitBBoxLUT.pyx":978
- *             min0 = cpos0_lower[idx]
- *             max0 = cpos0_upper[idx]
- *             min1 = cpos1[idx] - dpos1[idx]             # <<<<<<<<<<<<<<
- *             max1 = cpos1[idx] + dpos1[idx]
+                /* "splitBBoxLUT.pyx":716
  * 
+ *                         for j in range(bin1_min + 1, bin1_max):
+ *                             k = outMax[bin0_min, j]             # <<<<<<<<<<<<<<
+ *                             lut[bin0_min, j, k].idx = idx
+ *                             lut[bin0_min, j, k].coef =  deltaA
  */
-          __pyx_t_46 = __pyx_v_idx;
-          __pyx_t_47 = __pyx_v_idx;
-          __pyx_v_min1 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cpos1.rcbuffer->pybuffer.buf, __pyx_t_46, __pyx_pybuffernd_cpos1.diminfo[0].strides)) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_dpos1.rcbuffer->pybuffer.buf, __pyx_t_47, __pyx_pybuffernd_dpos1.diminfo[0].strides)));
+                __pyx_t_74 = __pyx_v_bin0_min;
+                __pyx_t_75 = __pyx_v_j;
+                __pyx_v_k = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_74, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_75, __pyx_pybuffernd_outMax.diminfo[1].strides));
 
-          /* "splitBBoxLUT.pyx":979
- *             max0 = cpos0_upper[idx]
- *             min1 = cpos1[idx] - dpos1[idx]
- *             max1 = cpos1[idx] + dpos1[idx]             # <<<<<<<<<<<<<<
- * 
- *             if (max0 < pos0_min) or (max1 < pos1_min) or (min0 > pos0_maxin) or (min1 > pos1_maxin) :
+                /* "splitBBoxLUT.pyx":717
+ *                         for j in range(bin1_min + 1, bin1_max):
+ *                             k = outMax[bin0_min, j]
+ *                             lut[bin0_min, j, k].idx = idx             # <<<<<<<<<<<<<<
+ *                             lut[bin0_min, j, k].coef =  deltaA
+ *                             outMax[bin0_min, j] = k + 1
  */
-          __pyx_t_48 = __pyx_v_idx;
-          __pyx_t_49 = __pyx_v_idx;
-          __pyx_v_max1 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_cpos1.rcbuffer->pybuffer.buf, __pyx_t_48, __pyx_pybuffernd_cpos1.diminfo[0].strides)) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_dpos1.rcbuffer->pybuffer.buf, __pyx_t_49, __pyx_pybuffernd_dpos1.diminfo[0].strides)));
+                __pyx_t_76 = __pyx_v_bin0_min;
+                __pyx_t_77 = __pyx_v_j;
+                __pyx_t_78 = __pyx_v_k;
+                (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_76, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_77, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_78, __pyx_pybuffernd_lut.diminfo[2].strides)).idx = __pyx_v_idx;
 
-          /* "splitBBoxLUT.pyx":981
- *             max1 = cpos1[idx] + dpos1[idx]
+                /* "splitBBoxLUT.pyx":718
+ *                             k = outMax[bin0_min, j]
+ *                             lut[bin0_min, j, k].idx = idx
+ *                             lut[bin0_min, j, k].coef =  deltaA             # <<<<<<<<<<<<<<
+ *                             outMax[bin0_min, j] = k + 1
  * 
- *             if (max0 < pos0_min) or (max1 < pos1_min) or (min0 > pos0_maxin) or (min1 > pos1_maxin) :             # <<<<<<<<<<<<<<
- *                 continue
+ */
+                __pyx_t_79 = __pyx_v_bin0_min;
+                __pyx_t_80 = __pyx_v_j;
+                __pyx_t_81 = __pyx_v_k;
+                (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_79, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_80, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_81, __pyx_pybuffernd_lut.diminfo[2].strides)).coef = __pyx_v_deltaA;
+
+                /* "splitBBoxLUT.pyx":719
+ *                             lut[bin0_min, j, k].idx = idx
+ *                             lut[bin0_min, j, k].coef =  deltaA
+ *                             outMax[bin0_min, j] = k + 1             # <<<<<<<<<<<<<<
  * 
+ *                 else: #spread on more than 2 bins in dim 0
  */
-          __pyx_t_5 = (__pyx_v_max0 < __pyx_v_pos0_min);
-          if (!__pyx_t_5) {
-            __pyx_t_25 = (__pyx_v_max1 < __pyx_v_pos1_min);
-            if (!__pyx_t_25) {
-              __pyx_t_26 = (__pyx_v_min0 > __pyx_v_pos0_maxin);
-              if (!__pyx_t_26) {
-                __pyx_t_50 = (__pyx_v_min1 > __pyx_v_pos1_maxin);
-                __pyx_t_51 = __pyx_t_50;
-              } else {
-                __pyx_t_51 = __pyx_t_26;
+                __pyx_t_82 = __pyx_v_bin0_min;
+                __pyx_t_83 = __pyx_v_j;
+                *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_82, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_83, __pyx_pybuffernd_outMax.diminfo[1].strides) = (__pyx_v_k + 1);
               }
-              __pyx_t_26 = __pyx_t_51;
-            } else {
-              __pyx_t_26 = __pyx_t_25;
             }
-            __pyx_t_25 = __pyx_t_26;
-          } else {
-            __pyx_t_25 = __pyx_t_5;
+            __pyx_L34:;
+            goto __pyx_L33;
           }
-          if (__pyx_t_25) {
+          /*else*/ {
 
-            /* "splitBBoxLUT.pyx":982
+            /* "splitBBoxLUT.pyx":722
  * 
- *             if (max0 < pos0_min) or (max1 < pos1_min) or (min0 > pos0_maxin) or (min1 > pos1_maxin) :
- *                 continue             # <<<<<<<<<<<<<<
+ *                 else: #spread on more than 2 bins in dim 0
+ *                     if bin1_min == bin1_max:             # <<<<<<<<<<<<<<
+ *                         #All pixel fall on 1 bins in dim 1
+ *                         deltaA = 1.0 / (fbin0_max - fbin0_min)
+ */
+            __pyx_t_18 = ((__pyx_v_bin1_min == __pyx_v_bin1_max) != 0);
+            if (__pyx_t_18) {
+
+              /* "splitBBoxLUT.pyx":724
+ *                     if bin1_min == bin1_max:
+ *                         #All pixel fall on 1 bins in dim 1
+ *                         deltaA = 1.0 / (fbin0_max - fbin0_min)             # <<<<<<<<<<<<<<
+ *                         deltaL = (< float > (bin0_min + 1)) - fbin0_min
  * 
- *             if min0 < pos0_min:
  */
-            goto __pyx_L36_continue;
-            goto __pyx_L44;
-          }
-          __pyx_L44:;
+              __pyx_v_deltaA = (1.0 / (__pyx_v_fbin0_max - __pyx_v_fbin0_min));
+
+              /* "splitBBoxLUT.pyx":725
+ *                         #All pixel fall on 1 bins in dim 1
+ *                         deltaA = 1.0 / (fbin0_max - fbin0_min)
+ *                         deltaL = (< float > (bin0_min + 1)) - fbin0_min             # <<<<<<<<<<<<<<
+ * 
+ *                         k = outMax[bin0_min, bin1_min]
+ */
+              __pyx_v_deltaL = (((float)(__pyx_v_bin0_min + 1)) - __pyx_v_fbin0_min);
 
-          /* "splitBBoxLUT.pyx":984
- *                 continue
+              /* "splitBBoxLUT.pyx":727
+ *                         deltaL = (< float > (bin0_min + 1)) - fbin0_min
  * 
- *             if min0 < pos0_min:             # <<<<<<<<<<<<<<
- *                 min0 = pos0_min
- *             if min1 < pos1_min:
+ *                         k = outMax[bin0_min, bin1_min]             # <<<<<<<<<<<<<<
+ *                         lut[bin0_min, bin1_min, k].idx = idx
+ *                         lut[bin0_min, bin1_min, k].coef =  deltaA * deltaL
  */
-          __pyx_t_25 = (__pyx_v_min0 < __pyx_v_pos0_min);
-          if (__pyx_t_25) {
+              __pyx_t_72 = __pyx_v_bin0_min;
+              __pyx_t_84 = __pyx_v_bin1_min;
+              __pyx_v_k = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_72, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_84, __pyx_pybuffernd_outMax.diminfo[1].strides));
 
-            /* "splitBBoxLUT.pyx":985
+              /* "splitBBoxLUT.pyx":728
  * 
- *             if min0 < pos0_min:
- *                 min0 = pos0_min             # <<<<<<<<<<<<<<
- *             if min1 < pos1_min:
- *                 min1 = pos1_min
+ *                         k = outMax[bin0_min, bin1_min]
+ *                         lut[bin0_min, bin1_min, k].idx = idx             # <<<<<<<<<<<<<<
+ *                         lut[bin0_min, bin1_min, k].coef =  deltaA * deltaL
+ *                         outMax[bin0_min, bin1_min] = k+1
  */
-            __pyx_v_min0 = __pyx_v_pos0_min;
-            goto __pyx_L45;
-          }
-          __pyx_L45:;
-
-          /* "splitBBoxLUT.pyx":986
- *             if min0 < pos0_min:
- *                 min0 = pos0_min
- *             if min1 < pos1_min:             # <<<<<<<<<<<<<<
- *                 min1 = pos1_min
- *             if max0 > pos0_maxin:
- */
-          __pyx_t_25 = (__pyx_v_min1 < __pyx_v_pos1_min);
-          if (__pyx_t_25) {
-
-            /* "splitBBoxLUT.pyx":987
- *                 min0 = pos0_min
- *             if min1 < pos1_min:
- *                 min1 = pos1_min             # <<<<<<<<<<<<<<
- *             if max0 > pos0_maxin:
- *                 max0 = pos0_maxin
- */
-            __pyx_v_min1 = __pyx_v_pos1_min;
-            goto __pyx_L46;
-          }
-          __pyx_L46:;
-
-          /* "splitBBoxLUT.pyx":988
- *             if min1 < pos1_min:
- *                 min1 = pos1_min
- *             if max0 > pos0_maxin:             # <<<<<<<<<<<<<<
- *                 max0 = pos0_maxin
- *             if max1 > pos1_maxin:
- */
-          __pyx_t_25 = (__pyx_v_max0 > __pyx_v_pos0_maxin);
-          if (__pyx_t_25) {
-
-            /* "splitBBoxLUT.pyx":989
- *                 min1 = pos1_min
- *             if max0 > pos0_maxin:
- *                 max0 = pos0_maxin             # <<<<<<<<<<<<<<
- *             if max1 > pos1_maxin:
- *                 max1 = pos1_maxin
- */
-            __pyx_v_max0 = __pyx_v_pos0_maxin;
-            goto __pyx_L47;
-          }
-          __pyx_L47:;
+              __pyx_t_85 = __pyx_v_bin0_min;
+              __pyx_t_86 = __pyx_v_bin1_min;
+              __pyx_t_73 = __pyx_v_k;
+              (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_85, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_86, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_73, __pyx_pybuffernd_lut.diminfo[2].strides)).idx = __pyx_v_idx;
 
-          /* "splitBBoxLUT.pyx":990
- *             if max0 > pos0_maxin:
- *                 max0 = pos0_maxin
- *             if max1 > pos1_maxin:             # <<<<<<<<<<<<<<
- *                 max1 = pos1_maxin
+              /* "splitBBoxLUT.pyx":729
+ *                         k = outMax[bin0_min, bin1_min]
+ *                         lut[bin0_min, bin1_min, k].idx = idx
+ *                         lut[bin0_min, bin1_min, k].coef =  deltaA * deltaL             # <<<<<<<<<<<<<<
+ *                         outMax[bin0_min, bin1_min] = k+1
  * 
  */
-          __pyx_t_25 = (__pyx_v_max1 > __pyx_v_pos1_maxin);
-          if (__pyx_t_25) {
+              __pyx_t_87 = __pyx_v_bin0_min;
+              __pyx_t_88 = __pyx_v_bin1_min;
+              __pyx_t_89 = __pyx_v_k;
+              (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_87, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_88, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_89, __pyx_pybuffernd_lut.diminfo[2].strides)).coef = (__pyx_v_deltaA * __pyx_v_deltaL);
 
-            /* "splitBBoxLUT.pyx":991
- *                 max0 = pos0_maxin
- *             if max1 > pos1_maxin:
- *                 max1 = pos1_maxin             # <<<<<<<<<<<<<<
- * 
+              /* "splitBBoxLUT.pyx":730
+ *                         lut[bin0_min, bin1_min, k].idx = idx
+ *                         lut[bin0_min, bin1_min, k].coef =  deltaA * deltaL
+ *                         outMax[bin0_min, bin1_min] = k+1             # <<<<<<<<<<<<<<
  * 
+ *                         deltaR = fbin0_max - (< float > bin0_max)
  */
-            __pyx_v_max1 = __pyx_v_pos1_maxin;
-            goto __pyx_L48;
-          }
-          __pyx_L48:;
+              __pyx_t_90 = __pyx_v_bin0_min;
+              __pyx_t_91 = __pyx_v_bin1_min;
+              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_90, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_91, __pyx_pybuffernd_outMax.diminfo[1].strides) = (__pyx_v_k + 1);
 
-          /* "splitBBoxLUT.pyx":994
+              /* "splitBBoxLUT.pyx":732
+ *                         outMax[bin0_min, bin1_min] = k+1
  * 
+ *                         deltaR = fbin0_max - (< float > bin0_max)             # <<<<<<<<<<<<<<
  * 
- *             fbin0_min = getBinNr(min0, pos0_min, delta0)             # <<<<<<<<<<<<<<
- *             fbin0_max = getBinNr(max0, pos0_min, delta0)
- *             fbin1_min = getBinNr(min1, pos1_min, delta1)
+ *                         k = outMax[bin0_max, bin1_min]
  */
-          __pyx_v_fbin0_min = __pyx_f_12splitBBoxLUT_getBinNr(__pyx_v_min0, __pyx_v_pos0_min, __pyx_v_delta0);
+              __pyx_v_deltaR = (__pyx_v_fbin0_max - ((float)__pyx_v_bin0_max));
 
-          /* "splitBBoxLUT.pyx":995
+              /* "splitBBoxLUT.pyx":734
+ *                         deltaR = fbin0_max - (< float > bin0_max)
  * 
- *             fbin0_min = getBinNr(min0, pos0_min, delta0)
- *             fbin0_max = getBinNr(max0, pos0_min, delta0)             # <<<<<<<<<<<<<<
- *             fbin1_min = getBinNr(min1, pos1_min, delta1)
- *             fbin1_max = getBinNr(max1, pos1_min, delta1)
+ *                         k = outMax[bin0_max, bin1_min]             # <<<<<<<<<<<<<<
+ *                         lut[bin0_max, bin1_min, k].idx = idx
+ *                         lut[bin0_max, bin1_min, k].coef =  deltaA * deltaR
  */
-          __pyx_v_fbin0_max = __pyx_f_12splitBBoxLUT_getBinNr(__pyx_v_max0, __pyx_v_pos0_min, __pyx_v_delta0);
+              __pyx_t_92 = __pyx_v_bin0_max;
+              __pyx_t_93 = __pyx_v_bin1_min;
+              __pyx_v_k = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_92, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_93, __pyx_pybuffernd_outMax.diminfo[1].strides));
 
-          /* "splitBBoxLUT.pyx":996
- *             fbin0_min = getBinNr(min0, pos0_min, delta0)
- *             fbin0_max = getBinNr(max0, pos0_min, delta0)
- *             fbin1_min = getBinNr(min1, pos1_min, delta1)             # <<<<<<<<<<<<<<
- *             fbin1_max = getBinNr(max1, pos1_min, delta1)
+              /* "splitBBoxLUT.pyx":735
  * 
+ *                         k = outMax[bin0_max, bin1_min]
+ *                         lut[bin0_max, bin1_min, k].idx = idx             # <<<<<<<<<<<<<<
+ *                         lut[bin0_max, bin1_min, k].coef =  deltaA * deltaR
+ *                         outMax[bin0_max, bin1_min] = k + 1
  */
-          __pyx_v_fbin1_min = __pyx_f_12splitBBoxLUT_getBinNr(__pyx_v_min1, __pyx_v_pos1_min, __pyx_v_delta1);
+              __pyx_t_94 = __pyx_v_bin0_max;
+              __pyx_t_95 = __pyx_v_bin1_min;
+              __pyx_t_96 = __pyx_v_k;
+              (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_94, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_95, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_96, __pyx_pybuffernd_lut.diminfo[2].strides)).idx = __pyx_v_idx;
 
-          /* "splitBBoxLUT.pyx":997
- *             fbin0_max = getBinNr(max0, pos0_min, delta0)
- *             fbin1_min = getBinNr(min1, pos1_min, delta1)
- *             fbin1_max = getBinNr(max1, pos1_min, delta1)             # <<<<<<<<<<<<<<
+              /* "splitBBoxLUT.pyx":736
+ *                         k = outMax[bin0_max, bin1_min]
+ *                         lut[bin0_max, bin1_min, k].idx = idx
+ *                         lut[bin0_max, bin1_min, k].coef =  deltaA * deltaR             # <<<<<<<<<<<<<<
+ *                         outMax[bin0_max, bin1_min] = k + 1
  * 
- *             bin0_min = <int> fbin0_min
  */
-          __pyx_v_fbin1_max = __pyx_f_12splitBBoxLUT_getBinNr(__pyx_v_max1, __pyx_v_pos1_min, __pyx_v_delta1);
+              __pyx_t_97 = __pyx_v_bin0_max;
+              __pyx_t_98 = __pyx_v_bin1_min;
+              __pyx_t_99 = __pyx_v_k;
+              (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_97, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_98, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_99, __pyx_pybuffernd_lut.diminfo[2].strides)).coef = (__pyx_v_deltaA * __pyx_v_deltaR);
 
-          /* "splitBBoxLUT.pyx":999
- *             fbin1_max = getBinNr(max1, pos1_min, delta1)
+              /* "splitBBoxLUT.pyx":737
+ *                         lut[bin0_max, bin1_min, k].idx = idx
+ *                         lut[bin0_max, bin1_min, k].coef =  deltaA * deltaR
+ *                         outMax[bin0_max, bin1_min] = k + 1             # <<<<<<<<<<<<<<
  * 
- *             bin0_min = <int> fbin0_min             # <<<<<<<<<<<<<<
- *             bin0_max = <int> fbin0_max
- *             bin1_min = <int> fbin1_min
+ *                         for i in range(bin0_min + 1, bin0_max):
  */
-          __pyx_v_bin0_min = ((int)__pyx_v_fbin0_min);
+              __pyx_t_100 = __pyx_v_bin0_max;
+              __pyx_t_101 = __pyx_v_bin1_min;
+              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_100, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_101, __pyx_pybuffernd_outMax.diminfo[1].strides) = (__pyx_v_k + 1);
 
-          /* "splitBBoxLUT.pyx":1000
+              /* "splitBBoxLUT.pyx":739
+ *                         outMax[bin0_max, bin1_min] = k + 1
  * 
- *             bin0_min = <int> fbin0_min
- *             bin0_max = <int> fbin0_max             # <<<<<<<<<<<<<<
- *             bin1_min = <int> fbin1_min
- *             bin1_max = <int> fbin1_max
+ *                         for i in range(bin0_min + 1, bin0_max):             # <<<<<<<<<<<<<<
+ *                             k = outMax[i, bin1_min]
+ *                             lut[i, bin1_min ,k].idx = idx
  */
-          __pyx_v_bin0_max = ((int)__pyx_v_fbin0_max);
+              __pyx_t_102 = __pyx_v_bin0_max;
+              for (__pyx_t_103 = (__pyx_v_bin0_min + 1); __pyx_t_103 < __pyx_t_102; __pyx_t_103+=1) {
+                __pyx_v_i = __pyx_t_103;
 
-          /* "splitBBoxLUT.pyx":1001
- *             bin0_min = <int> fbin0_min
- *             bin0_max = <int> fbin0_max
- *             bin1_min = <int> fbin1_min             # <<<<<<<<<<<<<<
- *             bin1_max = <int> fbin1_max
+                /* "splitBBoxLUT.pyx":740
  * 
+ *                         for i in range(bin0_min + 1, bin0_max):
+ *                             k = outMax[i, bin1_min]             # <<<<<<<<<<<<<<
+ *                             lut[i, bin1_min ,k].idx = idx
+ *                             lut[i, bin1_min, k].coef =  deltaA
  */
-          __pyx_v_bin1_min = ((int)__pyx_v_fbin1_min);
+                __pyx_t_104 = __pyx_v_i;
+                __pyx_t_105 = __pyx_v_bin1_min;
+                __pyx_v_k = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_104, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_105, __pyx_pybuffernd_outMax.diminfo[1].strides));
 
-          /* "splitBBoxLUT.pyx":1002
- *             bin0_max = <int> fbin0_max
- *             bin1_min = <int> fbin1_min
- *             bin1_max = <int> fbin1_max             # <<<<<<<<<<<<<<
- * 
- * 
+                /* "splitBBoxLUT.pyx":741
+ *                         for i in range(bin0_min + 1, bin0_max):
+ *                             k = outMax[i, bin1_min]
+ *                             lut[i, bin1_min ,k].idx = idx             # <<<<<<<<<<<<<<
+ *                             lut[i, bin1_min, k].coef =  deltaA
+ *                             outMax[i, bin1_min] = k + 1
  */
-          __pyx_v_bin1_max = ((int)__pyx_v_fbin1_max);
+                __pyx_t_106 = __pyx_v_i;
+                __pyx_t_107 = __pyx_v_bin1_min;
+                __pyx_t_108 = __pyx_v_k;
+                (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_106, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_107, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_108, __pyx_pybuffernd_lut.diminfo[2].strides)).idx = __pyx_v_idx;
 
-          /* "splitBBoxLUT.pyx":1005
- * 
+                /* "splitBBoxLUT.pyx":742
+ *                             k = outMax[i, bin1_min]
+ *                             lut[i, bin1_min ,k].idx = idx
+ *                             lut[i, bin1_min, k].coef =  deltaA             # <<<<<<<<<<<<<<
+ *                             outMax[i, bin1_min] = k + 1
  * 
- *             if bin0_min == bin0_max:             # <<<<<<<<<<<<<<
- *                 if bin1_min == bin1_max:
- *                     #All pixel is within a single bin
  */
-          __pyx_t_25 = (__pyx_v_bin0_min == __pyx_v_bin0_max);
-          if (__pyx_t_25) {
+                __pyx_t_109 = __pyx_v_i;
+                __pyx_t_110 = __pyx_v_bin1_min;
+                __pyx_t_111 = __pyx_v_k;
+                (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_109, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_110, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_111, __pyx_pybuffernd_lut.diminfo[2].strides)).coef = __pyx_v_deltaA;
 
-            /* "splitBBoxLUT.pyx":1006
+                /* "splitBBoxLUT.pyx":743
+ *                             lut[i, bin1_min ,k].idx = idx
+ *                             lut[i, bin1_min, k].coef =  deltaA
+ *                             outMax[i, bin1_min] = k + 1             # <<<<<<<<<<<<<<
  * 
- *             if bin0_min == bin0_max:
- *                 if bin1_min == bin1_max:             # <<<<<<<<<<<<<<
- *                     #All pixel is within a single bin
- *                     outCount[bin0_min, bin1_min] += 1.0
+ *                     else:
  */
-            __pyx_t_25 = (__pyx_v_bin1_min == __pyx_v_bin1_max);
-            if (__pyx_t_25) {
+                __pyx_t_112 = __pyx_v_i;
+                __pyx_t_113 = __pyx_v_bin1_min;
+                *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_112, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_113, __pyx_pybuffernd_outMax.diminfo[1].strides) = (__pyx_v_k + 1);
+              }
+              goto __pyx_L37;
+            }
+            /*else*/ {
 
-              /* "splitBBoxLUT.pyx":1008
- *                 if bin1_min == bin1_max:
- *                     #All pixel is within a single bin
- *                     outCount[bin0_min, bin1_min] += 1.0             # <<<<<<<<<<<<<<
- *                     outData[bin0_min, bin1_min] += data
- *                 else:
+              /* "splitBBoxLUT.pyx":747
+ *                     else:
+ *                         #spread on n pix in dim0 and m pixel in dim1:
+ *                         deltaL = (< float > (bin0_min + 1)) - fbin0_min             # <<<<<<<<<<<<<<
+ *                         deltaR = fbin0_max - (< float > bin0_max)
+ *                         deltaD = (< float > (bin1_min + 1)) - fbin1_min
  */
-              __pyx_t_52 = __pyx_v_bin0_min;
-              __pyx_t_53 = __pyx_v_bin1_min;
-              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_52, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_53, __pyx_pybuffernd_outCount.diminfo[1].strides) += 1.0;
+              __pyx_v_deltaL = (((float)(__pyx_v_bin0_min + 1)) - __pyx_v_fbin0_min);
 
-              /* "splitBBoxLUT.pyx":1009
- *                     #All pixel is within a single bin
- *                     outCount[bin0_min, bin1_min] += 1.0
- *                     outData[bin0_min, bin1_min] += data             # <<<<<<<<<<<<<<
- *                 else:
- *                     #spread on more than 2 bins
+              /* "splitBBoxLUT.pyx":748
+ *                         #spread on n pix in dim0 and m pixel in dim1:
+ *                         deltaL = (< float > (bin0_min + 1)) - fbin0_min
+ *                         deltaR = fbin0_max - (< float > bin0_max)             # <<<<<<<<<<<<<<
+ *                         deltaD = (< float > (bin1_min + 1)) - fbin1_min
+ *                         deltaU = fbin1_max - (< float > bin1_max)
  */
-              __pyx_t_54 = __pyx_v_bin0_min;
-              __pyx_t_55 = __pyx_v_bin1_min;
-              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_54, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_55, __pyx_pybuffernd_outData.diminfo[1].strides) += __pyx_v_data;
-              goto __pyx_L50;
-            }
-            /*else*/ {
+              __pyx_v_deltaR = (__pyx_v_fbin0_max - ((float)__pyx_v_bin0_max));
 
-              /* "splitBBoxLUT.pyx":1012
- *                 else:
- *                     #spread on more than 2 bins
- *                     deltaD = (< float > (bin1_min + 1)) - fbin1_min             # <<<<<<<<<<<<<<
- *                     deltaU = fbin1_max - ( bin1_max)
- *                     deltaA = 1.0 / (fbin1_max - fbin1_min)
+              /* "splitBBoxLUT.pyx":749
+ *                         deltaL = (< float > (bin0_min + 1)) - fbin0_min
+ *                         deltaR = fbin0_max - (< float > bin0_max)
+ *                         deltaD = (< float > (bin1_min + 1)) - fbin1_min             # <<<<<<<<<<<<<<
+ *                         deltaU = fbin1_max - (< float > bin1_max)
+ *                         deltaA = 1.0 / ((fbin0_max - fbin0_min) * (fbin1_max - fbin1_min))
  */
               __pyx_v_deltaD = (((float)(__pyx_v_bin1_min + 1)) - __pyx_v_fbin1_min);
 
-              /* "splitBBoxLUT.pyx":1013
- *                     #spread on more than 2 bins
- *                     deltaD = (< float > (bin1_min + 1)) - fbin1_min
- *                     deltaU = fbin1_max - ( bin1_max)             # <<<<<<<<<<<<<<
- *                     deltaA = 1.0 / (fbin1_max - fbin1_min)
+              /* "splitBBoxLUT.pyx":750
+ *                         deltaR = fbin0_max - (< float > bin0_max)
+ *                         deltaD = (< float > (bin1_min + 1)) - fbin1_min
+ *                         deltaU = fbin1_max - (< float > bin1_max)             # <<<<<<<<<<<<<<
+ *                         deltaA = 1.0 / ((fbin0_max - fbin0_min) * (fbin1_max - fbin1_min))
  * 
  */
-              __pyx_v_deltaU = (__pyx_v_fbin1_max - __pyx_v_bin1_max);
+              __pyx_v_deltaU = (__pyx_v_fbin1_max - ((float)__pyx_v_bin1_max));
 
-              /* "splitBBoxLUT.pyx":1014
- *                     deltaD = (< float > (bin1_min + 1)) - fbin1_min
- *                     deltaU = fbin1_max - ( bin1_max)
- *                     deltaA = 1.0 / (fbin1_max - fbin1_min)             # <<<<<<<<<<<<<<
+              /* "splitBBoxLUT.pyx":751
+ *                         deltaD = (< float > (bin1_min + 1)) - fbin1_min
+ *                         deltaU = fbin1_max - (< float > bin1_max)
+ *                         deltaA = 1.0 / ((fbin0_max - fbin0_min) * (fbin1_max - fbin1_min))             # <<<<<<<<<<<<<<
  * 
- *                     outCount[bin0_min, bin1_min] +=  deltaA * deltaD
+ *                         k = outMax[bin0_min, bin1_min]
  */
-              __pyx_v_deltaA = (1.0 / (__pyx_v_fbin1_max - __pyx_v_fbin1_min));
+              __pyx_v_deltaA = (1.0 / ((__pyx_v_fbin0_max - __pyx_v_fbin0_min) * (__pyx_v_fbin1_max - __pyx_v_fbin1_min)));
 
-              /* "splitBBoxLUT.pyx":1016
- *                     deltaA = 1.0 / (fbin1_max - fbin1_min)
- * 
- *                     outCount[bin0_min, bin1_min] +=  deltaA * deltaD             # <<<<<<<<<<<<<<
- *                     outData[bin0_min, bin1_min] += data * deltaA * deltaD
+              /* "splitBBoxLUT.pyx":753
+ *                         deltaA = 1.0 / ((fbin0_max - fbin0_min) * (fbin1_max - fbin1_min))
  * 
+ *                         k = outMax[bin0_min, bin1_min]             # <<<<<<<<<<<<<<
+ *                         lut[bin0_min, bin1_min ,k].idx = idx
+ *                         lut[bin0_min, bin1_min, k].coef =  deltaA * deltaL * deltaD
  */
-              __pyx_t_56 = __pyx_v_bin0_min;
-              __pyx_t_57 = __pyx_v_bin1_min;
-              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_56, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_57, __pyx_pybuffernd_outCount.diminfo[1].strides) += (__pyx_v_deltaA * __pyx_v_deltaD);
+              __pyx_t_102 = __pyx_v_bin0_min;
+              __pyx_t_114 = __pyx_v_bin1_min;
+              __pyx_v_k = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_102, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_114, __pyx_pybuffernd_outMax.diminfo[1].strides));
 
-              /* "splitBBoxLUT.pyx":1017
- * 
- *                     outCount[bin0_min, bin1_min] +=  deltaA * deltaD
- *                     outData[bin0_min, bin1_min] += data * deltaA * deltaD             # <<<<<<<<<<<<<<
+              /* "splitBBoxLUT.pyx":754
  * 
- *                     outCount[bin0_min, bin1_max] +=  deltaA * deltaU
+ *                         k = outMax[bin0_min, bin1_min]
+ *                         lut[bin0_min, bin1_min ,k].idx = idx             # <<<<<<<<<<<<<<
+ *                         lut[bin0_min, bin1_min, k].coef =  deltaA * deltaL * deltaD
+ *                         outMax[bin0_min, bin1_min] = k + 1
  */
-              __pyx_t_58 = __pyx_v_bin0_min;
-              __pyx_t_59 = __pyx_v_bin1_min;
-              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_58, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_59, __pyx_pybuffernd_outData.diminfo[1].strides) += ((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaD);
+              __pyx_t_115 = __pyx_v_bin0_min;
+              __pyx_t_116 = __pyx_v_bin1_min;
+              __pyx_t_103 = __pyx_v_k;
+              (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_115, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_116, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_103, __pyx_pybuffernd_lut.diminfo[2].strides)).idx = __pyx_v_idx;
 
-              /* "splitBBoxLUT.pyx":1019
- *                     outData[bin0_min, bin1_min] += data * deltaA * deltaD
+              /* "splitBBoxLUT.pyx":755
+ *                         k = outMax[bin0_min, bin1_min]
+ *                         lut[bin0_min, bin1_min ,k].idx = idx
+ *                         lut[bin0_min, bin1_min, k].coef =  deltaA * deltaL * deltaD             # <<<<<<<<<<<<<<
+ *                         outMax[bin0_min, bin1_min] = k + 1
  * 
- *                     outCount[bin0_min, bin1_max] +=  deltaA * deltaU             # <<<<<<<<<<<<<<
- *                     outData[bin0_min, bin1_max] += data * deltaA * deltaU
- *                     for j in range(bin1_min + 1, bin1_max):
  */
-              __pyx_t_60 = __pyx_v_bin0_min;
-              __pyx_t_61 = __pyx_v_bin1_max;
-              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_60, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_61, __pyx_pybuffernd_outCount.diminfo[1].strides) += (__pyx_v_deltaA * __pyx_v_deltaU);
+              __pyx_t_117 = __pyx_v_bin0_min;
+              __pyx_t_118 = __pyx_v_bin1_min;
+              __pyx_t_119 = __pyx_v_k;
+              (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_117, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_118, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_119, __pyx_pybuffernd_lut.diminfo[2].strides)).coef = ((__pyx_v_deltaA * __pyx_v_deltaL) * __pyx_v_deltaD);
 
-              /* "splitBBoxLUT.pyx":1020
+              /* "splitBBoxLUT.pyx":756
+ *                         lut[bin0_min, bin1_min ,k].idx = idx
+ *                         lut[bin0_min, bin1_min, k].coef =  deltaA * deltaL * deltaD
+ *                         outMax[bin0_min, bin1_min] = k + 1             # <<<<<<<<<<<<<<
  * 
- *                     outCount[bin0_min, bin1_max] +=  deltaA * deltaU
- *                     outData[bin0_min, bin1_max] += data * deltaA * deltaU             # <<<<<<<<<<<<<<
- *                     for j in range(bin1_min + 1, bin1_max):
- *                         outCount[bin0_min, j] +=  deltaA
- */
-              __pyx_t_62 = __pyx_v_bin0_min;
-              __pyx_t_63 = __pyx_v_bin1_max;
-              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_62, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_63, __pyx_pybuffernd_outData.diminfo[1].strides) += ((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaU);
-
-              /* "splitBBoxLUT.pyx":1021
- *                     outCount[bin0_min, bin1_max] +=  deltaA * deltaU
- *                     outData[bin0_min, bin1_max] += data * deltaA * deltaU
- *                     for j in range(bin1_min + 1, bin1_max):             # <<<<<<<<<<<<<<
- *                         outCount[bin0_min, j] +=  deltaA
- *                         outData[bin0_min, j] += data * deltaA
+ *                         k = outMax[bin0_min, bin1_max]
  */
-              __pyx_t_64 = __pyx_v_bin1_max;
-              for (__pyx_t_65 = (__pyx_v_bin1_min + 1); __pyx_t_65 < __pyx_t_64; __pyx_t_65+=1) {
-                __pyx_v_j = __pyx_t_65;
+              __pyx_t_120 = __pyx_v_bin0_min;
+              __pyx_t_121 = __pyx_v_bin1_min;
+              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_120, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_121, __pyx_pybuffernd_outMax.diminfo[1].strides) = (__pyx_v_k + 1);
 
-                /* "splitBBoxLUT.pyx":1022
- *                     outData[bin0_min, bin1_max] += data * deltaA * deltaU
- *                     for j in range(bin1_min + 1, bin1_max):
- *                         outCount[bin0_min, j] +=  deltaA             # <<<<<<<<<<<<<<
- *                         outData[bin0_min, j] += data * deltaA
+              /* "splitBBoxLUT.pyx":758
+ *                         outMax[bin0_min, bin1_min] = k + 1
  * 
+ *                         k = outMax[bin0_min, bin1_max]             # <<<<<<<<<<<<<<
+ *                         lut[bin0_min, bin1_max, k].idx = idx
+ *                         lut[bin0_min, bin1_max, k].coef =  deltaA * deltaL * deltaU
  */
-                __pyx_t_66 = __pyx_v_bin0_min;
-                __pyx_t_67 = __pyx_v_j;
-                *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_66, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_67, __pyx_pybuffernd_outCount.diminfo[1].strides) += __pyx_v_deltaA;
+              __pyx_t_122 = __pyx_v_bin0_min;
+              __pyx_t_123 = __pyx_v_bin1_max;
+              __pyx_v_k = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_122, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_123, __pyx_pybuffernd_outMax.diminfo[1].strides));
 
-                /* "splitBBoxLUT.pyx":1023
- *                     for j in range(bin1_min + 1, bin1_max):
- *                         outCount[bin0_min, j] +=  deltaA
- *                         outData[bin0_min, j] += data * deltaA             # <<<<<<<<<<<<<<
+              /* "splitBBoxLUT.pyx":759
  * 
- *             else: #spread on more than 2 bins in dim 0
+ *                         k = outMax[bin0_min, bin1_max]
+ *                         lut[bin0_min, bin1_max, k].idx = idx             # <<<<<<<<<<<<<<
+ *                         lut[bin0_min, bin1_max, k].coef =  deltaA * deltaL * deltaU
+ *                         outMax[bin0_min, bin1_max] = k + 1
  */
-                __pyx_t_68 = __pyx_v_bin0_min;
-                __pyx_t_69 = __pyx_v_j;
-                *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_68, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_69, __pyx_pybuffernd_outData.diminfo[1].strides) += (__pyx_v_data * __pyx_v_deltaA);
-              }
-            }
-            __pyx_L50:;
-            goto __pyx_L49;
-          }
-          /*else*/ {
+              __pyx_t_124 = __pyx_v_bin0_min;
+              __pyx_t_125 = __pyx_v_bin1_max;
+              __pyx_t_126 = __pyx_v_k;
+              (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_124, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_125, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_126, __pyx_pybuffernd_lut.diminfo[2].strides)).idx = __pyx_v_idx;
 
-            /* "splitBBoxLUT.pyx":1026
+              /* "splitBBoxLUT.pyx":760
+ *                         k = outMax[bin0_min, bin1_max]
+ *                         lut[bin0_min, bin1_max, k].idx = idx
+ *                         lut[bin0_min, bin1_max, k].coef =  deltaA * deltaL * deltaU             # <<<<<<<<<<<<<<
+ *                         outMax[bin0_min, bin1_max] = k + 1
  * 
- *             else: #spread on more than 2 bins in dim 0
- *                 if bin1_min == bin1_max:             # <<<<<<<<<<<<<<
- *                     #All pixel fall on 1 bins in dim 1
- *                     deltaA = 1.0 / (fbin0_max - fbin0_min)
- */
-            __pyx_t_25 = (__pyx_v_bin1_min == __pyx_v_bin1_max);
-            if (__pyx_t_25) {
-
-              /* "splitBBoxLUT.pyx":1028
- *                 if bin1_min == bin1_max:
- *                     #All pixel fall on 1 bins in dim 1
- *                     deltaA = 1.0 / (fbin0_max - fbin0_min)             # <<<<<<<<<<<<<<
- *                     deltaL = (< float > (bin0_min + 1)) - fbin0_min
- *                     outCount[bin0_min, bin1_min] +=  deltaA * deltaL
- */
-              __pyx_v_deltaA = (1.0 / (__pyx_v_fbin0_max - __pyx_v_fbin0_min));
-
-              /* "splitBBoxLUT.pyx":1029
- *                     #All pixel fall on 1 bins in dim 1
- *                     deltaA = 1.0 / (fbin0_max - fbin0_min)
- *                     deltaL = (< float > (bin0_min + 1)) - fbin0_min             # <<<<<<<<<<<<<<
- *                     outCount[bin0_min, bin1_min] +=  deltaA * deltaL
- *                     outData[bin0_min, bin1_min] +=  data * deltaA * deltaL
- */
-              __pyx_v_deltaL = (((float)(__pyx_v_bin0_min + 1)) - __pyx_v_fbin0_min);
-
-              /* "splitBBoxLUT.pyx":1030
- *                     deltaA = 1.0 / (fbin0_max - fbin0_min)
- *                     deltaL = (< float > (bin0_min + 1)) - fbin0_min
- *                     outCount[bin0_min, bin1_min] +=  deltaA * deltaL             # <<<<<<<<<<<<<<
- *                     outData[bin0_min, bin1_min] +=  data * deltaA * deltaL
- *                     deltaR = fbin0_max - (< float > bin0_max)
- */
-              __pyx_t_64 = __pyx_v_bin0_min;
-              __pyx_t_65 = __pyx_v_bin1_min;
-              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_64, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_65, __pyx_pybuffernd_outCount.diminfo[1].strides) += (__pyx_v_deltaA * __pyx_v_deltaL);
-
-              /* "splitBBoxLUT.pyx":1031
- *                     deltaL = (< float > (bin0_min + 1)) - fbin0_min
- *                     outCount[bin0_min, bin1_min] +=  deltaA * deltaL
- *                     outData[bin0_min, bin1_min] +=  data * deltaA * deltaL             # <<<<<<<<<<<<<<
- *                     deltaR = fbin0_max - (< float > bin0_max)
- *                     outCount[bin0_max, bin1_min] +=  deltaA * deltaR
  */
-              __pyx_t_70 = __pyx_v_bin0_min;
-              __pyx_t_71 = __pyx_v_bin1_min;
-              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_70, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_71, __pyx_pybuffernd_outData.diminfo[1].strides) += ((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaL);
-
-              /* "splitBBoxLUT.pyx":1032
- *                     outCount[bin0_min, bin1_min] +=  deltaA * deltaL
- *                     outData[bin0_min, bin1_min] +=  data * deltaA * deltaL
- *                     deltaR = fbin0_max - (< float > bin0_max)             # <<<<<<<<<<<<<<
- *                     outCount[bin0_max, bin1_min] +=  deltaA * deltaR
- *                     outData[bin0_max, bin1_min] +=  data * deltaA * deltaR
- */
-              __pyx_v_deltaR = (__pyx_v_fbin0_max - ((float)__pyx_v_bin0_max));
+              __pyx_t_127 = __pyx_v_bin0_min;
+              __pyx_t_128 = __pyx_v_bin1_max;
+              __pyx_t_129 = __pyx_v_k;
+              (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_127, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_128, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_129, __pyx_pybuffernd_lut.diminfo[2].strides)).coef = ((__pyx_v_deltaA * __pyx_v_deltaL) * __pyx_v_deltaU);
 
-              /* "splitBBoxLUT.pyx":1033
- *                     outData[bin0_min, bin1_min] +=  data * deltaA * deltaL
- *                     deltaR = fbin0_max - (< float > bin0_max)
- *                     outCount[bin0_max, bin1_min] +=  deltaA * deltaR             # <<<<<<<<<<<<<<
- *                     outData[bin0_max, bin1_min] +=  data * deltaA * deltaR
- *                     for i in range(bin0_min + 1, bin0_max):
- */
-              __pyx_t_72 = __pyx_v_bin0_max;
-              __pyx_t_73 = __pyx_v_bin1_min;
-              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_72, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_73, __pyx_pybuffernd_outCount.diminfo[1].strides) += (__pyx_v_deltaA * __pyx_v_deltaR);
-
-              /* "splitBBoxLUT.pyx":1034
- *                     deltaR = fbin0_max - (< float > bin0_max)
- *                     outCount[bin0_max, bin1_min] +=  deltaA * deltaR
- *                     outData[bin0_max, bin1_min] +=  data * deltaA * deltaR             # <<<<<<<<<<<<<<
- *                     for i in range(bin0_min + 1, bin0_max):
- *                             outCount[i, bin1_min] +=  deltaA
- */
-              __pyx_t_74 = __pyx_v_bin0_max;
-              __pyx_t_75 = __pyx_v_bin1_min;
-              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_74, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_75, __pyx_pybuffernd_outData.diminfo[1].strides) += ((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaR);
-
-              /* "splitBBoxLUT.pyx":1035
- *                     outCount[bin0_max, bin1_min] +=  deltaA * deltaR
- *                     outData[bin0_max, bin1_min] +=  data * deltaA * deltaR
- *                     for i in range(bin0_min + 1, bin0_max):             # <<<<<<<<<<<<<<
- *                             outCount[i, bin1_min] +=  deltaA
- *                             outData[i, bin1_min] +=  data * deltaA
- */
-              __pyx_t_76 = __pyx_v_bin0_max;
-              for (__pyx_t_77 = (__pyx_v_bin0_min + 1); __pyx_t_77 < __pyx_t_76; __pyx_t_77+=1) {
-                __pyx_v_i = __pyx_t_77;
-
-                /* "splitBBoxLUT.pyx":1036
- *                     outData[bin0_max, bin1_min] +=  data * deltaA * deltaR
- *                     for i in range(bin0_min + 1, bin0_max):
- *                             outCount[i, bin1_min] +=  deltaA             # <<<<<<<<<<<<<<
- *                             outData[i, bin1_min] +=  data * deltaA
- *                 else:
+              /* "splitBBoxLUT.pyx":761
+ *                         lut[bin0_min, bin1_max, k].idx = idx
+ *                         lut[bin0_min, bin1_max, k].coef =  deltaA * deltaL * deltaU
+ *                         outMax[bin0_min, bin1_max] = k + 1             # <<<<<<<<<<<<<<
+ * 
+ *                         k = outMax[bin0_max, bin1_min]
  */
-                __pyx_t_78 = __pyx_v_i;
-                __pyx_t_79 = __pyx_v_bin1_min;
-                *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_78, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_79, __pyx_pybuffernd_outCount.diminfo[1].strides) += __pyx_v_deltaA;
+              __pyx_t_130 = __pyx_v_bin0_min;
+              __pyx_t_131 = __pyx_v_bin1_max;
+              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_130, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_131, __pyx_pybuffernd_outMax.diminfo[1].strides) = (__pyx_v_k + 1);
 
-                /* "splitBBoxLUT.pyx":1037
- *                     for i in range(bin0_min + 1, bin0_max):
- *                             outCount[i, bin1_min] +=  deltaA
- *                             outData[i, bin1_min] +=  data * deltaA             # <<<<<<<<<<<<<<
- *                 else:
- *                     #spread on n pix in dim0 and m pixel in dim1:
+              /* "splitBBoxLUT.pyx":763
+ *                         outMax[bin0_min, bin1_max] = k + 1
+ * 
+ *                         k = outMax[bin0_max, bin1_min]             # <<<<<<<<<<<<<<
+ *                         lut[bin0_max, bin1_min, k].idx = idx
+ *                         lut[bin0_max, bin1_min, k].coef =  deltaA * deltaR * deltaD
  */
-                __pyx_t_80 = __pyx_v_i;
-                __pyx_t_81 = __pyx_v_bin1_min;
-                *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_80, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_81, __pyx_pybuffernd_outData.diminfo[1].strides) += (__pyx_v_data * __pyx_v_deltaA);
-              }
-              goto __pyx_L53;
-            }
-            /*else*/ {
+              __pyx_t_132 = __pyx_v_bin0_max;
+              __pyx_t_133 = __pyx_v_bin1_min;
+              __pyx_v_k = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_132, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_133, __pyx_pybuffernd_outMax.diminfo[1].strides));
 
-              /* "splitBBoxLUT.pyx":1040
- *                 else:
- *                     #spread on n pix in dim0 and m pixel in dim1:
- *                     deltaL = (< float > (bin0_min + 1)) - fbin0_min             # <<<<<<<<<<<<<<
- *                     deltaR = fbin0_max - (< float > bin0_max)
- *                     deltaD = (< float > (bin1_min + 1)) - fbin1_min
+              /* "splitBBoxLUT.pyx":764
+ * 
+ *                         k = outMax[bin0_max, bin1_min]
+ *                         lut[bin0_max, bin1_min, k].idx = idx             # <<<<<<<<<<<<<<
+ *                         lut[bin0_max, bin1_min, k].coef =  deltaA * deltaR * deltaD
+ *                         outMax[bin0_max, bin1_min] = k + 1
  */
-              __pyx_v_deltaL = (((float)(__pyx_v_bin0_min + 1)) - __pyx_v_fbin0_min);
+              __pyx_t_134 = __pyx_v_bin0_max;
+              __pyx_t_135 = __pyx_v_bin1_min;
+              __pyx_t_136 = __pyx_v_k;
+              (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_134, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_135, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_136, __pyx_pybuffernd_lut.diminfo[2].strides)).idx = __pyx_v_idx;
 
-              /* "splitBBoxLUT.pyx":1041
- *                     #spread on n pix in dim0 and m pixel in dim1:
- *                     deltaL = (< float > (bin0_min + 1)) - fbin0_min
- *                     deltaR = fbin0_max - (< float > bin0_max)             # <<<<<<<<<<<<<<
- *                     deltaD = (< float > (bin1_min + 1)) - fbin1_min
- *                     deltaU = fbin1_max - (< float > bin1_max)
+              /* "splitBBoxLUT.pyx":765
+ *                         k = outMax[bin0_max, bin1_min]
+ *                         lut[bin0_max, bin1_min, k].idx = idx
+ *                         lut[bin0_max, bin1_min, k].coef =  deltaA * deltaR * deltaD             # <<<<<<<<<<<<<<
+ *                         outMax[bin0_max, bin1_min] = k + 1
+ * 
  */
-              __pyx_v_deltaR = (__pyx_v_fbin0_max - ((float)__pyx_v_bin0_max));
+              __pyx_t_137 = __pyx_v_bin0_max;
+              __pyx_t_138 = __pyx_v_bin1_min;
+              __pyx_t_139 = __pyx_v_k;
+              (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_137, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_138, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_139, __pyx_pybuffernd_lut.diminfo[2].strides)).coef = ((__pyx_v_deltaA * __pyx_v_deltaR) * __pyx_v_deltaD);
 
-              /* "splitBBoxLUT.pyx":1042
- *                     deltaL = (< float > (bin0_min + 1)) - fbin0_min
- *                     deltaR = fbin0_max - (< float > bin0_max)
- *                     deltaD = (< float > (bin1_min + 1)) - fbin1_min             # <<<<<<<<<<<<<<
- *                     deltaU = fbin1_max - (< float > bin1_max)
- *                     deltaA = 1.0 / ((fbin0_max - fbin0_min) * (fbin1_max - fbin1_min))
+              /* "splitBBoxLUT.pyx":766
+ *                         lut[bin0_max, bin1_min, k].idx = idx
+ *                         lut[bin0_max, bin1_min, k].coef =  deltaA * deltaR * deltaD
+ *                         outMax[bin0_max, bin1_min] = k + 1             # <<<<<<<<<<<<<<
+ * 
+ *                         k = outMax[bin0_max, bin1_max]
  */
-              __pyx_v_deltaD = (((float)(__pyx_v_bin1_min + 1)) - __pyx_v_fbin1_min);
+              __pyx_t_140 = __pyx_v_bin0_max;
+              __pyx_t_141 = __pyx_v_bin1_min;
+              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_140, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_141, __pyx_pybuffernd_outMax.diminfo[1].strides) = (__pyx_v_k + 1);
 
-              /* "splitBBoxLUT.pyx":1043
- *                     deltaR = fbin0_max - (< float > bin0_max)
- *                     deltaD = (< float > (bin1_min + 1)) - fbin1_min
- *                     deltaU = fbin1_max - (< float > bin1_max)             # <<<<<<<<<<<<<<
- *                     deltaA = 1.0 / ((fbin0_max - fbin0_min) * (fbin1_max - fbin1_min))
+              /* "splitBBoxLUT.pyx":768
+ *                         outMax[bin0_max, bin1_min] = k + 1
  * 
+ *                         k = outMax[bin0_max, bin1_max]             # <<<<<<<<<<<<<<
+ *                         lut[bin0_max, bin1_max, k].idx = idx
+ *                         lut[bin0_max, bin1_max, k].coef =  deltaA * deltaR * deltaU
  */
-              __pyx_v_deltaU = (__pyx_v_fbin1_max - ((float)__pyx_v_bin1_max));
+              __pyx_t_142 = __pyx_v_bin0_max;
+              __pyx_t_143 = __pyx_v_bin1_max;
+              __pyx_v_k = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_142, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_143, __pyx_pybuffernd_outMax.diminfo[1].strides));
 
-              /* "splitBBoxLUT.pyx":1044
- *                     deltaD = (< float > (bin1_min + 1)) - fbin1_min
- *                     deltaU = fbin1_max - (< float > bin1_max)
- *                     deltaA = 1.0 / ((fbin0_max - fbin0_min) * (fbin1_max - fbin1_min))             # <<<<<<<<<<<<<<
+              /* "splitBBoxLUT.pyx":769
  * 
- *                     outCount[bin0_min, bin1_min] +=  deltaA * deltaL * deltaD
+ *                         k = outMax[bin0_max, bin1_max]
+ *                         lut[bin0_max, bin1_max, k].idx = idx             # <<<<<<<<<<<<<<
+ *                         lut[bin0_max, bin1_max, k].coef =  deltaA * deltaR * deltaU
+ *                         outMax[bin0_max, bin1_max] = k + 1
  */
-              __pyx_v_deltaA = (1.0 / ((__pyx_v_fbin0_max - __pyx_v_fbin0_min) * (__pyx_v_fbin1_max - __pyx_v_fbin1_min)));
+              __pyx_t_144 = __pyx_v_bin0_max;
+              __pyx_t_145 = __pyx_v_bin1_max;
+              __pyx_t_146 = __pyx_v_k;
+              (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_144, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_145, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_146, __pyx_pybuffernd_lut.diminfo[2].strides)).idx = __pyx_v_idx;
 
-              /* "splitBBoxLUT.pyx":1046
- *                     deltaA = 1.0 / ((fbin0_max - fbin0_min) * (fbin1_max - fbin1_min))
- * 
- *                     outCount[bin0_min, bin1_min] +=  deltaA * deltaL * deltaD             # <<<<<<<<<<<<<<
- *                     outData[bin0_min, bin1_min] +=  data * deltaA * deltaL * deltaD
+              /* "splitBBoxLUT.pyx":770
+ *                         k = outMax[bin0_max, bin1_max]
+ *                         lut[bin0_max, bin1_max, k].idx = idx
+ *                         lut[bin0_max, bin1_max, k].coef =  deltaA * deltaR * deltaU             # <<<<<<<<<<<<<<
+ *                         outMax[bin0_max, bin1_max] = k + 1
  * 
  */
-              __pyx_t_76 = __pyx_v_bin0_min;
-              __pyx_t_77 = __pyx_v_bin1_min;
-              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_76, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_77, __pyx_pybuffernd_outCount.diminfo[1].strides) += ((__pyx_v_deltaA * __pyx_v_deltaL) * __pyx_v_deltaD);
+              __pyx_t_147 = __pyx_v_bin0_max;
+              __pyx_t_148 = __pyx_v_bin1_max;
+              __pyx_t_149 = __pyx_v_k;
+              (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_147, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_148, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_149, __pyx_pybuffernd_lut.diminfo[2].strides)).coef = ((__pyx_v_deltaA * __pyx_v_deltaR) * __pyx_v_deltaU);
 
-              /* "splitBBoxLUT.pyx":1047
- * 
- *                     outCount[bin0_min, bin1_min] +=  deltaA * deltaL * deltaD
- *                     outData[bin0_min, bin1_min] +=  data * deltaA * deltaL * deltaD             # <<<<<<<<<<<<<<
+              /* "splitBBoxLUT.pyx":771
+ *                         lut[bin0_max, bin1_max, k].idx = idx
+ *                         lut[bin0_max, bin1_max, k].coef =  deltaA * deltaR * deltaU
+ *                         outMax[bin0_max, bin1_max] = k + 1             # <<<<<<<<<<<<<<
  * 
- *                     outCount[bin0_min, bin1_max] +=  deltaA * deltaL * deltaU
+ *                         for i in range(bin0_min + 1, bin0_max):
  */
-              __pyx_t_82 = __pyx_v_bin0_min;
-              __pyx_t_83 = __pyx_v_bin1_min;
-              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_82, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_83, __pyx_pybuffernd_outData.diminfo[1].strides) += (((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaL) * __pyx_v_deltaD);
+              __pyx_t_150 = __pyx_v_bin0_max;
+              __pyx_t_151 = __pyx_v_bin1_max;
+              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_150, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_151, __pyx_pybuffernd_outMax.diminfo[1].strides) = (__pyx_v_k + 1);
 
-              /* "splitBBoxLUT.pyx":1049
- *                     outData[bin0_min, bin1_min] +=  data * deltaA * deltaL * deltaD
- * 
- *                     outCount[bin0_min, bin1_max] +=  deltaA * deltaL * deltaU             # <<<<<<<<<<<<<<
- *                     outData[bin0_min, bin1_max] +=  data * deltaA * deltaL * deltaU
+              /* "splitBBoxLUT.pyx":773
+ *                         outMax[bin0_max, bin1_max] = k + 1
  * 
+ *                         for i in range(bin0_min + 1, bin0_max):             # <<<<<<<<<<<<<<
+ *                             k = outMax[i, bin1_min]
+ *                             lut[i, bin1_min, k].idx = idx
  */
-              __pyx_t_84 = __pyx_v_bin0_min;
-              __pyx_t_85 = __pyx_v_bin1_max;
-              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_84, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_85, __pyx_pybuffernd_outCount.diminfo[1].strides) += ((__pyx_v_deltaA * __pyx_v_deltaL) * __pyx_v_deltaU);
+              __pyx_t_152 = __pyx_v_bin0_max;
+              for (__pyx_t_153 = (__pyx_v_bin0_min + 1); __pyx_t_153 < __pyx_t_152; __pyx_t_153+=1) {
+                __pyx_v_i = __pyx_t_153;
 
-              /* "splitBBoxLUT.pyx":1050
- * 
- *                     outCount[bin0_min, bin1_max] +=  deltaA * deltaL * deltaU
- *                     outData[bin0_min, bin1_max] +=  data * deltaA * deltaL * deltaU             # <<<<<<<<<<<<<<
+                /* "splitBBoxLUT.pyx":774
  * 
- *                     outCount[bin0_max, bin1_min] +=  deltaA * deltaR * deltaD
+ *                         for i in range(bin0_min + 1, bin0_max):
+ *                             k = outMax[i, bin1_min]             # <<<<<<<<<<<<<<
+ *                             lut[i, bin1_min, k].idx = idx
+ *                             lut[i, bin1_min, k].coef =  deltaA * deltaD
  */
-              __pyx_t_86 = __pyx_v_bin0_min;
-              __pyx_t_87 = __pyx_v_bin1_max;
-              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_86, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_87, __pyx_pybuffernd_outData.diminfo[1].strides) += (((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaL) * __pyx_v_deltaU);
+                __pyx_t_154 = __pyx_v_i;
+                __pyx_t_155 = __pyx_v_bin1_min;
+                __pyx_v_k = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_154, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_155, __pyx_pybuffernd_outMax.diminfo[1].strides));
 
-              /* "splitBBoxLUT.pyx":1052
- *                     outData[bin0_min, bin1_max] +=  data * deltaA * deltaL * deltaU
- * 
- *                     outCount[bin0_max, bin1_min] +=  deltaA * deltaR * deltaD             # <<<<<<<<<<<<<<
- *                     outData[bin0_max, bin1_min] +=  data * deltaA * deltaR * deltaD
- * 
+                /* "splitBBoxLUT.pyx":775
+ *                         for i in range(bin0_min + 1, bin0_max):
+ *                             k = outMax[i, bin1_min]
+ *                             lut[i, bin1_min, k].idx = idx             # <<<<<<<<<<<<<<
+ *                             lut[i, bin1_min, k].coef =  deltaA * deltaD
+ *                             outMax[i, bin1_min] = k + 1
  */
-              __pyx_t_88 = __pyx_v_bin0_max;
-              __pyx_t_89 = __pyx_v_bin1_min;
-              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_88, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_89, __pyx_pybuffernd_outCount.diminfo[1].strides) += ((__pyx_v_deltaA * __pyx_v_deltaR) * __pyx_v_deltaD);
+                __pyx_t_156 = __pyx_v_i;
+                __pyx_t_157 = __pyx_v_bin1_min;
+                __pyx_t_158 = __pyx_v_k;
+                (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_156, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_157, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_158, __pyx_pybuffernd_lut.diminfo[2].strides)).idx = __pyx_v_idx;
 
-              /* "splitBBoxLUT.pyx":1053
- * 
- *                     outCount[bin0_max, bin1_min] +=  deltaA * deltaR * deltaD
- *                     outData[bin0_max, bin1_min] +=  data * deltaA * deltaR * deltaD             # <<<<<<<<<<<<<<
+                /* "splitBBoxLUT.pyx":776
+ *                             k = outMax[i, bin1_min]
+ *                             lut[i, bin1_min, k].idx = idx
+ *                             lut[i, bin1_min, k].coef =  deltaA * deltaD             # <<<<<<<<<<<<<<
+ *                             outMax[i, bin1_min] = k + 1
  * 
- *                     outCount[bin0_max, bin1_max] +=  deltaA * deltaR * deltaU
  */
-              __pyx_t_90 = __pyx_v_bin0_max;
-              __pyx_t_91 = __pyx_v_bin1_min;
-              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_90, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_91, __pyx_pybuffernd_outData.diminfo[1].strides) += (((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaR) * __pyx_v_deltaD);
+                __pyx_t_159 = __pyx_v_i;
+                __pyx_t_160 = __pyx_v_bin1_min;
+                __pyx_t_161 = __pyx_v_k;
+                (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_159, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_160, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_161, __pyx_pybuffernd_lut.diminfo[2].strides)).coef = (__pyx_v_deltaA * __pyx_v_deltaD);
 
-              /* "splitBBoxLUT.pyx":1055
- *                     outData[bin0_max, bin1_min] +=  data * deltaA * deltaR * deltaD
+                /* "splitBBoxLUT.pyx":777
+ *                             lut[i, bin1_min, k].idx = idx
+ *                             lut[i, bin1_min, k].coef =  deltaA * deltaD
+ *                             outMax[i, bin1_min] = k + 1             # <<<<<<<<<<<<<<
  * 
- *                     outCount[bin0_max, bin1_max] +=  deltaA * deltaR * deltaU             # <<<<<<<<<<<<<<
- *                     outData[bin0_max, bin1_max] +=  data * deltaA * deltaR * deltaU
- *                     for i in range(bin0_min + 1, bin0_max):
+ *                             for j in range(bin1_min + 1, bin1_max):
  */
-              __pyx_t_92 = __pyx_v_bin0_max;
-              __pyx_t_93 = __pyx_v_bin1_max;
-              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_92, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_93, __pyx_pybuffernd_outCount.diminfo[1].strides) += ((__pyx_v_deltaA * __pyx_v_deltaR) * __pyx_v_deltaU);
+                __pyx_t_162 = __pyx_v_i;
+                __pyx_t_163 = __pyx_v_bin1_min;
+                *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_162, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_163, __pyx_pybuffernd_outMax.diminfo[1].strides) = (__pyx_v_k + 1);
 
-              /* "splitBBoxLUT.pyx":1056
+                /* "splitBBoxLUT.pyx":779
+ *                             outMax[i, bin1_min] = k + 1
  * 
- *                     outCount[bin0_max, bin1_max] +=  deltaA * deltaR * deltaU
- *                     outData[bin0_max, bin1_max] +=  data * deltaA * deltaR * deltaU             # <<<<<<<<<<<<<<
- *                     for i in range(bin0_min + 1, bin0_max):
- *                             outCount[i, bin1_min] +=  deltaA * deltaD
+ *                             for j in range(bin1_min + 1, bin1_max):             # <<<<<<<<<<<<<<
+ *                                 k = outMax[i, j]
+ *                                 lut[i, j, k].idx = idx
  */
-              __pyx_t_94 = __pyx_v_bin0_max;
-              __pyx_t_95 = __pyx_v_bin1_max;
-              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_94, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_95, __pyx_pybuffernd_outData.diminfo[1].strides) += (((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaR) * __pyx_v_deltaU);
-
-              /* "splitBBoxLUT.pyx":1057
- *                     outCount[bin0_max, bin1_max] +=  deltaA * deltaR * deltaU
- *                     outData[bin0_max, bin1_max] +=  data * deltaA * deltaR * deltaU
- *                     for i in range(bin0_min + 1, bin0_max):             # <<<<<<<<<<<<<<
- *                             outCount[i, bin1_min] +=  deltaA * deltaD
- *                             outData[i, bin1_min] +=  data * deltaA * deltaD
- */
-              __pyx_t_96 = __pyx_v_bin0_max;
-              for (__pyx_t_97 = (__pyx_v_bin0_min + 1); __pyx_t_97 < __pyx_t_96; __pyx_t_97+=1) {
-                __pyx_v_i = __pyx_t_97;
-
-                /* "splitBBoxLUT.pyx":1058
- *                     outData[bin0_max, bin1_max] +=  data * deltaA * deltaR * deltaU
- *                     for i in range(bin0_min + 1, bin0_max):
- *                             outCount[i, bin1_min] +=  deltaA * deltaD             # <<<<<<<<<<<<<<
- *                             outData[i, bin1_min] +=  data * deltaA * deltaD
+                __pyx_t_164 = __pyx_v_bin1_max;
+                for (__pyx_t_165 = (__pyx_v_bin1_min + 1); __pyx_t_165 < __pyx_t_164; __pyx_t_165+=1) {
+                  __pyx_v_j = __pyx_t_165;
+
+                  /* "splitBBoxLUT.pyx":780
+ * 
  *                             for j in range(bin1_min + 1, bin1_max):
+ *                                 k = outMax[i, j]             # <<<<<<<<<<<<<<
+ *                                 lut[i, j, k].idx = idx
+ *                                 lut[i, j, k].coef =  deltaA
  */
-                __pyx_t_98 = __pyx_v_i;
-                __pyx_t_99 = __pyx_v_bin1_min;
-                *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_98, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_99, __pyx_pybuffernd_outCount.diminfo[1].strides) += (__pyx_v_deltaA * __pyx_v_deltaD);
+                  __pyx_t_166 = __pyx_v_i;
+                  __pyx_t_167 = __pyx_v_j;
+                  __pyx_v_k = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_166, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_167, __pyx_pybuffernd_outMax.diminfo[1].strides));
 
-                /* "splitBBoxLUT.pyx":1059
- *                     for i in range(bin0_min + 1, bin0_max):
- *                             outCount[i, bin1_min] +=  deltaA * deltaD
- *                             outData[i, bin1_min] +=  data * deltaA * deltaD             # <<<<<<<<<<<<<<
+                  /* "splitBBoxLUT.pyx":781
  *                             for j in range(bin1_min + 1, bin1_max):
- *                                 outCount[i, j] +=  deltaA
+ *                                 k = outMax[i, j]
+ *                                 lut[i, j, k].idx = idx             # <<<<<<<<<<<<<<
+ *                                 lut[i, j, k].coef =  deltaA
+ *                                 outMax[i, j] = k + 1
  */
-                __pyx_t_100 = __pyx_v_i;
-                __pyx_t_101 = __pyx_v_bin1_min;
-                *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_100, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_101, __pyx_pybuffernd_outData.diminfo[1].strides) += ((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaD);
+                  __pyx_t_168 = __pyx_v_i;
+                  __pyx_t_169 = __pyx_v_j;
+                  __pyx_t_170 = __pyx_v_k;
+                  (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_168, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_169, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_170, __pyx_pybuffernd_lut.diminfo[2].strides)).idx = __pyx_v_idx;
 
-                /* "splitBBoxLUT.pyx":1060
- *                             outCount[i, bin1_min] +=  deltaA * deltaD
- *                             outData[i, bin1_min] +=  data * deltaA * deltaD
- *                             for j in range(bin1_min + 1, bin1_max):             # <<<<<<<<<<<<<<
- *                                 outCount[i, j] +=  deltaA
- *                                 outData[i, j] +=  data * deltaA
+                  /* "splitBBoxLUT.pyx":782
+ *                                 k = outMax[i, j]
+ *                                 lut[i, j, k].idx = idx
+ *                                 lut[i, j, k].coef =  deltaA             # <<<<<<<<<<<<<<
+ *                                 outMax[i, j] = k + 1
+ * 
  */
-                __pyx_t_102 = __pyx_v_bin1_max;
-                for (__pyx_t_103 = (__pyx_v_bin1_min + 1); __pyx_t_103 < __pyx_t_102; __pyx_t_103+=1) {
-                  __pyx_v_j = __pyx_t_103;
+                  __pyx_t_171 = __pyx_v_i;
+                  __pyx_t_172 = __pyx_v_j;
+                  __pyx_t_173 = __pyx_v_k;
+                  (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_171, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_172, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_173, __pyx_pybuffernd_lut.diminfo[2].strides)).coef = __pyx_v_deltaA;
 
-                  /* "splitBBoxLUT.pyx":1061
- *                             outData[i, bin1_min] +=  data * deltaA * deltaD
- *                             for j in range(bin1_min + 1, bin1_max):
- *                                 outCount[i, j] +=  deltaA             # <<<<<<<<<<<<<<
- *                                 outData[i, j] +=  data * deltaA
- *                             outCount[i, bin1_max] +=  deltaA * deltaU
+                  /* "splitBBoxLUT.pyx":783
+ *                                 lut[i, j, k].idx = idx
+ *                                 lut[i, j, k].coef =  deltaA
+ *                                 outMax[i, j] = k + 1             # <<<<<<<<<<<<<<
+ * 
+ *                             k = outMax[i, bin1_max]
  */
-                  __pyx_t_104 = __pyx_v_i;
-                  __pyx_t_105 = __pyx_v_j;
-                  *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_104, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_105, __pyx_pybuffernd_outCount.diminfo[1].strides) += __pyx_v_deltaA;
-
-                  /* "splitBBoxLUT.pyx":1062
- *                             for j in range(bin1_min + 1, bin1_max):
- *                                 outCount[i, j] +=  deltaA
- *                                 outData[i, j] +=  data * deltaA             # <<<<<<<<<<<<<<
- *                             outCount[i, bin1_max] +=  deltaA * deltaU
- *                             outData[i, bin1_max] +=  data * deltaA * deltaU
- */
-                  __pyx_t_106 = __pyx_v_i;
-                  __pyx_t_107 = __pyx_v_j;
-                  *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_106, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_107, __pyx_pybuffernd_outData.diminfo[1].strides) += (__pyx_v_data * __pyx_v_deltaA);
+                  __pyx_t_174 = __pyx_v_i;
+                  __pyx_t_175 = __pyx_v_j;
+                  *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_174, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_175, __pyx_pybuffernd_outMax.diminfo[1].strides) = (__pyx_v_k + 1);
                 }
 
-                /* "splitBBoxLUT.pyx":1063
- *                                 outCount[i, j] +=  deltaA
- *                                 outData[i, j] +=  data * deltaA
- *                             outCount[i, bin1_max] +=  deltaA * deltaU             # <<<<<<<<<<<<<<
- *                             outData[i, bin1_max] +=  data * deltaA * deltaU
- *                     for j in range(bin1_min + 1, bin1_max):
- */
-                __pyx_t_102 = __pyx_v_i;
-                __pyx_t_103 = __pyx_v_bin1_max;
-                *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_102, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_103, __pyx_pybuffernd_outCount.diminfo[1].strides) += (__pyx_v_deltaA * __pyx_v_deltaU);
-
-                /* "splitBBoxLUT.pyx":1064
- *                                 outData[i, j] +=  data * deltaA
- *                             outCount[i, bin1_max] +=  deltaA * deltaU
- *                             outData[i, bin1_max] +=  data * deltaA * deltaU             # <<<<<<<<<<<<<<
- *                     for j in range(bin1_min + 1, bin1_max):
- *                             outCount[bin0_min, j] +=  deltaA * deltaL
- */
-                __pyx_t_108 = __pyx_v_i;
-                __pyx_t_109 = __pyx_v_bin1_max;
-                *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_108, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_109, __pyx_pybuffernd_outData.diminfo[1].strides) += ((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaU);
-              }
+                /* "splitBBoxLUT.pyx":785
+ *                                 outMax[i, j] = k + 1
+ * 
+ *                             k = outMax[i, bin1_max]             # <<<<<<<<<<<<<<
+ *                             lut[i, bin1_max, k].idx = idx
+ *                             lut[i, bin1_max, k].coef =  deltaA * deltaU
+ */
+                __pyx_t_165 = __pyx_v_i;
+                __pyx_t_164 = __pyx_v_bin1_max;
+                __pyx_v_k = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_165, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_164, __pyx_pybuffernd_outMax.diminfo[1].strides));
+
+                /* "splitBBoxLUT.pyx":786
+ * 
+ *                             k = outMax[i, bin1_max]
+ *                             lut[i, bin1_max, k].idx = idx             # <<<<<<<<<<<<<<
+ *                             lut[i, bin1_max, k].coef =  deltaA * deltaU
+ *                             outMax[i, bin1_max] = k + 1
+ */
+                __pyx_t_176 = __pyx_v_i;
+                __pyx_t_177 = __pyx_v_bin1_max;
+                __pyx_t_178 = __pyx_v_k;
+                (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_176, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_177, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_178, __pyx_pybuffernd_lut.diminfo[2].strides)).idx = __pyx_v_idx;
 
-              /* "splitBBoxLUT.pyx":1065
- *                             outCount[i, bin1_max] +=  deltaA * deltaU
- *                             outData[i, bin1_max] +=  data * deltaA * deltaU
- *                     for j in range(bin1_min + 1, bin1_max):             # <<<<<<<<<<<<<<
- *                             outCount[bin0_min, j] +=  deltaA * deltaL
- *                             outData[bin0_min, j] +=  data * deltaA * deltaL
+                /* "splitBBoxLUT.pyx":787
+ *                             k = outMax[i, bin1_max]
+ *                             lut[i, bin1_max, k].idx = idx
+ *                             lut[i, bin1_max, k].coef =  deltaA * deltaU             # <<<<<<<<<<<<<<
+ *                             outMax[i, bin1_max] = k + 1
+ * 
  */
-              __pyx_t_96 = __pyx_v_bin1_max;
-              for (__pyx_t_97 = (__pyx_v_bin1_min + 1); __pyx_t_97 < __pyx_t_96; __pyx_t_97+=1) {
-                __pyx_v_j = __pyx_t_97;
+                __pyx_t_179 = __pyx_v_i;
+                __pyx_t_180 = __pyx_v_bin1_max;
+                __pyx_t_181 = __pyx_v_k;
+                (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_179, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_180, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_181, __pyx_pybuffernd_lut.diminfo[2].strides)).coef = (__pyx_v_deltaA * __pyx_v_deltaU);
 
-                /* "splitBBoxLUT.pyx":1066
- *                             outData[i, bin1_max] +=  data * deltaA * deltaU
- *                     for j in range(bin1_min + 1, bin1_max):
- *                             outCount[bin0_min, j] +=  deltaA * deltaL             # <<<<<<<<<<<<<<
- *                             outData[bin0_min, j] +=  data * deltaA * deltaL
+                /* "splitBBoxLUT.pyx":788
+ *                             lut[i, bin1_max, k].idx = idx
+ *                             lut[i, bin1_max, k].coef =  deltaA * deltaU
+ *                             outMax[i, bin1_max] = k + 1             # <<<<<<<<<<<<<<
  * 
+ *                         for j in range(bin1_min + 1, bin1_max):
  */
-                __pyx_t_110 = __pyx_v_bin0_min;
-                __pyx_t_111 = __pyx_v_j;
-                *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_110, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_111, __pyx_pybuffernd_outCount.diminfo[1].strides) += (__pyx_v_deltaA * __pyx_v_deltaL);
+                __pyx_t_182 = __pyx_v_i;
+                __pyx_t_183 = __pyx_v_bin1_max;
+                *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_182, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_183, __pyx_pybuffernd_outMax.diminfo[1].strides) = (__pyx_v_k + 1);
+              }
 
-                /* "splitBBoxLUT.pyx":1067
- *                     for j in range(bin1_min + 1, bin1_max):
- *                             outCount[bin0_min, j] +=  deltaA * deltaL
- *                             outData[bin0_min, j] +=  data * deltaA * deltaL             # <<<<<<<<<<<<<<
+              /* "splitBBoxLUT.pyx":790
+ *                             outMax[i, bin1_max] = k + 1
  * 
- *                             outCount[bin0_max, j] +=  deltaA * deltaR
+ *                         for j in range(bin1_min + 1, bin1_max):             # <<<<<<<<<<<<<<
+ *                             k = outMax[bin0_min, j]
+ *                             lut[bin0_min, j, k].idx = idx
  */
-                __pyx_t_112 = __pyx_v_bin0_min;
-                __pyx_t_113 = __pyx_v_j;
-                *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_112, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_113, __pyx_pybuffernd_outData.diminfo[1].strides) += ((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaL);
+              __pyx_t_152 = __pyx_v_bin1_max;
+              for (__pyx_t_153 = (__pyx_v_bin1_min + 1); __pyx_t_153 < __pyx_t_152; __pyx_t_153+=1) {
+                __pyx_v_j = __pyx_t_153;
 
-                /* "splitBBoxLUT.pyx":1069
- *                             outData[bin0_min, j] +=  data * deltaA * deltaL
+                /* "splitBBoxLUT.pyx":791
  * 
- *                             outCount[bin0_max, j] +=  deltaA * deltaR             # <<<<<<<<<<<<<<
- *                             outData[bin0_max, j] +=  data * deltaA * deltaR
+ *                         for j in range(bin1_min + 1, bin1_max):
+ *                             k = outMax[bin0_min, j]             # <<<<<<<<<<<<<<
+ *                             lut[bin0_min, j, k].idx = idx
+ *                             lut[bin0_min, j, k].coef =  deltaA * deltaL
+ */
+                __pyx_t_184 = __pyx_v_bin0_min;
+                __pyx_t_185 = __pyx_v_j;
+                __pyx_v_k = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_184, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_185, __pyx_pybuffernd_outMax.diminfo[1].strides));
+
+                /* "splitBBoxLUT.pyx":792
+ *                         for j in range(bin1_min + 1, bin1_max):
+ *                             k = outMax[bin0_min, j]
+ *                             lut[bin0_min, j, k].idx = idx             # <<<<<<<<<<<<<<
+ *                             lut[bin0_min, j, k].coef =  deltaA * deltaL
+ *                             outMax[bin0_min, j] = k + 1
+ */
+                __pyx_t_186 = __pyx_v_bin0_min;
+                __pyx_t_187 = __pyx_v_j;
+                __pyx_t_188 = __pyx_v_k;
+                (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_186, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_187, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_188, __pyx_pybuffernd_lut.diminfo[2].strides)).idx = __pyx_v_idx;
+
+                /* "splitBBoxLUT.pyx":793
+ *                             k = outMax[bin0_min, j]
+ *                             lut[bin0_min, j, k].idx = idx
+ *                             lut[bin0_min, j, k].coef =  deltaA * deltaL             # <<<<<<<<<<<<<<
+ *                             outMax[bin0_min, j] = k + 1
  * 
  */
-                __pyx_t_114 = __pyx_v_bin0_max;
-                __pyx_t_115 = __pyx_v_j;
-                *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_114, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_115, __pyx_pybuffernd_outCount.diminfo[1].strides) += (__pyx_v_deltaA * __pyx_v_deltaR);
+                __pyx_t_189 = __pyx_v_bin0_min;
+                __pyx_t_190 = __pyx_v_j;
+                __pyx_t_191 = __pyx_v_k;
+                (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_189, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_190, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_191, __pyx_pybuffernd_lut.diminfo[2].strides)).coef = (__pyx_v_deltaA * __pyx_v_deltaL);
 
-                /* "splitBBoxLUT.pyx":1070
+                /* "splitBBoxLUT.pyx":794
+ *                             lut[bin0_min, j, k].idx = idx
+ *                             lut[bin0_min, j, k].coef =  deltaA * deltaL
+ *                             outMax[bin0_min, j] = k + 1             # <<<<<<<<<<<<<<
  * 
- *                             outCount[bin0_max, j] +=  deltaA * deltaR
- *                             outData[bin0_max, j] +=  data * deltaA * deltaR             # <<<<<<<<<<<<<<
+ *                             k = outMax[bin0_max, j]
+ */
+                __pyx_t_192 = __pyx_v_bin0_min;
+                __pyx_t_193 = __pyx_v_j;
+                *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_192, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_193, __pyx_pybuffernd_outMax.diminfo[1].strides) = (__pyx_v_k + 1);
+
+                /* "splitBBoxLUT.pyx":796
+ *                             outMax[bin0_min, j] = k + 1
  * 
- *         for i in range(bins0):
+ *                             k = outMax[bin0_max, j]             # <<<<<<<<<<<<<<
+ *                             lut[bin0_max, j, k].idx = idx
+ *                             lut[bin0_max, j, k].coef =  deltaA * deltaR
  */
-                __pyx_t_116 = __pyx_v_bin0_max;
-                __pyx_t_117 = __pyx_v_j;
-                *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_116, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_117, __pyx_pybuffernd_outData.diminfo[1].strides) += ((__pyx_v_data * __pyx_v_deltaA) * __pyx_v_deltaR);
-              }
-            }
-            __pyx_L53:;
-          }
-          __pyx_L49:;
-          __pyx_L36_continue:;
-        }
+                __pyx_t_194 = __pyx_v_bin0_max;
+                __pyx_t_195 = __pyx_v_j;
+                __pyx_v_k = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_194, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_195, __pyx_pybuffernd_outMax.diminfo[1].strides));
 
-        /* "splitBBoxLUT.pyx":1072
- *                             outData[bin0_max, j] +=  data * deltaA * deltaR
+                /* "splitBBoxLUT.pyx":797
  * 
- *         for i in range(bins0):             # <<<<<<<<<<<<<<
- *             for j in range(bins1):
- *                 if outCount[i, j] > epsilon:
+ *                             k = outMax[bin0_max, j]
+ *                             lut[bin0_max, j, k].idx = idx             # <<<<<<<<<<<<<<
+ *                             lut[bin0_max, j, k].coef =  deltaA * deltaR
+ *                             outMax[bin0_max, j] = k + 1
  */
-        __pyx_t_12 = __pyx_v_bins0;
-        for (__pyx_t_96 = 0; __pyx_t_96 < __pyx_t_12; __pyx_t_96+=1) {
-          __pyx_v_i = __pyx_t_96;
+                __pyx_t_196 = __pyx_v_bin0_max;
+                __pyx_t_197 = __pyx_v_j;
+                __pyx_t_198 = __pyx_v_k;
+                (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_196, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_197, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_198, __pyx_pybuffernd_lut.diminfo[2].strides)).idx = __pyx_v_idx;
 
-          /* "splitBBoxLUT.pyx":1073
+                /* "splitBBoxLUT.pyx":798
+ *                             k = outMax[bin0_max, j]
+ *                             lut[bin0_max, j, k].idx = idx
+ *                             lut[bin0_max, j, k].coef =  deltaA * deltaR             # <<<<<<<<<<<<<<
+ *                             outMax[bin0_max, j] = k + 1
  * 
- *         for i in range(bins0):
- *             for j in range(bins1):             # <<<<<<<<<<<<<<
- *                 if outCount[i, j] > epsilon:
- *                     outMerge[i, j] = <float> (outData[i, j] / outCount[i, j])
  */
-          __pyx_t_97 = __pyx_v_bins1;
-          for (__pyx_t_118 = 0; __pyx_t_118 < __pyx_t_97; __pyx_t_118+=1) {
-            __pyx_v_j = __pyx_t_118;
-
-            /* "splitBBoxLUT.pyx":1074
- *         for i in range(bins0):
- *             for j in range(bins1):
- *                 if outCount[i, j] > epsilon:             # <<<<<<<<<<<<<<
- *                     outMerge[i, j] = <float> (outData[i, j] / outCount[i, j])
- *                 else:
- */
-            __pyx_t_119 = __pyx_v_i;
-            __pyx_t_120 = __pyx_v_j;
-            __pyx_t_25 = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_119, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_120, __pyx_pybuffernd_outCount.diminfo[1].strides)) > __pyx_v_epsilon);
-            if (__pyx_t_25) {
-
-              /* "splitBBoxLUT.pyx":1075
- *             for j in range(bins1):
- *                 if outCount[i, j] > epsilon:
- *                     outMerge[i, j] = <float> (outData[i, j] / outCount[i, j])             # <<<<<<<<<<<<<<
- *                 else:
- *                     outMerge[i, j] = cdummy
- */
-              __pyx_t_121 = __pyx_v_i;
-              __pyx_t_122 = __pyx_v_j;
-              __pyx_t_123 = __pyx_v_i;
-              __pyx_t_124 = __pyx_v_j;
-              __pyx_t_125 = __pyx_v_i;
-              __pyx_t_126 = __pyx_v_j;
-              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.buf, __pyx_t_125, __pyx_pybuffernd_outMerge.diminfo[0].strides, __pyx_t_126, __pyx_pybuffernd_outMerge.diminfo[1].strides) = ((float)((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData.rcbuffer->pybuffer.buf, __pyx_t_121, __pyx_pybuffernd_outData.diminfo[0].strides, __pyx_t_122, __pyx_pybuffernd_outData.diminfo[1].strides)) / (*__Pyx_BufPtrStrided2d(__py [...]
-              goto __pyx_L66;
-            }
-            /*else*/ {
+                __pyx_t_199 = __pyx_v_bin0_max;
+                __pyx_t_200 = __pyx_v_j;
+                __pyx_t_201 = __pyx_v_k;
+                (*__Pyx_BufPtrStrided3d(struct __pyx_t_12splitBBoxLUT_lut_point *, __pyx_pybuffernd_lut.rcbuffer->pybuffer.buf, __pyx_t_199, __pyx_pybuffernd_lut.diminfo[0].strides, __pyx_t_200, __pyx_pybuffernd_lut.diminfo[1].strides, __pyx_t_201, __pyx_pybuffernd_lut.diminfo[2].strides)).coef = (__pyx_v_deltaA * __pyx_v_deltaR);
 
-              /* "splitBBoxLUT.pyx":1077
- *                     outMerge[i, j] = <float> (outData[i, j] / outCount[i, j])
- *                 else:
- *                     outMerge[i, j] = cdummy             # <<<<<<<<<<<<<<
- *     return outMerge.T, edges0, edges1, outData.T, outCount.T
+                /* "splitBBoxLUT.pyx":799
+ *                             lut[bin0_max, j, k].idx = idx
+ *                             lut[bin0_max, j, k].coef =  deltaA * deltaR
+ *                             outMax[bin0_max, j] = k + 1             # <<<<<<<<<<<<<<
  * 
+ *         self.lut=lut
  */
-              __pyx_t_127 = __pyx_v_i;
-              __pyx_t_128 = __pyx_v_j;
-              *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_outMerge.rcbuffer->pybuffer.buf, __pyx_t_127, __pyx_pybuffernd_outMerge.diminfo[0].strides, __pyx_t_128, __pyx_pybuffernd_outMerge.diminfo[1].strides) = __pyx_v_cdummy;
+                __pyx_t_202 = __pyx_v_bin0_max;
+                __pyx_t_203 = __pyx_v_j;
+                *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outMax.rcbuffer->pybuffer.buf, __pyx_t_202, __pyx_pybuffernd_outMax.diminfo[0].strides, __pyx_t_203, __pyx_pybuffernd_outMax.diminfo[1].strides) = (__pyx_v_k + 1);
+              }
             }
-            __pyx_L66:;
+            __pyx_L37:;
           }
+          __pyx_L33:;
+          __pyx_L25_continue:;
         }
       }
 
-      /* "splitBBoxLUT.pyx":958
- *     edges0 = numpy.linspace(pos0_min+0.5*delta0, pos0_maxin-0.5*delta0, bins0)
- *     edges1 = numpy.linspace(pos1_min+0.5*delta1, pos1_maxin-0.5*delta1, bins1)
- *     with nogil:             # <<<<<<<<<<<<<<
- *         for idx in range(size):
- *             if (check_mask) and cmask[idx]:
+      /* "splitBBoxLUT.pyx":659
+ *         lut = numpy.recarray(shape=(bins0, bins1, lut_size),dtype=[("idx",numpy.int32),("coef",numpy.float32)])
+ *         memset(&lut[0,0,0], 0, lut_nbytes)
+ *         with nogil:             # <<<<<<<<<<<<<<
+ *             for idx in range(size):
+ *                 if (check_mask) and cmask[idx]:
  */
       /*finally:*/ {
         int __pyx_why;
-        __pyx_why = 0; goto __pyx_L35;
-        __pyx_L34: __pyx_why = 4; goto __pyx_L35;
-        __pyx_L35:;
+        __pyx_why = 0; goto __pyx_L24;
+        __pyx_L23: __pyx_why = 4; goto __pyx_L24;
+        __pyx_L24:;
+        #ifdef WITH_THREAD
         Py_BLOCK_THREADS
+        #endif
         switch (__pyx_why) {
           case 4: goto __pyx_L1_error;
         }
       }
   }
 
-  /* "splitBBoxLUT.pyx":1078
- *                 else:
- *                     outMerge[i, j] = cdummy
- *     return outMerge.T, edges0, edges1, outData.T, outCount.T             # <<<<<<<<<<<<<<
+  /* "splitBBoxLUT.pyx":801
+ *                             outMax[bin0_max, j] = k + 1
+ * 
+ *         self.lut=lut             # <<<<<<<<<<<<<<
+ *         return outMax
+ * 
+ */
+  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__lut, ((PyObject *)__pyx_v_lut)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "splitBBoxLUT.pyx":802
  * 
+ *         self.lut=lut
+ *         return outMax             # <<<<<<<<<<<<<<
  * 
+ *     @cython.cdivision(True)
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_outMerge), __pyx_n_s__T); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_9 = PyObject_GetAttr(((PyObject *)__pyx_v_outData), __pyx_n_s__T); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_9);
-  __pyx_t_13 = PyObject_GetAttr(((PyObject *)__pyx_v_outCount), __pyx_n_s__T); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_13);
-  __pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
-  __Pyx_GIVEREF(__pyx_t_3);
-  __Pyx_INCREF(__pyx_v_edges0);
-  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_edges0);
-  __Pyx_GIVEREF(__pyx_v_edges0);
-  __Pyx_INCREF(__pyx_v_edges1);
-  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_edges1);
-  __Pyx_GIVEREF(__pyx_v_edges1);
-  PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_9);
-  __Pyx_GIVEREF(__pyx_t_9);
-  PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_t_13);
-  __Pyx_GIVEREF(__pyx_t_13);
-  __pyx_t_3 = 0;
-  __pyx_t_9 = 0;
-  __pyx_t_13 = 0;
-  __pyx_r = ((PyObject *)__pyx_t_4);
-  __pyx_t_4 = 0;
+  __Pyx_INCREF(((PyObject *)__pyx_v_outMax));
+  __pyx_r = ((PyObject *)__pyx_v_outMax);
   goto __pyx_L0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -16573,176 +12454,80 @@ static PyObject *__pyx_pf_12splitBBoxLUT_histoBBox2d(CYTHON_UNUSED PyObject *__p
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_XDECREF(__pyx_t_4);
-  __Pyx_XDECREF(__pyx_t_9);
-  __Pyx_XDECREF(__pyx_t_13);
-  __PYX_XDEC_MEMVIEW(&__pyx_t_24, 1);
-  __PYX_XDEC_MEMVIEW(&__pyx_t_28, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1);
+  __Pyx_XDECREF(__pyx_t_10);
+  __Pyx_XDECREF(__pyx_t_11);
+  __Pyx_XDECREF(__pyx_t_12);
+  __PYX_XDEC_MEMVIEW(&__pyx_t_15, 1);
+  __Pyx_XDECREF(__pyx_t_32);
   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
-    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cdata.rcbuffer->pybuffer);
-    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos0.rcbuffer->pybuffer);
-    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos0_lower.rcbuffer->pybuffer);
-    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos0_upper.rcbuffer->pybuffer);
-    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos1.rcbuffer->pybuffer);
-    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dpos0.rcbuffer->pybuffer);
-    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dpos1.rcbuffer->pybuffer);
-    __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_lut.rcbuffer->pybuffer);
+    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outMax.rcbuffer->pybuffer);
   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
-  __Pyx_AddTraceback("splitBBoxLUT.histoBBox2d", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("splitBBoxLUT.HistoBBox2d.calc_lut", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   goto __pyx_L2;
   __pyx_L0:;
-  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cdata.rcbuffer->pybuffer);
-  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos0.rcbuffer->pybuffer);
-  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos0_lower.rcbuffer->pybuffer);
-  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos0_upper.rcbuffer->pybuffer);
-  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cpos1.rcbuffer->pybuffer);
-  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dpos0.rcbuffer->pybuffer);
-  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dpos1.rcbuffer->pybuffer);
-  __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_lut.rcbuffer->pybuffer);
+  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outMax.rcbuffer->pybuffer);
   __pyx_L2:;
-  __Pyx_XDECREF((PyObject *)__pyx_v_cdata);
-  __Pyx_XDECREF((PyObject *)__pyx_v_cpos0);
-  __Pyx_XDECREF((PyObject *)__pyx_v_dpos0);
-  __Pyx_XDECREF((PyObject *)__pyx_v_cpos1);
-  __Pyx_XDECREF((PyObject *)__pyx_v_dpos1);
-  __Pyx_XDECREF((PyObject *)__pyx_v_cpos0_upper);
-  __Pyx_XDECREF((PyObject *)__pyx_v_cpos0_lower);
-  __Pyx_XDECREF((PyObject *)__pyx_v_outData);
-  __Pyx_XDECREF((PyObject *)__pyx_v_outCount);
-  __Pyx_XDECREF((PyObject *)__pyx_v_outMerge);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_cpos0_sup, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_cpos0_inf, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_cpos1_inf, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_cpos1_sup, 1);
+  __Pyx_XDECREF((PyObject *)__pyx_v_outMax);
+  __Pyx_XDECREF((PyObject *)__pyx_v_lut);
   __PYX_XDEC_MEMVIEW(&__pyx_v_cmask, 1);
-  __PYX_XDEC_MEMVIEW(&__pyx_v_cflat, 1);
-  __PYX_XDEC_MEMVIEW(&__pyx_v_cdark, 1);
-  __PYX_XDEC_MEMVIEW(&__pyx_v_cpolarization, 1);
-  __PYX_XDEC_MEMVIEW(&__pyx_v_csolidangle, 1);
-  __Pyx_XDECREF(__pyx_v_edges0);
-  __Pyx_XDECREF(__pyx_v_edges1);
+  __Pyx_XDECREF(__pyx_v_memsize);
   __Pyx_XGIVEREF(__pyx_r);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
 /* Python wrapper */
-static PyObject *__pyx_pw_12splitBBoxLUT_3histoBBox1d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_12splitBBoxLUT_2histoBBox1d[] = "\n    Calculates histogram of pos0 (tth) weighted by weights\n\n    Splitting is done on the pixel's bounding box like fit2D\n\n    @param weights: array with intensities\n    @param pos0: 1D array with pos0: tth or q_vect\n    @param delta_pos0: 1D array with delta pos0: max center-corner distance\n    @param pos1: 1D array with pos1: chi\n    @param delta_pos1: 1D array with max pos1: max center-corner distance, unused !\n    @para [...]
-static PyMethodDef __pyx_mdef_12splitBBoxLUT_3histoBBox1d = {__Pyx_NAMESTR("histoBBox1d"), (PyCFunction)__pyx_pw_12splitBBoxLUT_3histoBBox1d, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_12splitBBoxLUT_2histoBBox1d)};
-static PyObject *__pyx_pw_12splitBBoxLUT_3histoBBox1d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_12splitBBoxLUT_11HistoBBox2d_7integrate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_12splitBBoxLUT_11HistoBBox2d_6integrate[] = "\n        Actually perform the 2D integration which in this case looks more like a matrix-vector product\n\n        @param weights: input image\n        @type weights: ndarray\n        @param dummy: value for dead pixels (optional)\n        @type dummy: float\n        @param delta_dummy: precision for dead-pixel value in dynamic masking\n        @type delta_dummy: float\n        @param dark: array with the dark-current va [...]
+static PyMethodDef __pyx_mdef_12splitBBoxLUT_11HistoBBox2d_7integrate = {__Pyx_NAMESTR("integrate"), (PyCFunction)__pyx_pw_12splitBBoxLUT_11HistoBBox2d_7integrate, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_12splitBBoxLUT_11HistoBBox2d_6integrate)};
+static PyObject *__pyx_pw_12splitBBoxLUT_11HistoBBox2d_7integrate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  PyObject *__pyx_v_self = 0;
   PyObject *__pyx_v_weights = 0;
-  PyObject *__pyx_v_pos0 = 0;
-  PyObject *__pyx_v_delta_pos0 = 0;
-  PyObject *__pyx_v_pos1 = 0;
-  PyObject *__pyx_v_delta_pos1 = 0;
-  PyObject *__pyx_v_bins = 0;
-  PyObject *__pyx_v_pos0Range = 0;
-  PyObject *__pyx_v_pos1Range = 0;
   PyObject *__pyx_v_dummy = 0;
   PyObject *__pyx_v_delta_dummy = 0;
-  PyObject *__pyx_v_mask = 0;
   PyObject *__pyx_v_dark = 0;
   PyObject *__pyx_v_flat = 0;
+  PyObject *__pyx_v_solidAngle = 0;
+  PyObject *__pyx_v_polarization = 0;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
-  __Pyx_RefNannySetupContext("histoBBox1d (wrapper)", 0);
+  __Pyx_RefNannySetupContext("integrate (wrapper)", 0);
   {
-    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__weights,&__pyx_n_s__pos0,&__pyx_n_s__delta_pos0,&__pyx_n_s__pos1,&__pyx_n_s__delta_pos1,&__pyx_n_s__bins,&__pyx_n_s__pos0Range,&__pyx_n_s__pos1Range,&__pyx_n_s__dummy,&__pyx_n_s__delta_dummy,&__pyx_n_s__mask,&__pyx_n_s__dark,&__pyx_n_s__flat,0};
-    PyObject* values[13] = {0,0,0,0,0,0,0,0,0,0,0,0,0};
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__weights,&__pyx_n_s__dummy,&__pyx_n_s__delta_dummy,&__pyx_n_s__dark,&__pyx_n_s__flat,&__pyx_n_s__solidAngle,&__pyx_n_s__polarization,0};
+    PyObject* values[8] = {0,0,0,0,0,0,0,0};
 
-    /* "splitBBoxLUT.pyx":1084
- *                 pos0,
- *                 delta_pos0,
- *                 pos1=None,             # <<<<<<<<<<<<<<
- *                 delta_pos1=None,
- *                 bins=100,
- */
-    values[3] = ((PyObject *)Py_None);
-
-    /* "splitBBoxLUT.pyx":1085
- *                 delta_pos0,
- *                 pos1=None,
- *                 delta_pos1=None,             # <<<<<<<<<<<<<<
- *                 bins=100,
- *                 pos0Range=None,
- */
-    values[4] = ((PyObject *)Py_None);
-    values[5] = ((PyObject *)__pyx_int_100);
-
-    /* "splitBBoxLUT.pyx":1087
- *                 delta_pos1=None,
- *                 bins=100,
- *                 pos0Range=None,             # <<<<<<<<<<<<<<
- *                 pos1Range=None,
- *                 dummy=None,
- */
-    values[6] = ((PyObject *)Py_None);
-
-    /* "splitBBoxLUT.pyx":1088
- *                 bins=100,
- *                 pos0Range=None,
- *                 pos1Range=None,             # <<<<<<<<<<<<<<
- *                 dummy=None,
- *                 delta_dummy=None,
- */
-    values[7] = ((PyObject *)Py_None);
-
-    /* "splitBBoxLUT.pyx":1089
- *                 pos0Range=None,
- *                 pos1Range=None,
- *                 dummy=None,             # <<<<<<<<<<<<<<
- *                 delta_dummy=None,
- *                 mask=None,
- */
-    values[8] = ((PyObject *)Py_None);
-
-    /* "splitBBoxLUT.pyx":1090
- *                 pos1Range=None,
- *                 dummy=None,
- *                 delta_dummy=None,             # <<<<<<<<<<<<<<
- *                 mask=None,
- *                 dark=None,
- */
-    values[9] = ((PyObject *)Py_None);
-
-    /* "splitBBoxLUT.pyx":1091
- *                 dummy=None,
- *                 delta_dummy=None,
- *                 mask=None,             # <<<<<<<<<<<<<<
- *                 dark=None,
- *                 flat=None
- */
-    values[10] = ((PyObject *)Py_None);
-
-    /* "splitBBoxLUT.pyx":1092
- *                 delta_dummy=None,
- *                 mask=None,
- *                 dark=None,             # <<<<<<<<<<<<<<
- *                 flat=None
- *               ):
- */
-    values[11] = ((PyObject *)Py_None);
-
-    /* "splitBBoxLUT.pyx":1093
- *                 mask=None,
- *                 dark=None,
- *                 flat=None             # <<<<<<<<<<<<<<
- *               ):
- *     """
+    /* "splitBBoxLUT.pyx":807
+ *     @cython.boundscheck(False)
+ *     @cython.wraparound(False)
+ *     def integrate(self, weights, dummy=None, delta_dummy=None, dark=None, flat=None, solidAngle=None, polarization=None):             # <<<<<<<<<<<<<<
+ *         """
+ *         Actually perform the 2D integration which in this case looks more like a matrix-vector product
  */
-    values[12] = ((PyObject *)Py_None);
+    values[2] = ((PyObject *)((PyObject *)Py_None));
+    values[3] = ((PyObject *)((PyObject *)Py_None));
+    values[4] = ((PyObject *)((PyObject *)Py_None));
+    values[5] = ((PyObject *)((PyObject *)Py_None));
+    values[6] = ((PyObject *)((PyObject *)Py_None));
+    values[7] = ((PyObject *)((PyObject *)Py_None));
     if (unlikely(__pyx_kwds)) {
       Py_ssize_t kw_args;
       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
       switch (pos_args) {
-        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
-        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
-        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
-        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
-        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
         case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
         case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
         case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
@@ -16757,171 +12542,129 @@ static PyObject *__pyx_pw_12splitBBoxLUT_3histoBBox1d(PyObject *__pyx_self, PyOb
       kw_args = PyDict_Size(__pyx_kwds);
       switch (pos_args) {
         case  0:
-        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__weights)) != 0)) kw_args--;
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
         else goto __pyx_L5_argtuple_error;
         case  1:
-        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos0)) != 0)) kw_args--;
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__weights)) != 0)) kw_args--;
         else {
-          __Pyx_RaiseArgtupleInvalid("histoBBox1d", 0, 3, 13, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+          __Pyx_RaiseArgtupleInvalid("integrate", 0, 2, 8, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         case  2:
-        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__delta_pos0)) != 0)) kw_args--;
-        else {
-          __Pyx_RaiseArgtupleInvalid("histoBBox1d", 0, 3, 13, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        if (kw_args > 0) {
+          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dummy);
+          if (value) { values[2] = value; kw_args--; }
         }
         case  3:
         if (kw_args > 0) {
-          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos1);
+          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__delta_dummy);
           if (value) { values[3] = value; kw_args--; }
         }
         case  4:
         if (kw_args > 0) {
-          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__delta_pos1);
+          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dark);
           if (value) { values[4] = value; kw_args--; }
         }
         case  5:
         if (kw_args > 0) {
-          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bins);
+          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flat);
           if (value) { values[5] = value; kw_args--; }
         }
         case  6:
         if (kw_args > 0) {
-          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos0Range);
+          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__solidAngle);
           if (value) { values[6] = value; kw_args--; }
         }
         case  7:
         if (kw_args > 0) {
-          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos1Range);
+          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__polarization);
           if (value) { values[7] = value; kw_args--; }
         }
-        case  8:
-        if (kw_args > 0) {
-          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dummy);
-          if (value) { values[8] = value; kw_args--; }
-        }
-        case  9:
-        if (kw_args > 0) {
-          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__delta_dummy);
-          if (value) { values[9] = value; kw_args--; }
-        }
-        case 10:
-        if (kw_args > 0) {
-          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mask);
-          if (value) { values[10] = value; kw_args--; }
-        }
-        case 11:
-        if (kw_args > 0) {
-          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dark);
-          if (value) { values[11] = value; kw_args--; }
-        }
-        case 12:
-        if (kw_args > 0) {
-          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flat);
-          if (value) { values[12] = value; kw_args--; }
-        }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "histoBBox1d") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "integrate") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     } else {
       switch (PyTuple_GET_SIZE(__pyx_args)) {
-        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
-        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
-        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
-        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
-        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
         case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
         case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
         case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
-        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+        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_weights = values[0];
-    __pyx_v_pos0 = values[1];
-    __pyx_v_delta_pos0 = values[2];
-    __pyx_v_pos1 = values[3];
-    __pyx_v_delta_pos1 = values[4];
-    __pyx_v_bins = values[5];
-    __pyx_v_pos0Range = values[6];
-    __pyx_v_pos1Range = values[7];
-    __pyx_v_dummy = values[8];
-    __pyx_v_delta_dummy = values[9];
-    __pyx_v_mask = values[10];
-    __pyx_v_dark = values[11];
-    __pyx_v_flat = values[12];
+    __pyx_v_self = values[0];
+    __pyx_v_weights = values[1];
+    __pyx_v_dummy = values[2];
+    __pyx_v_delta_dummy = values[3];
+    __pyx_v_dark = values[4];
+    __pyx_v_flat = values[5];
+    __pyx_v_solidAngle = values[6];
+    __pyx_v_polarization = values[7];
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("histoBBox1d", 0, 3, 13, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __Pyx_RaiseArgtupleInvalid("integrate", 0, 2, 8, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("splitBBoxLUT.histoBBox1d", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_AddTraceback("splitBBoxLUT.HistoBBox2d.integrate", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   return NULL;
   __pyx_L4_argument_unpacking_done:;
-  __pyx_r = __pyx_pf_12splitBBoxLUT_2histoBBox1d(__pyx_self, __pyx_v_weights, __pyx_v_pos0, __pyx_v_delta_pos0, __pyx_v_pos1, __pyx_v_delta_pos1, __pyx_v_bins, __pyx_v_pos0Range, __pyx_v_pos1Range, __pyx_v_dummy, __pyx_v_delta_dummy, __pyx_v_mask, __pyx_v_dark, __pyx_v_flat);
+  __pyx_r = __pyx_pf_12splitBBoxLUT_11HistoBBox2d_6integrate(__pyx_self, __pyx_v_self, __pyx_v_weights, __pyx_v_dummy, __pyx_v_delta_dummy, __pyx_v_dark, __pyx_v_flat, __pyx_v_solidAngle, __pyx_v_polarization);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "splitBBoxLUT.pyx":1081
- * 
- * 
- * def histoBBox1d(weights ,             # <<<<<<<<<<<<<<
- *                 pos0,
- *                 delta_pos0,
- */
-
-static PyObject *__pyx_pf_12splitBBoxLUT_2histoBBox1d(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_weights, PyObject *__pyx_v_pos0, PyObject *__pyx_v_delta_pos0, PyObject *__pyx_v_pos1, PyObject *__pyx_v_delta_pos1, PyObject *__pyx_v_bins, PyObject *__pyx_v_pos0Range, PyObject *__pyx_v_pos1Range, PyObject *__pyx_v_dummy, PyObject *__pyx_v_delta_dummy, PyObject *__pyx_v_mask, PyObject *__pyx_v_dark, PyObject *__pyx_v_flat) {
-  PyObject *__pyx_v_size = NULL;
-  CYTHON_UNUSED long __pyx_v_bin;
+static PyObject *__pyx_pf_12splitBBoxLUT_11HistoBBox2d_6integrate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_weights, PyObject *__pyx_v_dummy, PyObject *__pyx_v_delta_dummy, PyObject *__pyx_v_dark, PyObject *__pyx_v_flat, PyObject *__pyx_v_solidAngle, PyObject *__pyx_v_polarization) {
+  int __pyx_v_i;
+  int __pyx_v_j;
+  int __pyx_v_idx;
+  int __pyx_v_bins0;
+  int __pyx_v_bins1;
+  CYTHON_UNUSED int __pyx_v_bins;
+  int __pyx_v_lut_size;
+  int __pyx_v_size;
+  double __pyx_v_sum_data;
+  double __pyx_v_sum_count;
   double __pyx_v_epsilon;
-  double __pyx_v_cdummy;
-  double __pyx_v_ddummy;
-  long __pyx_v_check_pos1;
-  long __pyx_v_check_mask;
-  long __pyx_v_do_dummy;
-  long __pyx_v_do_dark;
-  long __pyx_v_do_flat;
-  PyObject *__pyx_v_cdata = NULL;
-  PyObject *__pyx_v_cpos0 = NULL;
-  PyObject *__pyx_v_dpos0 = NULL;
-  PyObject *__pyx_v_outData = NULL;
-  PyObject *__pyx_v_outCount = NULL;
-  PyObject *__pyx_v_outMax = NULL;
-  PyObject *__pyx_v_outMerge = NULL;
-  PyObject *__pyx_v_cmask = NULL;
-  PyObject *__pyx_v_cdark = NULL;
-  PyObject *__pyx_v_cflat = NULL;
-  PyObject *__pyx_v_cpos0_lower = NULL;
-  PyObject *__pyx_v_cpos0_upper = NULL;
-  PyObject *__pyx_v_pos0_min = NULL;
-  PyObject *__pyx_v_pos0_max = NULL;
-  PyObject *__pyx_v_idx = NULL;
-  PyObject *__pyx_v_min0 = NULL;
-  PyObject *__pyx_v_max0 = NULL;
-  PyObject *__pyx_v_pos0_maxin = NULL;
-  PyObject *__pyx_v_cpos1 = NULL;
-  PyObject *__pyx_v_dpos1 = NULL;
-  PyObject *__pyx_v_pos1_min = NULL;
-  PyObject *__pyx_v_pos1_maxin = NULL;
-  PyObject *__pyx_v_pos1_max = NULL;
-  PyObject *__pyx_v_delta = NULL;
-  PyObject *__pyx_v_outPos = NULL;
-  PyObject *__pyx_v_data = NULL;
-  PyObject *__pyx_v_fbin0_min = NULL;
-  PyObject *__pyx_v_fbin0_max = NULL;
-  PyObject *__pyx_v_bin0_min = NULL;
-  PyObject *__pyx_v_bin0_max = NULL;
-  PyObject *__pyx_v_deltaA = NULL;
-  PyObject *__pyx_v_deltaL = NULL;
-  PyObject *__pyx_v_deltaR = NULL;
-  PyObject *__pyx_v_i = NULL;
+  float __pyx_v_data;
+  float __pyx_v_coef;
+  float __pyx_v_cdummy;
+  float __pyx_v_cddummy;
+  int __pyx_v_do_dummy;
+  int __pyx_v_do_dark;
+  int __pyx_v_do_flat;
+  int __pyx_v_do_polarization;
+  int __pyx_v_do_solidAngle;
+  PyArrayObject *__pyx_v_outData = 0;
+  PyArrayObject *__pyx_v_outCount = 0;
+  PyArrayObject *__pyx_v_outMerge = 0;
+  PyArrayObject *__pyx_v_outData_1d = 0;
+  PyArrayObject *__pyx_v_outCount_1d = 0;
+  PyArrayObject *__pyx_v_outMerge_1d = 0;
+  __Pyx_memviewslice __pyx_v_lut = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_cdata = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_tdata = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_cflat = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_cdark = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_csolidAngle = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_memviewslice __pyx_v_cpolarization = { 0, 0, { 0 }, { 0 }, { 0 } };
+  __Pyx_LocalBuf_ND __pyx_pybuffernd_outCount;
+  __Pyx_Buffer __pyx_pybuffer_outCount;
+  __Pyx_LocalBuf_ND __pyx_pybuffernd_outCount_1d;
+  __Pyx_Buffer __pyx_pybuffer_outCount_1d;
+  __Pyx_LocalBuf_ND __pyx_pybuffernd_outData;
+  __Pyx_Buffer __pyx_pybuffer_outData;
+  __Pyx_LocalBuf_ND __pyx_pybuffernd_outData_1d;
+  __Pyx_Buffer __pyx_pybuffer_outData_1d;
+  __Pyx_LocalBuf_ND __pyx_pybuffernd_outMerge;
+  __Pyx_Buffer __pyx_pybuffer_outMerge;
+  __Pyx_LocalBuf_ND __pyx_pybuffernd_outMerge_1d;
+  __Pyx_Buffer __pyx_pybuffer_outMerge_1d;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
@@ -16930,2312 +12673,2103 @@ static PyObject *__pyx_pf_12splitBBoxLUT_2histoBBox1d(CYTHON_UNUSED PyObject *__
   PyObject *__pyx_t_4 = NULL;
   PyObject *__pyx_t_5 = NULL;
   PyObject *__pyx_t_6 = NULL;
-  int __pyx_t_7;
-  int __pyx_t_8;
-  double __pyx_t_9;
-  Py_ssize_t __pyx_t_10;
-  PyObject *(*__pyx_t_11)(PyObject *);
-  float __pyx_t_12;
-  float __pyx_t_13;
-  float __pyx_t_14;
+  PyArrayObject *__pyx_t_7 = NULL;
+  PyArrayObject *__pyx_t_8 = NULL;
+  PyArrayObject *__pyx_t_9 = NULL;
+  PyArrayObject *__pyx_t_10 = NULL;
+  PyArrayObject *__pyx_t_11 = NULL;
+  PyArrayObject *__pyx_t_12 = NULL;
+  __Pyx_memviewslice __pyx_t_13 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  int __pyx_t_14;
   int __pyx_t_15;
-  Py_ssize_t __pyx_t_16;
-  PyObject *(*__pyx_t_17)(PyObject *);
-  PyObject *__pyx_t_18 = NULL;
+  double __pyx_t_16;
+  __Pyx_memviewslice __pyx_t_17 = { 0, 0, { 0 }, { 0 }, { 0 } };
+  int __pyx_t_18;
+  int __pyx_t_19;
+  int __pyx_t_20;
+  int __pyx_t_21;
+  int __pyx_t_22;
+  int __pyx_t_23;
+  int __pyx_t_24;
+  int __pyx_t_25;
+  int __pyx_t_26;
+  int __pyx_t_27;
+  int __pyx_t_28;
+  int __pyx_t_29;
+  int __pyx_t_30;
+  int __pyx_t_31;
+  int __pyx_t_32;
+  int __pyx_t_33;
+  int __pyx_t_34;
+  int __pyx_t_35;
+  int __pyx_t_36;
+  int __pyx_t_37;
+  int __pyx_t_38;
+  int __pyx_t_39;
+  int __pyx_t_40;
+  int __pyx_t_41;
+  __pyx_t_5numpy_int32_t __pyx_t_42;
+  int __pyx_t_43;
+  int __pyx_t_44;
+  __pyx_t_5numpy_float32_t __pyx_t_45;
+  int __pyx_t_46;
+  int __pyx_t_47;
+  int __pyx_t_48;
+  PyObject *__pyx_t_49 = NULL;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
-  __Pyx_RefNannySetupContext("histoBBox1d", 0);
+  __Pyx_RefNannySetupContext("integrate", 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_outData_1d.pybuffer.buf = NULL;
+  __pyx_pybuffer_outData_1d.refcount = 0;
+  __pyx_pybuffernd_outData_1d.data = NULL;
+  __pyx_pybuffernd_outData_1d.rcbuffer = &__pyx_pybuffer_outData_1d;
+  __pyx_pybuffer_outCount_1d.pybuffer.buf = NULL;
+  __pyx_pybuffer_outCount_1d.refcount = 0;
+  __pyx_pybuffernd_outCount_1d.data = NULL;
+  __pyx_pybuffernd_outCount_1d.rcbuffer = &__pyx_pybuffer_outCount_1d;
+  __pyx_pybuffer_outMerge_1d.pybuffer.buf = NULL;
+  __pyx_pybuffer_outMerge_1d.refcount = 0;
+  __pyx_pybuffernd_outMerge_1d.data = NULL;
+  __pyx_pybuffernd_outMerge_1d.rcbuffer = &__pyx_pybuffer_outMerge_1d;
 
-  /* "splitBBoxLUT.pyx":1115
- *     @return 2theta, I, weighted histogram, unweighted histogram
- *     """
- *     size = weights.size             # <<<<<<<<<<<<<<
- *     assert pos0.size == size
- *     assert delta_pos0.size == size
+  /* "splitBBoxLUT.pyx":829
+ * 
+ *         """
+ *         cdef int i=0, j=0, idx=0, bins0=self.bins[0], bins1=self.bins[1], bins=bins0*bins1, lut_size=self.lut_size, size=self.size             # <<<<<<<<<<<<<<
+ *         cdef double sum_data=0, sum_count=0, epsilon=1e-10
+ *         cdef float data=0, coef=0, cdummy=0, cddummy=0
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_weights, __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_v_i = 0;
+  __pyx_v_j = 0;
+  __pyx_v_idx = 0;
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__bins); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_v_size = __pyx_t_1;
-  __pyx_t_1 = 0;
+  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_v_bins0 = __pyx_t_3;
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__bins); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 1, sizeof(long), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_v_bins1 = __pyx_t_3;
+  __pyx_v_bins = (__pyx_v_bins0 * __pyx_v_bins1);
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__lut_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_v_lut_size = __pyx_t_3;
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_v_size = __pyx_t_3;
 
-  /* "splitBBoxLUT.pyx":1116
- *     """
- *     size = weights.size
- *     assert pos0.size == size             # <<<<<<<<<<<<<<
- *     assert delta_pos0.size == size
- *     assert  bins > 1
+  /* "splitBBoxLUT.pyx":830
+ *         """
+ *         cdef int i=0, j=0, idx=0, bins0=self.bins[0], bins1=self.bins[1], bins=bins0*bins1, lut_size=self.lut_size, size=self.size
+ *         cdef double sum_data=0, sum_count=0, epsilon=1e-10             # <<<<<<<<<<<<<<
+ *         cdef float data=0, coef=0, cdummy=0, cddummy=0
+ *         cdef bint do_dummy=False, do_dark=False, do_flat=False, do_polarization=False, do_solidAngle=False
  */
-  #ifndef CYTHON_WITHOUT_ASSERTIONS
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_pos0, __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_v_sum_data = 0.0;
+  __pyx_v_sum_count = 0.0;
+  __pyx_v_epsilon = 1e-10;
+
+  /* "splitBBoxLUT.pyx":831
+ *         cdef int i=0, j=0, idx=0, bins0=self.bins[0], bins1=self.bins[1], bins=bins0*bins1, lut_size=self.lut_size, size=self.size
+ *         cdef double sum_data=0, sum_count=0, epsilon=1e-10
+ *         cdef float data=0, coef=0, cdummy=0, cddummy=0             # <<<<<<<<<<<<<<
+ *         cdef bint do_dummy=False, do_dark=False, do_flat=False, do_polarization=False, do_solidAngle=False
+ *         cdef numpy.ndarray[numpy.float64_t, ndim = 2] outData = numpy.zeros(self.bins, dtype=numpy.float64)
+ */
+  __pyx_v_data = 0.0;
+  __pyx_v_coef = 0.0;
+  __pyx_v_cdummy = 0.0;
+  __pyx_v_cddummy = 0.0;
+
+  /* "splitBBoxLUT.pyx":832
+ *         cdef double sum_data=0, sum_count=0, epsilon=1e-10
+ *         cdef float data=0, coef=0, cdummy=0, cddummy=0
+ *         cdef bint do_dummy=False, do_dark=False, do_flat=False, do_polarization=False, do_solidAngle=False             # <<<<<<<<<<<<<<
+ *         cdef numpy.ndarray[numpy.float64_t, ndim = 2] outData = numpy.zeros(self.bins, dtype=numpy.float64)
+ *         cdef numpy.ndarray[numpy.float64_t, ndim = 2] outCount = numpy.zeros(self.bins, dtype=numpy.float64)
+ */
+  __pyx_v_do_dummy = 0;
+  __pyx_v_do_dark = 0;
+  __pyx_v_do_flat = 0;
+  __pyx_v_do_polarization = 0;
+  __pyx_v_do_solidAngle = 0;
+
+  /* "splitBBoxLUT.pyx":833
+ *         cdef float data=0, coef=0, cdummy=0, cddummy=0
+ *         cdef bint do_dummy=False, do_dark=False, do_flat=False, do_polarization=False, do_solidAngle=False
+ *         cdef numpy.ndarray[numpy.float64_t, ndim = 2] outData = numpy.zeros(self.bins, dtype=numpy.float64)             # <<<<<<<<<<<<<<
+ *         cdef numpy.ndarray[numpy.float64_t, ndim = 2] outCount = numpy.zeros(self.bins, dtype=numpy.float64)
+ *         cdef numpy.ndarray[numpy.float32_t, ndim = 2] outMerge = numpy.zeros(self.bins, dtype=numpy.float32)
+ */
+  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_v_size, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__bins); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
+  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
+  __Pyx_GIVEREF(__pyx_t_1);
+  __pyx_t_1 = 0;
+  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
+  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__float64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_6);
+  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+  __pyx_t_6 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_6);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (unlikely(!__pyx_t_3)) {
-    PyErr_SetNone(PyExc_AssertionError);
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 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 = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = ((PyArrayObject *)__pyx_t_6);
+  {
+    __Pyx_BufFmt_StackElem __pyx_stack[1];
+    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outData.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 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 = 833; __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];
+    }
   }
-  #endif
+  __pyx_t_7 = 0;
+  __pyx_v_outData = ((PyArrayObject *)__pyx_t_6);
+  __pyx_t_6 = 0;
 
-  /* "splitBBoxLUT.pyx":1117
- *     size = weights.size
- *     assert pos0.size == size
- *     assert delta_pos0.size == size             # <<<<<<<<<<<<<<
- *     assert  bins > 1
- *     bin = 0
+  /* "splitBBoxLUT.pyx":834
+ *         cdef bint do_dummy=False, do_dark=False, do_flat=False, do_polarization=False, do_solidAngle=False
+ *         cdef numpy.ndarray[numpy.float64_t, ndim = 2] outData = numpy.zeros(self.bins, dtype=numpy.float64)
+ *         cdef numpy.ndarray[numpy.float64_t, ndim = 2] outCount = numpy.zeros(self.bins, dtype=numpy.float64)             # <<<<<<<<<<<<<<
+ *         cdef numpy.ndarray[numpy.float32_t, ndim = 2] outMerge = numpy.zeros(self.bins, dtype=numpy.float32)
+ *         cdef numpy.ndarray[numpy.float64_t, ndim = 1] outData_1d = outData.ravel()
  */
-  #ifndef CYTHON_WITHOUT_ASSERTIONS
-  __pyx_t_2 = PyObject_GetAttr(__pyx_v_delta_pos0, __pyx_n_s__size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_6);
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__bins); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_6);
+  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
+  PyTuple_SET_ITEM(__pyx_t_4, 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 = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_6));
+  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_v_size, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__float64); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+  __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (unlikely(!__pyx_t_3)) {
-    PyErr_SetNone(PyExc_AssertionError);
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_8 = ((PyArrayObject *)__pyx_t_5);
+  {
+    __Pyx_BufFmt_StackElem __pyx_stack[1];
+    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outCount.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 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 = 834; __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];
+    }
   }
-  #endif
+  __pyx_t_8 = 0;
+  __pyx_v_outCount = ((PyArrayObject *)__pyx_t_5);
+  __pyx_t_5 = 0;
 
-  /* "splitBBoxLUT.pyx":1118
- *     assert pos0.size == size
- *     assert delta_pos0.size == size
- *     assert  bins > 1             # <<<<<<<<<<<<<<
- *     bin = 0
- *     epsilon = 1e-10
+  /* "splitBBoxLUT.pyx":835
+ *         cdef numpy.ndarray[numpy.float64_t, ndim = 2] outData = numpy.zeros(self.bins, dtype=numpy.float64)
+ *         cdef numpy.ndarray[numpy.float64_t, ndim = 2] outCount = numpy.zeros(self.bins, dtype=numpy.float64)
+ *         cdef numpy.ndarray[numpy.float32_t, ndim = 2] outMerge = numpy.zeros(self.bins, dtype=numpy.float32)             # <<<<<<<<<<<<<<
+ *         cdef numpy.ndarray[numpy.float64_t, ndim = 1] outData_1d = outData.ravel()
+ *         cdef numpy.ndarray[numpy.float64_t, ndim = 1] outCount_1d = outCount.ravel()
  */
-  #ifndef CYTHON_WITHOUT_ASSERTIONS
-  __pyx_t_1 = PyObject_RichCompare(__pyx_v_bins, __pyx_int_1, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
+  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__zeros); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_6);
+  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__bins); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
+  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
+  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
+  __Pyx_GIVEREF(__pyx_t_5);
+  __pyx_t_5 = 0;
+  __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__float32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (unlikely(!__pyx_t_3)) {
-    PyErr_SetNone(PyExc_AssertionError);
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_2 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_9 = ((PyArrayObject *)__pyx_t_2);
+  {
+    __Pyx_BufFmt_StackElem __pyx_stack[1];
+    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outMerge.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 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 = 835; __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];
+    }
   }
-  #endif
+  __pyx_t_9 = 0;
+  __pyx_v_outMerge = ((PyArrayObject *)__pyx_t_2);
+  __pyx_t_2 = 0;
 
-  /* "splitBBoxLUT.pyx":1119
- *     assert delta_pos0.size == size
- *     assert  bins > 1
- *     bin = 0             # <<<<<<<<<<<<<<
- *     epsilon = 1e-10
- *     cdummy = 0
+  /* "splitBBoxLUT.pyx":836
+ *         cdef numpy.ndarray[numpy.float64_t, ndim = 2] outCount = numpy.zeros(self.bins, dtype=numpy.float64)
+ *         cdef numpy.ndarray[numpy.float32_t, ndim = 2] outMerge = numpy.zeros(self.bins, dtype=numpy.float32)
+ *         cdef numpy.ndarray[numpy.float64_t, ndim = 1] outData_1d = outData.ravel()             # <<<<<<<<<<<<<<
+ *         cdef numpy.ndarray[numpy.float64_t, ndim = 1] outCount_1d = outCount.ravel()
+ *         cdef numpy.ndarray[numpy.float32_t, ndim = 1] outMerge_1d = outMerge.ravel()
  */
-  __pyx_v_bin = 0;
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_outData), __pyx_n_s__ravel); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_10 = ((PyArrayObject *)__pyx_t_5);
+  {
+    __Pyx_BufFmt_StackElem __pyx_stack[1];
+    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outData_1d.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_1d = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_outData_1d.rcbuffer->pybuffer.buf = NULL;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    } else {__pyx_pybuffernd_outData_1d.diminfo[0].strides = __pyx_pybuffernd_outData_1d.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outData_1d.diminfo[0].shape = __pyx_pybuffernd_outData_1d.rcbuffer->pybuffer.shape[0];
+    }
+  }
+  __pyx_t_10 = 0;
+  __pyx_v_outData_1d = ((PyArrayObject *)__pyx_t_5);
+  __pyx_t_5 = 0;
 
-  /* "splitBBoxLUT.pyx":1120
- *     assert  bins > 1
- *     bin = 0
- *     epsilon = 1e-10             # <<<<<<<<<<<<<<
- *     cdummy = 0
- *     ddummy = 0
+  /* "splitBBoxLUT.pyx":837
+ *         cdef numpy.ndarray[numpy.float32_t, ndim = 2] outMerge = numpy.zeros(self.bins, dtype=numpy.float32)
+ *         cdef numpy.ndarray[numpy.float64_t, ndim = 1] outData_1d = outData.ravel()
+ *         cdef numpy.ndarray[numpy.float64_t, ndim = 1] outCount_1d = outCount.ravel()             # <<<<<<<<<<<<<<
+ *         cdef numpy.ndarray[numpy.float32_t, ndim = 1] outMerge_1d = outMerge.ravel()
+ * 
  */
-  __pyx_v_epsilon = 1e-10;
+  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_outCount), __pyx_n_s__ravel); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
+  __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_11 = ((PyArrayObject *)__pyx_t_2);
+  {
+    __Pyx_BufFmt_StackElem __pyx_stack[1];
+    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outCount_1d.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_1d = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_outCount_1d.rcbuffer->pybuffer.buf = NULL;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    } else {__pyx_pybuffernd_outCount_1d.diminfo[0].strides = __pyx_pybuffernd_outCount_1d.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outCount_1d.diminfo[0].shape = __pyx_pybuffernd_outCount_1d.rcbuffer->pybuffer.shape[0];
+    }
+  }
+  __pyx_t_11 = 0;
+  __pyx_v_outCount_1d = ((PyArrayObject *)__pyx_t_2);
+  __pyx_t_2 = 0;
 
-  /* "splitBBoxLUT.pyx":1121
- *     bin = 0
- *     epsilon = 1e-10
- *     cdummy = 0             # <<<<<<<<<<<<<<
- *     ddummy = 0
+  /* "splitBBoxLUT.pyx":838
+ *         cdef numpy.ndarray[numpy.float64_t, ndim = 1] outData_1d = outData.ravel()
+ *         cdef numpy.ndarray[numpy.float64_t, ndim = 1] outCount_1d = outCount.ravel()
+ *         cdef numpy.ndarray[numpy.float32_t, ndim = 1] outMerge_1d = outMerge.ravel()             # <<<<<<<<<<<<<<
  * 
+ *         cdef lut_point[:,:] lut = self.lut
  */
-  __pyx_v_cdummy = 0.0;
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_outMerge), __pyx_n_s__ravel); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_12 = ((PyArrayObject *)__pyx_t_5);
+  {
+    __Pyx_BufFmt_StackElem __pyx_stack[1];
+    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outMerge_1d.rcbuffer->pybuffer, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
+      __pyx_v_outMerge_1d = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_outMerge_1d.rcbuffer->pybuffer.buf = NULL;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    } else {__pyx_pybuffernd_outMerge_1d.diminfo[0].strides = __pyx_pybuffernd_outMerge_1d.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outMerge_1d.diminfo[0].shape = __pyx_pybuffernd_outMerge_1d.rcbuffer->pybuffer.shape[0];
+    }
+  }
+  __pyx_t_12 = 0;
+  __pyx_v_outMerge_1d = ((PyArrayObject *)__pyx_t_5);
+  __pyx_t_5 = 0;
 
-  /* "splitBBoxLUT.pyx":1122
- *     epsilon = 1e-10
- *     cdummy = 0
- *     ddummy = 0             # <<<<<<<<<<<<<<
+  /* "splitBBoxLUT.pyx":840
+ *         cdef numpy.ndarray[numpy.float32_t, ndim = 1] outMerge_1d = outMerge.ravel()
  * 
- *     check_pos1 = 0
- */
-  __pyx_v_ddummy = 0.0;
-
-  /* "splitBBoxLUT.pyx":1124
- *     ddummy = 0
+ *         cdef lut_point[:,:] lut = self.lut             # <<<<<<<<<<<<<<
+ *         cdef float[:] cdata, tdata, cflat, cdark, csolidAngle, cpolarization
  * 
- *     check_pos1 = 0             # <<<<<<<<<<<<<<
- *     check_mask = 0
- *     do_dummy = 0
  */
-  __pyx_v_check_pos1 = 0;
+  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__lut); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
+  __pyx_t_13 = __Pyx_PyObject_to_MemoryviewSlice_dsds_nn_struct___pyx_t_12splitBBoxLUT_lut_point(__pyx_t_5);
+  if (unlikely(!__pyx_t_13.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+  __pyx_v_lut = __pyx_t_13;
+  __pyx_t_13.memview = NULL;
+  __pyx_t_13.data = NULL;
 
-  /* "splitBBoxLUT.pyx":1125
+  /* "splitBBoxLUT.pyx":843
+ *         cdef float[:] cdata, tdata, cflat, cdark, csolidAngle, cpolarization
+ * 
+ *         assert size == weights.size             # <<<<<<<<<<<<<<
  * 
- *     check_pos1 = 0
- *     check_mask = 0             # <<<<<<<<<<<<<<
- *     do_dummy = 0
- *     do_dark = 0
+ *         if dummy is not None:
  */
-  __pyx_v_check_mask = 0;
+  #ifndef CYTHON_WITHOUT_ASSERTIONS
+  __pyx_t_5 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_weights, __pyx_n_s__size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  if (unlikely(!__pyx_t_14)) {
+    PyErr_SetNone(PyExc_AssertionError);
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  }
+  #endif
 
-  /* "splitBBoxLUT.pyx":1126
- *     check_pos1 = 0
- *     check_mask = 0
- *     do_dummy = 0             # <<<<<<<<<<<<<<
- *     do_dark = 0
- *     do_flat = 0
+  /* "splitBBoxLUT.pyx":845
+ *         assert size == weights.size
+ * 
+ *         if dummy is not None:             # <<<<<<<<<<<<<<
+ *             do_dummy = True
+ *             cdummy =  <float>float(dummy)
  */
-  __pyx_v_do_dummy = 0;
+  __pyx_t_14 = (__pyx_v_dummy != Py_None);
+  __pyx_t_15 = (__pyx_t_14 != 0);
+  if (__pyx_t_15) {
 
-  /* "splitBBoxLUT.pyx":1127
- *     check_mask = 0
- *     do_dummy = 0
- *     do_dark = 0             # <<<<<<<<<<<<<<
- *     do_flat = 0
+    /* "splitBBoxLUT.pyx":846
  * 
+ *         if dummy is not None:
+ *             do_dummy = True             # <<<<<<<<<<<<<<
+ *             cdummy =  <float>float(dummy)
+ *             if delta_dummy is None:
  */
-  __pyx_v_do_dark = 0;
+    __pyx_v_do_dummy = 1;
 
-  /* "splitBBoxLUT.pyx":1128
- *     do_dummy = 0
- *     do_dark = 0
- *     do_flat = 0             # <<<<<<<<<<<<<<
- * 
- *     cdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)
+    /* "splitBBoxLUT.pyx":847
+ *         if dummy is not None:
+ *             do_dummy = True
+ *             cdummy =  <float>float(dummy)             # <<<<<<<<<<<<<<
+ *             if delta_dummy is None:
+ *                 cddummy = <float>0.0
  */
-  __pyx_v_do_flat = 0;
+    __pyx_t_16 = __Pyx_PyObject_AsDouble(__pyx_v_dummy); if (unlikely(__pyx_t_16 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_v_cdummy = ((float)__pyx_t_16);
 
-  /* "splitBBoxLUT.pyx":1130
- *     do_flat = 0
- * 
- *     cdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
- *     cpos0 = numpy.ascontiguousarray(pos0.ravel(), dtype=numpy.float32)
- *     dpos0 = numpy.ascontiguousarray(delta_pos0.ravel(), dtype=numpy.float32)
+    /* "splitBBoxLUT.pyx":848
+ *             do_dummy = True
+ *             cdummy =  <float>float(dummy)
+ *             if delta_dummy is None:             # <<<<<<<<<<<<<<
+ *                 cddummy = <float>0.0
+ *             else:
  */
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_weights, __pyx_n_s__ravel); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
-  __Pyx_GIVEREF(__pyx_t_4);
-  __pyx_t_4 = 0;
-  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__float32); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-  __pyx_t_6 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-  __pyx_v_cdata = __pyx_t_6;
-  __pyx_t_6 = 0;
+    __pyx_t_15 = (__pyx_v_delta_dummy == Py_None);
+    __pyx_t_14 = (__pyx_t_15 != 0);
+    if (__pyx_t_14) {
 
-  /* "splitBBoxLUT.pyx":1131
- * 
- *     cdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)
- *     cpos0 = numpy.ascontiguousarray(pos0.ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
- *     dpos0 = numpy.ascontiguousarray(delta_pos0.ravel(), dtype=numpy.float32)
- * 
+      /* "splitBBoxLUT.pyx":849
+ *             cdummy =  <float>float(dummy)
+ *             if delta_dummy is None:
+ *                 cddummy = <float>0.0             # <<<<<<<<<<<<<<
+ *             else:
+ *                 cddummy = <float>float(delta_dummy)
  */
-  __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-  __pyx_t_6 = PyObject_GetAttr(__pyx_v_pos0, __pyx_n_s__ravel); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
-  __pyx_t_1 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1131; __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 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__float32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-  __pyx_v_cpos0 = __pyx_t_5;
-  __pyx_t_5 = 0;
+      __pyx_v_cddummy = ((float)0.0);
+      goto __pyx_L4;
+    }
+    /*else*/ {
 
-  /* "splitBBoxLUT.pyx":1132
- *     cdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)
- *     cpos0 = numpy.ascontiguousarray(pos0.ravel(), dtype=numpy.float32)
- *     dpos0 = numpy.ascontiguousarray(delta_pos0.ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
- * 
+      /* "splitBBoxLUT.pyx":851
+ *                 cddummy = <float>0.0
+ *             else:
+ *                 cddummy = <float>float(delta_dummy)             # <<<<<<<<<<<<<<
  * 
+ *         if flat is not None:
  */
-  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __pyx_t_5 = PyObject_GetAttr(__pyx_v_delta_pos0, __pyx_n_s__ravel); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  PyTuple_SET_ITEM(__pyx_t_5, 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 = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_6));
-  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__float32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
-  __pyx_v_dpos0 = __pyx_t_2;
-  __pyx_t_2 = 0;
+      __pyx_t_16 = __Pyx_PyObject_AsDouble(__pyx_v_delta_dummy); if (unlikely(__pyx_t_16 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_v_cddummy = ((float)__pyx_t_16);
+    }
+    __pyx_L4:;
+    goto __pyx_L3;
+  }
+  __pyx_L3:;
 
-  /* "splitBBoxLUT.pyx":1135
- * 
+  /* "splitBBoxLUT.pyx":853
+ *                 cddummy = <float>float(delta_dummy)
  * 
- *     outData = numpy.zeros(bins, dtype=numpy.float64)             # <<<<<<<<<<<<<<
- *     outCount = numpy.zeros(bins, dtype=numpy.float64)
- *     outMax = numpy.zeros(bins, dtype=numpy.int64)
+ *         if flat is not None:             # <<<<<<<<<<<<<<
+ *             do_flat = True
+ *             assert flat.size == size
  */
-  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_6 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__zeros); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
-  __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 = 1135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_INCREF(__pyx_v_bins);
-  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_bins);
-  __Pyx_GIVEREF(__pyx_v_bins);
-  __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_t_4 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
-  __pyx_v_outData = __pyx_t_4;
-  __pyx_t_4 = 0;
+  __pyx_t_14 = (__pyx_v_flat != Py_None);
+  __pyx_t_15 = (__pyx_t_14 != 0);
+  if (__pyx_t_15) {
 
-  /* "splitBBoxLUT.pyx":1136
+    /* "splitBBoxLUT.pyx":854
  * 
- *     outData = numpy.zeros(bins, dtype=numpy.float64)
- *     outCount = numpy.zeros(bins, dtype=numpy.float64)             # <<<<<<<<<<<<<<
- *     outMax = numpy.zeros(bins, dtype=numpy.int64)
- *     outMerge = numpy.zeros(bins, dtype=numpy.float32)
+ *         if flat is not None:
+ *             do_flat = True             # <<<<<<<<<<<<<<
+ *             assert flat.size == size
+ *             cflat = numpy.ascontiguousarray(flat.ravel(), dtype=numpy.float32)
  */
-  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__zeros); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_INCREF(__pyx_v_bins);
-  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_bins);
-  __Pyx_GIVEREF(__pyx_v_bins);
-  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-  __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__float64); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-  __pyx_v_outCount = __pyx_t_1;
-  __pyx_t_1 = 0;
+    __pyx_v_do_flat = 1;
 
-  /* "splitBBoxLUT.pyx":1137
- *     outData = numpy.zeros(bins, dtype=numpy.float64)
- *     outCount = numpy.zeros(bins, dtype=numpy.float64)
- *     outMax = numpy.zeros(bins, dtype=numpy.int64)             # <<<<<<<<<<<<<<
- *     outMerge = numpy.zeros(bins, dtype=numpy.float32)
- * #    outPos = numpy.zeros(bins, dtype=numpy.float32)
+    /* "splitBBoxLUT.pyx":855
+ *         if flat is not None:
+ *             do_flat = True
+ *             assert flat.size == size             # <<<<<<<<<<<<<<
+ *             cflat = numpy.ascontiguousarray(flat.ravel(), dtype=numpy.float32)
+ *         if dark is not None:
  */
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __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 = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_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_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__int64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-  __pyx_t_6 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-  __pyx_v_outMax = __pyx_t_6;
-  __pyx_t_6 = 0;
+    #ifndef CYTHON_WITHOUT_ASSERTIONS
+    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_flat, __pyx_n_s__size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_2 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    if (unlikely(!__pyx_t_15)) {
+      PyErr_SetNone(PyExc_AssertionError);
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    }
+    #endif
 
-  /* "splitBBoxLUT.pyx":1138
- *     outCount = numpy.zeros(bins, dtype=numpy.float64)
- *     outMax = numpy.zeros(bins, dtype=numpy.int64)
- *     outMerge = numpy.zeros(bins, dtype=numpy.float32)             # <<<<<<<<<<<<<<
- * #    outPos = numpy.zeros(bins, dtype=numpy.float32)
- * 
+    /* "splitBBoxLUT.pyx":856
+ *             do_flat = True
+ *             assert flat.size == size
+ *             cflat = numpy.ascontiguousarray(flat.ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
+ *         if dark is not None:
+ *             do_dark = True
  */
-  __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
-  __Pyx_INCREF(__pyx_v_bins);
-  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_bins);
-  __Pyx_GIVEREF(__pyx_v_bins);
-  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__float32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-  __pyx_v_outMerge = __pyx_t_5;
-  __pyx_t_5 = 0;
+    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_flat, __pyx_n_s__ravel); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
+    __Pyx_GIVEREF(__pyx_t_4);
+    __pyx_t_4 = 0;
+    __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+    __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s__float32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+    __pyx_t_17 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_1);
+    if (unlikely(!__pyx_t_17.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_v_cflat = __pyx_t_17;
+    __pyx_t_17.memview = NULL;
+    __pyx_t_17.data = NULL;
+    goto __pyx_L5;
+  }
+  __pyx_L5:;
 
-  /* "splitBBoxLUT.pyx":1141
- * #    outPos = numpy.zeros(bins, dtype=numpy.float32)
- * 
- *     if  mask is not None:             # <<<<<<<<<<<<<<
- *         assert mask.size == size
- *         check_mask = 1
+  /* "splitBBoxLUT.pyx":857
+ *             assert flat.size == size
+ *             cflat = numpy.ascontiguousarray(flat.ravel(), dtype=numpy.float32)
+ *         if dark is not None:             # <<<<<<<<<<<<<<
+ *             do_dark = True
+ *             assert dark.size == size
  */
-  __pyx_t_3 = (__pyx_v_mask != Py_None);
-  if (__pyx_t_3) {
+  __pyx_t_15 = (__pyx_v_dark != Py_None);
+  __pyx_t_14 = (__pyx_t_15 != 0);
+  if (__pyx_t_14) {
 
-    /* "splitBBoxLUT.pyx":1142
- * 
- *     if  mask is not None:
- *         assert mask.size == size             # <<<<<<<<<<<<<<
- *         check_mask = 1
- *         cmask = numpy.ascontiguousarray(mask.ravel(), dtype=numpy.int8)
+    /* "splitBBoxLUT.pyx":858
+ *             cflat = numpy.ascontiguousarray(flat.ravel(), dtype=numpy.float32)
+ *         if dark is not None:
+ *             do_dark = True             # <<<<<<<<<<<<<<
+ *             assert dark.size == size
+ *             cdark = numpy.ascontiguousarray(dark.ravel(), dtype=numpy.float32)
+ */
+    __pyx_v_do_dark = 1;
+
+    /* "splitBBoxLUT.pyx":859
+ *         if dark is not None:
+ *             do_dark = True
+ *             assert dark.size == size             # <<<<<<<<<<<<<<
+ *             cdark = numpy.ascontiguousarray(dark.ravel(), dtype=numpy.float32)
+ *         if solidAngle is not None:
  */
     #ifndef CYTHON_WITHOUT_ASSERTIONS
-    __pyx_t_5 = PyObject_GetAttr(__pyx_v_mask, __pyx_n_s__size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_1 = PyObject_RichCompare(__pyx_t_5, __pyx_v_size, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_dark, __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_4 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_5 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    if (unlikely(!__pyx_t_3)) {
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    if (unlikely(!__pyx_t_14)) {
       PyErr_SetNone(PyExc_AssertionError);
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     #endif
 
-    /* "splitBBoxLUT.pyx":1143
- *     if  mask is not None:
- *         assert mask.size == size
- *         check_mask = 1             # <<<<<<<<<<<<<<
- *         cmask = numpy.ascontiguousarray(mask.ravel(), dtype=numpy.int8)
- * 
- */
-    __pyx_v_check_mask = 1;
-
-    /* "splitBBoxLUT.pyx":1144
- *         assert mask.size == size
- *         check_mask = 1
- *         cmask = numpy.ascontiguousarray(mask.ravel(), dtype=numpy.int8)             # <<<<<<<<<<<<<<
- * 
- *     if (dummy is not None) and delta_dummy is not None:
+    /* "splitBBoxLUT.pyx":860
+ *             do_dark = True
+ *             assert dark.size == size
+ *             cdark = numpy.ascontiguousarray(dark.ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
+ *         if solidAngle is not None:
+ *             do_solidAngle = True
  */
-    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_1 = PyObject_GetAttr(__pyx_v_mask, __pyx_n_s__ravel); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
-    __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 = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    PyTuple_SET_ITEM(__pyx_t_1, 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 = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
-    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_dark, __pyx_n_s__ravel); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
+    __Pyx_GIVEREF(__pyx_t_1);
+    __pyx_t_1 = 0;
+    __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__float32); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
-    __pyx_v_cmask = __pyx_t_2;
-    __pyx_t_2 = 0;
-    goto __pyx_L3;
-  }
-  __pyx_L3:;
-
-  /* "splitBBoxLUT.pyx":1146
- *         cmask = numpy.ascontiguousarray(mask.ravel(), dtype=numpy.int8)
- * 
- *     if (dummy is not None) and delta_dummy is not None:             # <<<<<<<<<<<<<<
- *         do_dummy = 1
- *         cdummy = float(dummy)
- */
-  __pyx_t_3 = (__pyx_v_dummy != Py_None);
-  if (__pyx_t_3) {
-    __pyx_t_7 = (__pyx_v_delta_dummy != Py_None);
-    __pyx_t_8 = __pyx_t_7;
-  } else {
-    __pyx_t_8 = __pyx_t_3;
-  }
-  if (__pyx_t_8) {
-
-    /* "splitBBoxLUT.pyx":1147
- * 
- *     if (dummy is not None) and delta_dummy is not None:
- *         do_dummy = 1             # <<<<<<<<<<<<<<
- *         cdummy = float(dummy)
- *         ddummy = float(delta_dummy)
- */
-    __pyx_v_do_dummy = 1;
-
-    /* "splitBBoxLUT.pyx":1148
- *     if (dummy is not None) and delta_dummy is not None:
- *         do_dummy = 1
- *         cdummy = float(dummy)             # <<<<<<<<<<<<<<
- *         ddummy = float(delta_dummy)
- *     elif (dummy is not None):
- */
-    __pyx_t_9 = __Pyx_PyObject_AsDouble(__pyx_v_dummy); if (unlikely(__pyx_t_9 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_v_cdummy = __pyx_t_9;
-
-    /* "splitBBoxLUT.pyx":1149
- *         do_dummy = 1
- *         cdummy = float(dummy)
- *         ddummy = float(delta_dummy)             # <<<<<<<<<<<<<<
- *     elif (dummy is not None):
- *         cdummy = float(dummy)
- */
-    __pyx_t_9 = __Pyx_PyObject_AsDouble(__pyx_v_delta_dummy); if (unlikely(__pyx_t_9 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_v_ddummy = __pyx_t_9;
-    goto __pyx_L4;
-  }
-
-  /* "splitBBoxLUT.pyx":1150
- *         cdummy = float(dummy)
- *         ddummy = float(delta_dummy)
- *     elif (dummy is not None):             # <<<<<<<<<<<<<<
- *         cdummy = float(dummy)
- *     else:
- */
-  __pyx_t_8 = (__pyx_v_dummy != Py_None);
-  if (__pyx_t_8) {
-
-    /* "splitBBoxLUT.pyx":1151
- *         ddummy = float(delta_dummy)
- *     elif (dummy is not None):
- *         cdummy = float(dummy)             # <<<<<<<<<<<<<<
- *     else:
- *         cdummy = 0.0
- */
-    __pyx_t_9 = __Pyx_PyObject_AsDouble(__pyx_v_dummy); if (unlikely(__pyx_t_9 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_v_cdummy = __pyx_t_9;
-    goto __pyx_L4;
+    __pyx_t_17 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_6);
+    if (unlikely(!__pyx_t_17.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __pyx_v_cdark = __pyx_t_17;
+    __pyx_t_17.memview = NULL;
+    __pyx_t_17.data = NULL;
+    goto __pyx_L6;
   }
-  /*else*/ {
+  __pyx_L6:;
 
-    /* "splitBBoxLUT.pyx":1153
- *         cdummy = float(dummy)
- *     else:
- *         cdummy = 0.0             # <<<<<<<<<<<<<<
- * 
- *     if dark is not None:
+  /* "splitBBoxLUT.pyx":861
+ *             assert dark.size == size
+ *             cdark = numpy.ascontiguousarray(dark.ravel(), dtype=numpy.float32)
+ *         if solidAngle is not None:             # <<<<<<<<<<<<<<
+ *             do_solidAngle = True
+ *             assert solidAngle.size == size
  */
-    __pyx_v_cdummy = 0.0;
-  }
-  __pyx_L4:;
+  __pyx_t_14 = (__pyx_v_solidAngle != Py_None);
+  __pyx_t_15 = (__pyx_t_14 != 0);
+  if (__pyx_t_15) {
 
-  /* "splitBBoxLUT.pyx":1155
- *         cdummy = 0.0
- * 
- *     if dark is not None:             # <<<<<<<<<<<<<<
- *         assert dark.size == size
- *         do_dark = 1
+    /* "splitBBoxLUT.pyx":862
+ *             cdark = numpy.ascontiguousarray(dark.ravel(), dtype=numpy.float32)
+ *         if solidAngle is not None:
+ *             do_solidAngle = True             # <<<<<<<<<<<<<<
+ *             assert solidAngle.size == size
+ *             csolidAngle = numpy.ascontiguousarray(solidAngle.ravel(), dtype=numpy.float32)
  */
-  __pyx_t_8 = (__pyx_v_dark != Py_None);
-  if (__pyx_t_8) {
+    __pyx_v_do_solidAngle = 1;
 
-    /* "splitBBoxLUT.pyx":1156
- * 
- *     if dark is not None:
- *         assert dark.size == size             # <<<<<<<<<<<<<<
- *         do_dark = 1
- *         cdark = numpy.ascontiguousarray(dark.ravel(), dtype=numpy.float32)
+    /* "splitBBoxLUT.pyx":863
+ *         if solidAngle is not None:
+ *             do_solidAngle = True
+ *             assert solidAngle.size == size             # <<<<<<<<<<<<<<
+ *             csolidAngle = numpy.ascontiguousarray(solidAngle.ravel(), dtype=numpy.float32)
+ *         if polarization is not None:
  */
     #ifndef CYTHON_WITHOUT_ASSERTIONS
-    __pyx_t_2 = PyObject_GetAttr(__pyx_v_dark, __pyx_n_s__size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_v_size, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_solidAngle, __pyx_n_s__size); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __pyx_t_1 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_5 = PyObject_RichCompare(__pyx_t_6, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    if (unlikely(!__pyx_t_8)) {
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    if (unlikely(!__pyx_t_15)) {
       PyErr_SetNone(PyExc_AssertionError);
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     #endif
 
-    /* "splitBBoxLUT.pyx":1157
- *     if dark is not None:
- *         assert dark.size == size
- *         do_dark = 1             # <<<<<<<<<<<<<<
- *         cdark = numpy.ascontiguousarray(dark.ravel(), dtype=numpy.float32)
- * 
- */
-    __pyx_v_do_dark = 1;
-
-    /* "splitBBoxLUT.pyx":1158
- *         assert dark.size == size
- *         do_dark = 1
- *         cdark = numpy.ascontiguousarray(dark.ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
- * 
- *     if flat is not None:
+    /* "splitBBoxLUT.pyx":864
+ *             do_solidAngle = True
+ *             assert solidAngle.size == size
+ *             csolidAngle = numpy.ascontiguousarray(solidAngle.ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
+ *         if polarization is not None:
+ *             do_polarization = True
  */
-    __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_2 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_t_6 = PyObject_GetAttr(__pyx_v_dark, __pyx_n_s__ravel); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_1 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_solidAngle, __pyx_n_s__ravel); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __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 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-    __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__float32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    PyTuple_SET_ITEM(__pyx_t_5, 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 = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
+    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__float32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
+    if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-    __pyx_v_cdark = __pyx_t_4;
-    __pyx_t_4 = 0;
-    goto __pyx_L5;
+    __pyx_t_17 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_2);
+    if (unlikely(!__pyx_t_17.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __pyx_v_csolidAngle = __pyx_t_17;
+    __pyx_t_17.memview = NULL;
+    __pyx_t_17.data = NULL;
+    goto __pyx_L7;
   }
-  __pyx_L5:;
+  __pyx_L7:;
 
-  /* "splitBBoxLUT.pyx":1160
- *         cdark = numpy.ascontiguousarray(dark.ravel(), dtype=numpy.float32)
- * 
- *     if flat is not None:             # <<<<<<<<<<<<<<
- *         assert flat.size == size
- *         do_flat = 1
+  /* "splitBBoxLUT.pyx":865
+ *             assert solidAngle.size == size
+ *             csolidAngle = numpy.ascontiguousarray(solidAngle.ravel(), dtype=numpy.float32)
+ *         if polarization is not None:             # <<<<<<<<<<<<<<
+ *             do_polarization = True
+ *             assert polarization.size == size
+ */
+  __pyx_t_15 = (__pyx_v_polarization != Py_None);
+  __pyx_t_14 = (__pyx_t_15 != 0);
+  if (__pyx_t_14) {
+
+    /* "splitBBoxLUT.pyx":866
+ *             csolidAngle = numpy.ascontiguousarray(solidAngle.ravel(), dtype=numpy.float32)
+ *         if polarization is not None:
+ *             do_polarization = True             # <<<<<<<<<<<<<<
+ *             assert polarization.size == size
+ *             cpolarization = numpy.ascontiguousarray(polarization.ravel(), dtype=numpy.float32)
  */
-  __pyx_t_8 = (__pyx_v_flat != Py_None);
-  if (__pyx_t_8) {
+    __pyx_v_do_polarization = 1;
 
-    /* "splitBBoxLUT.pyx":1161
+    /* "splitBBoxLUT.pyx":867
+ *         if polarization is not None:
+ *             do_polarization = True
+ *             assert polarization.size == size             # <<<<<<<<<<<<<<
+ *             cpolarization = numpy.ascontiguousarray(polarization.ravel(), dtype=numpy.float32)
  * 
- *     if flat is not None:
- *         assert flat.size == size             # <<<<<<<<<<<<<<
- *         do_flat = 1
- *         cflat = numpy.ascontiguousarray(flat.ravel(), dtype=numpy.float32)
  */
     #ifndef CYTHON_WITHOUT_ASSERTIONS
-    __pyx_t_4 = PyObject_GetAttr(__pyx_v_flat, __pyx_n_s__size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_v_size, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    if (unlikely(!__pyx_t_8)) {
+    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_polarization, __pyx_n_s__size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_6 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    if (unlikely(!__pyx_t_14)) {
       PyErr_SetNone(PyExc_AssertionError);
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     #endif
 
-    /* "splitBBoxLUT.pyx":1162
- *     if flat is not None:
- *         assert flat.size == size
- *         do_flat = 1             # <<<<<<<<<<<<<<
- *         cflat = numpy.ascontiguousarray(flat.ravel(), dtype=numpy.float32)
- * 
- */
-    __pyx_v_do_flat = 1;
-
-    /* "splitBBoxLUT.pyx":1163
- *         assert flat.size == size
- *         do_flat = 1
- *         cflat = numpy.ascontiguousarray(flat.ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
- * 
+    /* "splitBBoxLUT.pyx":868
+ *             do_polarization = True
+ *             assert polarization.size == size
+ *             cpolarization = numpy.ascontiguousarray(polarization.ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
  * 
+ *         if (do_dark + do_flat + do_polarization + do_solidAngle):
  */
-    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_1 = PyObject_GetAttr(__pyx_v_flat, __pyx_n_s__ravel); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
-    __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 = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    PyTuple_SET_ITEM(__pyx_t_1, 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 = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
-    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__float32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_polarization, __pyx_n_s__ravel); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
+    PyTuple_SET_ITEM(__pyx_t_5, 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 = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__float32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
-    __pyx_v_cflat = __pyx_t_5;
-    __pyx_t_5 = 0;
-    goto __pyx_L6;
-  }
-  __pyx_L6:;
-
-  /* "splitBBoxLUT.pyx":1166
- * 
- * 
- *     cpos0_lower = numpy.zeros(size, dtype=numpy.float32)             # <<<<<<<<<<<<<<
- *     cpos0_upper = numpy.zeros(size, dtype=numpy.float32)
- *     pos0_min = cpos0[0]
- */
-  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__zeros); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __Pyx_INCREF(__pyx_v_size);
-  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_size);
-  __Pyx_GIVEREF(__pyx_v_size);
-  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__float32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-  __pyx_v_cpos0_lower = __pyx_t_2;
-  __pyx_t_2 = 0;
+    __pyx_t_4 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+    __pyx_t_17 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_4);
+    if (unlikely(!__pyx_t_17.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_v_cpolarization = __pyx_t_17;
+    __pyx_t_17.memview = NULL;
+    __pyx_t_17.data = NULL;
+    goto __pyx_L8;
+  }
+  __pyx_L8:;
 
-  /* "splitBBoxLUT.pyx":1167
+  /* "splitBBoxLUT.pyx":870
+ *             cpolarization = numpy.ascontiguousarray(polarization.ravel(), dtype=numpy.float32)
  * 
- *     cpos0_lower = numpy.zeros(size, dtype=numpy.float32)
- *     cpos0_upper = numpy.zeros(size, dtype=numpy.float32)             # <<<<<<<<<<<<<<
- *     pos0_min = cpos0[0]
- *     pos0_max = cpos0[0]
- */
-  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_INCREF(__pyx_v_size);
-  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_size);
-  __Pyx_GIVEREF(__pyx_v_size);
-  __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
-  __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__float32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-  if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
-  __pyx_v_cpos0_upper = __pyx_t_4;
-  __pyx_t_4 = 0;
-
-  /* "splitBBoxLUT.pyx":1168
- *     cpos0_lower = numpy.zeros(size, dtype=numpy.float32)
- *     cpos0_upper = numpy.zeros(size, dtype=numpy.float32)
- *     pos0_min = cpos0[0]             # <<<<<<<<<<<<<<
- *     pos0_max = cpos0[0]
- *     for idx in range(size):
- */
-  __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_cpos0, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_v_pos0_min = __pyx_t_4;
-  __pyx_t_4 = 0;
-
-  /* "splitBBoxLUT.pyx":1169
- *     cpos0_upper = numpy.zeros(size, dtype=numpy.float32)
- *     pos0_min = cpos0[0]
- *     pos0_max = cpos0[0]             # <<<<<<<<<<<<<<
- *     for idx in range(size):
- *             min0 = cpos0[idx] - dpos0[idx]
+ *         if (do_dark + do_flat + do_polarization + do_solidAngle):             # <<<<<<<<<<<<<<
+ *             tdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)
+ *             cdata = numpy.zeros(size,dtype=numpy.float32)
  */
-  __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_cpos0, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_v_pos0_max = __pyx_t_4;
-  __pyx_t_4 = 0;
+  __pyx_t_14 = ((((__pyx_v_do_dark + __pyx_v_do_flat) + __pyx_v_do_polarization) + __pyx_v_do_solidAngle) != 0);
+  if (__pyx_t_14) {
 
-  /* "splitBBoxLUT.pyx":1170
- *     pos0_min = cpos0[0]
- *     pos0_max = cpos0[0]
- *     for idx in range(size):             # <<<<<<<<<<<<<<
- *             min0 = cpos0[idx] - dpos0[idx]
- *             max0 = cpos0[idx] + dpos0[idx]
+    /* "splitBBoxLUT.pyx":871
+ * 
+ *         if (do_dark + do_flat + do_polarization + do_solidAngle):
+ *             tdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
+ *             cdata = numpy.zeros(size,dtype=numpy.float32)
+ *             if do_dummy:
  */
-  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_INCREF(__pyx_v_size);
-  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_size);
-  __Pyx_GIVEREF(__pyx_v_size);
-  __pyx_t_5 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-  if (PyList_CheckExact(__pyx_t_5) || PyTuple_CheckExact(__pyx_t_5)) {
-    __pyx_t_4 = __pyx_t_5; __Pyx_INCREF(__pyx_t_4); __pyx_t_10 = 0;
-    __pyx_t_11 = NULL;
-  } else {
-    __pyx_t_10 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_11 = Py_TYPE(__pyx_t_4)->tp_iternext;
-  }
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  for (;;) {
-    if (!__pyx_t_11 && PyList_CheckExact(__pyx_t_4)) {
-      if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_4)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_5 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_10); __Pyx_INCREF(__pyx_t_5); __pyx_t_10++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
-    } else if (!__pyx_t_11 && PyTuple_CheckExact(__pyx_t_4)) {
-      if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_10); __Pyx_INCREF(__pyx_t_5); __pyx_t_10++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
-    } else {
-      __pyx_t_5 = __pyx_t_11(__pyx_t_4);
-      if (unlikely(!__pyx_t_5)) {
-        if (PyErr_Occurred()) {
-          if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
-          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        }
-        break;
-      }
-      __Pyx_GOTREF(__pyx_t_5);
-    }
-    __Pyx_XDECREF(__pyx_v_idx);
-    __pyx_v_idx = __pyx_t_5;
-    __pyx_t_5 = 0;
-
-    /* "splitBBoxLUT.pyx":1171
- *     pos0_max = cpos0[0]
- *     for idx in range(size):
- *             min0 = cpos0[idx] - dpos0[idx]             # <<<<<<<<<<<<<<
- *             max0 = cpos0[idx] + dpos0[idx]
- *             cpos0_upper[idx] = max0
- */
-    __pyx_t_5 = PyObject_GetItem(__pyx_v_cpos0, __pyx_v_idx); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_2 = PyObject_GetItem(__pyx_v_dpos0, __pyx_v_idx); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_1 = PyNumber_Subtract(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_weights, __pyx_n_s__ravel); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
+    __Pyx_GIVEREF(__pyx_t_5);
+    __pyx_t_5 = 0;
+    __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+    __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s__float32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_XDECREF(__pyx_v_min0);
-    __pyx_v_min0 = __pyx_t_1;
-    __pyx_t_1 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+    __pyx_t_17 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_1);
+    if (unlikely(!__pyx_t_17.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_v_tdata = __pyx_t_17;
+    __pyx_t_17.memview = NULL;
+    __pyx_t_17.data = NULL;
 
-    /* "splitBBoxLUT.pyx":1172
- *     for idx in range(size):
- *             min0 = cpos0[idx] - dpos0[idx]
- *             max0 = cpos0[idx] + dpos0[idx]             # <<<<<<<<<<<<<<
- *             cpos0_upper[idx] = max0
- *             cpos0_lower[idx] = min0
+    /* "splitBBoxLUT.pyx":872
+ *         if (do_dark + do_flat + do_polarization + do_solidAngle):
+ *             tdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)
+ *             cdata = numpy.zeros(size,dtype=numpy.float32)             # <<<<<<<<<<<<<<
+ *             if do_dummy:
+ *                 for i in prange(size, nogil=True, schedule="static"):
  */
-    __pyx_t_1 = PyObject_GetItem(__pyx_v_cpos0, __pyx_v_idx); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_2 = PyObject_GetItem(__pyx_v_dpos0, __pyx_v_idx); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_5 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_1 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
+    __Pyx_GIVEREF(__pyx_t_1);
+    __pyx_t_1 = 0;
+    __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__float32); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_XDECREF(__pyx_v_max0);
-    __pyx_v_max0 = __pyx_t_5;
-    __pyx_t_5 = 0;
-
-    /* "splitBBoxLUT.pyx":1173
- *             min0 = cpos0[idx] - dpos0[idx]
- *             max0 = cpos0[idx] + dpos0[idx]
- *             cpos0_upper[idx] = max0             # <<<<<<<<<<<<<<
- *             cpos0_lower[idx] = min0
- *             if max0 > pos0_max:
- */
-    if (PyObject_SetItem(__pyx_v_cpos0_upper, __pyx_v_idx, __pyx_v_max0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
-    /* "splitBBoxLUT.pyx":1174
- *             max0 = cpos0[idx] + dpos0[idx]
- *             cpos0_upper[idx] = max0
- *             cpos0_lower[idx] = min0             # <<<<<<<<<<<<<<
- *             if max0 > pos0_max:
- *                 pos0_max = max0
- */
-    if (PyObject_SetItem(__pyx_v_cpos0_lower, __pyx_v_idx, __pyx_v_min0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
-    /* "splitBBoxLUT.pyx":1175
- *             cpos0_upper[idx] = max0
- *             cpos0_lower[idx] = min0
- *             if max0 > pos0_max:             # <<<<<<<<<<<<<<
- *                 pos0_max = max0
- *             if min0 < pos0_min:
- */
-    __pyx_t_5 = PyObject_RichCompare(__pyx_v_max0, __pyx_v_pos0_max, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    if (__pyx_t_8) {
+    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+    __pyx_t_17 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_6);
+    if (unlikely(!__pyx_t_17.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __pyx_v_cdata = __pyx_t_17;
+    __pyx_t_17.memview = NULL;
+    __pyx_t_17.data = NULL;
 
-      /* "splitBBoxLUT.pyx":1176
- *             cpos0_lower[idx] = min0
- *             if max0 > pos0_max:
- *                 pos0_max = max0             # <<<<<<<<<<<<<<
- *             if min0 < pos0_min:
- *                 pos0_min = min0
+    /* "splitBBoxLUT.pyx":873
+ *             tdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)
+ *             cdata = numpy.zeros(size,dtype=numpy.float32)
+ *             if do_dummy:             # <<<<<<<<<<<<<<
+ *                 for i in prange(size, nogil=True, schedule="static"):
+ *                     data = tdata[i]
  */
-      __Pyx_INCREF(__pyx_v_max0);
-      __Pyx_DECREF(__pyx_v_pos0_max);
-      __pyx_v_pos0_max = __pyx_v_max0;
-      goto __pyx_L9;
-    }
-    __pyx_L9:;
+    __pyx_t_14 = (__pyx_v_do_dummy != 0);
+    if (__pyx_t_14) {
 
-    /* "splitBBoxLUT.pyx":1177
- *             if max0 > pos0_max:
- *                 pos0_max = max0
- *             if min0 < pos0_min:             # <<<<<<<<<<<<<<
- *                 pos0_min = min0
- * 
+      /* "splitBBoxLUT.pyx":874
+ *             cdata = numpy.zeros(size,dtype=numpy.float32)
+ *             if do_dummy:
+ *                 for i in prange(size, nogil=True, schedule="static"):             # <<<<<<<<<<<<<<
+ *                     data = tdata[i]
+ *                     if ((cddummy!=0) and (fabs(data-cdummy) > cddummy)) or ((cddummy==0) and (data!=cdummy)):
  */
-    __pyx_t_5 = PyObject_RichCompare(__pyx_v_min0, __pyx_v_pos0_min, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    if (__pyx_t_8) {
+      {
+          #ifdef WITH_THREAD
+          PyThreadState *_save;
+          Py_UNBLOCK_THREADS
+          #endif
+          /*try:*/ {
+            __pyx_t_3 = __pyx_v_size;
+            if (1 == 0) abort();
+            {
+                float __pyx_parallel_temp0 = __PYX_NAN();
+                int __pyx_parallel_temp1 = 0xbad0bad0;
+                const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0;
+                PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL;
+                int __pyx_parallel_why;
+                __pyx_parallel_why = 0;
+                #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_3 - 0) / 1;
+                if (__pyx_t_19 > 0)
+                {
+                    #ifdef _OPENMP
+                    #pragma omp parallel private(__pyx_t_14, __pyx_t_26, __pyx_t_28, __pyx_t_23, __pyx_t_27, __pyx_t_20, __pyx_t_24, __pyx_t_21, __pyx_t_15, __pyx_t_25, __pyx_t_22) private(__pyx_filename, __pyx_lineno, __pyx_clineno) shared(__pyx_parallel_why, __pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb)
+                    #endif /* _OPENMP */
+                    {
+                        #ifdef _OPENMP
+                        #ifdef WITH_THREAD
+                        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+                        #endif
+                        Py_BEGIN_ALLOW_THREADS
+                        #endif /* _OPENMP */
+                        #ifdef _OPENMP
+                        #pragma omp for lastprivate(__pyx_v_data) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) schedule(static)
+                        #endif /* _OPENMP */
+                        for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_19; __pyx_t_18++){
+                            if (__pyx_parallel_why < 2)
+                            {
+                                __pyx_v_i = 0 + 1 * __pyx_t_18;
+                                /* Initialize private variables to invalid values */
+                                __pyx_v_data = ((float)__PYX_NAN());
 
-      /* "splitBBoxLUT.pyx":1178
- *                 pos0_max = max0
- *             if min0 < pos0_min:
- *                 pos0_min = min0             # <<<<<<<<<<<<<<
- * 
- *     if pos0Range is not None and len(pos0Range) > 1:
+                                /* "splitBBoxLUT.pyx":875
+ *             if do_dummy:
+ *                 for i in prange(size, nogil=True, schedule="static"):
+ *                     data = tdata[i]             # <<<<<<<<<<<<<<
+ *                     if ((cddummy!=0) and (fabs(data-cdummy) > cddummy)) or ((cddummy==0) and (data!=cdummy)):
+ *                         #Nota: -= and /= operatore are seen as reduction in cython parallel.
  */
-      __Pyx_INCREF(__pyx_v_min0);
-      __Pyx_DECREF(__pyx_v_pos0_min);
-      __pyx_v_pos0_min = __pyx_v_min0;
-      goto __pyx_L10;
-    }
-    __pyx_L10:;
-  }
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+                                __pyx_t_20 = __pyx_v_i;
+                                __pyx_v_data = (*((float *) ( /* dim=0 */ (__pyx_v_tdata.data + __pyx_t_20 * __pyx_v_tdata.strides[0]) )));
 
-  /* "splitBBoxLUT.pyx":1180
- *                 pos0_min = min0
- * 
- *     if pos0Range is not None and len(pos0Range) > 1:             # <<<<<<<<<<<<<<
- *         pos0_min = min(pos0Range)
- *         pos0_maxin = max(pos0Range)
+                                /* "splitBBoxLUT.pyx":876
+ *                 for i in prange(size, nogil=True, schedule="static"):
+ *                     data = tdata[i]
+ *                     if ((cddummy!=0) and (fabs(data-cdummy) > cddummy)) or ((cddummy==0) and (data!=cdummy)):             # <<<<<<<<<<<<<<
+ *                         #Nota: -= and /= operatore are seen as reduction in cython parallel.
+ *                         if do_dark:
  */
-  __pyx_t_8 = (__pyx_v_pos0Range != Py_None);
-  if (__pyx_t_8) {
-    __pyx_t_10 = PyObject_Length(__pyx_v_pos0Range); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_3 = (__pyx_t_10 > 1);
-    __pyx_t_7 = __pyx_t_3;
-  } else {
-    __pyx_t_7 = __pyx_t_8;
-  }
-  if (__pyx_t_7) {
+                                __pyx_t_14 = ((__pyx_v_cddummy != 0.0) != 0);
+                                if (__pyx_t_14) {
+                                  __pyx_t_15 = ((fabs((__pyx_v_data - __pyx_v_cdummy)) > __pyx_v_cddummy) != 0);
+                                  __pyx_t_21 = __pyx_t_15;
+                                } else {
+                                  __pyx_t_21 = __pyx_t_14;
+                                }
+                                if (!__pyx_t_21) {
+                                  __pyx_t_14 = ((__pyx_v_cddummy == 0.0) != 0);
+                                  if (__pyx_t_14) {
+                                    __pyx_t_15 = ((__pyx_v_data != __pyx_v_cdummy) != 0);
+                                    __pyx_t_22 = __pyx_t_15;
+                                  } else {
+                                    __pyx_t_22 = __pyx_t_14;
+                                  }
+                                  __pyx_t_14 = __pyx_t_22;
+                                } else {
+                                  __pyx_t_14 = __pyx_t_21;
+                                }
+                                if (__pyx_t_14) {
 
-    /* "splitBBoxLUT.pyx":1181
- * 
- *     if pos0Range is not None and len(pos0Range) > 1:
- *         pos0_min = min(pos0Range)             # <<<<<<<<<<<<<<
- *         pos0_maxin = max(pos0Range)
- *     else:
+                                  /* "splitBBoxLUT.pyx":878
+ *                     if ((cddummy!=0) and (fabs(data-cdummy) > cddummy)) or ((cddummy==0) and (data!=cdummy)):
+ *                         #Nota: -= and /= operatore are seen as reduction in cython parallel.
+ *                         if do_dark:             # <<<<<<<<<<<<<<
+ *                             data = data - cdark[i]
+ *                         if do_flat:
  */
-    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_INCREF(__pyx_v_pos0Range);
-    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_pos0Range);
-    __Pyx_GIVEREF(__pyx_v_pos0Range);
-    __pyx_t_5 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-    __Pyx_DECREF(__pyx_v_pos0_min);
-    __pyx_v_pos0_min = __pyx_t_5;
-    __pyx_t_5 = 0;
+                                  __pyx_t_14 = (__pyx_v_do_dark != 0);
+                                  if (__pyx_t_14) {
 
-    /* "splitBBoxLUT.pyx":1182
- *     if pos0Range is not None and len(pos0Range) > 1:
- *         pos0_min = min(pos0Range)
- *         pos0_maxin = max(pos0Range)             # <<<<<<<<<<<<<<
- *     else:
- *         pos0_maxin = pos0_max
+                                    /* "splitBBoxLUT.pyx":879
+ *                         #Nota: -= and /= operatore are seen as reduction in cython parallel.
+ *                         if do_dark:
+ *                             data = data - cdark[i]             # <<<<<<<<<<<<<<
+ *                         if do_flat:
+ *                             data = data / cflat[i]
  */
-    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_INCREF(__pyx_v_pos0Range);
-    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_pos0Range);
-    __Pyx_GIVEREF(__pyx_v_pos0Range);
-    __pyx_t_4 = PyObject_Call(__pyx_builtin_max, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
-    __pyx_v_pos0_maxin = __pyx_t_4;
-    __pyx_t_4 = 0;
-    goto __pyx_L11;
-  }
-  /*else*/ {
+                                    if (unlikely(!__pyx_v_cdark.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cdark"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L16_error;} }
+                                    __pyx_t_23 = __pyx_v_i;
+                                    __pyx_v_data = (__pyx_v_data - (*((float *) ( /* dim=0 */ (__pyx_v_cdark.data + __pyx_t_23 * __pyx_v_cdark.strides[0]) ))));
+                                    goto __pyx_L19;
+                                  }
+                                  __pyx_L19:;
 
-    /* "splitBBoxLUT.pyx":1184
- *         pos0_maxin = max(pos0Range)
- *     else:
- *         pos0_maxin = pos0_max             # <<<<<<<<<<<<<<
- *     if pos0_min < 0: pos0_min = 0
- *     pos0_max = pos0_maxin * EPS32
+                                  /* "splitBBoxLUT.pyx":880
+ *                         if do_dark:
+ *                             data = data - cdark[i]
+ *                         if do_flat:             # <<<<<<<<<<<<<<
+ *                             data = data / cflat[i]
+ *                         if do_polarization:
  */
-    __Pyx_INCREF(__pyx_v_pos0_max);
-    __pyx_v_pos0_maxin = __pyx_v_pos0_max;
-  }
-  __pyx_L11:;
+                                  __pyx_t_14 = (__pyx_v_do_flat != 0);
+                                  if (__pyx_t_14) {
 
-  /* "splitBBoxLUT.pyx":1185
- *     else:
- *         pos0_maxin = pos0_max
- *     if pos0_min < 0: pos0_min = 0             # <<<<<<<<<<<<<<
- *     pos0_max = pos0_maxin * EPS32
- * 
+                                    /* "splitBBoxLUT.pyx":881
+ *                             data = data - cdark[i]
+ *                         if do_flat:
+ *                             data = data / cflat[i]             # <<<<<<<<<<<<<<
+ *                         if do_polarization:
+ *                             data = data / cpolarization[i]
  */
-  __pyx_t_4 = PyObject_RichCompare(__pyx_v_pos0_min, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (__pyx_t_7) {
-    __Pyx_INCREF(__pyx_int_0);
-    __Pyx_DECREF(__pyx_v_pos0_min);
-    __pyx_v_pos0_min = __pyx_int_0;
-    goto __pyx_L12;
-  }
-  __pyx_L12:;
+                                    if (unlikely(!__pyx_v_cflat.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cflat"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L16_error;} }
+                                    __pyx_t_24 = __pyx_v_i;
+                                    __pyx_v_data = (__pyx_v_data / (*((float *) ( /* dim=0 */ (__pyx_v_cflat.data + __pyx_t_24 * __pyx_v_cflat.strides[0]) ))));
+                                    goto __pyx_L20;
+                                  }
+                                  __pyx_L20:;
 
-  /* "splitBBoxLUT.pyx":1186
- *         pos0_maxin = pos0_max
- *     if pos0_min < 0: pos0_min = 0
- *     pos0_max = pos0_maxin * EPS32             # <<<<<<<<<<<<<<
- * 
- *     if pos1Range is not None and len(pos1Range) > 1:
+                                  /* "splitBBoxLUT.pyx":882
+ *                         if do_flat:
+ *                             data = data / cflat[i]
+ *                         if do_polarization:             # <<<<<<<<<<<<<<
+ *                             data = data / cpolarization[i]
+ *                         if do_solidAngle:
+ */
+                                  __pyx_t_14 = (__pyx_v_do_polarization != 0);
+                                  if (__pyx_t_14) {
+
+                                    /* "splitBBoxLUT.pyx":883
+ *                             data = data / cflat[i]
+ *                         if do_polarization:
+ *                             data = data / cpolarization[i]             # <<<<<<<<<<<<<<
+ *                         if do_solidAngle:
+ *                             data = data / csolidAngle[i]
  */
-  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__EPS32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_5 = PyNumber_Multiply(__pyx_v_pos0_maxin, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __Pyx_DECREF(__pyx_v_pos0_max);
-  __pyx_v_pos0_max = __pyx_t_5;
-  __pyx_t_5 = 0;
+                                    if (unlikely(!__pyx_v_cpolarization.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cpolarization"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L16_error;} }
+                                    __pyx_t_25 = __pyx_v_i;
+                                    __pyx_v_data = (__pyx_v_data / (*((float *) ( /* dim=0 */ (__pyx_v_cpolarization.data + __pyx_t_25 * __pyx_v_cpolarization.strides[0]) ))));
+                                    goto __pyx_L21;
+                                  }
+                                  __pyx_L21:;
 
-  /* "splitBBoxLUT.pyx":1188
- *     pos0_max = pos0_maxin * EPS32
- * 
- *     if pos1Range is not None and len(pos1Range) > 1:             # <<<<<<<<<<<<<<
- *         assert pos1.size == size
- *         assert delta_pos1.size == size
+                                  /* "splitBBoxLUT.pyx":884
+ *                         if do_polarization:
+ *                             data = data / cpolarization[i]
+ *                         if do_solidAngle:             # <<<<<<<<<<<<<<
+ *                             data = data / csolidAngle[i]
+ *                         cdata[i]+=data
  */
-  __pyx_t_7 = (__pyx_v_pos1Range != Py_None);
-  if (__pyx_t_7) {
-    __pyx_t_10 = PyObject_Length(__pyx_v_pos1Range); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_8 = (__pyx_t_10 > 1);
-    __pyx_t_3 = __pyx_t_8;
-  } else {
-    __pyx_t_3 = __pyx_t_7;
-  }
-  if (__pyx_t_3) {
+                                  __pyx_t_14 = (__pyx_v_do_solidAngle != 0);
+                                  if (__pyx_t_14) {
 
-    /* "splitBBoxLUT.pyx":1189
- * 
- *     if pos1Range is not None and len(pos1Range) > 1:
- *         assert pos1.size == size             # <<<<<<<<<<<<<<
- *         assert delta_pos1.size == size
- *         check_pos1 = 1
+                                    /* "splitBBoxLUT.pyx":885
+ *                             data = data / cpolarization[i]
+ *                         if do_solidAngle:
+ *                             data = data / csolidAngle[i]             # <<<<<<<<<<<<<<
+ *                         cdata[i]+=data
+ *                     else: #set all dummy_like values to cdummy. simplifies further processing
  */
-    #ifndef CYTHON_WITHOUT_ASSERTIONS
-    __pyx_t_5 = PyObject_GetAttr(__pyx_v_pos1, __pyx_n_s__size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, __pyx_v_size, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    if (unlikely(!__pyx_t_3)) {
-      PyErr_SetNone(PyExc_AssertionError);
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    }
-    #endif
+                                    if (unlikely(!__pyx_v_csolidAngle.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("csolidAngle"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 885; __pyx_clineno = __LINE__; goto __pyx_L16_error;} }
+                                    __pyx_t_26 = __pyx_v_i;
+                                    __pyx_v_data = (__pyx_v_data / (*((float *) ( /* dim=0 */ (__pyx_v_csolidAngle.data + __pyx_t_26 * __pyx_v_csolidAngle.strides[0]) ))));
+                                    goto __pyx_L22;
+                                  }
+                                  __pyx_L22:;
 
-    /* "splitBBoxLUT.pyx":1190
- *     if pos1Range is not None and len(pos1Range) > 1:
- *         assert pos1.size == size
- *         assert delta_pos1.size == size             # <<<<<<<<<<<<<<
- *         check_pos1 = 1
- *         cpos1 = numpy.ascontiguousarray(pos1.ravel(), dtype=numpy.float32)
+                                  /* "splitBBoxLUT.pyx":886
+ *                         if do_solidAngle:
+ *                             data = data / csolidAngle[i]
+ *                         cdata[i]+=data             # <<<<<<<<<<<<<<
+ *                     else: #set all dummy_like values to cdummy. simplifies further processing
+ *                         cdata[i]+=cdummy
  */
-    #ifndef CYTHON_WITHOUT_ASSERTIONS
-    __pyx_t_4 = PyObject_GetAttr(__pyx_v_delta_pos1, __pyx_n_s__size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_v_size, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    if (unlikely(!__pyx_t_3)) {
-      PyErr_SetNone(PyExc_AssertionError);
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    }
-    #endif
+                                  __pyx_t_27 = __pyx_v_i;
+                                  *((float *) ( /* dim=0 */ (__pyx_v_cdata.data + __pyx_t_27 * __pyx_v_cdata.strides[0]) )) += __pyx_v_data;
+                                  goto __pyx_L18;
+                                }
+                                /*else*/ {
 
-    /* "splitBBoxLUT.pyx":1191
- *         assert pos1.size == size
- *         assert delta_pos1.size == size
- *         check_pos1 = 1             # <<<<<<<<<<<<<<
- *         cpos1 = numpy.ascontiguousarray(pos1.ravel(), dtype=numpy.float32)
- *         dpos1 = numpy.ascontiguousarray(delta_pos1.ravel(), dtype=numpy.float32)
+                                  /* "splitBBoxLUT.pyx":888
+ *                         cdata[i]+=data
+ *                     else: #set all dummy_like values to cdummy. simplifies further processing
+ *                         cdata[i]+=cdummy             # <<<<<<<<<<<<<<
+ *             else:
+ *                 for i in prange(size, nogil=True, schedule="static"):
  */
-    __pyx_v_check_pos1 = 1;
+                                  __pyx_t_28 = __pyx_v_i;
+                                  *((float *) ( /* dim=0 */ (__pyx_v_cdata.data + __pyx_t_28 * __pyx_v_cdata.strides[0]) )) += __pyx_v_cdummy;
+                                }
+                                __pyx_L18:;
+                                goto __pyx_L24;
+                                __pyx_L16_error:;
+                                {
+                                    #ifdef WITH_THREAD
+                                    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+                                    #endif
+                                    #ifdef _OPENMP
+                                    #pragma omp flush(__pyx_parallel_exc_type)
+                                    #endif /* _OPENMP */
+                                    if (!__pyx_parallel_exc_type) {
+                                      __Pyx_ErrFetch(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb);
+                                      __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno;
+                                      __Pyx_GOTREF(__pyx_parallel_exc_type);
+                                    }
+                                    #ifdef WITH_THREAD
+                                    PyGILState_Release(__pyx_gilstate_save);
+                                    #endif
+                                }
+                                __pyx_parallel_why = 4;
+                                goto __pyx_L23;
+                                __pyx_L23:;
+                                #ifdef _OPENMP
+                                #pragma omp critical(__pyx_parallel_lastprivates2)
+                                #endif /* _OPENMP */
+                                {
+                                    __pyx_parallel_temp0 = __pyx_v_data;
+                                    __pyx_parallel_temp1 = __pyx_v_i;
+                                }
+                                __pyx_L24:;
+                                #ifdef _OPENMP
+                                #pragma omp flush(__pyx_parallel_why)
+                                #endif /* _OPENMP */
+                            }
+                        }
+                        #ifdef _OPENMP
+                        Py_END_ALLOW_THREADS
+                        #else
+{
+#ifdef WITH_THREAD
+                        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+                        #endif
+                        #endif /* _OPENMP */
+                        /* Clean up any temporaries */
+                        #ifdef WITH_THREAD
+                        PyGILState_Release(__pyx_gilstate_save);
+                        #endif
+                        #ifndef _OPENMP
+}
+#endif /* _OPENMP */
+                    }
+                }
+                if (__pyx_parallel_exc_type) {
+                  /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */
+                  __pyx_parallel_why = 4;
+                }
+                if (__pyx_parallel_why) {
+                  __pyx_v_data = __pyx_parallel_temp0;
+                  __pyx_v_i = __pyx_parallel_temp1;
+                  switch (__pyx_parallel_why) {
+                        case 3: goto __pyx_L11;
+                        case 4:
+                    {
+                        #ifdef WITH_THREAD
+                        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+                        #endif
+                        __Pyx_ErrRestore(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb);
+                        __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno;
+                        __Pyx_GIVEREF(__pyx_parallel_exc_type);
+                        #ifdef WITH_THREAD
+                        PyGILState_Release(__pyx_gilstate_save);
+                        #endif
+                    }
+                    goto __pyx_L12;
+                  }
+                }
+            }
+            #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
+          }
 
-    /* "splitBBoxLUT.pyx":1192
- *         assert delta_pos1.size == size
- *         check_pos1 = 1
- *         cpos1 = numpy.ascontiguousarray(pos1.ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
- *         dpos1 = numpy.ascontiguousarray(delta_pos1.ravel(), dtype=numpy.float32)
- *         pos1_min = min(pos1Range)
+          /* "splitBBoxLUT.pyx":874
+ *             cdata = numpy.zeros(size,dtype=numpy.float32)
+ *             if do_dummy:
+ *                 for i in prange(size, nogil=True, schedule="static"):             # <<<<<<<<<<<<<<
+ *                     data = tdata[i]
+ *                     if ((cddummy!=0) and (fabs(data-cdummy) > cddummy)) or ((cddummy==0) and (data!=cdummy)):
  */
-    __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_5 = PyObject_GetAttr(__pyx_v_pos1, __pyx_n_s__ravel); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    PyTuple_SET_ITEM(__pyx_t_5, 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 = 1192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_6 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float32); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-    __pyx_v_cpos1 = __pyx_t_6;
-    __pyx_t_6 = 0;
+          /*finally:*/ {
+            int __pyx_why;
+            __pyx_why = 0; goto __pyx_L13;
+            __pyx_L11: __pyx_why = 3; goto __pyx_L13;
+            __pyx_L12: __pyx_why = 4; goto __pyx_L13;
+            __pyx_L13:;
+            #ifdef WITH_THREAD
+            Py_BLOCK_THREADS
+            #endif
+            switch (__pyx_why) {
+              case 3: goto __pyx_L0;
+              case 4: goto __pyx_L1_error;
+            }
+          }
+      }
+      goto __pyx_L10;
+    }
+    /*else*/ {
 
-    /* "splitBBoxLUT.pyx":1193
- *         check_pos1 = 1
- *         cpos1 = numpy.ascontiguousarray(pos1.ravel(), dtype=numpy.float32)
- *         dpos1 = numpy.ascontiguousarray(delta_pos1.ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
- *         pos1_min = min(pos1Range)
- *         pos1_maxin = max(pos1Range)
+      /* "splitBBoxLUT.pyx":890
+ *                         cdata[i]+=cdummy
+ *             else:
+ *                 for i in prange(size, nogil=True, schedule="static"):             # <<<<<<<<<<<<<<
+ *                     data = tdata[i]
+ *                     if do_dark:
  */
-    __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_2 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_t_6 = PyObject_GetAttr(__pyx_v_delta_pos1, __pyx_n_s__ravel); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_5 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
-    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
-    __Pyx_GIVEREF(__pyx_t_5);
-    __pyx_t_5 = 0;
-    __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
-    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__float32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
-    __pyx_v_dpos1 = __pyx_t_1;
-    __pyx_t_1 = 0;
+      {
+          #ifdef WITH_THREAD
+          PyThreadState *_save;
+          Py_UNBLOCK_THREADS
+          #endif
+          /*try:*/ {
+            __pyx_t_19 = __pyx_v_size;
+            if (1 == 0) abort();
+            {
+                float __pyx_parallel_temp0 = __PYX_NAN();
+                int __pyx_parallel_temp1 = 0xbad0bad0;
+                const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0;
+                PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL;
+                int __pyx_parallel_why;
+                __pyx_parallel_why = 0;
+                #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_3 = (__pyx_t_19 - 0) / 1;
+                if (__pyx_t_3 > 0)
+                {
+                    #ifdef _OPENMP
+                    #pragma omp parallel private(__pyx_t_14, __pyx_t_31, __pyx_t_34, __pyx_t_30, __pyx_t_29, __pyx_t_33, __pyx_t_32) private(__pyx_filename, __pyx_lineno, __pyx_clineno) shared(__pyx_parallel_why, __pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb)
+                    #endif /* _OPENMP */
+                    {
+                        #ifdef _OPENMP
+                        #ifdef WITH_THREAD
+                        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+                        #endif
+                        Py_BEGIN_ALLOW_THREADS
+                        #endif /* _OPENMP */
+                        #ifdef _OPENMP
+                        #pragma omp for lastprivate(__pyx_v_data) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) schedule(static)
+                        #endif /* _OPENMP */
+                        for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_3; __pyx_t_18++){
+                            if (__pyx_parallel_why < 2)
+                            {
+                                __pyx_v_i = 0 + 1 * __pyx_t_18;
+                                /* Initialize private variables to invalid values */
+                                __pyx_v_data = ((float)__PYX_NAN());
 
-    /* "splitBBoxLUT.pyx":1194
- *         cpos1 = numpy.ascontiguousarray(pos1.ravel(), dtype=numpy.float32)
- *         dpos1 = numpy.ascontiguousarray(delta_pos1.ravel(), dtype=numpy.float32)
- *         pos1_min = min(pos1Range)             # <<<<<<<<<<<<<<
- *         pos1_maxin = max(pos1Range)
- *         pos1_max = pos1_maxin * EPS32
+                                /* "splitBBoxLUT.pyx":891
+ *             else:
+ *                 for i in prange(size, nogil=True, schedule="static"):
+ *                     data = tdata[i]             # <<<<<<<<<<<<<<
+ *                     if do_dark:
+ *                         data = data - cdark[i]
  */
-    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_INCREF(__pyx_v_pos1Range);
-    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_pos1Range);
-    __Pyx_GIVEREF(__pyx_v_pos1Range);
-    __pyx_t_5 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-    __pyx_v_pos1_min = __pyx_t_5;
-    __pyx_t_5 = 0;
+                                __pyx_t_29 = __pyx_v_i;
+                                __pyx_v_data = (*((float *) ( /* dim=0 */ (__pyx_v_tdata.data + __pyx_t_29 * __pyx_v_tdata.strides[0]) )));
 
-    /* "splitBBoxLUT.pyx":1195
- *         dpos1 = numpy.ascontiguousarray(delta_pos1.ravel(), dtype=numpy.float32)
- *         pos1_min = min(pos1Range)
- *         pos1_maxin = max(pos1Range)             # <<<<<<<<<<<<<<
- *         pos1_max = pos1_maxin * EPS32
- * 
+                                /* "splitBBoxLUT.pyx":892
+ *                 for i in prange(size, nogil=True, schedule="static"):
+ *                     data = tdata[i]
+ *                     if do_dark:             # <<<<<<<<<<<<<<
+ *                         data = data - cdark[i]
+ *                     if do_flat:
  */
-    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_INCREF(__pyx_v_pos1Range);
-    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_pos1Range);
-    __Pyx_GIVEREF(__pyx_v_pos1Range);
-    __pyx_t_1 = PyObject_Call(__pyx_builtin_max, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
-    __pyx_v_pos1_maxin = __pyx_t_1;
-    __pyx_t_1 = 0;
+                                __pyx_t_14 = (__pyx_v_do_dark != 0);
+                                if (__pyx_t_14) {
 
-    /* "splitBBoxLUT.pyx":1196
- *         pos1_min = min(pos1Range)
- *         pos1_maxin = max(pos1Range)
- *         pos1_max = pos1_maxin * EPS32             # <<<<<<<<<<<<<<
- * 
- *     delta = (pos0_max - pos0_min) / ((bins))
+                                  /* "splitBBoxLUT.pyx":893
+ *                     data = tdata[i]
+ *                     if do_dark:
+ *                         data = data - cdark[i]             # <<<<<<<<<<<<<<
+ *                     if do_flat:
+ *                         data = data / cflat[i]
  */
-    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__EPS32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_5 = PyNumber_Multiply(__pyx_v_pos1_maxin, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_v_pos1_max = __pyx_t_5;
-    __pyx_t_5 = 0;
-    goto __pyx_L13;
-  }
-  __pyx_L13:;
+                                  if (unlikely(!__pyx_v_cdark.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cdark"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L31_error;} }
+                                  __pyx_t_30 = __pyx_v_i;
+                                  __pyx_v_data = (__pyx_v_data - (*((float *) ( /* dim=0 */ (__pyx_v_cdark.data + __pyx_t_30 * __pyx_v_cdark.strides[0]) ))));
+                                  goto __pyx_L33;
+                                }
+                                __pyx_L33:;
 
-  /* "splitBBoxLUT.pyx":1198
- *         pos1_max = pos1_maxin * EPS32
- * 
- *     delta = (pos0_max - pos0_min) / ((bins))             # <<<<<<<<<<<<<<
- * 
- * #    for i in range(bins):
+                                /* "splitBBoxLUT.pyx":894
+ *                     if do_dark:
+ *                         data = data - cdark[i]
+ *                     if do_flat:             # <<<<<<<<<<<<<<
+ *                         data = data / cflat[i]
+ *                     if do_polarization:
  */
-  __pyx_t_5 = PyNumber_Subtract(__pyx_v_pos0_max, __pyx_v_pos0_min); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_v_bins); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __pyx_v_delta = __pyx_t_1;
-  __pyx_t_1 = 0;
+                                __pyx_t_14 = (__pyx_v_do_flat != 0);
+                                if (__pyx_t_14) {
 
-  /* "splitBBoxLUT.pyx":1202
- * #    for i in range(bins):
- * #                outPos[i] = pos0_min + (0.5 + i) * delta
- *     outPos = numpy.linspace(pos0_min+0.5*delta,pos0_max-0.5*delta, bins)             # <<<<<<<<<<<<<<
- *     for idx in range(size):
- *             if (check_mask) and (cmask[idx]):
+                                  /* "splitBBoxLUT.pyx":895
+ *                         data = data - cdark[i]
+ *                     if do_flat:
+ *                         data = data / cflat[i]             # <<<<<<<<<<<<<<
+ *                     if do_polarization:
+ *                         data = data / cpolarization[i]
  */
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__linspace); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_6 = PyNumber_Multiply(__pyx_t_1, __pyx_v_delta); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyNumber_Add(__pyx_v_pos0_min, __pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-  __pyx_t_6 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
-  __pyx_t_2 = PyNumber_Multiply(__pyx_t_6, __pyx_v_delta); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-  __pyx_t_6 = PyNumber_Subtract(__pyx_v_pos0_max, __pyx_t_2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
-  __Pyx_GIVEREF(__pyx_t_1);
-  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_6);
-  __Pyx_GIVEREF(__pyx_t_6);
-  __Pyx_INCREF(__pyx_v_bins);
-  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_bins);
-  __Pyx_GIVEREF(__pyx_v_bins);
-  __pyx_t_1 = 0;
-  __pyx_t_6 = 0;
-  __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-  __pyx_v_outPos = __pyx_t_6;
-  __pyx_t_6 = 0;
+                                  if (unlikely(!__pyx_v_cflat.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cflat"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L31_error;} }
+                                  __pyx_t_31 = __pyx_v_i;
+                                  __pyx_v_data = (__pyx_v_data / (*((float *) ( /* dim=0 */ (__pyx_v_cflat.data + __pyx_t_31 * __pyx_v_cflat.strides[0]) ))));
+                                  goto __pyx_L34;
+                                }
+                                __pyx_L34:;
 
-  /* "splitBBoxLUT.pyx":1203
- * #                outPos[i] = pos0_min + (0.5 + i) * delta
- *     outPos = numpy.linspace(pos0_min+0.5*delta,pos0_max-0.5*delta, bins)
- *     for idx in range(size):             # <<<<<<<<<<<<<<
- *             if (check_mask) and (cmask[idx]):
- *                 continue
+                                /* "splitBBoxLUT.pyx":896
+ *                     if do_flat:
+ *                         data = data / cflat[i]
+ *                     if do_polarization:             # <<<<<<<<<<<<<<
+ *                         data = data / cpolarization[i]
+ *                     if do_solidAngle:
  */
-  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
-  __Pyx_INCREF(__pyx_v_size);
-  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_size);
-  __Pyx_GIVEREF(__pyx_v_size);
-  __pyx_t_2 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
-  if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
-    __pyx_t_6 = __pyx_t_2; __Pyx_INCREF(__pyx_t_6); __pyx_t_10 = 0;
-    __pyx_t_11 = NULL;
-  } else {
-    __pyx_t_10 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_11 = Py_TYPE(__pyx_t_6)->tp_iternext;
-  }
-  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  for (;;) {
-    if (!__pyx_t_11 && PyList_CheckExact(__pyx_t_6)) {
-      if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_6)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_10); __Pyx_INCREF(__pyx_t_2); __pyx_t_10++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_2 = PySequence_ITEM(__pyx_t_6, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
-    } else if (!__pyx_t_11 && PyTuple_CheckExact(__pyx_t_6)) {
-      if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_10); __Pyx_INCREF(__pyx_t_2); __pyx_t_10++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_2 = PySequence_ITEM(__pyx_t_6, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
-    } else {
-      __pyx_t_2 = __pyx_t_11(__pyx_t_6);
-      if (unlikely(!__pyx_t_2)) {
-        if (PyErr_Occurred()) {
-          if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
-          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        }
-        break;
-      }
-      __Pyx_GOTREF(__pyx_t_2);
-    }
-    __Pyx_XDECREF(__pyx_v_idx);
-    __pyx_v_idx = __pyx_t_2;
-    __pyx_t_2 = 0;
+                                __pyx_t_14 = (__pyx_v_do_polarization != 0);
+                                if (__pyx_t_14) {
 
-    /* "splitBBoxLUT.pyx":1204
- *     outPos = numpy.linspace(pos0_min+0.5*delta,pos0_max-0.5*delta, bins)
- *     for idx in range(size):
- *             if (check_mask) and (cmask[idx]):             # <<<<<<<<<<<<<<
- *                 continue
- * 
+                                  /* "splitBBoxLUT.pyx":897
+ *                         data = data / cflat[i]
+ *                     if do_polarization:
+ *                         data = data / cpolarization[i]             # <<<<<<<<<<<<<<
+ *                     if do_solidAngle:
+ *                         data = data / csolidAngle[i]
  */
-    if (__pyx_v_check_mask) {
-      if (unlikely(!__pyx_v_cmask)) { __Pyx_RaiseUnboundLocalError("cmask"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
-      __pyx_t_2 = PyObject_GetItem(__pyx_v_cmask, __pyx_v_idx); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __pyx_t_7 = __pyx_t_3;
-    } else {
-      __pyx_t_7 = __pyx_v_check_mask;
-    }
-    if (__pyx_t_7) {
+                                  if (unlikely(!__pyx_v_cpolarization.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cpolarization"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 897; __pyx_clineno = __LINE__; goto __pyx_L31_error;} }
+                                  __pyx_t_32 = __pyx_v_i;
+                                  __pyx_v_data = (__pyx_v_data / (*((float *) ( /* dim=0 */ (__pyx_v_cpolarization.data + __pyx_t_32 * __pyx_v_cpolarization.strides[0]) ))));
+                                  goto __pyx_L35;
+                                }
+                                __pyx_L35:;
 
-      /* "splitBBoxLUT.pyx":1205
- *     for idx in range(size):
- *             if (check_mask) and (cmask[idx]):
- *                 continue             # <<<<<<<<<<<<<<
- * 
- *             data = cdata[idx]
+                                /* "splitBBoxLUT.pyx":898
+ *                     if do_polarization:
+ *                         data = data / cpolarization[i]
+ *                     if do_solidAngle:             # <<<<<<<<<<<<<<
+ *                         data = data / csolidAngle[i]
+ *                     cdata[i]+=data
  */
-      goto __pyx_L14_continue;
-      goto __pyx_L16;
-    }
-    __pyx_L16:;
+                                __pyx_t_14 = (__pyx_v_do_solidAngle != 0);
+                                if (__pyx_t_14) {
 
-    /* "splitBBoxLUT.pyx":1207
- *                 continue
- * 
- *             data = cdata[idx]             # <<<<<<<<<<<<<<
- *             if do_dummy and (fabs(data - cdummy) <= ddummy):
- *                 continue
+                                  /* "splitBBoxLUT.pyx":899
+ *                         data = data / cpolarization[i]
+ *                     if do_solidAngle:
+ *                         data = data / csolidAngle[i]             # <<<<<<<<<<<<<<
+ *                     cdata[i]+=data
+ *         else:
  */
-    __pyx_t_2 = PyObject_GetItem(__pyx_v_cdata, __pyx_v_idx); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_XDECREF(__pyx_v_data);
-    __pyx_v_data = __pyx_t_2;
-    __pyx_t_2 = 0;
+                                  if (unlikely(!__pyx_v_csolidAngle.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("csolidAngle"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L31_error;} }
+                                  __pyx_t_33 = __pyx_v_i;
+                                  __pyx_v_data = (__pyx_v_data / (*((float *) ( /* dim=0 */ (__pyx_v_csolidAngle.data + __pyx_t_33 * __pyx_v_csolidAngle.strides[0]) ))));
+                                  goto __pyx_L36;
+                                }
+                                __pyx_L36:;
 
-    /* "splitBBoxLUT.pyx":1208
- * 
- *             data = cdata[idx]
- *             if do_dummy and (fabs(data - cdummy) <= ddummy):             # <<<<<<<<<<<<<<
- *                 continue
- * 
+                                /* "splitBBoxLUT.pyx":900
+ *                     if do_solidAngle:
+ *                         data = data / csolidAngle[i]
+ *                     cdata[i]+=data             # <<<<<<<<<<<<<<
+ *         else:
+ *             if do_dummy:
  */
-    if (__pyx_v_do_dummy) {
-      __pyx_t_2 = PyFloat_FromDouble(__pyx_v_cdummy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_5 = PyNumber_Subtract(__pyx_v_data, __pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __pyx_t_7 = (fabs(__pyx_t_9) <= __pyx_v_ddummy);
-      __pyx_t_3 = __pyx_t_7;
-    } else {
-      __pyx_t_3 = __pyx_v_do_dummy;
-    }
-    if (__pyx_t_3) {
+                                __pyx_t_34 = __pyx_v_i;
+                                *((float *) ( /* dim=0 */ (__pyx_v_cdata.data + __pyx_t_34 * __pyx_v_cdata.strides[0]) )) += __pyx_v_data;
+                                goto __pyx_L38;
+                                __pyx_L31_error:;
+                                {
+                                    #ifdef WITH_THREAD
+                                    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+                                    #endif
+                                    #ifdef _OPENMP
+                                    #pragma omp flush(__pyx_parallel_exc_type)
+                                    #endif /* _OPENMP */
+                                    if (!__pyx_parallel_exc_type) {
+                                      __Pyx_ErrFetch(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb);
+                                      __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno;
+                                      __Pyx_GOTREF(__pyx_parallel_exc_type);
+                                    }
+                                    #ifdef WITH_THREAD
+                                    PyGILState_Release(__pyx_gilstate_save);
+                                    #endif
+                                }
+                                __pyx_parallel_why = 4;
+                                goto __pyx_L37;
+                                __pyx_L37:;
+                                #ifdef _OPENMP
+                                #pragma omp critical(__pyx_parallel_lastprivates3)
+                                #endif /* _OPENMP */
+                                {
+                                    __pyx_parallel_temp0 = __pyx_v_data;
+                                    __pyx_parallel_temp1 = __pyx_v_i;
+                                }
+                                __pyx_L38:;
+                                #ifdef _OPENMP
+                                #pragma omp flush(__pyx_parallel_why)
+                                #endif /* _OPENMP */
+                            }
+                        }
+                        #ifdef _OPENMP
+                        Py_END_ALLOW_THREADS
+                        #else
+{
+#ifdef WITH_THREAD
+                        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+                        #endif
+                        #endif /* _OPENMP */
+                        /* Clean up any temporaries */
+                        #ifdef WITH_THREAD
+                        PyGILState_Release(__pyx_gilstate_save);
+                        #endif
+                        #ifndef _OPENMP
+}
+#endif /* _OPENMP */
+                    }
+                }
+                if (__pyx_parallel_exc_type) {
+                  /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */
+                  __pyx_parallel_why = 4;
+                }
+                if (__pyx_parallel_why) {
+                  __pyx_v_data = __pyx_parallel_temp0;
+                  __pyx_v_i = __pyx_parallel_temp1;
+                  switch (__pyx_parallel_why) {
+                        case 3: goto __pyx_L26;
+                        case 4:
+                    {
+                        #ifdef WITH_THREAD
+                        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+                        #endif
+                        __Pyx_ErrRestore(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb);
+                        __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno;
+                        __Pyx_GIVEREF(__pyx_parallel_exc_type);
+                        #ifdef WITH_THREAD
+                        PyGILState_Release(__pyx_gilstate_save);
+                        #endif
+                    }
+                    goto __pyx_L27;
+                  }
+                }
+            }
+            #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
+          }
 
-      /* "splitBBoxLUT.pyx":1209
- *             data = cdata[idx]
- *             if do_dummy and (fabs(data - cdummy) <= ddummy):
- *                 continue             # <<<<<<<<<<<<<<
- * 
- *             min0 = cpos0_lower[idx]
+          /* "splitBBoxLUT.pyx":890
+ *                         cdata[i]+=cdummy
+ *             else:
+ *                 for i in prange(size, nogil=True, schedule="static"):             # <<<<<<<<<<<<<<
+ *                     data = tdata[i]
+ *                     if do_dark:
  */
-      goto __pyx_L14_continue;
-      goto __pyx_L17;
+          /*finally:*/ {
+            int __pyx_why;
+            __pyx_why = 0; goto __pyx_L28;
+            __pyx_L26: __pyx_why = 3; goto __pyx_L28;
+            __pyx_L27: __pyx_why = 4; goto __pyx_L28;
+            __pyx_L28:;
+            #ifdef WITH_THREAD
+            Py_BLOCK_THREADS
+            #endif
+            switch (__pyx_why) {
+              case 3: goto __pyx_L0;
+              case 4: goto __pyx_L1_error;
+            }
+          }
+      }
     }
-    __pyx_L17:;
-
-    /* "splitBBoxLUT.pyx":1211
- *                 continue
- * 
- *             min0 = cpos0_lower[idx]             # <<<<<<<<<<<<<<
- *             max0 = cpos0_upper[idx]
- * 
- */
-    __pyx_t_5 = PyObject_GetItem(__pyx_v_cpos0_lower, __pyx_v_idx); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_XDECREF(__pyx_v_min0);
-    __pyx_v_min0 = __pyx_t_5;
-    __pyx_t_5 = 0;
+    __pyx_L10:;
+    goto __pyx_L9;
+  }
+  /*else*/ {
 
-    /* "splitBBoxLUT.pyx":1212
- * 
- *             min0 = cpos0_lower[idx]
- *             max0 = cpos0_upper[idx]             # <<<<<<<<<<<<<<
- * 
- *             if check_pos1 and (((cpos1[idx] + dpos1[idx]) < pos1_min) or ((cpos1[idx] - dpos1[idx]) > pos1_max)):
+    /* "splitBBoxLUT.pyx":902
+ *                     cdata[i]+=data
+ *         else:
+ *             if do_dummy:             # <<<<<<<<<<<<<<
+ *                 tdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)
+ *                 cdata = numpy.zeros(size,dtype=numpy.float32)
  */
-    __pyx_t_5 = PyObject_GetItem(__pyx_v_cpos0_upper, __pyx_v_idx); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_XDECREF(__pyx_v_max0);
-    __pyx_v_max0 = __pyx_t_5;
-    __pyx_t_5 = 0;
+    __pyx_t_14 = (__pyx_v_do_dummy != 0);
+    if (__pyx_t_14) {
 
-    /* "splitBBoxLUT.pyx":1214
- *             max0 = cpos0_upper[idx]
- * 
- *             if check_pos1 and (((cpos1[idx] + dpos1[idx]) < pos1_min) or ((cpos1[idx] - dpos1[idx]) > pos1_max)):             # <<<<<<<<<<<<<<
- *                     continue
- * 
+      /* "splitBBoxLUT.pyx":903
+ *         else:
+ *             if do_dummy:
+ *                 tdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
+ *                 cdata = numpy.zeros(size,dtype=numpy.float32)
+ *                 for i in prange(size, nogil=True, schedule="static"):
  */
-    if (__pyx_v_check_pos1) {
-      if (unlikely(!__pyx_v_cpos1)) { __Pyx_RaiseUnboundLocalError("cpos1"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
-      __pyx_t_5 = PyObject_GetItem(__pyx_v_cpos1, __pyx_v_idx); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_6);
+      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
+      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_weights, __pyx_n_s__ravel); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_6);
+      __pyx_t_4 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_4);
+      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_6);
+      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
+      __Pyx_GIVEREF(__pyx_t_4);
+      __pyx_t_4 = 0;
+      __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+      __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
-      if (unlikely(!__pyx_v_dpos1)) { __Pyx_RaiseUnboundLocalError("dpos1"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
-      __pyx_t_2 = PyObject_GetItem(__pyx_v_dpos1, __pyx_v_idx); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__float32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_1 = PyNumber_Add(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      if (unlikely(!__pyx_v_pos1_min)) { __Pyx_RaiseUnboundLocalError("pos1_min"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
-      __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_v_pos1_min, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+      __pyx_t_17 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_2);
+      if (unlikely(!__pyx_t_17.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      if (!__pyx_t_3) {
-        __pyx_t_2 = PyObject_GetItem(__pyx_v_cpos1, __pyx_v_idx); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
-        __pyx_t_1 = PyObject_GetItem(__pyx_v_dpos1, __pyx_v_idx); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_1);
-        __pyx_t_5 = PyNumber_Subtract(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_5);
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-        if (unlikely(!__pyx_v_pos1_max)) { __Pyx_RaiseUnboundLocalError("pos1_max"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
-        __pyx_t_1 = PyObject_RichCompare(__pyx_t_5, __pyx_v_pos1_max, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-        __pyx_t_8 = __pyx_t_7;
-      } else {
-        __pyx_t_8 = __pyx_t_3;
-      }
-      __pyx_t_3 = __pyx_t_8;
-    } else {
-      __pyx_t_3 = __pyx_v_check_pos1;
-    }
-    if (__pyx_t_3) {
-
-      /* "splitBBoxLUT.pyx":1215
- * 
- *             if check_pos1 and (((cpos1[idx] + dpos1[idx]) < pos1_min) or ((cpos1[idx] - dpos1[idx]) > pos1_max)):
- *                     continue             # <<<<<<<<<<<<<<
- * 
- *             fbin0_min = getBinNr(min0, pos0_min, delta)
- */
-      goto __pyx_L14_continue;
-      goto __pyx_L18;
-    }
-    __pyx_L18:;
-
-    /* "splitBBoxLUT.pyx":1217
- *                     continue
- * 
- *             fbin0_min = getBinNr(min0, pos0_min, delta)             # <<<<<<<<<<<<<<
- *             fbin0_max = getBinNr(max0, pos0_min, delta)
- *             bin0_min = <int> (fbin0_min)
- */
-    __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_v_min0); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_13 = __pyx_PyFloat_AsFloat(__pyx_v_pos0_min); if (unlikely((__pyx_t_13 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_14 = __pyx_PyFloat_AsFloat(__pyx_v_delta); if (unlikely((__pyx_t_14 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_1 = PyFloat_FromDouble(__pyx_f_12splitBBoxLUT_getBinNr(__pyx_t_12, __pyx_t_13, __pyx_t_14)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_XDECREF(__pyx_v_fbin0_min);
-    __pyx_v_fbin0_min = __pyx_t_1;
-    __pyx_t_1 = 0;
-
-    /* "splitBBoxLUT.pyx":1218
- * 
- *             fbin0_min = getBinNr(min0, pos0_min, delta)
- *             fbin0_max = getBinNr(max0, pos0_min, delta)             # <<<<<<<<<<<<<<
- *             bin0_min = <int> (fbin0_min)
- *             bin0_max = <int> (fbin0_max)
- */
-    __pyx_t_14 = __pyx_PyFloat_AsFloat(__pyx_v_max0); if (unlikely((__pyx_t_14 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_13 = __pyx_PyFloat_AsFloat(__pyx_v_pos0_min); if (unlikely((__pyx_t_13 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_v_delta); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_1 = PyFloat_FromDouble(__pyx_f_12splitBBoxLUT_getBinNr(__pyx_t_14, __pyx_t_13, __pyx_t_12)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_XDECREF(__pyx_v_fbin0_max);
-    __pyx_v_fbin0_max = __pyx_t_1;
-    __pyx_t_1 = 0;
-
-    /* "splitBBoxLUT.pyx":1219
- *             fbin0_min = getBinNr(min0, pos0_min, delta)
- *             fbin0_max = getBinNr(max0, pos0_min, delta)
- *             bin0_min = <int> (fbin0_min)             # <<<<<<<<<<<<<<
- *             bin0_max = <int> (fbin0_max)
- * 
- */
-    __pyx_t_15 = __Pyx_PyInt_AsInt(__pyx_v_fbin0_min); if (unlikely((__pyx_t_15 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_1 = PyInt_FromLong(((int)__pyx_t_15)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_XDECREF(__pyx_v_bin0_min);
-    __pyx_v_bin0_min = __pyx_t_1;
-    __pyx_t_1 = 0;
-
-    /* "splitBBoxLUT.pyx":1220
- *             fbin0_max = getBinNr(max0, pos0_min, delta)
- *             bin0_min = <int> (fbin0_min)
- *             bin0_max = <int> (fbin0_max)             # <<<<<<<<<<<<<<
- * 
- *             if (bin0_max < 0) or (bin0_min >= bins):
- */
-    __pyx_t_15 = __Pyx_PyInt_AsInt(__pyx_v_fbin0_max); if (unlikely((__pyx_t_15 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_1 = PyInt_FromLong(((int)__pyx_t_15)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_XDECREF(__pyx_v_bin0_max);
-    __pyx_v_bin0_max = __pyx_t_1;
-    __pyx_t_1 = 0;
-
-    /* "splitBBoxLUT.pyx":1222
- *             bin0_max = <int> (fbin0_max)
- * 
- *             if (bin0_max < 0) or (bin0_min >= bins):             # <<<<<<<<<<<<<<
- *                 continue
- *             if bin0_max >= bins:
- */
-    __pyx_t_1 = PyObject_RichCompare(__pyx_v_bin0_max, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    if (!__pyx_t_3) {
-      __pyx_t_1 = PyObject_RichCompare(__pyx_v_bin0_min, __pyx_v_bins, Py_GE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __pyx_t_7 = __pyx_t_8;
-    } else {
-      __pyx_t_7 = __pyx_t_3;
-    }
-    if (__pyx_t_7) {
-
-      /* "splitBBoxLUT.pyx":1223
- * 
- *             if (bin0_max < 0) or (bin0_min >= bins):
- *                 continue             # <<<<<<<<<<<<<<
- *             if bin0_max >= bins:
- *                 bin0_max = bins - 1
- */
-      goto __pyx_L14_continue;
-      goto __pyx_L19;
-    }
-    __pyx_L19:;
-
-    /* "splitBBoxLUT.pyx":1224
- *             if (bin0_max < 0) or (bin0_min >= bins):
- *                 continue
- *             if bin0_max >= bins:             # <<<<<<<<<<<<<<
- *                 bin0_max = bins - 1
- *             if  bin0_min < 0:
- */
-    __pyx_t_1 = PyObject_RichCompare(__pyx_v_bin0_max, __pyx_v_bins, Py_GE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    if (__pyx_t_7) {
+      __pyx_v_tdata = __pyx_t_17;
+      __pyx_t_17.memview = NULL;
+      __pyx_t_17.data = NULL;
 
-      /* "splitBBoxLUT.pyx":1225
- *                 continue
- *             if bin0_max >= bins:
- *                 bin0_max = bins - 1             # <<<<<<<<<<<<<<
- *             if  bin0_min < 0:
- *                 bin0_min = 0
+      /* "splitBBoxLUT.pyx":904
+ *             if do_dummy:
+ *                 tdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)
+ *                 cdata = numpy.zeros(size,dtype=numpy.float32)             # <<<<<<<<<<<<<<
+ *                 for i in prange(size, nogil=True, schedule="static"):
+ *                     data = tdata[i]
  */
-      __pyx_t_1 = PyNumber_Subtract(__pyx_v_bins, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 904; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 904; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_4);
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __pyx_t_2 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 904; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 904; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_6);
+      PyTuple_SET_ITEM(__pyx_t_6, 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 = 904; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+      __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 904; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_DECREF(__pyx_v_bin0_max);
-      __pyx_v_bin0_max = __pyx_t_1;
-      __pyx_t_1 = 0;
-      goto __pyx_L20;
-    }
-    __pyx_L20:;
+      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__float32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 904; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+      if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 904; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 904; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+      __pyx_t_17 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_5);
+      if (unlikely(!__pyx_t_17.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 904; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      __pyx_v_cdata = __pyx_t_17;
+      __pyx_t_17.memview = NULL;
+      __pyx_t_17.data = NULL;
 
-    /* "splitBBoxLUT.pyx":1226
- *             if bin0_max >= bins:
- *                 bin0_max = bins - 1
- *             if  bin0_min < 0:             # <<<<<<<<<<<<<<
- *                 bin0_min = 0
- * 
+      /* "splitBBoxLUT.pyx":905
+ *                 tdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)
+ *                 cdata = numpy.zeros(size,dtype=numpy.float32)
+ *                 for i in prange(size, nogil=True, schedule="static"):             # <<<<<<<<<<<<<<
+ *                     data = tdata[i]
+ *                     if ((cddummy!=0) and (fabs(data-cdummy) > cddummy)) or ((cddummy==0) and (data!=cdummy)):
  */
-    __pyx_t_1 = PyObject_RichCompare(__pyx_v_bin0_min, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    if (__pyx_t_7) {
+      {
+          #ifdef WITH_THREAD
+          PyThreadState *_save;
+          Py_UNBLOCK_THREADS
+          #endif
+          /*try:*/ {
+            __pyx_t_3 = __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_3 - 0) / 1;
+                if (__pyx_t_19 > 0)
+                {
+                    #ifdef _OPENMP
+                    #pragma omp parallel private(__pyx_t_14, __pyx_t_37, __pyx_t_35, __pyx_t_21, __pyx_t_15, __pyx_t_22, __pyx_t_36)
+                    #endif /* _OPENMP */
+                    {
+                        #ifdef _OPENMP
+                        #pragma omp for lastprivate(__pyx_v_data) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) schedule(static)
+                        #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_data = ((float)__PYX_NAN());
 
-      /* "splitBBoxLUT.pyx":1227
- *                 bin0_max = bins - 1
- *             if  bin0_min < 0:
- *                 bin0_min = 0             # <<<<<<<<<<<<<<
- * 
- *             if do_dark:
+                                /* "splitBBoxLUT.pyx":906
+ *                 cdata = numpy.zeros(size,dtype=numpy.float32)
+ *                 for i in prange(size, nogil=True, schedule="static"):
+ *                     data = tdata[i]             # <<<<<<<<<<<<<<
+ *                     if ((cddummy!=0) and (fabs(data-cdummy) > cddummy)) or ((cddummy==0) and (data!=cdummy)):
+ *                         cdata[i]+=data
  */
-      __Pyx_INCREF(__pyx_int_0);
-      __Pyx_DECREF(__pyx_v_bin0_min);
-      __pyx_v_bin0_min = __pyx_int_0;
-      goto __pyx_L21;
-    }
-    __pyx_L21:;
+                                __pyx_t_35 = __pyx_v_i;
+                                __pyx_v_data = (*((float *) ( /* dim=0 */ (__pyx_v_tdata.data + __pyx_t_35 * __pyx_v_tdata.strides[0]) )));
 
-    /* "splitBBoxLUT.pyx":1229
- *                 bin0_min = 0
- * 
- *             if do_dark:             # <<<<<<<<<<<<<<
- *                 data -= cdark[idx]
- *             if do_flat:
+                                /* "splitBBoxLUT.pyx":907
+ *                 for i in prange(size, nogil=True, schedule="static"):
+ *                     data = tdata[i]
+ *                     if ((cddummy!=0) and (fabs(data-cdummy) > cddummy)) or ((cddummy==0) and (data!=cdummy)):             # <<<<<<<<<<<<<<
+ *                         cdata[i]+=data
+ *                     else:
  */
-    if (__pyx_v_do_dark) {
+                                __pyx_t_14 = ((__pyx_v_cddummy != 0.0) != 0);
+                                if (__pyx_t_14) {
+                                  __pyx_t_21 = ((fabs((__pyx_v_data - __pyx_v_cdummy)) > __pyx_v_cddummy) != 0);
+                                  __pyx_t_22 = __pyx_t_21;
+                                } else {
+                                  __pyx_t_22 = __pyx_t_14;
+                                }
+                                if (!__pyx_t_22) {
+                                  __pyx_t_14 = ((__pyx_v_cddummy == 0.0) != 0);
+                                  if (__pyx_t_14) {
+                                    __pyx_t_21 = ((__pyx_v_data != __pyx_v_cdummy) != 0);
+                                    __pyx_t_15 = __pyx_t_21;
+                                  } else {
+                                    __pyx_t_15 = __pyx_t_14;
+                                  }
+                                  __pyx_t_14 = __pyx_t_15;
+                                } else {
+                                  __pyx_t_14 = __pyx_t_22;
+                                }
+                                if (__pyx_t_14) {
 
-      /* "splitBBoxLUT.pyx":1230
- * 
- *             if do_dark:
- *                 data -= cdark[idx]             # <<<<<<<<<<<<<<
- *             if do_flat:
- *                 data /= cflat[idx]
+                                  /* "splitBBoxLUT.pyx":908
+ *                     data = tdata[i]
+ *                     if ((cddummy!=0) and (fabs(data-cdummy) > cddummy)) or ((cddummy==0) and (data!=cdummy)):
+ *                         cdata[i]+=data             # <<<<<<<<<<<<<<
+ *                     else:
+ *                         cdata[i]+=cdummy
  */
-      if (unlikely(!__pyx_v_cdark)) { __Pyx_RaiseUnboundLocalError("cdark"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
-      __pyx_t_1 = PyObject_GetItem(__pyx_v_cdark, __pyx_v_idx); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_5 = PyNumber_InPlaceSubtract(__pyx_v_data, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __Pyx_DECREF(__pyx_v_data);
-      __pyx_v_data = __pyx_t_5;
-      __pyx_t_5 = 0;
-      goto __pyx_L22;
-    }
-    __pyx_L22:;
+                                  __pyx_t_36 = __pyx_v_i;
+                                  *((float *) ( /* dim=0 */ (__pyx_v_cdata.data + __pyx_t_36 * __pyx_v_cdata.strides[0]) )) += __pyx_v_data;
+                                  goto __pyx_L48;
+                                }
+                                /*else*/ {
 
-    /* "splitBBoxLUT.pyx":1231
- *             if do_dark:
- *                 data -= cdark[idx]
- *             if do_flat:             # <<<<<<<<<<<<<<
- *                 data /= cflat[idx]
- * 
+                                  /* "splitBBoxLUT.pyx":910
+ *                         cdata[i]+=data
+ *                     else:
+ *                         cdata[i]+=cdummy             # <<<<<<<<<<<<<<
+ *             else:
+ *                 cdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)
  */
-    if (__pyx_v_do_flat) {
+                                  __pyx_t_37 = __pyx_v_i;
+                                  *((float *) ( /* dim=0 */ (__pyx_v_cdata.data + __pyx_t_37 * __pyx_v_cdata.strides[0]) )) += __pyx_v_cdummy;
+                                }
+                                __pyx_L48:;
+                            }
+                        }
+                    }
+                }
+            }
+            #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
+          }
 
-      /* "splitBBoxLUT.pyx":1232
- *                 data -= cdark[idx]
- *             if do_flat:
- *                 data /= cflat[idx]             # <<<<<<<<<<<<<<
- * 
- *             if bin0_min == bin0_max:
- */
-      if (unlikely(!__pyx_v_cflat)) { __Pyx_RaiseUnboundLocalError("cflat"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
-      __pyx_t_5 = PyObject_GetItem(__pyx_v_cflat, __pyx_v_idx); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
-      __pyx_t_1 = __Pyx_PyNumber_InPlaceDivide(__pyx_v_data, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __Pyx_DECREF(__pyx_v_data);
-      __pyx_v_data = __pyx_t_1;
-      __pyx_t_1 = 0;
-      goto __pyx_L23;
+          /* "splitBBoxLUT.pyx":905
+ *                 tdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)
+ *                 cdata = numpy.zeros(size,dtype=numpy.float32)
+ *                 for i in prange(size, nogil=True, schedule="static"):             # <<<<<<<<<<<<<<
+ *                     data = tdata[i]
+ *                     if ((cddummy!=0) and (fabs(data-cdummy) > cddummy)) or ((cddummy==0) and (data!=cdummy)):
+ */
+          /*finally:*/ {
+            #ifdef WITH_THREAD
+            Py_BLOCK_THREADS
+            #endif
+          }
+      }
+      goto __pyx_L40;
     }
-    __pyx_L23:;
+    /*else*/ {
 
-    /* "splitBBoxLUT.pyx":1234
- *                 data /= cflat[idx]
+      /* "splitBBoxLUT.pyx":912
+ *                         cdata[i]+=cdummy
+ *             else:
+ *                 cdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)             # <<<<<<<<<<<<<<
  * 
- *             if bin0_min == bin0_max:             # <<<<<<<<<<<<<<
- *                 #All pixel is within a single bin
- *                 outCount[bin0_min] += 1.0
- */
-    __pyx_t_1 = PyObject_RichCompare(__pyx_v_bin0_min, __pyx_v_bin0_max, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    if (__pyx_t_7) {
-
-      /* "splitBBoxLUT.pyx":1236
- *             if bin0_min == bin0_max:
- *                 #All pixel is within a single bin
- *                 outCount[bin0_min] += 1.0             # <<<<<<<<<<<<<<
- *                 outData[bin0_min] += data
- *                 outMax[bin0_min] += 1
+ *         for i in prange(bins, nogil=True, schedule="guided"):
  */
-      __Pyx_INCREF(__pyx_v_bin0_min);
-      __pyx_t_1 = __pyx_v_bin0_min;
-      __pyx_t_5 = PyObject_GetItem(__pyx_v_outCount, __pyx_t_1); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
-      __pyx_t_2 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      if (PyObject_SetItem(__pyx_v_outCount, __pyx_t_1, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-
-      /* "splitBBoxLUT.pyx":1237
- *                 #All pixel is within a single bin
- *                 outCount[bin0_min] += 1.0
- *                 outData[bin0_min] += data             # <<<<<<<<<<<<<<
- *                 outMax[bin0_min] += 1
- * 
- */
-      __Pyx_INCREF(__pyx_v_bin0_min);
-      __pyx_t_1 = __pyx_v_bin0_min;
-      __pyx_t_4 = PyObject_GetItem(__pyx_v_outData, __pyx_t_1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_weights, __pyx_n_s__ravel); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_6);
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      PyTuple_SET_ITEM(__pyx_t_5, 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 = 912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
+      __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_t_4, __pyx_v_data); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__float32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      if (PyObject_SetItem(__pyx_v_outData, __pyx_t_1, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-
-      /* "splitBBoxLUT.pyx":1238
- *                 outCount[bin0_min] += 1.0
- *                 outData[bin0_min] += data
- *                 outMax[bin0_min] += 1             # <<<<<<<<<<<<<<
- * 
- *             else: #we have pixel spliting.
- */
-      __Pyx_INCREF(__pyx_v_bin0_min);
-      __pyx_t_1 = __pyx_v_bin0_min;
-      __pyx_t_2 = PyObject_GetItem(__pyx_v_outMax, __pyx_t_1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
+      __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_1);
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      if (PyObject_SetItem(__pyx_v_outMax, __pyx_t_1, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+      __pyx_t_17 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_1);
+      if (unlikely(!__pyx_t_17.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      goto __pyx_L24;
+      __pyx_v_cdata = __pyx_t_17;
+      __pyx_t_17.memview = NULL;
+      __pyx_t_17.data = NULL;
     }
-    /*else*/ {
+    __pyx_L40:;
+  }
+  __pyx_L9:;
 
-      /* "splitBBoxLUT.pyx":1241
- * 
- *             else: #we have pixel spliting.
- *                 deltaA = 1.0 / (fbin0_max - fbin0_min)             # <<<<<<<<<<<<<<
+  /* "splitBBoxLUT.pyx":914
+ *                 cdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)
  * 
- *                 deltaL = (bin0_min + 1) - fbin0_min
+ *         for i in prange(bins, nogil=True, schedule="guided"):             # <<<<<<<<<<<<<<
+ *             sum_data = 0.0
+ *             sum_count = 0.0
  */
-      __pyx_t_1 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_4 = PyNumber_Subtract(__pyx_v_fbin0_max, __pyx_v_fbin0_min); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __Pyx_XDECREF(__pyx_v_deltaA);
-      __pyx_v_deltaA = __pyx_t_2;
-      __pyx_t_2 = 0;
+  {
+      #ifdef WITH_THREAD
+      PyThreadState *_save;
+      Py_UNBLOCK_THREADS
+      #endif
+      /*try:*/ {
+        __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_3 = (__pyx_t_19 - 0) / 1;
+            if (__pyx_t_3 > 0)
+            {
+                #ifdef _OPENMP
+                #pragma omp parallel private(__pyx_t_42, __pyx_t_14, __pyx_t_38, __pyx_t_47, __pyx_t_43, __pyx_t_48, __pyx_t_44, __pyx_t_40, __pyx_t_45, __pyx_t_15, __pyx_t_39, __pyx_t_41, __pyx_t_46, __pyx_t_22)
+                #endif /* _OPENMP */
+                {
+                    #ifdef _OPENMP
+                    #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_sum_data) lastprivate(__pyx_v_sum_count) lastprivate(__pyx_v_data) lastprivate(__pyx_v_j) lastprivate(__pyx_v_idx) lastprivate(__pyx_v_coef) schedule(guided)
+                    #endif /* _OPENMP */
+                    for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_3; __pyx_t_18++){
+                        {
+                            __pyx_v_i = 0 + 1 * __pyx_t_18;
+                            /* Initialize private variables to invalid values */
+                            __pyx_v_sum_data = ((double)__PYX_NAN());
+                            __pyx_v_sum_count = ((double)__PYX_NAN());
+                            __pyx_v_data = ((float)__PYX_NAN());
+                            __pyx_v_j = ((int)0xbad0bad0);
+                            __pyx_v_idx = ((int)0xbad0bad0);
+                            __pyx_v_coef = ((float)__PYX_NAN());
 
-      /* "splitBBoxLUT.pyx":1243
- *                 deltaA = 1.0 / (fbin0_max - fbin0_min)
- * 
- *                 deltaL = (bin0_min + 1) - fbin0_min             # <<<<<<<<<<<<<<
- *                 deltaR = fbin0_max - (bin0_max)
+                            /* "splitBBoxLUT.pyx":915
  * 
+ *         for i in prange(bins, nogil=True, schedule="guided"):
+ *             sum_data = 0.0             # <<<<<<<<<<<<<<
+ *             sum_count = 0.0
+ *             for j in range(lut_size):
  */
-      __pyx_t_2 = PyNumber_Add(__pyx_v_bin0_min, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_4 = PyNumber_Subtract(__pyx_t_2, __pyx_v_fbin0_min); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __Pyx_XDECREF(__pyx_v_deltaL);
-      __pyx_v_deltaL = __pyx_t_4;
-      __pyx_t_4 = 0;
+                            __pyx_v_sum_data = 0.0;
 
-      /* "splitBBoxLUT.pyx":1244
- * 
- *                 deltaL = (bin0_min + 1) - fbin0_min
- *                 deltaR = fbin0_max - (bin0_max)             # <<<<<<<<<<<<<<
- * 
- *                 outCount[bin0_min] += (deltaA * deltaL)
+                            /* "splitBBoxLUT.pyx":916
+ *         for i in prange(bins, nogil=True, schedule="guided"):
+ *             sum_data = 0.0
+ *             sum_count = 0.0             # <<<<<<<<<<<<<<
+ *             for j in range(lut_size):
+ *                 idx = lut[i, j].idx
  */
-      __pyx_t_4 = PyNumber_Subtract(__pyx_v_fbin0_max, __pyx_v_bin0_max); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      __Pyx_XDECREF(__pyx_v_deltaR);
-      __pyx_v_deltaR = __pyx_t_4;
-      __pyx_t_4 = 0;
+                            __pyx_v_sum_count = 0.0;
 
-      /* "splitBBoxLUT.pyx":1246
- *                 deltaR = fbin0_max - (bin0_max)
- * 
- *                 outCount[bin0_min] += (deltaA * deltaL)             # <<<<<<<<<<<<<<
- *                 outData[bin0_min] += (data * deltaA * deltaL)
- *                 outMax[bin0_min] += 1
+                            /* "splitBBoxLUT.pyx":917
+ *             sum_data = 0.0
+ *             sum_count = 0.0
+ *             for j in range(lut_size):             # <<<<<<<<<<<<<<
+ *                 idx = lut[i, j].idx
+ *                 coef = lut[i, j].coef
  */
-      __Pyx_INCREF(__pyx_v_bin0_min);
-      __pyx_t_4 = __pyx_v_bin0_min;
-      __pyx_t_2 = PyObject_GetItem(__pyx_v_outCount, __pyx_t_4); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_1 = PyNumber_Multiply(__pyx_v_deltaA, __pyx_v_deltaL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      if (PyObject_SetItem(__pyx_v_outCount, __pyx_t_4, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+                            __pyx_t_38 = __pyx_v_lut_size;
+                            for (__pyx_t_39 = 0; __pyx_t_39 < __pyx_t_38; __pyx_t_39+=1) {
+                              __pyx_v_j = __pyx_t_39;
 
-      /* "splitBBoxLUT.pyx":1247
- * 
- *                 outCount[bin0_min] += (deltaA * deltaL)
- *                 outData[bin0_min] += (data * deltaA * deltaL)             # <<<<<<<<<<<<<<
- *                 outMax[bin0_min] += 1
- * 
+                              /* "splitBBoxLUT.pyx":918
+ *             sum_count = 0.0
+ *             for j in range(lut_size):
+ *                 idx = lut[i, j].idx             # <<<<<<<<<<<<<<
+ *                 coef = lut[i, j].coef
+ *                 if idx <= 0 and coef <= 0.0:
  */
-      __Pyx_INCREF(__pyx_v_bin0_min);
-      __pyx_t_4 = __pyx_v_bin0_min;
-      __pyx_t_5 = PyObject_GetItem(__pyx_v_outData, __pyx_t_4); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
-      __pyx_t_1 = PyNumber_Multiply(__pyx_v_data, __pyx_v_deltaA); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_v_deltaL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      if (PyObject_SetItem(__pyx_v_outData, __pyx_t_4, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+                              __pyx_t_40 = __pyx_v_i;
+                              __pyx_t_41 = __pyx_v_j;
+                              __pyx_t_42 = (*((struct __pyx_t_12splitBBoxLUT_lut_point *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_lut.data + __pyx_t_40 * __pyx_v_lut.strides[0]) ) + __pyx_t_41 * __pyx_v_lut.strides[1]) ))).idx;
+                              __pyx_v_idx = __pyx_t_42;
 
-      /* "splitBBoxLUT.pyx":1248
- *                 outCount[bin0_min] += (deltaA * deltaL)
- *                 outData[bin0_min] += (data * deltaA * deltaL)
- *                 outMax[bin0_min] += 1             # <<<<<<<<<<<<<<
- * 
- *                 outCount[bin0_max] += (deltaA * deltaR)
+                              /* "splitBBoxLUT.pyx":919
+ *             for j in range(lut_size):
+ *                 idx = lut[i, j].idx
+ *                 coef = lut[i, j].coef             # <<<<<<<<<<<<<<
+ *                 if idx <= 0 and coef <= 0.0:
+ *                     break
  */
-      __Pyx_INCREF(__pyx_v_bin0_min);
-      __pyx_t_4 = __pyx_v_bin0_min;
-      __pyx_t_1 = PyObject_GetItem(__pyx_v_outMax, __pyx_t_4); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      if (PyObject_SetItem(__pyx_v_outMax, __pyx_t_4, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+                              __pyx_t_43 = __pyx_v_i;
+                              __pyx_t_44 = __pyx_v_j;
+                              __pyx_t_45 = (*((struct __pyx_t_12splitBBoxLUT_lut_point *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_lut.data + __pyx_t_43 * __pyx_v_lut.strides[0]) ) + __pyx_t_44 * __pyx_v_lut.strides[1]) ))).coef;
+                              __pyx_v_coef = __pyx_t_45;
+
+                              /* "splitBBoxLUT.pyx":920
+ *                 idx = lut[i, j].idx
+ *                 coef = lut[i, j].coef
+ *                 if idx <= 0 and coef <= 0.0:             # <<<<<<<<<<<<<<
+ *                     break
+ *                 data = cdata[idx]
+ */
+                              __pyx_t_14 = ((__pyx_v_idx <= 0) != 0);
+                              if (__pyx_t_14) {
+                                __pyx_t_22 = ((__pyx_v_coef <= 0.0) != 0);
+                                __pyx_t_15 = __pyx_t_22;
+                              } else {
+                                __pyx_t_15 = __pyx_t_14;
+                              }
+                              if (__pyx_t_15) {
+
+                                /* "splitBBoxLUT.pyx":921
+ *                 coef = lut[i, j].coef
+ *                 if idx <= 0 and coef <= 0.0:
+ *                     break             # <<<<<<<<<<<<<<
+ *                 data = cdata[idx]
+ *                 if do_dummy and data==cdummy:
+ */
+                                goto __pyx_L59_break;
+                                goto __pyx_L60;
+                              }
+                              __pyx_L60:;
+
+                              /* "splitBBoxLUT.pyx":922
+ *                 if idx <= 0 and coef <= 0.0:
+ *                     break
+ *                 data = cdata[idx]             # <<<<<<<<<<<<<<
+ *                 if do_dummy and data==cdummy:
+ *                     continue
+ */
+                              __pyx_t_46 = __pyx_v_idx;
+                              __pyx_v_data = (*((float *) ( /* dim=0 */ (__pyx_v_cdata.data + __pyx_t_46 * __pyx_v_cdata.strides[0]) )));
 
-      /* "splitBBoxLUT.pyx":1250
- *                 outMax[bin0_min] += 1
+                              /* "splitBBoxLUT.pyx":923
+ *                     break
+ *                 data = cdata[idx]
+ *                 if do_dummy and data==cdummy:             # <<<<<<<<<<<<<<
+ *                     continue
  * 
- *                 outCount[bin0_max] += (deltaA * deltaR)             # <<<<<<<<<<<<<<
- *                 outData[bin0_max] += (data * deltaA * deltaR)
- *                 outMax[bin0_max] += 1
  */
-      __Pyx_INCREF(__pyx_v_bin0_max);
-      __pyx_t_4 = __pyx_v_bin0_max;
-      __pyx_t_2 = PyObject_GetItem(__pyx_v_outCount, __pyx_t_4); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_1 = PyNumber_Multiply(__pyx_v_deltaA, __pyx_v_deltaR); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      if (PyObject_SetItem(__pyx_v_outCount, __pyx_t_4, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+                              if ((__pyx_v_do_dummy != 0)) {
+                                __pyx_t_15 = ((__pyx_v_data == __pyx_v_cdummy) != 0);
+                                __pyx_t_14 = __pyx_t_15;
+                              } else {
+                                __pyx_t_14 = (__pyx_v_do_dummy != 0);
+                              }
+                              if (__pyx_t_14) {
 
-      /* "splitBBoxLUT.pyx":1251
+                                /* "splitBBoxLUT.pyx":924
+ *                 data = cdata[idx]
+ *                 if do_dummy and data==cdummy:
+ *                     continue             # <<<<<<<<<<<<<<
  * 
- *                 outCount[bin0_max] += (deltaA * deltaR)
- *                 outData[bin0_max] += (data * deltaA * deltaR)             # <<<<<<<<<<<<<<
- *                 outMax[bin0_max] += 1
- *                 if bin0_min + 1 < bin0_max:
+ *                 sum_data = sum_data + coef * data
  */
-      __Pyx_INCREF(__pyx_v_bin0_max);
-      __pyx_t_4 = __pyx_v_bin0_max;
-      __pyx_t_5 = PyObject_GetItem(__pyx_v_outData, __pyx_t_4); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_5);
-      __pyx_t_1 = PyNumber_Multiply(__pyx_v_data, __pyx_v_deltaA); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_v_deltaR); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      if (PyObject_SetItem(__pyx_v_outData, __pyx_t_4, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+                                goto __pyx_L58_continue;
+                                goto __pyx_L61;
+                              }
+                              __pyx_L61:;
 
-      /* "splitBBoxLUT.pyx":1252
- *                 outCount[bin0_max] += (deltaA * deltaR)
- *                 outData[bin0_max] += (data * deltaA * deltaR)
- *                 outMax[bin0_max] += 1             # <<<<<<<<<<<<<<
- *                 if bin0_min + 1 < bin0_max:
- *                     for i in range(bin0_min + 1, bin0_max):
+                              /* "splitBBoxLUT.pyx":926
+ *                     continue
+ * 
+ *                 sum_data = sum_data + coef * data             # <<<<<<<<<<<<<<
+ *                 sum_count = sum_count + coef
+ *             outData_1d[i] += sum_data
  */
-      __Pyx_INCREF(__pyx_v_bin0_max);
-      __pyx_t_4 = __pyx_v_bin0_max;
-      __pyx_t_1 = PyObject_GetItem(__pyx_v_outMax, __pyx_t_4); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      if (PyObject_SetItem(__pyx_v_outMax, __pyx_t_4, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+                              __pyx_v_sum_data = (__pyx_v_sum_data + (__pyx_v_coef * __pyx_v_data));
 
-      /* "splitBBoxLUT.pyx":1253
- *                 outData[bin0_max] += (data * deltaA * deltaR)
- *                 outMax[bin0_max] += 1
- *                 if bin0_min + 1 < bin0_max:             # <<<<<<<<<<<<<<
- *                     for i in range(bin0_min + 1, bin0_max):
- *                         outCount[i] += deltaA
+                              /* "splitBBoxLUT.pyx":927
+ * 
+ *                 sum_data = sum_data + coef * data
+ *                 sum_count = sum_count + coef             # <<<<<<<<<<<<<<
+ *             outData_1d[i] += sum_data
+ *             outCount_1d[i] += sum_count
  */
-      __pyx_t_4 = PyNumber_Add(__pyx_v_bin0_min, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_2 = PyObject_RichCompare(__pyx_t_4, __pyx_v_bin0_max, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      if (__pyx_t_7) {
+                              __pyx_v_sum_count = (__pyx_v_sum_count + __pyx_v_coef);
+                              __pyx_L58_continue:;
+                            }
+                            __pyx_L59_break:;
 
-        /* "splitBBoxLUT.pyx":1254
- *                 outMax[bin0_max] += 1
- *                 if bin0_min + 1 < bin0_max:
- *                     for i in range(bin0_min + 1, bin0_max):             # <<<<<<<<<<<<<<
- *                         outCount[i] += deltaA
- *                         outData[i] += (data * deltaA)
- */
-        __pyx_t_2 = PyNumber_Add(__pyx_v_bin0_min, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
-        __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_4);
-        PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
-        __Pyx_GIVEREF(__pyx_t_2);
-        __Pyx_INCREF(__pyx_v_bin0_max);
-        PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_bin0_max);
-        __Pyx_GIVEREF(__pyx_v_bin0_max);
-        __pyx_t_2 = 0;
-        __pyx_t_2 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __Pyx_GOTREF(__pyx_t_2);
-        __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-        if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
-          __pyx_t_4 = __pyx_t_2; __Pyx_INCREF(__pyx_t_4); __pyx_t_16 = 0;
-          __pyx_t_17 = NULL;
-        } else {
-          __pyx_t_16 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_4);
-          __pyx_t_17 = Py_TYPE(__pyx_t_4)->tp_iternext;
-        }
-        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-        for (;;) {
-          if (!__pyx_t_17 && PyList_CheckExact(__pyx_t_4)) {
-            if (__pyx_t_16 >= PyList_GET_SIZE(__pyx_t_4)) break;
-            #if CYTHON_COMPILING_IN_CPYTHON
-            __pyx_t_2 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_16); __Pyx_INCREF(__pyx_t_2); __pyx_t_16++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-            #else
-            __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_16); __pyx_t_16++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-            #endif
-          } else if (!__pyx_t_17 && PyTuple_CheckExact(__pyx_t_4)) {
-            if (__pyx_t_16 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
-            #if CYTHON_COMPILING_IN_CPYTHON
-            __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_16); __Pyx_INCREF(__pyx_t_2); __pyx_t_16++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-            #else
-            __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_16); __pyx_t_16++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-            #endif
-          } else {
-            __pyx_t_2 = __pyx_t_17(__pyx_t_4);
-            if (unlikely(!__pyx_t_2)) {
-              if (PyErr_Occurred()) {
-                if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
-                else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-              }
-              break;
-            }
-            __Pyx_GOTREF(__pyx_t_2);
-          }
-          __Pyx_XDECREF(__pyx_v_i);
-          __pyx_v_i = __pyx_t_2;
-          __pyx_t_2 = 0;
-
-          /* "splitBBoxLUT.pyx":1255
- *                 if bin0_min + 1 < bin0_max:
- *                     for i in range(bin0_min + 1, bin0_max):
- *                         outCount[i] += deltaA             # <<<<<<<<<<<<<<
- *                         outData[i] += (data * deltaA)
- *                         outMax[i] += 1
+                            /* "splitBBoxLUT.pyx":928
+ *                 sum_data = sum_data + coef * data
+ *                 sum_count = sum_count + coef
+ *             outData_1d[i] += sum_data             # <<<<<<<<<<<<<<
+ *             outCount_1d[i] += sum_count
+ *             if sum_count > epsilon:
  */
-          __Pyx_INCREF(__pyx_v_i);
-          __pyx_t_2 = __pyx_v_i;
-          __pyx_t_1 = PyObject_GetItem(__pyx_v_outCount, __pyx_t_2); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_1);
-          __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_t_1, __pyx_v_deltaA); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_5);
-          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-          if (PyObject_SetItem(__pyx_v_outCount, __pyx_t_2, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-
-          /* "splitBBoxLUT.pyx":1256
- *                     for i in range(bin0_min + 1, bin0_max):
- *                         outCount[i] += deltaA
- *                         outData[i] += (data * deltaA)             # <<<<<<<<<<<<<<
- *                         outMax[i] += 1
- * 
+                            __pyx_t_38 = __pyx_v_i;
+                            *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outData_1d.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_outData_1d.diminfo[0].strides) += __pyx_v_sum_data;
+
+                            /* "splitBBoxLUT.pyx":929
+ *                 sum_count = sum_count + coef
+ *             outData_1d[i] += sum_data
+ *             outCount_1d[i] += sum_count             # <<<<<<<<<<<<<<
+ *             if sum_count > epsilon:
+ *                 outMerge_1d[i] += sum_data / sum_count
  */
-          __Pyx_INCREF(__pyx_v_i);
-          __pyx_t_2 = __pyx_v_i;
-          __pyx_t_5 = PyObject_GetItem(__pyx_v_outData, __pyx_t_2); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_5);
-          __pyx_t_1 = PyNumber_Multiply(__pyx_v_data, __pyx_v_deltaA); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_1);
-          __pyx_t_18 = PyNumber_InPlaceAdd(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_18);
-          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-          if (PyObject_SetItem(__pyx_v_outData, __pyx_t_2, __pyx_t_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
-          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-
-          /* "splitBBoxLUT.pyx":1257
- *                         outCount[i] += deltaA
- *                         outData[i] += (data * deltaA)
- *                         outMax[i] += 1             # <<<<<<<<<<<<<<
- * 
- *     for i in range(bins):
- */
-          __Pyx_INCREF(__pyx_v_i);
-          __pyx_t_2 = __pyx_v_i;
-          __pyx_t_18 = PyObject_GetItem(__pyx_v_outMax, __pyx_t_2); if (!__pyx_t_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_18);
-          __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_t_18, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __Pyx_GOTREF(__pyx_t_1);
-          __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
-          if (PyObject_SetItem(__pyx_v_outMax, __pyx_t_2, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1257; __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_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-        goto __pyx_L25;
-      }
-      __pyx_L25:;
-    }
-    __pyx_L24:;
-    __pyx_L14_continue:;
-  }
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+                            __pyx_t_39 = __pyx_v_i;
+                            *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount_1d.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_outCount_1d.diminfo[0].strides) += __pyx_v_sum_count;
 
-  /* "splitBBoxLUT.pyx":1259
- *                         outMax[i] += 1
- * 
- *     for i in range(bins):             # <<<<<<<<<<<<<<
- *                 if outCount[i] > epsilon:
- *                     outMerge[i] = (outData[i] / outCount[i])
+                            /* "splitBBoxLUT.pyx":930
+ *             outData_1d[i] += sum_data
+ *             outCount_1d[i] += sum_count
+ *             if sum_count > epsilon:             # <<<<<<<<<<<<<<
+ *                 outMerge_1d[i] += sum_data / sum_count
+ *             else:
  */
-  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
-  __Pyx_INCREF(__pyx_v_bins);
-  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_bins);
-  __Pyx_GIVEREF(__pyx_v_bins);
-  __pyx_t_4 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
-  if (PyList_CheckExact(__pyx_t_4) || PyTuple_CheckExact(__pyx_t_4)) {
-    __pyx_t_6 = __pyx_t_4; __Pyx_INCREF(__pyx_t_6); __pyx_t_10 = 0;
-    __pyx_t_11 = NULL;
-  } else {
-    __pyx_t_10 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_11 = Py_TYPE(__pyx_t_6)->tp_iternext;
-  }
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  for (;;) {
-    if (!__pyx_t_11 && PyList_CheckExact(__pyx_t_6)) {
-      if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_6)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_4 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_10); __Pyx_INCREF(__pyx_t_4); __pyx_t_10++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_4 = PySequence_ITEM(__pyx_t_6, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
-    } else if (!__pyx_t_11 && PyTuple_CheckExact(__pyx_t_6)) {
-      if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
-      #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_10); __Pyx_INCREF(__pyx_t_4); __pyx_t_10++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #else
-      __pyx_t_4 = PySequence_ITEM(__pyx_t_6, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      #endif
-    } else {
-      __pyx_t_4 = __pyx_t_11(__pyx_t_6);
-      if (unlikely(!__pyx_t_4)) {
-        if (PyErr_Occurred()) {
-          if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
-          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        }
-        break;
-      }
-      __Pyx_GOTREF(__pyx_t_4);
-    }
-    __Pyx_XDECREF(__pyx_v_i);
-    __pyx_v_i = __pyx_t_4;
-    __pyx_t_4 = 0;
+                            __pyx_t_14 = ((__pyx_v_sum_count > __pyx_v_epsilon) != 0);
+                            if (__pyx_t_14) {
 
-    /* "splitBBoxLUT.pyx":1260
- * 
- *     for i in range(bins):
- *                 if outCount[i] > epsilon:             # <<<<<<<<<<<<<<
- *                     outMerge[i] = (outData[i] / outCount[i])
- *                 else:
+                              /* "splitBBoxLUT.pyx":931
+ *             outCount_1d[i] += sum_count
+ *             if sum_count > epsilon:
+ *                 outMerge_1d[i] += sum_data / sum_count             # <<<<<<<<<<<<<<
+ *             else:
+ *                 outMerge_1d[i] += cdummy
  */
-    __pyx_t_4 = PyObject_GetItem(__pyx_v_outCount, __pyx_v_i); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_epsilon); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_2, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    if (__pyx_t_7) {
+                              __pyx_t_47 = __pyx_v_i;
+                              *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_outMerge_1d.rcbuffer->pybuffer.buf, __pyx_t_47, __pyx_pybuffernd_outMerge_1d.diminfo[0].strides) += (__pyx_v_sum_data / __pyx_v_sum_count);
+                              goto __pyx_L62;
+                            }
+                            /*else*/ {
 
-      /* "splitBBoxLUT.pyx":1261
- *     for i in range(bins):
- *                 if outCount[i] > epsilon:
- *                     outMerge[i] = (outData[i] / outCount[i])             # <<<<<<<<<<<<<<
- *                 else:
- *                     outMerge[i] = cdummy
+                              /* "splitBBoxLUT.pyx":933
+ *                 outMerge_1d[i] += sum_data / sum_count
+ *             else:
+ *                 outMerge_1d[i] += cdummy             # <<<<<<<<<<<<<<
+ *         return  outMerge.T, self.outPos0, self.outPos1, outData.T, outCount.T
+ * 
  */
-      __pyx_t_1 = PyObject_GetItem(__pyx_v_outData, __pyx_v_i); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_2 = PyObject_GetItem(__pyx_v_outCount, __pyx_v_i); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1261; __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 (PyObject_SetItem(__pyx_v_outMerge, __pyx_v_i, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      goto __pyx_L30;
-    }
-    /*else*/ {
+                              __pyx_t_48 = __pyx_v_i;
+                              *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_outMerge_1d.rcbuffer->pybuffer.buf, __pyx_t_48, __pyx_pybuffernd_outMerge_1d.diminfo[0].strides) += __pyx_v_cdummy;
+                            }
+                            __pyx_L62:;
+                        }
+                    }
+                }
+            }
+        }
+        #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
+      }
 
-      /* "splitBBoxLUT.pyx":1263
- *                     outMerge[i] = (outData[i] / outCount[i])
- *                 else:
- *                     outMerge[i] = cdummy             # <<<<<<<<<<<<<<
+      /* "splitBBoxLUT.pyx":914
+ *                 cdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)
  * 
- *     return  outPos, outMerge, outData, outCount, outMax
+ *         for i in prange(bins, nogil=True, schedule="guided"):             # <<<<<<<<<<<<<<
+ *             sum_data = 0.0
+ *             sum_count = 0.0
  */
-      __pyx_t_4 = PyFloat_FromDouble(__pyx_v_cdummy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      if (PyObject_SetItem(__pyx_v_outMerge, __pyx_v_i, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    }
-    __pyx_L30:;
+      /*finally:*/ {
+        #ifdef WITH_THREAD
+        Py_BLOCK_THREADS
+        #endif
+      }
   }
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
 
-  /* "splitBBoxLUT.pyx":1265
- *                     outMerge[i] = cdummy
- * 
- *     return  outPos, outMerge, outData, outCount, outMax             # <<<<<<<<<<<<<<
- * 
+  /* "splitBBoxLUT.pyx":934
+ *             else:
+ *                 outMerge_1d[i] += cdummy
+ *         return  outMerge.T, self.outPos0, self.outPos1, outData.T, outCount.T             # <<<<<<<<<<<<<<
  * 
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_6 = PyTuple_New(5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_outMerge), __pyx_n_s__T); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__outPos0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
-  __Pyx_INCREF(__pyx_v_outPos);
-  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_outPos);
-  __Pyx_GIVEREF(__pyx_v_outPos);
-  __Pyx_INCREF(__pyx_v_outMerge);
-  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_outMerge);
-  __Pyx_GIVEREF(__pyx_v_outMerge);
-  __Pyx_INCREF(__pyx_v_outData);
-  PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_outData);
-  __Pyx_GIVEREF(__pyx_v_outData);
-  __Pyx_INCREF(__pyx_v_outCount);
-  PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_v_outCount);
-  __Pyx_GIVEREF(__pyx_v_outCount);
-  __Pyx_INCREF(__pyx_v_outMax);
-  PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_v_outMax);
-  __Pyx_GIVEREF(__pyx_v_outMax);
-  __pyx_r = ((PyObject *)__pyx_t_6);
+  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__outPos1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_outData), __pyx_n_s__T); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_outCount), __pyx_n_s__T); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
+  __pyx_t_49 = PyTuple_New(5); if (unlikely(!__pyx_t_49)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_49);
+  PyTuple_SET_ITEM(__pyx_t_49, 0, __pyx_t_1);
+  __Pyx_GIVEREF(__pyx_t_1);
+  PyTuple_SET_ITEM(__pyx_t_49, 1, __pyx_t_6);
+  __Pyx_GIVEREF(__pyx_t_6);
+  PyTuple_SET_ITEM(__pyx_t_49, 2, __pyx_t_5);
+  __Pyx_GIVEREF(__pyx_t_5);
+  PyTuple_SET_ITEM(__pyx_t_49, 3, __pyx_t_2);
+  __Pyx_GIVEREF(__pyx_t_2);
+  PyTuple_SET_ITEM(__pyx_t_49, 4, __pyx_t_4);
+  __Pyx_GIVEREF(__pyx_t_4);
+  __pyx_t_1 = 0;
   __pyx_t_6 = 0;
+  __pyx_t_5 = 0;
+  __pyx_t_2 = 0;
+  __pyx_t_4 = 0;
+  __pyx_r = ((PyObject *)__pyx_t_49);
+  __pyx_t_49 = 0;
   goto __pyx_L0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -19246,45 +14780,42 @@ static PyObject *__pyx_pf_12splitBBoxLUT_2histoBBox1d(CYTHON_UNUSED PyObject *__
   __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_5);
   __Pyx_XDECREF(__pyx_t_6);
-  __Pyx_XDECREF(__pyx_t_18);
-  __Pyx_AddTraceback("splitBBoxLUT.histoBBox1d", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __PYX_XDEC_MEMVIEW(&__pyx_t_13, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_t_17, 1);
+  __Pyx_XDECREF(__pyx_t_49);
+  { 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_outCount_1d.rcbuffer->pybuffer);
+    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outData.rcbuffer->pybuffer);
+    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outData_1d.rcbuffer->pybuffer);
+    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outMerge.rcbuffer->pybuffer);
+    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outMerge_1d.rcbuffer->pybuffer);
+  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
+  __Pyx_AddTraceback("splitBBoxLUT.HistoBBox2d.integrate", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
+  goto __pyx_L2;
   __pyx_L0:;
-  __Pyx_XDECREF(__pyx_v_size);
-  __Pyx_XDECREF(__pyx_v_cdata);
-  __Pyx_XDECREF(__pyx_v_cpos0);
-  __Pyx_XDECREF(__pyx_v_dpos0);
-  __Pyx_XDECREF(__pyx_v_outData);
-  __Pyx_XDECREF(__pyx_v_outCount);
-  __Pyx_XDECREF(__pyx_v_outMax);
-  __Pyx_XDECREF(__pyx_v_outMerge);
-  __Pyx_XDECREF(__pyx_v_cmask);
-  __Pyx_XDECREF(__pyx_v_cdark);
-  __Pyx_XDECREF(__pyx_v_cflat);
-  __Pyx_XDECREF(__pyx_v_cpos0_lower);
-  __Pyx_XDECREF(__pyx_v_cpos0_upper);
-  __Pyx_XDECREF(__pyx_v_pos0_min);
-  __Pyx_XDECREF(__pyx_v_pos0_max);
-  __Pyx_XDECREF(__pyx_v_idx);
-  __Pyx_XDECREF(__pyx_v_min0);
-  __Pyx_XDECREF(__pyx_v_max0);
-  __Pyx_XDECREF(__pyx_v_pos0_maxin);
-  __Pyx_XDECREF(__pyx_v_cpos1);
-  __Pyx_XDECREF(__pyx_v_dpos1);
-  __Pyx_XDECREF(__pyx_v_pos1_min);
-  __Pyx_XDECREF(__pyx_v_pos1_maxin);
-  __Pyx_XDECREF(__pyx_v_pos1_max);
-  __Pyx_XDECREF(__pyx_v_delta);
-  __Pyx_XDECREF(__pyx_v_outPos);
-  __Pyx_XDECREF(__pyx_v_data);
-  __Pyx_XDECREF(__pyx_v_fbin0_min);
-  __Pyx_XDECREF(__pyx_v_fbin0_max);
-  __Pyx_XDECREF(__pyx_v_bin0_min);
-  __Pyx_XDECREF(__pyx_v_bin0_max);
-  __Pyx_XDECREF(__pyx_v_deltaA);
-  __Pyx_XDECREF(__pyx_v_deltaL);
-  __Pyx_XDECREF(__pyx_v_deltaR);
-  __Pyx_XDECREF(__pyx_v_i);
+  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outCount.rcbuffer->pybuffer);
+  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outCount_1d.rcbuffer->pybuffer);
+  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outData.rcbuffer->pybuffer);
+  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outData_1d.rcbuffer->pybuffer);
+  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outMerge.rcbuffer->pybuffer);
+  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outMerge_1d.rcbuffer->pybuffer);
+  __pyx_L2:;
+  __Pyx_XDECREF((PyObject *)__pyx_v_outData);
+  __Pyx_XDECREF((PyObject *)__pyx_v_outCount);
+  __Pyx_XDECREF((PyObject *)__pyx_v_outMerge);
+  __Pyx_XDECREF((PyObject *)__pyx_v_outData_1d);
+  __Pyx_XDECREF((PyObject *)__pyx_v_outCount_1d);
+  __Pyx_XDECREF((PyObject *)__pyx_v_outMerge_1d);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_lut, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_cdata, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_tdata, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_cflat, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_cdark, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_csolidAngle, 1);
+  __PYX_XDEC_MEMVIEW(&__pyx_v_cpolarization, 1);
   __Pyx_XGIVEREF(__pyx_r);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
@@ -19347,7 +14878,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  * 
  *             cdef int copy_shape, i, ndim
  */
-  __pyx_t_1 = (__pyx_v_info == NULL);
+  __pyx_t_1 = ((__pyx_v_info == NULL) != 0);
   if (__pyx_t_1) {
     __pyx_r = 0;
     goto __pyx_L0;
@@ -19389,7 +14920,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 copy_shape = 1
  *             else:
  */
-  __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t)));
+  __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":209
@@ -19422,7 +14953,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
  *                 raise ValueError(u"ndarray is not C contiguous")
  */
-  __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS);
+  __pyx_t_1 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":214
@@ -19432,7 +14963,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 raise ValueError(u"ndarray is not C contiguous")
  * 
  */
-    __pyx_t_2 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS));
+    __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS) != 0)) != 0);
     __pyx_t_3 = __pyx_t_2;
   } else {
     __pyx_t_3 = __pyx_t_1;
@@ -19446,7 +14977,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  * 
  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
  */
-    __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_9), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __Pyx_Raise(__pyx_t_4, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
@@ -19462,7 +14993,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
  *                 raise ValueError(u"ndarray is not Fortran contiguous")
  */
-  __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS);
+  __pyx_t_3 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0);
   if (__pyx_t_3) {
 
     /* "numpy.pxd":218
@@ -19472,7 +15003,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 raise ValueError(u"ndarray is not Fortran contiguous")
  * 
  */
-    __pyx_t_1 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS));
+    __pyx_t_1 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS) != 0)) != 0);
     __pyx_t_2 = __pyx_t_1;
   } else {
     __pyx_t_2 = __pyx_t_3;
@@ -19486,7 +15017,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  * 
  *             info.buf = PyArray_DATA(self)
  */
-    __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_11), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __Pyx_Raise(__pyx_t_4, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
@@ -19520,7 +15051,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 # Allocate new buffer for strides and shape info.
  *                 # This is allocated as one block, strides first.
  */
-  if (__pyx_v_copy_shape) {
+  __pyx_t_2 = (__pyx_v_copy_shape != 0);
+  if (__pyx_t_2) {
 
     /* "numpy.pxd":226
  *                 # Allocate new buffer for strides and shape info.
@@ -19618,7 +15150,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  * 
  *             cdef int t
  */
-  __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self));
+  __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0));
 
   /* "numpy.pxd":239
  * 
@@ -19657,9 +15189,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 # do not call releasebuffer
  *                 info.obj = None
  */
-  __pyx_t_2 = (!__pyx_v_hasfields);
+  __pyx_t_2 = ((!(__pyx_v_hasfields != 0)) != 0);
   if (__pyx_t_2) {
-    __pyx_t_3 = (!__pyx_v_copy_shape);
+    __pyx_t_3 = ((!(__pyx_v_copy_shape != 0)) != 0);
     __pyx_t_1 = __pyx_t_3;
   } else {
     __pyx_t_1 = __pyx_t_2;
@@ -19704,7 +15236,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 t = descr.type_num
  *                 if ((descr.byteorder == c'>' and little_endian) or
  */
-  __pyx_t_1 = (!__pyx_v_hasfields);
+  __pyx_t_1 = ((!(__pyx_v_hasfields != 0)) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":254
@@ -19724,9 +15256,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                     (descr.byteorder == c'<' and not little_endian)):
  *                     raise ValueError(u"Non-native byte order not supported")
  */
-    __pyx_t_1 = (__pyx_v_descr->byteorder == '>');
+    __pyx_t_1 = ((__pyx_v_descr->byteorder == '>') != 0);
     if (__pyx_t_1) {
-      __pyx_t_2 = __pyx_v_little_endian;
+      __pyx_t_2 = (__pyx_v_little_endian != 0);
     } else {
       __pyx_t_2 = __pyx_t_1;
     }
@@ -19739,9 +15271,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                     raise ValueError(u"Non-native byte order not supported")
  *                 if   t == NPY_BYTE:        f = "b"
  */
-      __pyx_t_1 = (__pyx_v_descr->byteorder == '<');
+      __pyx_t_1 = ((__pyx_v_descr->byteorder == '<') != 0);
       if (__pyx_t_1) {
-        __pyx_t_3 = (!__pyx_v_little_endian);
+        __pyx_t_3 = ((!(__pyx_v_little_endian != 0)) != 0);
         __pyx_t_7 = __pyx_t_3;
       } else {
         __pyx_t_7 = __pyx_t_1;
@@ -19759,7 +15291,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 if   t == NPY_BYTE:        f = "b"
  *                 elif t == NPY_UBYTE:       f = "B"
  */
-      __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_13), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_4);
       __Pyx_Raise(__pyx_t_4, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
@@ -19768,227 +15300,202 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
     }
     __pyx_L12:;
 
-    /* "numpy.pxd":258
+    /* "numpy.pxd":274
+ *                 elif t == NPY_CDOUBLE:     f = "Zd"
+ *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
+ *                 elif t == NPY_OBJECT:      f = "O"             # <<<<<<<<<<<<<<
+ *                 else:
+ *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
+ */
+    switch (__pyx_v_t) {
+
+      /* "numpy.pxd":258
  *                     (descr.byteorder == c'<' and not little_endian)):
  *                     raise ValueError(u"Non-native byte order not supported")
  *                 if   t == NPY_BYTE:        f = "b"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_UBYTE:       f = "B"
  *                 elif t == NPY_SHORT:       f = "h"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_BYTE);
-    if (__pyx_t_1) {
+      case NPY_BYTE:
       __pyx_v_f = __pyx_k__b;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":259
+      /* "numpy.pxd":259
  *                     raise ValueError(u"Non-native byte order not supported")
  *                 if   t == NPY_BYTE:        f = "b"
  *                 elif t == NPY_UBYTE:       f = "B"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_SHORT:       f = "h"
  *                 elif t == NPY_USHORT:      f = "H"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_UBYTE);
-    if (__pyx_t_1) {
+      case NPY_UBYTE:
       __pyx_v_f = __pyx_k__B;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":260
+      /* "numpy.pxd":260
  *                 if   t == NPY_BYTE:        f = "b"
  *                 elif t == NPY_UBYTE:       f = "B"
  *                 elif t == NPY_SHORT:       f = "h"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_USHORT:      f = "H"
  *                 elif t == NPY_INT:         f = "i"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_SHORT);
-    if (__pyx_t_1) {
+      case NPY_SHORT:
       __pyx_v_f = __pyx_k__h;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":261
+      /* "numpy.pxd":261
  *                 elif t == NPY_UBYTE:       f = "B"
  *                 elif t == NPY_SHORT:       f = "h"
  *                 elif t == NPY_USHORT:      f = "H"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_INT:         f = "i"
  *                 elif t == NPY_UINT:        f = "I"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_USHORT);
-    if (__pyx_t_1) {
+      case NPY_USHORT:
       __pyx_v_f = __pyx_k__H;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":262
+      /* "numpy.pxd":262
  *                 elif t == NPY_SHORT:       f = "h"
  *                 elif t == NPY_USHORT:      f = "H"
  *                 elif t == NPY_INT:         f = "i"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_UINT:        f = "I"
  *                 elif t == NPY_LONG:        f = "l"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_INT);
-    if (__pyx_t_1) {
+      case NPY_INT:
       __pyx_v_f = __pyx_k__i;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":263
+      /* "numpy.pxd":263
  *                 elif t == NPY_USHORT:      f = "H"
  *                 elif t == NPY_INT:         f = "i"
  *                 elif t == NPY_UINT:        f = "I"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_LONG:        f = "l"
  *                 elif t == NPY_ULONG:       f = "L"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_UINT);
-    if (__pyx_t_1) {
+      case NPY_UINT:
       __pyx_v_f = __pyx_k__I;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":264
+      /* "numpy.pxd":264
  *                 elif t == NPY_INT:         f = "i"
  *                 elif t == NPY_UINT:        f = "I"
  *                 elif t == NPY_LONG:        f = "l"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_ULONG:       f = "L"
  *                 elif t == NPY_LONGLONG:    f = "q"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_LONG);
-    if (__pyx_t_1) {
+      case NPY_LONG:
       __pyx_v_f = __pyx_k__l;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":265
+      /* "numpy.pxd":265
  *                 elif t == NPY_UINT:        f = "I"
  *                 elif t == NPY_LONG:        f = "l"
  *                 elif t == NPY_ULONG:       f = "L"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_LONGLONG:    f = "q"
  *                 elif t == NPY_ULONGLONG:   f = "Q"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_ULONG);
-    if (__pyx_t_1) {
+      case NPY_ULONG:
       __pyx_v_f = __pyx_k__L;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":266
+      /* "numpy.pxd":266
  *                 elif t == NPY_LONG:        f = "l"
  *                 elif t == NPY_ULONG:       f = "L"
  *                 elif t == NPY_LONGLONG:    f = "q"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_ULONGLONG:   f = "Q"
  *                 elif t == NPY_FLOAT:       f = "f"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG);
-    if (__pyx_t_1) {
+      case NPY_LONGLONG:
       __pyx_v_f = __pyx_k__q;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":267
+      /* "numpy.pxd":267
  *                 elif t == NPY_ULONG:       f = "L"
  *                 elif t == NPY_LONGLONG:    f = "q"
  *                 elif t == NPY_ULONGLONG:   f = "Q"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_FLOAT:       f = "f"
  *                 elif t == NPY_DOUBLE:      f = "d"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG);
-    if (__pyx_t_1) {
+      case NPY_ULONGLONG:
       __pyx_v_f = __pyx_k__Q;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":268
+      /* "numpy.pxd":268
  *                 elif t == NPY_LONGLONG:    f = "q"
  *                 elif t == NPY_ULONGLONG:   f = "Q"
  *                 elif t == NPY_FLOAT:       f = "f"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_DOUBLE:      f = "d"
  *                 elif t == NPY_LONGDOUBLE:  f = "g"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_FLOAT);
-    if (__pyx_t_1) {
+      case NPY_FLOAT:
       __pyx_v_f = __pyx_k__f;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":269
+      /* "numpy.pxd":269
  *                 elif t == NPY_ULONGLONG:   f = "Q"
  *                 elif t == NPY_FLOAT:       f = "f"
  *                 elif t == NPY_DOUBLE:      f = "d"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_LONGDOUBLE:  f = "g"
  *                 elif t == NPY_CFLOAT:      f = "Zf"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE);
-    if (__pyx_t_1) {
+      case NPY_DOUBLE:
       __pyx_v_f = __pyx_k__d;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":270
+      /* "numpy.pxd":270
  *                 elif t == NPY_FLOAT:       f = "f"
  *                 elif t == NPY_DOUBLE:      f = "d"
  *                 elif t == NPY_LONGDOUBLE:  f = "g"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_CFLOAT:      f = "Zf"
  *                 elif t == NPY_CDOUBLE:     f = "Zd"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE);
-    if (__pyx_t_1) {
+      case NPY_LONGDOUBLE:
       __pyx_v_f = __pyx_k__g;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":271
+      /* "numpy.pxd":271
  *                 elif t == NPY_DOUBLE:      f = "d"
  *                 elif t == NPY_LONGDOUBLE:  f = "g"
  *                 elif t == NPY_CFLOAT:      f = "Zf"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_CDOUBLE:     f = "Zd"
  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT);
-    if (__pyx_t_1) {
+      case NPY_CFLOAT:
       __pyx_v_f = __pyx_k__Zf;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":272
+      /* "numpy.pxd":272
  *                 elif t == NPY_LONGDOUBLE:  f = "g"
  *                 elif t == NPY_CFLOAT:      f = "Zf"
  *                 elif t == NPY_CDOUBLE:     f = "Zd"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
  *                 elif t == NPY_OBJECT:      f = "O"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE);
-    if (__pyx_t_1) {
+      case NPY_CDOUBLE:
       __pyx_v_f = __pyx_k__Zd;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":273
+      /* "numpy.pxd":273
  *                 elif t == NPY_CFLOAT:      f = "Zf"
  *                 elif t == NPY_CDOUBLE:     f = "Zd"
  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_OBJECT:      f = "O"
  *                 else:
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE);
-    if (__pyx_t_1) {
+      case NPY_CLONGDOUBLE:
       __pyx_v_f = __pyx_k__Zg;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":274
+      /* "numpy.pxd":274
  *                 elif t == NPY_CDOUBLE:     f = "Zd"
  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
  *                 elif t == NPY_OBJECT:      f = "O"             # <<<<<<<<<<<<<<
  *                 else:
  *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_OBJECT);
-    if (__pyx_t_1) {
+      case NPY_OBJECT:
       __pyx_v_f = __pyx_k__O;
-      goto __pyx_L13;
-    }
-    /*else*/ {
+      break;
+      default:
 
       /* "numpy.pxd":276
  *                 elif t == NPY_OBJECT:      f = "O"
@@ -19999,7 +15506,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  */
       __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_15), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_14), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_8));
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
       __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -20013,8 +15520,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
       {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      break;
     }
-    __pyx_L13:;
 
     /* "numpy.pxd":277
  *                 else:
@@ -20138,7 +15645,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s
  *                 stdlib.free(info.format)
  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
  */
-  __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self);
+  __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":290
@@ -20160,7 +15667,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s
  *                 stdlib.free(info.strides)
  *                 # info.shape was stored after info.strides in the same block
  */
-  __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t)));
+  __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":292
@@ -20465,8 +15972,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
     #else
     __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     #endif
-    __Pyx_XDECREF(__pyx_v_childname);
-    __pyx_v_childname = __pyx_t_3;
+    __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3);
     __pyx_t_3 = 0;
 
     /* "numpy.pxd":795
@@ -20479,8 +15985,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
     __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_XDECREF(((PyObject *)__pyx_v_fields));
-    __pyx_v_fields = ((PyObject*)__pyx_t_3);
+    __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3));
     __pyx_t_3 = 0;
 
     /* "numpy.pxd":796
@@ -20537,11 +16042,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
       __pyx_L6_unpacking_done:;
     }
     if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_XDECREF(((PyObject *)__pyx_v_child));
-    __pyx_v_child = ((PyArray_Descr *)__pyx_t_3);
+    __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3));
     __pyx_t_3 = 0;
-    __Pyx_XDECREF(__pyx_v_new_offset);
-    __pyx_v_new_offset = __pyx_t_4;
+    __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4);
     __pyx_t_4 = 0;
 
     /* "numpy.pxd":798
@@ -20575,7 +16078,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  * 
  *         if ((child.byteorder == c'>' and little_endian) or
  */
-      __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_17), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_16), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
       __Pyx_Raise(__pyx_t_5, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
@@ -20591,9 +16094,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  *             (child.byteorder == c'<' and not little_endian)):
  *             raise ValueError(u"Non-native byte order not supported")
  */
-    __pyx_t_7 = (__pyx_v_child->byteorder == '>');
+    __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0);
     if (__pyx_t_7) {
-      __pyx_t_8 = __pyx_v_little_endian;
+      __pyx_t_8 = (__pyx_v_little_endian != 0);
     } else {
       __pyx_t_8 = __pyx_t_7;
     }
@@ -20606,9 +16109,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  *             raise ValueError(u"Non-native byte order not supported")
  *             # One could encode it in the format string and have Cython
  */
-      __pyx_t_7 = (__pyx_v_child->byteorder == '<');
+      __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0);
       if (__pyx_t_7) {
-        __pyx_t_9 = (!__pyx_v_little_endian);
+        __pyx_t_9 = ((!(__pyx_v_little_endian != 0)) != 0);
         __pyx_t_10 = __pyx_t_9;
       } else {
         __pyx_t_10 = __pyx_t_7;
@@ -20626,7 +16129,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  *             # One could encode it in the format string and have Cython
  *             # complain instead, BUT: < and > in format strings also imply
  */
-      __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_18), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_17), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_5);
       __Pyx_Raise(__pyx_t_5, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
@@ -20697,7 +16200,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  *             t = child.type_num
  *             if end - f < 5:
  */
-    __pyx_t_7 = (!PyDataType_HASFIELDS(__pyx_v_child));
+    __pyx_t_7 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0);
     if (__pyx_t_7) {
 
       /* "numpy.pxd":821
@@ -20709,8 +16212,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  */
       __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
-      __Pyx_XDECREF(__pyx_v_t);
-      __pyx_v_t = __pyx_t_3;
+      __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_3);
       __pyx_t_3 = 0;
 
       /* "numpy.pxd":822
@@ -20720,7 +16222,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  *                 raise RuntimeError(u"Format string allocated too short.")
  * 
  */
-      __pyx_t_7 = ((__pyx_v_end - __pyx_v_f) < 5);
+      __pyx_t_7 = (((__pyx_v_end - __pyx_v_f) < 5) != 0);
       if (__pyx_t_7) {
 
         /* "numpy.pxd":823
@@ -20730,7 +16232,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  * 
  *             # Until ticket #99 is fixed, use integers to avoid warnings
  */
-        __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_20), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_19), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_3);
         __Pyx_Raise(__pyx_t_3, 0, 0, 0);
         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
@@ -21059,7 +16561,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  *             f += 1
  *         else:
  */
-        __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_15), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_14), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(((PyObject *)__pyx_t_5));
         __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_3);
@@ -21142,6 +16644,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a
   PyObject *__pyx_v_baseptr;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
+  int __pyx_t_2;
   __Pyx_RefNannySetupContext("set_array_base", 0);
 
   /* "numpy.pxd":967
@@ -21152,7 +16655,8 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a
  *      else:
  */
   __pyx_t_1 = (__pyx_v_base == Py_None);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
     /* "numpy.pxd":968
  *      cdef PyObject* baseptr
@@ -21228,7 +16732,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py
  *         return None
  *     else:
  */
-  __pyx_t_1 = (__pyx_v_arr->base == NULL);
+  __pyx_t_1 = ((__pyx_v_arr->base == NULL) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":977
@@ -21273,6 +16777,9 @@ static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, P
   PyObject *__pyx_v_format = 0;
   PyObject *__pyx_v_mode = 0;
   int __pyx_v_allocate_buffer;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
@@ -21409,7 +16916,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
   /* "View.MemoryView":120
  *         cdef PyObject **p
  * 
- *         self.ndim = len(shape)             # <<<<<<<<<<<<<<
+ *         self.ndim = <int> len(shape)             # <<<<<<<<<<<<<<
  *         self.itemsize = itemsize
  * 
  */
@@ -21418,11 +16925,11 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   __pyx_t_1 = PyTuple_GET_SIZE(((PyObject *)__pyx_v_shape)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_self->ndim = __pyx_t_1;
+  __pyx_v_self->ndim = ((int)__pyx_t_1);
 
   /* "View.MemoryView":121
  * 
- *         self.ndim = len(shape)
+ *         self.ndim = <int> len(shape)
  *         self.itemsize = itemsize             # <<<<<<<<<<<<<<
  * 
  *         if not self.ndim:
@@ -21436,7 +16943,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             raise ValueError("Empty shape tuple for cython.array")
  * 
  */
-  __pyx_t_2 = (!__pyx_v_self->ndim);
+  __pyx_t_2 = ((!(__pyx_v_self->ndim != 0)) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":124
@@ -21446,7 +16953,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  *         if self.itemsize <= 0:
  */
-    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_22), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_21), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
@@ -21462,7 +16969,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             raise ValueError("itemsize <= 0 for cython.array")
  * 
  */
-  __pyx_t_2 = (__pyx_v_self->itemsize <= 0);
+  __pyx_t_2 = ((__pyx_v_self->itemsize <= 0) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":127
@@ -21472,7 +16979,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  *         encode = getattr(format, 'encode', None)
  */
-    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_24), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_23), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
@@ -21510,10 +17017,9 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *         self._format = format
  *         self.format = self._format
  */
-    __pyx_t_3 = PyObject_Call(__pyx_v_encode, ((PyObject *)__pyx_k_tuple_25), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Call(__pyx_v_encode, ((PyObject *)__pyx_k_tuple_24), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_v_format);
-    __pyx_v_format = __pyx_t_3;
+    __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_3);
     __pyx_t_3 = 0;
     goto __pyx_L5;
   }
@@ -21540,7 +17046,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  *         self._shape = <Py_ssize_t *> malloc(sizeof(Py_ssize_t)*self.ndim)
  */
-  __pyx_t_4 = PyBytes_AsString(((PyObject *)__pyx_v_self->_format)); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyObject_AsString(((PyObject *)__pyx_v_self->_format)); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_v_self->format = __pyx_t_4;
 
   /* "View.MemoryView":135
@@ -21568,9 +17074,9 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             free(self._shape)
  *             free(self._strides)
  */
-  __pyx_t_2 = (!(__pyx_v_self->_shape != 0));
+  __pyx_t_2 = ((!(__pyx_v_self->_shape != 0)) != 0);
   if (!__pyx_t_2) {
-    __pyx_t_5 = (!(__pyx_v_self->_strides != 0));
+    __pyx_t_5 = ((!(__pyx_v_self->_strides != 0)) != 0);
     __pyx_t_6 = __pyx_t_5;
   } else {
     __pyx_t_6 = __pyx_t_2;
@@ -21602,7 +17108,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  * 
  */
-    __pyx_t_3 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_27), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_26), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
@@ -21636,8 +17142,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
     #else
     __pyx_t_8 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     #endif
-    __Pyx_XDECREF(__pyx_v_dim);
-    __pyx_v_dim = __pyx_t_8;
+    __Pyx_XDECREF_SET(__pyx_v_dim, __pyx_t_8);
     __pyx_t_8 = 0;
     __pyx_v_idx = __pyx_t_7;
     __pyx_t_7 = (__pyx_t_7 + 1);
@@ -21671,7 +17176,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
       PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_dim);
       __Pyx_GIVEREF(__pyx_v_dim);
       __pyx_t_8 = 0;
-      __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_28), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_27), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_8));
       __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
       __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -21731,7 +17236,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
     __pyx_t_5 = ((int)__pyx_t_6);
   }
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_6 = __pyx_t_5;
+  __pyx_t_6 = (__pyx_t_5 != 0);
   if (__pyx_t_6) {
 
     /* "View.MemoryView":153
@@ -21741,7 +17246,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  *         cdef char order
  */
-    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_29), __pyx_v_mode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_28), __pyx_v_mode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_3));
     __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_8);
@@ -21831,10 +17336,9 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *         self.mode = mode
  * 
  */
-    __pyx_t_3 = PyObject_Call(__pyx_v_decode, ((PyObject *)__pyx_k_tuple_30), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Call(__pyx_v_decode, ((PyObject *)__pyx_k_tuple_29), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_v_mode);
-    __pyx_v_mode = __pyx_t_3;
+    __Pyx_DECREF_SET(__pyx_v_mode, __pyx_t_3);
     __pyx_t_3 = 0;
     goto __pyx_L12;
   }
@@ -21882,7 +17386,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             self.data = <char *>malloc(self.len)
  *             if not self.data:
  */
-  if (__pyx_v_allocate_buffer) {
+  __pyx_t_6 = (__pyx_v_allocate_buffer != 0);
+  if (__pyx_t_6) {
 
     /* "View.MemoryView":172
  *         self.dtype_is_object = format == b'O'
@@ -21900,7 +17405,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *                 raise MemoryError("unable to allocate array data.")
  * 
  */
-    __pyx_t_6 = (!(__pyx_v_self->data != 0));
+    __pyx_t_6 = ((!(__pyx_v_self->data != 0)) != 0);
     if (__pyx_t_6) {
 
       /* "View.MemoryView":174
@@ -21910,7 +17415,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  *             if self.dtype_is_object:
  */
-      __pyx_t_3 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_32), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_31), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
@@ -21926,7 +17431,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *                 p = <PyObject **> self.data
  *                 for i in range(self.len / itemsize):
  */
-    if (__pyx_v_self->dtype_is_object) {
+    __pyx_t_6 = (__pyx_v_self->dtype_is_object != 0);
+    if (__pyx_t_6) {
 
       /* "View.MemoryView":177
  * 
@@ -21945,11 +17451,23 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *                     Py_INCREF(Py_None)
  */
       if (unlikely(__pyx_v_itemsize == 0)) {
+        #ifdef WITH_THREAD
+        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+        #endif
         PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero");
+        #ifdef WITH_THREAD
+        PyGILState_Release(__pyx_gilstate_save);
+        #endif
         {__pyx_filename = __pyx_f[2]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       }
       else if (sizeof(Py_ssize_t) == sizeof(long) && unlikely(__pyx_v_itemsize == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) {
+        #ifdef WITH_THREAD
+        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+        #endif
         PyErr_Format(PyExc_OverflowError, "value too large to perform division");
+        #ifdef WITH_THREAD
+        PyGILState_Release(__pyx_gilstate_save);
+        #endif
         {__pyx_filename = __pyx_f[2]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       }
       __pyx_t_1 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_itemsize);
@@ -22022,12 +17540,13 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
   int __pyx_v_bufmode;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
-  int __pyx_t_1;
-  PyObject *__pyx_t_2 = NULL;
-  char *__pyx_t_3;
-  Py_ssize_t __pyx_t_4;
-  int __pyx_t_5;
-  Py_ssize_t *__pyx_t_6;
+  int __pyx_t_1;
+  int __pyx_t_2;
+  PyObject *__pyx_t_3 = NULL;
+  char *__pyx_t_4;
+  Py_ssize_t __pyx_t_5;
+  int __pyx_t_6;
+  Py_ssize_t *__pyx_t_7;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -22054,7 +17573,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         elif self.mode == b"fortran":
  */
   __pyx_t_1 = (__Pyx_PyUnicode_Equals(((PyObject *)__pyx_v_self->mode), ((PyObject *)__pyx_n_b__c), Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":186
  *         cdef int bufmode = -1
@@ -22074,7 +17594,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
  *         if not (flags & bufmode):
  */
-  __pyx_t_1 = (__Pyx_PyUnicode_Equals(((PyObject *)__pyx_v_self->mode), ((PyObject *)__pyx_n_b__fortran), Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = (__Pyx_PyUnicode_Equals(((PyObject *)__pyx_v_self->mode), ((PyObject *)__pyx_n_b__fortran), Py_EQ)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = (__pyx_t_2 != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":188
@@ -22096,7 +17617,7 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
  *         info.buf = self.data
  */
-  __pyx_t_1 = (!(__pyx_v_flags & __pyx_v_bufmode));
+  __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":190
@@ -22106,10 +17627,10 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.buf = self.data
  *         info.len = self.len
  */
-    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_34), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_33), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L4;
   }
@@ -22122,8 +17643,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.len = self.len
  *         info.ndim = self.ndim
  */
-  __pyx_t_3 = __pyx_v_self->data;
-  __pyx_v_info->buf = __pyx_t_3;
+  __pyx_t_4 = __pyx_v_self->data;
+  __pyx_v_info->buf = __pyx_t_4;
 
   /* "View.MemoryView":192
  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
@@ -22132,8 +17653,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.ndim = self.ndim
  *         info.shape = self._shape
  */
-  __pyx_t_4 = __pyx_v_self->len;
-  __pyx_v_info->len = __pyx_t_4;
+  __pyx_t_5 = __pyx_v_self->len;
+  __pyx_v_info->len = __pyx_t_5;
 
   /* "View.MemoryView":193
  *         info.buf = self.data
@@ -22142,8 +17663,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.shape = self._shape
  *         info.strides = self._strides
  */
-  __pyx_t_5 = __pyx_v_self->ndim;
-  __pyx_v_info->ndim = __pyx_t_5;
+  __pyx_t_6 = __pyx_v_self->ndim;
+  __pyx_v_info->ndim = __pyx_t_6;
 
   /* "View.MemoryView":194
  *         info.len = self.len
@@ -22152,8 +17673,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.strides = self._strides
  *         info.suboffsets = NULL
  */
-  __pyx_t_6 = __pyx_v_self->_shape;
-  __pyx_v_info->shape = __pyx_t_6;
+  __pyx_t_7 = __pyx_v_self->_shape;
+  __pyx_v_info->shape = __pyx_t_7;
 
   /* "View.MemoryView":195
  *         info.ndim = self.ndim
@@ -22162,8 +17683,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.suboffsets = NULL
  *         info.itemsize = self.itemsize
  */
-  __pyx_t_6 = __pyx_v_self->_strides;
-  __pyx_v_info->strides = __pyx_t_6;
+  __pyx_t_7 = __pyx_v_self->_strides;
+  __pyx_v_info->strides = __pyx_t_7;
 
   /* "View.MemoryView":196
  *         info.shape = self._shape
@@ -22181,8 +17702,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.readonly = 0
  * 
  */
-  __pyx_t_4 = __pyx_v_self->itemsize;
-  __pyx_v_info->itemsize = __pyx_t_4;
+  __pyx_t_5 = __pyx_v_self->itemsize;
+  __pyx_v_info->itemsize = __pyx_t_5;
 
   /* "View.MemoryView":198
  *         info.suboffsets = NULL
@@ -22200,8 +17721,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *             info.format = self.format
  *         else:
  */
-  __pyx_t_5 = (__pyx_v_flags & PyBUF_FORMAT);
-  if (__pyx_t_5) {
+  __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
+  if (__pyx_t_1) {
 
     /* "View.MemoryView":201
  * 
@@ -22210,8 +17731,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         else:
  *             info.format = NULL
  */
-    __pyx_t_3 = __pyx_v_self->format;
-    __pyx_v_info->format = __pyx_t_3;
+    __pyx_t_4 = __pyx_v_self->format;
+    __pyx_v_info->format = __pyx_t_4;
     goto __pyx_L5;
   }
   /*else*/ {
@@ -22243,7 +17764,7 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
   __pyx_r = 0;
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_2);
+  __Pyx_XDECREF(__pyx_t_3);
   __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) {
@@ -22290,7 +17811,7 @@ static void __pyx_array_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *_
  *             self.callback_free_data(self.data)
  *         elif self.free_data:
  */
-  __pyx_t_1 = (__pyx_v_self->callback_free_data != NULL);
+  __pyx_t_1 = ((__pyx_v_self->callback_free_data != NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":211
@@ -22311,7 +17832,8 @@ static void __pyx_array_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *_
  *             if self.dtype_is_object:
  *                 refcount_objects_in_slice(self.data, self._shape,
  */
-  if (__pyx_v_self->free_data) {
+  __pyx_t_1 = (__pyx_v_self->free_data != 0);
+  if (__pyx_t_1) {
 
     /* "View.MemoryView":213
  *             self.callback_free_data(self.data)
@@ -22320,7 +17842,8 @@ static void __pyx_array_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *_
  *                 refcount_objects_in_slice(self.data, self._shape,
  *                                           self._strides, self.ndim, False)
  */
-    if (__pyx_v_self->dtype_is_object) {
+    __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
+    if (__pyx_t_1) {
 
       /* "View.MemoryView":215
  *             if self.dtype_is_object:
@@ -22488,9 +18011,9 @@ static PyObject *__pyx_array_MemoryView_5array_6__getattr__(struct __pyx_array_o
  *     def __getitem__(self, item):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __pyx_r = __pyx_t_2;
@@ -22547,7 +18070,7 @@ static PyObject *__pyx_array_MemoryView_5array_8__getitem__(struct __pyx_array_o
  *     def __setitem__(self, item, value):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (!__pyx_t_2) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
@@ -22604,7 +18127,7 @@ static int __pyx_array_MemoryView_5array_10__setitem__(struct __pyx_array_obj *_
  * 
  * 
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   if (PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -22649,7 +18172,7 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize
  *         result = array(shape, itemsize, format, mode.decode('ASCII'))
  *     else:
  */
-  __pyx_t_1 = (__pyx_v_buf == NULL);
+  __pyx_t_1 = ((__pyx_v_buf == NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":245
@@ -22661,7 +18184,7 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize
  */
     __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_3 = PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_3));
     __pyx_t_4 = ((PyObject *)__Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_4));
@@ -22697,7 +18220,7 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize
  */
     __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_5 = PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_5));
     __pyx_t_3 = ((PyObject *)__Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_3));
@@ -22779,6 +18302,9 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize
 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_name = 0;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
@@ -22935,7 +18461,7 @@ static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment)
  *         aligned_p += alignment - offset
  * 
  */
-  __pyx_t_1 = (__pyx_v_offset > 0);
+  __pyx_t_1 = ((__pyx_v_offset > 0) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":303
@@ -22971,6 +18497,9 @@ static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_ar
   PyObject *__pyx_v_obj = 0;
   int __pyx_v_flags;
   int __pyx_v_dtype_is_object;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
@@ -23088,11 +18617,11 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor
  *             if <PyObject *> self.view.obj == NULL:
  */
   __pyx_t_1 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)((PyObject *)__pyx_memoryview_type)));
-  if (!__pyx_t_1) {
+  if (!(__pyx_t_1 != 0)) {
     __pyx_t_2 = (__pyx_v_obj != Py_None);
-    __pyx_t_3 = __pyx_t_2;
+    __pyx_t_3 = (__pyx_t_2 != 0);
   } else {
-    __pyx_t_3 = __pyx_t_1;
+    __pyx_t_3 = (__pyx_t_1 != 0);
   }
   if (__pyx_t_3) {
 
@@ -23112,7 +18641,7 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor
  *                 (<__pyx_buffer *> &self.view).obj = Py_None
  *                 Py_INCREF(Py_None)
  */
-    __pyx_t_3 = (((PyObject *)__pyx_v_self->view.obj) == NULL);
+    __pyx_t_3 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0);
     if (__pyx_t_3) {
 
       /* "View.MemoryView":329
@@ -23155,7 +18684,7 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor
  *             raise MemoryError
  * 
  */
-  __pyx_t_3 = (__pyx_v_self->lock == NULL);
+  __pyx_t_3 = ((__pyx_v_self->lock == NULL) != 0);
   if (__pyx_t_3) {
 
     /* "View.MemoryView":334
@@ -23177,8 +18706,8 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor
  *             self.dtype_is_object = self.view.format == b'O'
  *         else:
  */
-  __pyx_t_4 = (__pyx_v_flags & PyBUF_FORMAT);
-  if (__pyx_t_4) {
+  __pyx_t_3 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
+  if (__pyx_t_3) {
 
     /* "View.MemoryView":337
  * 
@@ -23187,7 +18716,7 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor
  *         else:
  *             self.dtype_is_object = dtype_is_object
  */
-    __pyx_t_5 = PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_5));
     __pyx_t_6 = PyObject_RichCompare(((PyObject *)__pyx_t_5), ((PyObject *)__pyx_n_b__O), Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
@@ -23259,6 +18788,7 @@ static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) {
 static void __pyx_memoryview_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) {
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
+  int __pyx_t_2;
   __Pyx_RefNannySetupContext("__dealloc__", 0);
 
   /* "View.MemoryView":346
@@ -23269,7 +18799,8 @@ static void __pyx_memoryview_MemoryView_10memoryview_2__dealloc__(struct __pyx_m
  * 
  */
   __pyx_t_1 = (__pyx_v_self->obj != Py_None);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":347
  *     def __dealloc__(memoryview self):
@@ -23290,8 +18821,8 @@ static void __pyx_memoryview_MemoryView_10memoryview_2__dealloc__(struct __pyx_m
  *             PyThread_free_lock(self.lock)
  * 
  */
-  __pyx_t_1 = (__pyx_v_self->lock != NULL);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((__pyx_v_self->lock != NULL) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":350
  * 
@@ -23385,8 +18916,7 @@ static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__py
       }
       __Pyx_GOTREF(__pyx_t_5);
     }
-    __Pyx_XDECREF(__pyx_v_idx);
-    __pyx_v_idx = __pyx_t_5;
+    __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5);
     __pyx_t_5 = 0;
     __pyx_v_dim = __pyx_t_1;
     __pyx_t_1 = (__pyx_t_1 + 1);
@@ -23453,12 +18983,13 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
-  PyObject *__pyx_t_2 = NULL;
+  int __pyx_t_2;
   PyObject *__pyx_t_3 = NULL;
   PyObject *__pyx_t_4 = NULL;
   PyObject *__pyx_t_5 = NULL;
-  PyObject *(*__pyx_t_6)(PyObject *);
-  char *__pyx_t_7;
+  PyObject *__pyx_t_6 = NULL;
+  PyObject *(*__pyx_t_7)(PyObject *);
+  char *__pyx_t_8;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -23472,7 +19003,8 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  * 
  */
   __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":364
  *     def __getitem__(memoryview self, object index):
@@ -23496,10 +19028,10 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  * 
  *         cdef char *itemp
  */
-  __pyx_t_2 = ((PyObject *)_unellipsify(__pyx_v_index, __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  if (likely(PyTuple_CheckExact(__pyx_t_2))) {
-    PyObject* sequence = __pyx_t_2;
+  __pyx_t_3 = ((PyObject *)_unellipsify(__pyx_v_index, __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  if (likely(PyTuple_CheckExact(__pyx_t_3))) {
+    PyObject* sequence = __pyx_t_3;
     #if CYTHON_COMPILING_IN_CPYTHON
     Py_ssize_t size = Py_SIZE(sequence);
     #else
@@ -23511,45 +19043,45 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
       {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     #if CYTHON_COMPILING_IN_CPYTHON
-    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
-    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
-    __Pyx_INCREF(__pyx_t_3);
+    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
+    __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
     __Pyx_INCREF(__pyx_t_4);
+    __Pyx_INCREF(__pyx_t_5);
     #else
-    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
     #endif
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   } else if (1) {
     __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   } else
   {
     Py_ssize_t index = -1;
-    __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
-    index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L4_unpacking_failed;
-    __Pyx_GOTREF(__pyx_t_3);
-    index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed;
+    __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
+    index = 0; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed;
     __Pyx_GOTREF(__pyx_t_4);
-    if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_6 = NULL;
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L4_unpacking_failed;
+    __Pyx_GOTREF(__pyx_t_5);
+    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = NULL;
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
     goto __pyx_L5_unpacking_done;
     __pyx_L4_unpacking_failed:;
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_6 = NULL;
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __pyx_t_7 = NULL;
     if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_L5_unpacking_done:;
   }
-  __pyx_v_have_slices = __pyx_t_3;
-  __pyx_t_3 = 0;
-  __pyx_v_indices = __pyx_t_4;
+  __pyx_v_have_slices = __pyx_t_4;
   __pyx_t_4 = 0;
+  __pyx_v_indices = __pyx_t_5;
+  __pyx_t_5 = 0;
 
   /* "View.MemoryView":369
  * 
@@ -23558,8 +19090,8 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  *             return memview_slice(self, indices)
  *         else:
  */
-  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__pyx_t_1) {
+  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":370
  *         cdef char *itemp
@@ -23569,10 +19101,10 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  *             itemp = self.get_item_pointer(indices)
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_2 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_r = __pyx_t_2;
-    __pyx_t_2 = 0;
+    __pyx_t_3 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_r = __pyx_t_3;
+    __pyx_t_3 = 0;
     goto __pyx_L0;
     goto __pyx_L6;
   }
@@ -23585,8 +19117,8 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  *             return self.convert_item_to_object(itemp)
  * 
  */
-    __pyx_t_7 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_v_itemp = __pyx_t_7;
+    __pyx_t_8 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_8 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_v_itemp = __pyx_t_8;
 
     /* "View.MemoryView":373
  *         else:
@@ -23596,10 +19128,10 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  *     def __setitem__(memoryview self, object index, object value):
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_r = __pyx_t_2;
-    __pyx_t_2 = 0;
+    __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_r = __pyx_t_3;
+    __pyx_t_3 = 0;
     goto __pyx_L0;
   }
   __pyx_L6:;
@@ -23607,10 +19139,10 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_5);
+  __Pyx_XDECREF(__pyx_t_6);
   __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
@@ -23716,8 +19248,7 @@ static int __pyx_memoryview_MemoryView_10memoryview_6__setitem__(struct __pyx_me
   }
   __pyx_v_have_slices = __pyx_t_2;
   __pyx_t_2 = 0;
-  __Pyx_DECREF(__pyx_v_index);
-  __pyx_v_index = __pyx_t_3;
+  __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_3);
   __pyx_t_3 = 0;
 
   /* "View.MemoryView":378
@@ -23853,7 +19384,7 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
  *                 obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS,
  */
   __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, ((PyObject *)__pyx_memoryview_type)); 
-  __pyx_t_2 = (!__pyx_t_1);
+  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":389
@@ -23903,8 +19434,7 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
         __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject *)__pyx_memoryview_type)), ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
         __Pyx_GOTREF(__pyx_t_7);
         __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
-        __Pyx_DECREF(__pyx_v_obj);
-        __pyx_v_obj = __pyx_t_7;
+        __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7);
         __pyx_t_7 = 0;
       }
       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
@@ -24047,11 +19577,11 @@ static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryvi
  * 
  *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):
  */
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_src, __pyx_n_s__ndim); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s__ndim); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_dst, __pyx_n_s__ndim); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s__ndim); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -24122,7 +19652,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor
  *             tmp = malloc(self.view.itemsize)
  *             if tmp == NULL:
  */
-  __pyx_t_1 = (((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array)));
+  __pyx_t_1 = ((((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":414
@@ -24141,7 +19671,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor
  *                 raise MemoryError
  *             item = tmp
  */
-    __pyx_t_1 = (__pyx_v_tmp == NULL);
+    __pyx_t_1 = ((__pyx_v_tmp == NULL) != 0);
     if (__pyx_t_1) {
 
       /* "View.MemoryView":416
@@ -24186,7 +19716,8 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor
  *             (<PyObject **> item)[0] = <PyObject *> value
  *         else:
  */
-  if (__pyx_v_self->dtype_is_object) {
+  __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
+  if (__pyx_t_1) {
 
     /* "View.MemoryView":422
  * 
@@ -24296,7 +19827,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor
  *             assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
  *         slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
  */
-  __pyx_t_1 = (__pyx_v_self->view.suboffsets != NULL);
+  __pyx_t_1 = ((__pyx_v_self->view.suboffsets != NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":433
@@ -24445,7 +19976,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview
  *         try:
  *             result = struct.unpack(self.view.format, bytesitem)
  */
-  __pyx_t_1 = PyBytes_FromStringAndSize(((const char*)__pyx_v_itemp) + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __pyx_v_bytesitem = ((PyObject*)__pyx_t_1);
   __pyx_t_1 = 0;
@@ -24471,9 +20002,9 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview
  *         except struct.error:
  *             raise ValueError("Unable to convert item to object")
  */
-      __pyx_t_1 = PyObject_GetAttr(__pyx_v_struct, __pyx_n_s__unpack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s__unpack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_5 = PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_5));
       __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       __Pyx_GOTREF(__pyx_t_6);
@@ -24500,7 +20031,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview
  *             return result
  */
       __pyx_t_7 = strlen(__pyx_v_self->view.format); 
-      __pyx_t_8 = (__pyx_t_7 == 1);
+      __pyx_t_8 = ((__pyx_t_7 == 1) != 0);
       if (__pyx_t_8) {
 
         /* "View.MemoryView":455
@@ -24511,7 +20042,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview
  * 
  */
         __Pyx_XDECREF(__pyx_r);
-        __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_result, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
+        __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_result, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_5) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
         __Pyx_GOTREF(__pyx_t_5);
         __pyx_r = __pyx_t_5;
         __pyx_t_5 = 0;
@@ -24548,7 +20079,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview
  *             raise ValueError("Unable to convert item to object")
  *         else:
  */
-    __pyx_t_5 = PyObject_GetAttr(__pyx_v_struct, __pyx_n_s__error); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
+    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s__error); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __pyx_t_9 = PyErr_ExceptionMatches(__pyx_t_5);
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
@@ -24566,7 +20097,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview
  *         else:
  *             if len(self.view.format) == 1:
  */
-      __pyx_t_10 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_36), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
+      __pyx_t_10 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_35), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
       __Pyx_GOTREF(__pyx_t_10);
       __Pyx_Raise(__pyx_t_10, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
@@ -24631,15 +20162,16 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
   int __pyx_t_2;
-  PyObject *__pyx_t_3 = NULL;
+  int __pyx_t_3;
   PyObject *__pyx_t_4 = NULL;
   PyObject *__pyx_t_5 = NULL;
-  Py_ssize_t __pyx_t_6;
-  PyObject *__pyx_t_7 = NULL;
-  char *__pyx_t_8;
+  PyObject *__pyx_t_6 = NULL;
+  Py_ssize_t __pyx_t_7;
+  PyObject *__pyx_t_8 = NULL;
   char *__pyx_t_9;
   char *__pyx_t_10;
   char *__pyx_t_11;
+  char *__pyx_t_12;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -24665,7 +20197,8 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  *         else:
  */
   __pyx_t_2 = PyTuple_Check(__pyx_v_value); 
-  if (__pyx_t_2) {
+  __pyx_t_3 = (__pyx_t_2 != 0);
+  if (__pyx_t_3) {
 
     /* "View.MemoryView":467
  * 
@@ -24674,28 +20207,28 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  *         else:
  *             bytesvalue = struct.pack(self.view.format, value)
  */
-    __pyx_t_1 = PyObject_GetAttr(__pyx_v_struct, __pyx_n_s__pack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s__pack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_3 = PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
-    __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
-    __pyx_t_3 = 0;
-    __pyx_t_3 = PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-    __pyx_t_5 = PyNumber_Add(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+    __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4));
+    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
+    __pyx_t_4 = 0;
+    __pyx_t_4 = PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+    __pyx_t_6 = PyNumber_Add(((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
+    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-    __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
-    if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_v_bytesvalue = ((PyObject*)__pyx_t_3);
-    __pyx_t_3 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+    if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_4)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
+    __pyx_t_4 = 0;
     goto __pyx_L3;
   }
   /*else*/ {
@@ -24707,25 +20240,25 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  * 
  *         for i, c in enumerate(bytesvalue):
  */
-    __pyx_t_3 = PyObject_GetAttr(__pyx_v_struct, __pyx_n_s__pack); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_5 = PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s__pack); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
     __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_5));
-    __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
+    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_6));
+    __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
     __Pyx_INCREF(__pyx_v_value);
     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_value);
     __Pyx_GIVEREF(__pyx_v_value);
-    __pyx_t_5 = 0;
-    __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __pyx_t_6 = 0;
+    __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-    if (!(likely(PyBytes_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_5)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_v_bytesvalue = ((PyObject*)__pyx_t_5);
-    __pyx_t_5 = 0;
+    if (!(likely(PyBytes_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_6)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_v_bytesvalue = ((PyObject*)__pyx_t_6);
+    __pyx_t_6 = 0;
   }
   __pyx_L3:;
 
@@ -24736,18 +20269,18 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  *             itemp[i] = c
  * 
  */
-  __pyx_t_6 = 0;
+  __pyx_t_7 = 0;
   if (unlikely(((PyObject *)__pyx_v_bytesvalue) == Py_None)) {
     PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   __Pyx_INCREF(((PyObject *)__pyx_v_bytesvalue));
-  __pyx_t_7 = __pyx_v_bytesvalue;
-  __pyx_t_9 = PyBytes_AS_STRING(__pyx_t_7);
-  __pyx_t_10 = (__pyx_t_9 + PyBytes_GET_SIZE(__pyx_t_7));
-  for (__pyx_t_11 = __pyx_t_9; __pyx_t_11 < __pyx_t_10; __pyx_t_11++) {
-    __pyx_t_8 = __pyx_t_11;
-    __pyx_v_c = (__pyx_t_8[0]);
+  __pyx_t_8 = __pyx_v_bytesvalue;
+  __pyx_t_10 = PyBytes_AS_STRING(__pyx_t_8);
+  __pyx_t_11 = (__pyx_t_10 + PyBytes_GET_SIZE(__pyx_t_8));
+  for (__pyx_t_12 = __pyx_t_10; __pyx_t_12 < __pyx_t_11; __pyx_t_12++) {
+    __pyx_t_9 = __pyx_t_12;
+    __pyx_v_c = (__pyx_t_9[0]);
 
     /* "View.MemoryView":472
  * 
@@ -24756,7 +20289,7 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  * 
  *     @cname('getbuffer')
  */
-    __pyx_v_i = __pyx_t_6;
+    __pyx_v_i = __pyx_t_7;
 
     /* "View.MemoryView":471
  *             bytesvalue = struct.pack(self.view.format, value)
@@ -24765,7 +20298,7 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  *             itemp[i] = c
  * 
  */
-    __pyx_t_6 = (__pyx_t_6 + 1);
+    __pyx_t_7 = (__pyx_t_7 + 1);
 
     /* "View.MemoryView":472
  * 
@@ -24776,16 +20309,16 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  */
     (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c;
   }
-  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_5);
-  __Pyx_XDECREF(((PyObject *)__pyx_t_7));
+  __Pyx_XDECREF(__pyx_t_6);
+  __Pyx_XDECREF(((PyObject *)__pyx_t_8));
   __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
@@ -24822,7 +20355,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
   Py_ssize_t *__pyx_t_2;
   char *__pyx_t_3;
   void *__pyx_t_4;
-  Py_ssize_t __pyx_t_5;
+  int __pyx_t_5;
+  Py_ssize_t __pyx_t_6;
   __Pyx_RefNannySetupContext("__getbuffer__", 0);
   if (__pyx_v_info != NULL) {
     __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
@@ -24836,7 +20370,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *             info.shape = self.view.shape
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_flags & PyBUF_STRIDES);
+  __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":477
@@ -24870,7 +20404,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *             info.strides = self.view.strides
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_flags & PyBUF_STRIDES);
+  __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":482
@@ -24904,7 +20438,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *             info.suboffsets = self.view.suboffsets
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_flags & PyBUF_INDIRECT);
+  __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":487
@@ -24938,7 +20472,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *             info.format = self.view.format
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_flags & PyBUF_FORMAT);
+  __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":492
@@ -24982,8 +20516,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         info.itemsize = self.view.itemsize
  *         info.len = self.view.len
  */
-  __pyx_t_1 = __pyx_v_self->view.ndim;
-  __pyx_v_info->ndim = __pyx_t_1;
+  __pyx_t_5 = __pyx_v_self->view.ndim;
+  __pyx_v_info->ndim = __pyx_t_5;
 
   /* "View.MemoryView":498
  *         info.buf = self.view.buf
@@ -24992,8 +20526,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         info.len = self.view.len
  *         info.readonly = 0
  */
-  __pyx_t_5 = __pyx_v_self->view.itemsize;
-  __pyx_v_info->itemsize = __pyx_t_5;
+  __pyx_t_6 = __pyx_v_self->view.itemsize;
+  __pyx_v_info->itemsize = __pyx_t_6;
 
   /* "View.MemoryView":499
  *         info.ndim = self.view.ndim
@@ -25002,8 +20536,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         info.readonly = 0
  *         info.obj = self
  */
-  __pyx_t_5 = __pyx_v_self->view.len;
-  __pyx_v_info->len = __pyx_t_5;
+  __pyx_t_6 = __pyx_v_self->view.len;
+  __pyx_v_info->len = __pyx_t_6;
 
   /* "View.MemoryView":500
  *         info.itemsize = self.view.itemsize
@@ -25203,10 +20737,10 @@ static PyObject *__pyx_memoryview_get_shape_MemoryView_10memoryview_5shape___get
     __pyx_v_i = __pyx_t_3;
     __pyx_t_4 = PyInt_FromSsize_t((__pyx_v_self->view.shape[__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    if (unlikely(__Pyx_PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   }
-  __pyx_t_4 = ((PyObject *)PyList_AsTuple(__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = ((PyObject *)PyList_AsTuple(((PyObject*)__pyx_t_1))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_4));
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   __pyx_r = ((PyObject *)__pyx_t_4);
@@ -25266,7 +20800,7 @@ static PyObject *__pyx_memoryview_get_strides_MemoryView_10memoryview_7strides__
  * 
  *                 raise ValueError("Buffer view does not expose strides")
  */
-  __pyx_t_1 = (__pyx_v_self->view.strides == NULL);
+  __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":528
@@ -25276,7 +20810,7 @@ static PyObject *__pyx_memoryview_get_strides_MemoryView_10memoryview_7strides__
  * 
  *             return tuple([self.view.strides[i] for i in xrange(self.view.ndim)])
  */
-    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_38), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_37), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
@@ -25300,10 +20834,10 @@ static PyObject *__pyx_memoryview_get_strides_MemoryView_10memoryview_7strides__
     __pyx_v_i = __pyx_t_4;
     __pyx_t_5 = PyInt_FromSsize_t((__pyx_v_self->view.strides[__pyx_v_i])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    if (unlikely(__Pyx_PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
   }
-  __pyx_t_5 = ((PyObject *)PyList_AsTuple(__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = ((PyObject *)PyList_AsTuple(((PyObject*)__pyx_t_2))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_5));
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __pyx_r = ((PyObject *)__pyx_t_5);
@@ -25363,7 +20897,7 @@ static PyObject *__pyx_memoryview_get_suboffsets_MemoryView_10memoryview_10subof
  *                 return [-1] * self.view.ndim
  * 
  */
-  __pyx_t_1 = (__pyx_v_self->view.suboffsets == NULL);
+  __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":536
@@ -25405,10 +20939,10 @@ static PyObject *__pyx_memoryview_get_suboffsets_MemoryView_10memoryview_10subof
     __pyx_v_i = __pyx_t_4;
     __pyx_t_5 = PyInt_FromSsize_t((__pyx_v_self->view.suboffsets[__pyx_v_i])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    if (unlikely(__Pyx_PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
   }
-  __pyx_t_5 = ((PyObject *)PyList_AsTuple(__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = ((PyObject *)PyList_AsTuple(((PyObject*)__pyx_t_2))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_5));
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __pyx_r = ((PyObject *)__pyx_t_5);
@@ -25574,7 +21108,7 @@ static PyObject *__pyx_memoryview_get_nbytes_MemoryView_10memoryview_6nbytes___g
  *     property size:
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
@@ -25625,10 +21159,11 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
-  PyObject *__pyx_t_2 = NULL;
+  int __pyx_t_2;
   PyObject *__pyx_t_3 = NULL;
-  Py_ssize_t __pyx_t_4;
-  PyObject *(*__pyx_t_5)(PyObject *);
+  PyObject *__pyx_t_4 = NULL;
+  Py_ssize_t __pyx_t_5;
+  PyObject *(*__pyx_t_6)(PyObject *);
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -25642,7 +21177,8 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__
  * 
  */
   __pyx_t_1 = (__pyx_v_self->_size == Py_None);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":559
  *         def __get__(self):
@@ -25661,46 +21197,45 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__
  *                     result *= length
  * 
  */
-    __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
-      __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
-      __pyx_t_5 = NULL;
+    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) {
+      __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
+      __pyx_t_6 = NULL;
     } else {
-      __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext;
+      __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_4);
+      __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext;
     }
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     for (;;) {
-      if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_3)) {
-        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
+      if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_4)) {
+        if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
         #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         #else
-        __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         #endif
-      } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_3)) {
-        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
+      } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_4)) {
+        if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
         #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         #else
-        __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         #endif
       } else {
-        __pyx_t_2 = __pyx_t_5(__pyx_t_3);
-        if (unlikely(!__pyx_t_2)) {
+        __pyx_t_3 = __pyx_t_6(__pyx_t_4);
+        if (unlikely(!__pyx_t_3)) {
           if (PyErr_Occurred()) {
             if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
             else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           }
           break;
         }
-        __Pyx_GOTREF(__pyx_t_2);
+        __Pyx_GOTREF(__pyx_t_3);
       }
-      __Pyx_XDECREF(__pyx_v_length);
-      __pyx_v_length = __pyx_t_2;
-      __pyx_t_2 = 0;
+      __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_3);
+      __pyx_t_3 = 0;
 
       /* "View.MemoryView":562
  * 
@@ -25709,13 +21244,12 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__
  * 
  *                 self._size = result
  */
-      __pyx_t_2 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(__pyx_v_result);
-      __pyx_v_result = __pyx_t_2;
-      __pyx_t_2 = 0;
+      __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_3);
+      __pyx_t_3 = 0;
     }
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
     /* "View.MemoryView":564
  *                     result *= length
@@ -25748,8 +21282,8 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
+  __Pyx_XDECREF(__pyx_t_4);
   __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
@@ -25792,7 +21326,7 @@ static Py_ssize_t __pyx_memoryview_MemoryView_10memoryview_10__len__(struct __py
  *             return self.view.shape[0]
  * 
  */
-  __pyx_t_1 = (__pyx_v_self->view.ndim >= 1);
+  __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":570
@@ -25862,12 +21396,12 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_12__repr__(struct __py
  * 
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__base); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__base); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____name__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s____name__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
@@ -25894,7 +21428,7 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_12__repr__(struct __py
   __Pyx_GIVEREF(__pyx_t_3);
   __pyx_t_1 = 0;
   __pyx_t_3 = 0;
-  __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_39), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_38), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_3));
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __pyx_r = ((PyObject *)__pyx_t_3);
@@ -25952,12 +21486,12 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_14__str__(struct __pyx
  * 
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__base); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__base); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____name__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s____name__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -25965,7 +21499,7 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_14__str__(struct __pyx
   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
   __pyx_t_1 = 0;
-  __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_40), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_39), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __pyx_r = ((PyObject *)__pyx_t_1);
@@ -26373,12 +21907,12 @@ static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, in
 /* "View.MemoryView":624
  * 
  * @cname('__pyx_memoryview_check')
- * cdef bint memoryview_check(object o):             # <<<<<<<<<<<<<<
+ * cdef inline bint memoryview_check(object o):             # <<<<<<<<<<<<<<
  *     return isinstance(o, memoryview)
  * 
  */
 
-static int __pyx_memoryview_check(PyObject *__pyx_v_o) {
+static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
@@ -26386,7 +21920,7 @@ static int __pyx_memoryview_check(PyObject *__pyx_v_o) {
 
   /* "View.MemoryView":625
  * @cname('__pyx_memoryview_check')
- * cdef bint memoryview_check(object o):
+ * cdef inline bint memoryview_check(object o):
  *     return isinstance(o, memoryview)             # <<<<<<<<<<<<<<
  * 
  * cdef tuple _unellipsify(object index, int ndim):
@@ -26444,7 +21978,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *     else:
  */
   __pyx_t_1 = PyTuple_Check(__pyx_v_index); 
-  __pyx_t_2 = (!__pyx_t_1);
+  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":633
@@ -26553,12 +22087,10 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
       }
       __Pyx_GOTREF(__pyx_t_7);
     }
-    __Pyx_XDECREF(__pyx_v_item);
-    __pyx_v_item = __pyx_t_7;
+    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7);
     __pyx_t_7 = 0;
     __Pyx_INCREF(__pyx_t_3);
-    __Pyx_XDECREF(__pyx_v_idx);
-    __pyx_v_idx = __pyx_t_3;
+    __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3);
     __pyx_t_7 = PyNumber_Add(__pyx_t_3, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
     __Pyx_DECREF(__pyx_t_3);
@@ -26573,7 +22105,8 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
  */
     __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis);
-    if (__pyx_t_2) {
+    __pyx_t_1 = (__pyx_t_2 != 0);
+    if (__pyx_t_1) {
 
       /* "View.MemoryView":642
  *     for idx, item in enumerate(tup):
@@ -26582,8 +22115,8 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
  *                 seen_ellipsis = True
  */
-      __pyx_t_2 = (!__pyx_v_seen_ellipsis);
-      if (__pyx_t_2) {
+      __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0);
+      if (__pyx_t_1) {
 
         /* "View.MemoryView":643
  *         if item is Ellipsis:
@@ -26592,9 +22125,9 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *                 seen_ellipsis = True
  *             else:
  */
-        __pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_v_result), __pyx_n_s__extend); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_result), __pyx_n_s__extend); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_7);
-        __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_41), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_40), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_8);
         __pyx_t_9 = PyObject_Length(__pyx_v_tup); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __pyx_t_10 = PyList_New(1 * ((((__pyx_v_ndim - __pyx_t_9) + 1)<0) ? 0:((__pyx_v_ndim - __pyx_t_9) + 1))); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -26637,9 +22170,9 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *             have_slices = True
  *         else:
  */
-        __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_42), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_41), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_10);
-        __pyx_t_11 = PyList_Append(__pyx_v_result, __pyx_t_10); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_10); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
       }
       __pyx_L7:;
@@ -26653,8 +22186,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  */
       __pyx_t_10 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_10);
-      __Pyx_DECREF(__pyx_v_have_slices);
-      __pyx_v_have_slices = __pyx_t_10;
+      __Pyx_DECREF_SET(__pyx_v_have_slices, __pyx_t_10);
       __pyx_t_10 = 0;
       goto __pyx_L6;
     }
@@ -26667,13 +22199,13 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *                 raise TypeError("Cannot index with type '%s'" % type(item))
  * 
  */
-      __pyx_t_2 = PySlice_Check(__pyx_v_item); 
-      __pyx_t_1 = (!__pyx_t_2);
-      if (__pyx_t_1) {
-        __pyx_t_2 = (!__Pyx_PyIndex_Check(__pyx_v_item));
-        __pyx_t_12 = __pyx_t_2;
-      } else {
+      __pyx_t_1 = PySlice_Check(__pyx_v_item); 
+      __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
+      if (__pyx_t_2) {
+        __pyx_t_1 = ((!(__Pyx_PyIndex_Check(__pyx_v_item) != 0)) != 0);
         __pyx_t_12 = __pyx_t_1;
+      } else {
+        __pyx_t_12 = __pyx_t_2;
       }
       if (__pyx_t_12) {
 
@@ -26684,7 +22216,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  * 
  *             have_slices = have_slices or isinstance(item, slice)
  */
-        __pyx_t_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_43), ((PyObject *)Py_TYPE(__pyx_v_item))); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_42), ((PyObject *)Py_TYPE(__pyx_v_item))); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(((PyObject *)__pyx_t_10));
         __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_8);
@@ -26719,8 +22251,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
         __Pyx_INCREF(__pyx_v_have_slices);
         __pyx_t_8 = __pyx_v_have_slices;
       }
-      __Pyx_DECREF(__pyx_v_have_slices);
-      __pyx_v_have_slices = __pyx_t_8;
+      __Pyx_DECREF_SET(__pyx_v_have_slices, __pyx_t_8);
       __pyx_t_8 = 0;
 
       /* "View.MemoryView":653
@@ -26730,7 +22261,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  * 
  *     nslices = ndim - len(result)
  */
-      __pyx_t_11 = PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     __pyx_L6:;
   }
@@ -26767,9 +22298,9 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  * 
  *     return have_slices or nslices, tuple(result)
  */
-    __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_result), __pyx_n_s__extend); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_result), __pyx_n_s__extend); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_44), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_43), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_8);
@@ -26886,7 +22417,7 @@ static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __
  *             raise ValueError("Indirect dimensions not supported")
  * 
  */
-    __pyx_t_3 = ((__pyx_v_suboffsets[__pyx_v_i]) >= 0);
+    __pyx_t_3 = (((__pyx_v_suboffsets[__pyx_v_i]) >= 0) != 0);
     if (__pyx_t_3) {
 
       /* "View.MemoryView":665
@@ -26896,7 +22427,7 @@ static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __
  * 
  * 
  */
-      __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_46), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_45), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_4);
       __Pyx_Raise(__pyx_t_4, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
@@ -26946,16 +22477,17 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
   struct __pyx_memoryview_obj *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
-  struct __pyx_memoryview_obj *__pyx_t_2;
-  char *__pyx_t_3;
-  int __pyx_t_4;
-  PyObject *__pyx_t_5 = NULL;
-  Py_ssize_t __pyx_t_6;
-  PyObject *(*__pyx_t_7)(PyObject *);
-  PyObject *__pyx_t_8 = NULL;
-  int __pyx_t_9;
+  int __pyx_t_2;
+  struct __pyx_memoryview_obj *__pyx_t_3;
+  char *__pyx_t_4;
+  int __pyx_t_5;
+  PyObject *__pyx_t_6 = NULL;
+  Py_ssize_t __pyx_t_7;
+  PyObject *(*__pyx_t_8)(PyObject *);
+  PyObject *__pyx_t_9 = NULL;
   Py_ssize_t __pyx_t_10;
-  PyObject *__pyx_t_11 = NULL;
+  int __pyx_t_11;
+  PyObject *__pyx_t_12 = NULL;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -26988,7 +22520,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *     if isinstance(memview, _memoryviewslice):
  */
   #ifndef CYTHON_WITHOUT_ASSERTIONS
-  if (unlikely(!(__pyx_v_memview->view.ndim > 0))) {
+  if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) {
     PyErr_SetNone(PyExc_AssertionError);
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
@@ -27002,7 +22534,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *         p_src = &memviewsliceobj.from_slice
  */
   __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), ((PyObject *)__pyx_memoryviewslice_type)); 
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":687
  * 
@@ -27054,8 +22587,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *     dst.data = p_src.data
  * 
  */
-  __pyx_t_2 = __pyx_v_p_src->memview;
-  __pyx_v_dst.memview = __pyx_t_2;
+  __pyx_t_3 = __pyx_v_p_src->memview;
+  __pyx_v_dst.memview = __pyx_t_3;
 
   /* "View.MemoryView":698
  * 
@@ -27064,8 +22597,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  * 
  * 
  */
-  __pyx_t_3 = __pyx_v_p_src->data;
-  __pyx_v_dst.data = __pyx_t_3;
+  __pyx_t_4 = __pyx_v_p_src->data;
+  __pyx_v_dst.data = __pyx_t_4;
 
   /* "View.MemoryView":703
  * 
@@ -27092,46 +22625,45 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *         if PyIndex_Check(index):
  *             slice_memviewslice(
  */
-  __pyx_t_4 = 0;
+  __pyx_t_5 = 0;
   if (PyList_CheckExact(__pyx_v_indices) || PyTuple_CheckExact(__pyx_v_indices)) {
-    __pyx_t_5 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_5); __pyx_t_6 = 0;
-    __pyx_t_7 = NULL;
+    __pyx_t_6 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_6); __pyx_t_7 = 0;
+    __pyx_t_8 = NULL;
   } else {
-    __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext;
+    __pyx_t_7 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __pyx_t_8 = Py_TYPE(__pyx_t_6)->tp_iternext;
   }
   for (;;) {
-    if (!__pyx_t_7 && PyList_CheckExact(__pyx_t_5)) {
-      if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break;
+    if (!__pyx_t_8 && PyList_CheckExact(__pyx_t_6)) {
+      if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_6)) break;
       #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_8 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       #else
-      __pyx_t_8 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       #endif
-    } else if (!__pyx_t_7 && PyTuple_CheckExact(__pyx_t_5)) {
-      if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
+    } else if (!__pyx_t_8 && PyTuple_CheckExact(__pyx_t_6)) {
+      if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
       #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       #else
-      __pyx_t_8 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       #endif
     } else {
-      __pyx_t_8 = __pyx_t_7(__pyx_t_5);
-      if (unlikely(!__pyx_t_8)) {
+      __pyx_t_9 = __pyx_t_8(__pyx_t_6);
+      if (unlikely(!__pyx_t_9)) {
         if (PyErr_Occurred()) {
           if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
           else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         }
         break;
       }
-      __Pyx_GOTREF(__pyx_t_8);
+      __Pyx_GOTREF(__pyx_t_9);
     }
-    __Pyx_XDECREF(__pyx_v_index);
-    __pyx_v_index = __pyx_t_8;
-    __pyx_t_8 = 0;
-    __pyx_v_dim = __pyx_t_4;
-    __pyx_t_4 = (__pyx_t_4 + 1);
+    __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9);
+    __pyx_t_9 = 0;
+    __pyx_v_dim = __pyx_t_5;
+    __pyx_t_5 = (__pyx_t_5 + 1);
 
     /* "View.MemoryView":709
  * 
@@ -27140,8 +22672,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             slice_memviewslice(
  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
  */
-    __pyx_t_9 = __Pyx_PyIndex_Check(__pyx_v_index);
-    if (__pyx_t_9) {
+    __pyx_t_2 = (__Pyx_PyIndex_Check(__pyx_v_index) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":713
  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
@@ -27159,7 +22691,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *         elif index is None:
  *             p_dst.shape[new_ndim] = 1
  */
-      __pyx_t_9 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_10, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_10, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L6;
     }
 
@@ -27170,7 +22702,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             p_dst.shape[new_ndim] = 1
  *             p_dst.strides[new_ndim] = 0
  */
-    __pyx_t_1 = (__pyx_v_index == Py_None);
+    __pyx_t_2 = (__pyx_v_index == Py_None);
+    __pyx_t_1 = (__pyx_t_2 != 0);
     if (__pyx_t_1) {
 
       /* "View.MemoryView":717
@@ -27219,19 +22752,19 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             stop = index.stop or 0
  *             step = index.step or 0
  */
-      __pyx_t_8 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_8);
-      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
+      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       if (!__pyx_t_1) {
-        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
         __Pyx_INCREF(__pyx_int_0);
-        __pyx_t_11 = __pyx_int_0;
+        __pyx_t_12 = __pyx_int_0;
       } else {
-        __pyx_t_11 = __pyx_t_8;
-        __pyx_t_8 = 0;
+        __pyx_t_12 = __pyx_t_9;
+        __pyx_t_9 = 0;
       }
-      __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_11); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+      __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_12); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
       __pyx_v_start = __pyx_t_10;
 
       /* "View.MemoryView":723
@@ -27241,19 +22774,19 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             step = index.step or 0
  * 
  */
-      __pyx_t_11 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__stop); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_11);
-      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__stop); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_12);
+      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       if (!__pyx_t_1) {
-        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
         __Pyx_INCREF(__pyx_int_0);
-        __pyx_t_8 = __pyx_int_0;
+        __pyx_t_9 = __pyx_int_0;
       } else {
-        __pyx_t_8 = __pyx_t_11;
-        __pyx_t_11 = 0;
+        __pyx_t_9 = __pyx_t_12;
+        __pyx_t_12 = 0;
       }
-      __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+      __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
       __pyx_v_stop = __pyx_t_10;
 
       /* "View.MemoryView":724
@@ -27263,19 +22796,19 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  * 
  *             have_start = index.start is not None
  */
-      __pyx_t_8 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_8);
-      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
+      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       if (!__pyx_t_1) {
-        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
         __Pyx_INCREF(__pyx_int_0);
-        __pyx_t_11 = __pyx_int_0;
+        __pyx_t_12 = __pyx_int_0;
       } else {
-        __pyx_t_11 = __pyx_t_8;
-        __pyx_t_8 = 0;
+        __pyx_t_12 = __pyx_t_9;
+        __pyx_t_9 = 0;
       }
-      __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_11); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+      __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_12); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
       __pyx_v_step = __pyx_t_10;
 
       /* "View.MemoryView":726
@@ -27285,10 +22818,10 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             have_stop = index.stop is not None
  *             have_step = index.step is not None
  */
-      __pyx_t_11 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_11);
-      __pyx_t_1 = (__pyx_t_11 != Py_None);
-      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_12);
+      __pyx_t_1 = (__pyx_t_12 != Py_None);
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
       __pyx_v_have_start = __pyx_t_1;
 
       /* "View.MemoryView":727
@@ -27298,10 +22831,10 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             have_step = index.step is not None
  * 
  */
-      __pyx_t_11 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__stop); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_11);
-      __pyx_t_1 = (__pyx_t_11 != Py_None);
-      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__stop); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_12);
+      __pyx_t_1 = (__pyx_t_12 != Py_None);
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
       __pyx_v_have_stop = __pyx_t_1;
 
       /* "View.MemoryView":728
@@ -27311,10 +22844,10 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  * 
  *             slice_memviewslice(
  */
-      __pyx_t_11 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_11);
-      __pyx_t_1 = (__pyx_t_11 != Py_None);
-      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_12);
+      __pyx_t_1 = (__pyx_t_12 != Py_None);
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
       __pyx_v_have_step = __pyx_t_1;
 
       /* "View.MemoryView":735
@@ -27324,7 +22857,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             new_ndim += 1
  * 
  */
-      __pyx_t_9 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
       /* "View.MemoryView":736
  *                 have_start, have_stop, have_step,
@@ -27337,7 +22870,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
     }
     __pyx_L6:;
   }
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
 
   /* "View.MemoryView":738
  *             new_ndim += 1
@@ -27347,7 +22880,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *                                     memviewsliceobj.to_object_func,
  */
   __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), ((PyObject *)__pyx_memoryviewslice_type)); 
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":739
  * 
@@ -27374,11 +22908,11 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *     else:
  *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,
  */
-    __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_5);
-    __pyx_t_5 = 0;
+    __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_6);
+    __pyx_t_6 = 0;
     goto __pyx_L0;
     goto __pyx_L7;
   }
@@ -27400,11 +22934,11 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  * 
  * 
  */
-    __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_5);
-    __pyx_t_5 = 0;
+    __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_6);
+    __pyx_t_6 = 0;
     goto __pyx_L0;
   }
   __pyx_L7:;
@@ -27412,9 +22946,9 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
   __pyx_r = ((struct __pyx_memoryview_obj *)Py_None); __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_5);
-  __Pyx_XDECREF(__pyx_t_8);
-  __Pyx_XDECREF(__pyx_t_11);
+  __Pyx_XDECREF(__pyx_t_6);
+  __Pyx_XDECREF(__pyx_t_9);
+  __Pyx_XDECREF(__pyx_t_12);
   __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
@@ -27441,7 +22975,6 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
   int __pyx_t_2;
   int __pyx_t_3;
   int __pyx_t_4;
-  Py_ssize_t __pyx_t_5;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -27453,7 +22986,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  * 
  *         if start < 0:
  */
-  __pyx_t_1 = (!__pyx_v_is_slice);
+  __pyx_t_1 = ((!(__pyx_v_is_slice != 0)) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":791
@@ -27463,7 +22996,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             start += shape
  *         if not 0 <= start < shape:
  */
-    __pyx_t_1 = (__pyx_v_start < 0);
+    __pyx_t_1 = ((__pyx_v_start < 0) != 0);
     if (__pyx_t_1) {
 
       /* "View.MemoryView":792
@@ -27489,7 +23022,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
     if (__pyx_t_1) {
       __pyx_t_1 = (__pyx_v_start < __pyx_v_shape);
     }
-    __pyx_t_2 = (!__pyx_t_1);
+    __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":794
@@ -27499,7 +23032,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *     else:
  * 
  */
-      __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, __pyx_k_47, __pyx_v_dim); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, __pyx_k_46, __pyx_v_dim); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L5;
     }
     __pyx_L5:;
@@ -27530,11 +23063,11 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
  * 
  */
-    if (__pyx_v_have_step) {
+    if ((__pyx_v_have_step != 0)) {
       __pyx_t_4 = (__pyx_v_step == 0);
       __pyx_t_2 = __pyx_t_4;
     } else {
-      __pyx_t_2 = __pyx_v_have_step;
+      __pyx_t_2 = (__pyx_v_have_step != 0);
     }
     if (__pyx_t_2) {
 
@@ -27545,7 +23078,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  * 
  * 
  */
-      __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, __pyx_k_48, __pyx_v_dim); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, __pyx_k_47, __pyx_v_dim); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L6;
     }
     __pyx_L6:;
@@ -27557,7 +23090,8 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             if start < 0:
  *                 start += shape
  */
-    if (__pyx_v_have_start) {
+    __pyx_t_2 = (__pyx_v_have_start != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":804
  * 
@@ -27566,7 +23100,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 start += shape
  *                 if start < 0:
  */
-      __pyx_t_2 = (__pyx_v_start < 0);
+      __pyx_t_2 = ((__pyx_v_start < 0) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":805
@@ -27585,7 +23119,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                     start = 0
  *             elif start >= shape:
  */
-        __pyx_t_2 = (__pyx_v_start < 0);
+        __pyx_t_2 = ((__pyx_v_start < 0) != 0);
         if (__pyx_t_2) {
 
           /* "View.MemoryView":807
@@ -27609,7 +23143,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 if negative_step:
  *                     start = shape - 1
  */
-      __pyx_t_2 = (__pyx_v_start >= __pyx_v_shape);
+      __pyx_t_2 = ((__pyx_v_start >= __pyx_v_shape) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":809
@@ -27619,7 +23153,8 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                     start = shape - 1
  *                 else:
  */
-        if (__pyx_v_negative_step) {
+        __pyx_t_2 = (__pyx_v_negative_step != 0);
+        if (__pyx_t_2) {
 
           /* "View.MemoryView":810
  *             elif start >= shape:
@@ -27657,7 +23192,8 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 start = shape - 1
  *             else:
  */
-      if (__pyx_v_negative_step) {
+      __pyx_t_2 = (__pyx_v_negative_step != 0);
+      if (__pyx_t_2) {
 
         /* "View.MemoryView":815
  *         else:
@@ -27691,7 +23227,8 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             if stop < 0:
  *                 stop += shape
  */
-    if (__pyx_v_have_stop) {
+    __pyx_t_2 = (__pyx_v_have_stop != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":820
  * 
@@ -27700,7 +23237,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 stop += shape
  *                 if stop < 0:
  */
-      __pyx_t_2 = (__pyx_v_stop < 0);
+      __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":821
@@ -27719,7 +23256,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                     stop = 0
  *             elif stop > shape:
  */
-        __pyx_t_2 = (__pyx_v_stop < 0);
+        __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
         if (__pyx_t_2) {
 
           /* "View.MemoryView":823
@@ -27743,7 +23280,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 stop = shape
  *         else:
  */
-      __pyx_t_2 = (__pyx_v_stop > __pyx_v_shape);
+      __pyx_t_2 = ((__pyx_v_stop > __pyx_v_shape) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":825
@@ -27768,7 +23305,8 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 stop = -1
  *             else:
  */
-      if (__pyx_v_negative_step) {
+      __pyx_t_2 = (__pyx_v_negative_step != 0);
+      if (__pyx_t_2) {
 
         /* "View.MemoryView":828
  *         else:
@@ -27802,7 +23340,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             step = 1
  * 
  */
-    __pyx_t_2 = (!__pyx_v_have_step);
+    __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":833
@@ -27833,8 +23371,8 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 new_shape += 1
  * 
  */
-    __pyx_t_5 = ((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape));
-    if (__pyx_t_5) {
+    __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":840
  * 
@@ -27855,7 +23393,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             new_shape = 0
  * 
  */
-    __pyx_t_2 = (__pyx_v_new_shape < 0);
+    __pyx_t_2 = ((__pyx_v_new_shape < 0) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":843
@@ -27906,7 +23444,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *         dst.data += start * stride
  *     else:
  */
-  __pyx_t_2 = ((__pyx_v_suboffset_dim[0]) < 0);
+  __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":852
@@ -27940,7 +23478,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *         if not is_slice:
  *             if new_ndim == 0:
  */
-  __pyx_t_2 = (__pyx_v_suboffset >= 0);
+  __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":857
@@ -27950,7 +23488,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             if new_ndim == 0:
  *                 dst.data = (<char **> dst.data)[0] + suboffset
  */
-    __pyx_t_2 = (!__pyx_v_is_slice);
+    __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":858
@@ -27960,7 +23498,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 dst.data = (<char **> dst.data)[0] + suboffset
  *             else:
  */
-      __pyx_t_2 = (__pyx_v_new_ndim == 0);
+      __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":859
@@ -27982,7 +23520,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *         else:
  *             suboffset_dim[0] = new_ndim
  */
-        __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, __pyx_k_49, __pyx_v_dim); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, __pyx_k_48, __pyx_v_dim); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       }
       __pyx_L22:;
       goto __pyx_L21;
@@ -28034,11 +23572,11 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  * 
  * @cname('__pyx_pybuffer_index')
  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,             # <<<<<<<<<<<<<<
- *                           int dim) except NULL:
+ *                           Py_ssize_t dim) except NULL:
  *     cdef Py_ssize_t shape, stride, suboffset = -1
  */
 
-static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, int __pyx_v_dim) {
+static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) {
   Py_ssize_t __pyx_v_shape;
   Py_ssize_t __pyx_v_stride;
   Py_ssize_t __pyx_v_suboffset;
@@ -28057,7 +23595,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
 
   /* "View.MemoryView":874
  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,
- *                           int dim) except NULL:
+ *                           Py_ssize_t dim) except NULL:
  *     cdef Py_ssize_t shape, stride, suboffset = -1             # <<<<<<<<<<<<<<
  *     cdef Py_ssize_t itemsize = view.itemsize
  *     cdef char *resultp
@@ -28065,7 +23603,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
   __pyx_v_suboffset = -1;
 
   /* "View.MemoryView":875
- *                           int dim) except NULL:
+ *                           Py_ssize_t dim) except NULL:
  *     cdef Py_ssize_t shape, stride, suboffset = -1
  *     cdef Py_ssize_t itemsize = view.itemsize             # <<<<<<<<<<<<<<
  *     cdef char *resultp
@@ -28081,7 +23619,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *         shape = view.len / itemsize
  *         stride = itemsize
  */
-  __pyx_t_2 = (__pyx_v_view->ndim == 0);
+  __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":879
@@ -28092,11 +23630,23 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *     else:
  */
     if (unlikely(__pyx_v_itemsize == 0)) {
+      #ifdef WITH_THREAD
+      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+      #endif
       PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero");
+      #ifdef WITH_THREAD
+      PyGILState_Release(__pyx_gilstate_save);
+      #endif
       {__pyx_filename = __pyx_f[2]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     else if (sizeof(Py_ssize_t) == sizeof(long) && unlikely(__pyx_v_itemsize == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) {
+      #ifdef WITH_THREAD
+      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+      #endif
       PyErr_Format(PyExc_OverflowError, "value too large to perform division");
+      #ifdef WITH_THREAD
+      PyGILState_Release(__pyx_gilstate_save);
+      #endif
       {__pyx_filename = __pyx_f[2]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize);
@@ -28138,7 +23688,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *             suboffset = view.suboffsets[dim]
  * 
  */
-    __pyx_t_2 = (__pyx_v_view->suboffsets != NULL);
+    __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":885
@@ -28162,7 +23712,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *         index += view.shape[dim]
  *         if index < 0:
  */
-  __pyx_t_2 = (__pyx_v_index < 0);
+  __pyx_t_2 = ((__pyx_v_index < 0) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":888
@@ -28181,7 +23731,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
  * 
  */
-    __pyx_t_2 = (__pyx_v_index < 0);
+    __pyx_t_2 = ((__pyx_v_index < 0) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":890
@@ -28191,9 +23741,9 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  * 
  *     if index >= shape:
  */
-      __pyx_t_3 = PyInt_FromLong(__pyx_v_dim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_50), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_49), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_4));
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
       __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -28221,7 +23771,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
  * 
  */
-  __pyx_t_2 = (__pyx_v_index >= __pyx_v_shape);
+  __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":893
@@ -28231,9 +23781,9 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  * 
  *     resultp = bufp + index * stride
  */
-    __pyx_t_4 = PyInt_FromLong(__pyx_v_dim); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_50), __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_49), __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_3));
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -28267,7 +23817,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *         resultp = (<char **> resultp)[0] + suboffset
  * 
  */
-  __pyx_t_2 = (__pyx_v_suboffset >= 0);
+  __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":897
@@ -28413,9 +23963,9 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
  * 
  */
-    __pyx_t_6 = ((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0);
+    __pyx_t_6 = (((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0) != 0);
     if (!__pyx_t_6) {
-      __pyx_t_7 = ((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0);
+      __pyx_t_7 = (((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0) != 0);
       __pyx_t_8 = __pyx_t_7;
     } else {
       __pyx_t_8 = __pyx_t_6;
@@ -28429,7 +23979,7 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  * 
  *     return 1
  */
-      __pyx_t_9 = __pyx_memoryview_err(__pyx_builtin_ValueError, __pyx_k_51); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = __pyx_memoryview_err(__pyx_builtin_ValueError, __pyx_k_50); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L5;
     }
     __pyx_L5:;
@@ -28520,7 +24070,7 @@ static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memor
  *             return self.to_object_func(itemp)
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_self->to_object_func != NULL);
+  __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":943
@@ -28594,7 +24144,7 @@ static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memo
  *             self.to_dtype_func(itemp, value)
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_self->to_dtype_func != NULL);
+  __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":949
@@ -28710,7 +24260,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
  *         return None
  * 
  */
-  __pyx_t_1 = (((PyObject *)__pyx_v_memviewslice.memview) == Py_None);
+  __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":972
@@ -28779,7 +24329,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
  *     result.typeinfo = memviewslice.memview.typeinfo
  * 
  */
-  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s__base); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s__base); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_GIVEREF(__pyx_t_2);
   __Pyx_GOTREF(__pyx_v_result->from_object);
@@ -28967,6 +24517,7 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p
   __Pyx_memviewslice *__pyx_r;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
+  int __pyx_t_2;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -28980,7 +24531,8 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p
  *         return &obj.from_slice
  */
   __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), ((PyObject *)__pyx_memoryviewslice_type)); 
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":1011
  *     cdef _memoryviewslice obj
@@ -29142,7 +24694,7 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem
  *             dst.suboffsets[dim] = -1
  *         else:
  */
-    __pyx_t_4 = (__pyx_v_suboffsets == NULL);
+    __pyx_t_4 = ((__pyx_v_suboffsets == NULL) != 0);
     if (__pyx_t_4) {
 
       /* "View.MemoryView":1033
@@ -29239,9 +24791,10 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
-  PyObject *(*__pyx_t_2)(char *);
-  int (*__pyx_t_3)(char *, PyObject *);
-  PyObject *__pyx_t_4 = NULL;
+  int __pyx_t_2;
+  PyObject *(*__pyx_t_3)(char *);
+  int (*__pyx_t_4)(char *, PyObject *);
+  PyObject *__pyx_t_5 = NULL;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -29255,7 +24808,8 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview
  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
  */
   __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), ((PyObject *)__pyx_memoryviewslice_type)); 
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":1053
  * 
@@ -29264,8 +24818,8 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview
  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
  *     else:
  */
-    __pyx_t_2 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
-    __pyx_v_to_object_func = __pyx_t_2;
+    __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
+    __pyx_v_to_object_func = __pyx_t_3;
 
     /* "View.MemoryView":1054
  *     if isinstance(memview, _memoryviewslice):
@@ -29274,8 +24828,8 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview
  *     else:
  *         to_object_func = NULL
  */
-    __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
-    __pyx_v_to_dtype_func = __pyx_t_3;
+    __pyx_t_4 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
+    __pyx_v_to_dtype_func = __pyx_t_4;
     goto __pyx_L3;
   }
   /*else*/ {
@@ -29316,16 +24870,16 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview
  * 
  * 
  */
-  __pyx_t_4 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_r = __pyx_t_4;
-  __pyx_t_4 = 0;
+  __pyx_t_5 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
+  __pyx_r = __pyx_t_5;
+  __pyx_t_5 = 0;
   goto __pyx_L0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_4);
+  __Pyx_XDECREF(__pyx_t_5);
   __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
@@ -29353,7 +24907,7 @@ static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) {
  *         return -arg
  *     else:
  */
-  __pyx_t_1 = (__pyx_v_arg < 0);
+  __pyx_t_1 = ((__pyx_v_arg < 0) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":1069
@@ -29438,7 +24992,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _
  *             c_stride = mslice.strides[i]
  *             break
  */
-    __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1);
+    __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":1084
@@ -29482,7 +25036,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _
  *             f_stride = mslice.strides[i]
  *             break
  */
-    __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1);
+    __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":1089
@@ -29515,7 +25069,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _
  *         return 'C'
  *     else:
  */
-  __pyx_t_2 = (abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride));
+  __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":1093
@@ -29612,7 +25166,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v
  *        if (src_stride > 0 and dst_stride > 0 and
  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
  */
-  __pyx_t_1 = (__pyx_v_ndim == 1);
+  __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":1111
@@ -29622,9 +25176,9 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v
  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
  *            memcpy(dst_data, src_data, itemsize * dst_extent)
  */
-    __pyx_t_1 = (__pyx_v_src_stride > 0);
+    __pyx_t_1 = ((__pyx_v_src_stride > 0) != 0);
     if (__pyx_t_1) {
-      __pyx_t_2 = (__pyx_v_dst_stride > 0);
+      __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":1112
@@ -29638,7 +25192,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v
         if (__pyx_t_3) {
           __pyx_t_3 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride));
         }
-        __pyx_t_4 = __pyx_t_3;
+        __pyx_t_4 = (__pyx_t_3 != 0);
       } else {
         __pyx_t_4 = __pyx_t_2;
       }
@@ -29852,7 +25406,7 @@ static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_
  *         for idx in range(ndim):
  *             strides[idx] = stride
  */
-  __pyx_t_1 = (__pyx_v_order == 'F');
+  __pyx_t_1 = ((__pyx_v_order == 'F') != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":1156
@@ -29992,7 +25546,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *         _err(MemoryError, NULL)
  * 
  */
-  __pyx_t_2 = (!(__pyx_v_result != 0));
+  __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":1183
@@ -30083,7 +25637,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *             tmpslice.strides[i] = 0
  * 
  */
-    __pyx_t_2 = ((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1);
+    __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":1198
@@ -30106,7 +25660,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *         memcpy(result, src.data, size)
  *     else:
  */
-  __pyx_t_2 = __pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim);
+  __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":1201
@@ -30206,7 +25760,7 @@ static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent
   __pyx_t_1 = 0;
   __pyx_t_2 = 0;
   __pyx_t_3 = 0;
-  __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_52), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_51), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_3));
   __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
   __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -30335,7 +25889,7 @@ static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) {
  *         raise error(msg.decode('ascii'))
  *     else:
  */
-  __pyx_t_1 = (__pyx_v_msg != NULL);
+  __pyx_t_1 = ((__pyx_v_msg != NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":1222
@@ -30414,6 +25968,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
   int __pyx_t_4;
   int __pyx_t_5;
   void *__pyx_t_6;
+  int __pyx_t_7;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -30471,7 +26026,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *         broadcast_leading(&src, src_ndim, dst_ndim)
  *     elif dst_ndim < src_ndim:
  */
-  __pyx_t_2 = (__pyx_v_src_ndim < __pyx_v_dst_ndim);
+  __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":1244
@@ -30492,7 +26047,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *         broadcast_leading(&dst, dst_ndim, src_ndim)
  * 
  */
-  __pyx_t_2 = (__pyx_v_dst_ndim < __pyx_v_src_ndim);
+  __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":1246
@@ -30516,7 +26071,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  */
   __pyx_t_3 = __pyx_v_dst_ndim;
   __pyx_t_4 = __pyx_v_src_ndim;
-  if ((__pyx_t_3 > __pyx_t_4)) {
+  if (((__pyx_t_3 > __pyx_t_4) != 0)) {
     __pyx_t_5 = __pyx_t_3;
   } else {
     __pyx_t_5 = __pyx_t_4;
@@ -30541,7 +26096,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *             if src.shape[i] == 1:
  *                 broadcasting = True
  */
-    __pyx_t_2 = ((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i]));
+    __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":1252
@@ -30551,7 +26106,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *                 broadcasting = True
  *                 src.strides[i] = 0
  */
-      __pyx_t_2 = ((__pyx_v_src.shape[__pyx_v_i]) == 1);
+      __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":1253
@@ -30596,7 +26151,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *             _err_dim(ValueError, "Dimension %d is not direct", i)
  * 
  */
-    __pyx_t_2 = ((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0);
+    __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":1259
@@ -30606,7 +26161,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  *     if slices_overlap(&src, &dst, ndim, itemsize):
  */
-      __pyx_t_4 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, __pyx_k_53, __pyx_v_i); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, __pyx_k_52, __pyx_v_i); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L8;
     }
     __pyx_L8:;
@@ -30619,7 +26174,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  *         if not slice_is_contig(&src, order, ndim):
  */
-  __pyx_t_2 = __pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize);
+  __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":1263
@@ -30629,7 +26184,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *             order = get_best_order(&dst, ndim)
  * 
  */
-    __pyx_t_2 = (!__pyx_memviewslice_is_contig((&__pyx_v_src), __pyx_v_order, __pyx_v_ndim));
+    __pyx_t_2 = ((!(__pyx_memviewslice_is_contig((&__pyx_v_src), __pyx_v_order, __pyx_v_ndim) != 0)) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":1264
@@ -30673,7 +26228,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  * 
  */
-  __pyx_t_2 = (!__pyx_v_broadcasting);
+  __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":1272
@@ -30683,7 +26238,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *             direct_copy = slice_is_contig(&dst, 'C', ndim)
  *         elif slice_is_contig(&src, 'F', ndim):
  */
-    __pyx_t_2 = __pyx_memviewslice_is_contig((&__pyx_v_src), 'C', __pyx_v_ndim);
+    __pyx_t_2 = (__pyx_memviewslice_is_contig((&__pyx_v_src), 'C', __pyx_v_ndim) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":1273
@@ -30704,7 +26259,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *             direct_copy = slice_is_contig(&dst, 'F', ndim)
  * 
  */
-    __pyx_t_2 = __pyx_memviewslice_is_contig((&__pyx_v_src), 'F', __pyx_v_ndim);
+    __pyx_t_2 = (__pyx_memviewslice_is_contig((&__pyx_v_src), 'F', __pyx_v_ndim) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":1275
@@ -30726,7 +26281,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  *             refcount_copying(&dst, dtype_is_object, ndim, False)
  */
-    if (__pyx_v_direct_copy) {
+    __pyx_t_2 = (__pyx_v_direct_copy != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1279
  *         if direct_copy:
@@ -30782,7 +26338,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
   if (__pyx_t_2) {
     __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
   }
-  if (__pyx_t_2) {
+  __pyx_t_7 = (__pyx_t_2 != 0);
+  if (__pyx_t_7) {
 
     /* "View.MemoryView":1287
  * 
@@ -30979,6 +26536,7 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_slice
  */
 
 static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) {
+  int __pyx_t_1;
 
   /* "View.MemoryView":1324
  * 
@@ -30987,7 +26545,8 @@ static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, i
  *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,
  *                                            dst.strides, ndim, inc)
  */
-  if (__pyx_v_dtype_is_object) {
+  __pyx_t_1 = (__pyx_v_dtype_is_object != 0);
+  if (__pyx_t_1) {
 
     /* "View.MemoryView":1326
  *     if dtype_is_object:
@@ -31067,7 +26626,7 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss
  *             if inc:
  *                 Py_INCREF((<PyObject **> data)[0])
  */
-    __pyx_t_3 = (__pyx_v_ndim == 1);
+    __pyx_t_3 = ((__pyx_v_ndim == 1) != 0);
     if (__pyx_t_3) {
 
       /* "View.MemoryView":1341
@@ -31077,7 +26636,8 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss
  *                 Py_INCREF((<PyObject **> data)[0])
  *             else:
  */
-      if (__pyx_v_inc) {
+      __pyx_t_3 = (__pyx_v_inc != 0);
+      if (__pyx_t_3) {
 
         /* "View.MemoryView":1342
  *         if ndim == 1:
@@ -31209,7 +26769,7 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t
  *         for i in range(extent):
  *             memcpy(data, item, itemsize)
  */
-  __pyx_t_1 = (__pyx_v_ndim == 1);
+  __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":1373
@@ -31278,359 +26838,157 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t
   __pyx_L3:;
 
 }
+static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;
 
-static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
-  struct __pyx_array_obj *p;
-  PyObject *o = (*t->tp_alloc)(t, 0);
-  if (!o) return 0;
-  p = ((struct __pyx_array_obj *)o);
-  p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
-  p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
-  if (__pyx_array___cinit__(o, a, k) < 0) {
+static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
+  struct __pyx_memoryview_obj *p;
+  PyObject *o;
+  o = (*t->tp_alloc)(t, 0);
+  if (unlikely(!o)) return 0;
+  p = ((struct __pyx_memoryview_obj *)o);
+  p->__pyx_vtab = __pyx_vtabptr_memoryview;
+  p->obj = Py_None; Py_INCREF(Py_None);
+  p->_size = Py_None; Py_INCREF(Py_None);
+  p->_array_interface = Py_None; Py_INCREF(Py_None);
+  p->view.obj = NULL;
+  if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) {
     Py_DECREF(o); o = 0;
   }
   return o;
 }
 
-static void __pyx_tp_dealloc_array(PyObject *o) {
-  struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
+static void __pyx_tp_dealloc_memoryview(PyObject *o) {
+  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
   PyObject_GC_UnTrack(o);
   {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
     ++Py_REFCNT(o);
-    __pyx_array___dealloc__(o);
+    __pyx_memoryview___dealloc__(o);
     if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
     --Py_REFCNT(o);
     PyErr_Restore(etype, eval, etb);
   }
-  Py_CLEAR(p->mode);
-  Py_CLEAR(p->_format);
-  PyObject_GC_Track(o);
-  (*Py_TYPE(o)->tp_free)(o);
-}
-
-static int __pyx_tp_traverse_array(PyObject *o, visitproc v, void *a) {
-  int e;
-  struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
-  if (p->mode) {
-    e = (*v)(p->mode, a); if (e) return e;
-  }
-  if (p->_format) {
-    e = (*v)(p->_format, a); if (e) return e;
-  }
-  return 0;
-}
-
-static int __pyx_tp_clear_array(PyObject *o) {
-  struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
-  PyObject* tmp;
-  tmp = ((PyObject*)p->mode);
-  p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
-  Py_XDECREF(tmp);
-  tmp = ((PyObject*)p->_format);
-  p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
-  Py_XDECREF(tmp);
-  return 0;
-}
-static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
-  PyObject *r;
-  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
-  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
-  Py_DECREF(x);
-  return r;
-}
-
-static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) {
-  if (v) {
-    return __pyx_array___setitem__(o, i, v);
-  }
-  else {
-    PyErr_Format(PyExc_NotImplementedError,
-      "Subscript deletion not supported by %s", Py_TYPE(o)->tp_name);
-    return -1;
-  }
-}
-
-static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) {
-  PyObject *v = PyObject_GenericGetAttr(o, n);
-  if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
-    PyErr_Clear();
-    v = __pyx_array___getattr__(o, n);
-  }
-  return v;
-}
-
-static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) {
-  return get_memview(o);
-}
-
-static PyMethodDef __pyx_methods_array[] = {
-  {__Pyx_NAMESTR("__getattr__"), (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, __Pyx_DOCSTR(0)},
-  {0, 0, 0, 0}
-};
-
-static struct PyGetSetDef __pyx_getsets_array[] = {
-  {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, 0, 0},
-  {0, 0, 0, 0, 0}
-};
-
-static PyNumberMethods __pyx_tp_as_number_array = {
-  0, /*nb_add*/
-  0, /*nb_subtract*/
-  0, /*nb_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_divide*/
-  #endif
-  0, /*nb_remainder*/
-  0, /*nb_divmod*/
-  0, /*nb_power*/
-  0, /*nb_negative*/
-  0, /*nb_positive*/
-  0, /*nb_absolute*/
-  0, /*nb_nonzero*/
-  0, /*nb_invert*/
-  0, /*nb_lshift*/
-  0, /*nb_rshift*/
-  0, /*nb_and*/
-  0, /*nb_xor*/
-  0, /*nb_or*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_coerce*/
-  #endif
-  0, /*nb_int*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_long*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*nb_float*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_oct*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_hex*/
-  #endif
-  0, /*nb_inplace_add*/
-  0, /*nb_inplace_subtract*/
-  0, /*nb_inplace_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_inplace_divide*/
-  #endif
-  0, /*nb_inplace_remainder*/
-  0, /*nb_inplace_power*/
-  0, /*nb_inplace_lshift*/
-  0, /*nb_inplace_rshift*/
-  0, /*nb_inplace_and*/
-  0, /*nb_inplace_xor*/
-  0, /*nb_inplace_or*/
-  0, /*nb_floor_divide*/
-  0, /*nb_true_divide*/
-  0, /*nb_inplace_floor_divide*/
-  0, /*nb_inplace_true_divide*/
-  #if PY_VERSION_HEX >= 0x02050000
-  0, /*nb_index*/
-  #endif
-};
-
-static PySequenceMethods __pyx_tp_as_sequence_array = {
-  0, /*sq_length*/
-  0, /*sq_concat*/
-  0, /*sq_repeat*/
-  __pyx_sq_item_array, /*sq_item*/
-  0, /*sq_slice*/
-  0, /*sq_ass_item*/
-  0, /*sq_ass_slice*/
-  0, /*sq_contains*/
-  0, /*sq_inplace_concat*/
-  0, /*sq_inplace_repeat*/
-};
-
-static PyMappingMethods __pyx_tp_as_mapping_array = {
-  0, /*mp_length*/
-  __pyx_array___getitem__, /*mp_subscript*/
-  __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/
-};
-
-static PyBufferProcs __pyx_tp_as_buffer_array = {
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getreadbuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getwritebuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getsegcount*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getcharbuffer*/
-  #endif
-  #if PY_VERSION_HEX >= 0x02060000
-  __pyx_array_getbuffer, /*bf_getbuffer*/
-  #endif
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_releasebuffer*/
-  #endif
-};
-
-static PyTypeObject __pyx_type___pyx_array = {
-  PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("splitBBoxLUT.array"), /*tp_name*/
-  sizeof(struct __pyx_array_obj), /*tp_basicsize*/
-  0, /*tp_itemsize*/
-  __pyx_tp_dealloc_array, /*tp_dealloc*/
-  0, /*tp_print*/
-  0, /*tp_getattr*/
-  0, /*tp_setattr*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*tp_compare*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*tp_repr*/
-  &__pyx_tp_as_number_array, /*tp_as_number*/
-  &__pyx_tp_as_sequence_array, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping_array, /*tp_as_mapping*/
-  0, /*tp_hash*/
-  0, /*tp_call*/
-  0, /*tp_str*/
-  __pyx_tp_getattro_array, /*tp_getattro*/
-  0, /*tp_setattro*/
-  &__pyx_tp_as_buffer_array, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
-  0, /*tp_doc*/
-  __pyx_tp_traverse_array, /*tp_traverse*/
-  __pyx_tp_clear_array, /*tp_clear*/
-  0, /*tp_richcompare*/
-  0, /*tp_weaklistoffset*/
-  0, /*tp_iter*/
-  0, /*tp_iternext*/
-  __pyx_methods_array, /*tp_methods*/
-  0, /*tp_members*/
-  __pyx_getsets_array, /*tp_getset*/
-  0, /*tp_base*/
-  0, /*tp_dict*/
-  0, /*tp_descr_get*/
-  0, /*tp_descr_set*/
-  0, /*tp_dictoffset*/
-  0, /*tp_init*/
-  0, /*tp_alloc*/
-  __pyx_tp_new_array, /*tp_new*/
-  0, /*tp_free*/
-  0, /*tp_is_gc*/
-  0, /*tp_bases*/
-  0, /*tp_mro*/
-  0, /*tp_cache*/
-  0, /*tp_subclasses*/
-  0, /*tp_weaklist*/
-  0, /*tp_del*/
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*tp_version_tag*/
-  #endif
-};
-
-static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
-  struct __pyx_MemviewEnum_obj *p;
-  PyObject *o = (*t->tp_alloc)(t, 0);
-  if (!o) return 0;
-  p = ((struct __pyx_MemviewEnum_obj *)o);
-  p->name = Py_None; Py_INCREF(Py_None);
-  return o;
-}
-
-static void __pyx_tp_dealloc_Enum(PyObject *o) {
-  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
-  PyObject_GC_UnTrack(o);
-  Py_CLEAR(p->name);
-  PyObject_GC_Track(o);
+  Py_CLEAR(p->obj);
+  Py_CLEAR(p->_size);
+  Py_CLEAR(p->_array_interface);
   (*Py_TYPE(o)->tp_free)(o);
 }
 
-static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) {
   int e;
-  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
-  if (p->name) {
-    e = (*v)(p->name, a); if (e) return e;
+  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
+  if (p->obj) {
+    e = (*v)(p->obj, a); if (e) return e;
+  }
+  if (p->_size) {
+    e = (*v)(p->_size, a); if (e) return e;
+  }
+  if (p->_array_interface) {
+    e = (*v)(p->_array_interface, a); if (e) return e;
+  }
+  if (p->view.obj) {
+    e = (*v)(p->view.obj, a); if (e) return e;
   }
   return 0;
 }
 
-static int __pyx_tp_clear_Enum(PyObject *o) {
-  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
+static int __pyx_tp_clear_memoryview(PyObject *o) {
+  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
   PyObject* tmp;
-  tmp = ((PyObject*)p->name);
-  p->name = Py_None; Py_INCREF(Py_None);
+  tmp = ((PyObject*)p->obj);
+  p->obj = Py_None; Py_INCREF(Py_None);
   Py_XDECREF(tmp);
+  tmp = ((PyObject*)p->_size);
+  p->_size = Py_None; Py_INCREF(Py_None);
+  Py_XDECREF(tmp);
+  tmp = ((PyObject*)p->_array_interface);
+  p->_array_interface = Py_None; Py_INCREF(Py_None);
+  Py_XDECREF(tmp);
+  Py_CLEAR(p->view.obj);
   return 0;
 }
+static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
+  PyObject *r;
+  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
+  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
+  Py_DECREF(x);
+  return r;
+}
 
-static PyMethodDef __pyx_methods_Enum[] = {
+static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) {
+  if (v) {
+    return __pyx_memoryview___setitem__(o, i, v);
+  }
+  else {
+    PyErr_Format(PyExc_NotImplementedError,
+      "Subscript deletion not supported by %s", Py_TYPE(o)->tp_name);
+    return -1;
+  }
+}
+
+static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_transpose(o);
+}
+
+static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview__get__base(o);
+}
+
+static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_shape(o);
+}
+
+static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_strides(o);
+}
+
+static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_suboffsets(o);
+}
+
+static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_ndim(o);
+}
+
+static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_itemsize(o);
+}
+
+static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_nbytes(o);
+}
+
+static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_size(o);
+}
+
+static PyMethodDef __pyx_methods_memoryview[] = {
+  {__Pyx_NAMESTR("is_c_contig"), (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, __Pyx_DOCSTR(0)},
+  {__Pyx_NAMESTR("is_f_contig"), (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, __Pyx_DOCSTR(0)},
+  {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, __Pyx_DOCSTR(0)},
+  {__Pyx_NAMESTR("copy_fortran"), (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, __Pyx_DOCSTR(0)},
   {0, 0, 0, 0}
 };
 
-static PyNumberMethods __pyx_tp_as_number_Enum = {
-  0, /*nb_add*/
-  0, /*nb_subtract*/
-  0, /*nb_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_divide*/
-  #endif
-  0, /*nb_remainder*/
-  0, /*nb_divmod*/
-  0, /*nb_power*/
-  0, /*nb_negative*/
-  0, /*nb_positive*/
-  0, /*nb_absolute*/
-  0, /*nb_nonzero*/
-  0, /*nb_invert*/
-  0, /*nb_lshift*/
-  0, /*nb_rshift*/
-  0, /*nb_and*/
-  0, /*nb_xor*/
-  0, /*nb_or*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_coerce*/
-  #endif
-  0, /*nb_int*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_long*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*nb_float*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_oct*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_hex*/
-  #endif
-  0, /*nb_inplace_add*/
-  0, /*nb_inplace_subtract*/
-  0, /*nb_inplace_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_inplace_divide*/
-  #endif
-  0, /*nb_inplace_remainder*/
-  0, /*nb_inplace_power*/
-  0, /*nb_inplace_lshift*/
-  0, /*nb_inplace_rshift*/
-  0, /*nb_inplace_and*/
-  0, /*nb_inplace_xor*/
-  0, /*nb_inplace_or*/
-  0, /*nb_floor_divide*/
-  0, /*nb_true_divide*/
-  0, /*nb_inplace_floor_divide*/
-  0, /*nb_inplace_true_divide*/
-  #if PY_VERSION_HEX >= 0x02050000
-  0, /*nb_index*/
-  #endif
+static struct PyGetSetDef __pyx_getsets_memoryview[] = {
+  {(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, 0, 0},
+  {(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, 0, 0},
+  {(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, 0, 0},
+  {(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, 0, 0},
+  {(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, 0, 0},
+  {(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, 0, 0},
+  {(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, 0, 0},
+  {(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, 0, 0},
+  {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, 0, 0},
+  {0, 0, 0, 0, 0}
 };
 
-static PySequenceMethods __pyx_tp_as_sequence_Enum = {
-  0, /*sq_length*/
+static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
+  __pyx_memoryview___len__, /*sq_length*/
   0, /*sq_concat*/
   0, /*sq_repeat*/
-  0, /*sq_item*/
+  __pyx_sq_item_memoryview, /*sq_item*/
   0, /*sq_slice*/
   0, /*sq_ass_item*/
   0, /*sq_ass_slice*/
@@ -31639,13 +26997,13 @@ static PySequenceMethods __pyx_tp_as_sequence_Enum = {
   0, /*sq_inplace_repeat*/
 };
 
-static PyMappingMethods __pyx_tp_as_mapping_Enum = {
-  0, /*mp_length*/
-  0, /*mp_subscript*/
-  0, /*mp_ass_subscript*/
+static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
+  __pyx_memoryview___len__, /*mp_length*/
+  __pyx_memoryview___getitem__, /*mp_subscript*/
+  __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/
 };
 
-static PyBufferProcs __pyx_tp_as_buffer_Enum = {
+static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
   #if PY_MAJOR_VERSION < 3
   0, /*bf_getreadbuffer*/
   #endif
@@ -31659,19 +27017,19 @@ static PyBufferProcs __pyx_tp_as_buffer_Enum = {
   0, /*bf_getcharbuffer*/
   #endif
   #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_getbuffer*/
+  __pyx_memoryview_getbuffer, /*bf_getbuffer*/
   #endif
   #if PY_VERSION_HEX >= 0x02060000
   0, /*bf_releasebuffer*/
   #endif
 };
 
-static PyTypeObject __pyx_type___pyx_MemviewEnum = {
+static PyTypeObject __pyx_type___pyx_memoryview = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("splitBBoxLUT.Enum"), /*tp_name*/
-  sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/
+  __Pyx_NAMESTR("splitBBoxLUT.memoryview"), /*tp_name*/
+  sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_Enum, /*tp_dealloc*/
+  __pyx_tp_dealloc_memoryview, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -31680,35 +27038,35 @@ static PyTypeObject __pyx_type___pyx_MemviewEnum = {
   #else
   0, /*reserved*/
   #endif
-  __pyx_MemviewEnum___repr__, /*tp_repr*/
-  &__pyx_tp_as_number_Enum, /*tp_as_number*/
-  &__pyx_tp_as_sequence_Enum, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping_Enum, /*tp_as_mapping*/
+  __pyx_memoryview___repr__, /*tp_repr*/
+  0, /*tp_as_number*/
+  &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/
+  &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/
   0, /*tp_hash*/
   0, /*tp_call*/
-  0, /*tp_str*/
+  __pyx_memoryview___str__, /*tp_str*/
   0, /*tp_getattro*/
   0, /*tp_setattro*/
-  &__pyx_tp_as_buffer_Enum, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+  &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
   0, /*tp_doc*/
-  __pyx_tp_traverse_Enum, /*tp_traverse*/
-  __pyx_tp_clear_Enum, /*tp_clear*/
+  __pyx_tp_traverse_memoryview, /*tp_traverse*/
+  __pyx_tp_clear_memoryview, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
   0, /*tp_iter*/
   0, /*tp_iternext*/
-  __pyx_methods_Enum, /*tp_methods*/
+  __pyx_methods_memoryview, /*tp_methods*/
   0, /*tp_members*/
-  0, /*tp_getset*/
+  __pyx_getsets_memoryview, /*tp_getset*/
   0, /*tp_base*/
   0, /*tp_dict*/
   0, /*tp_descr_get*/
   0, /*tp_descr_set*/
   0, /*tp_dictoffset*/
-  __pyx_MemviewEnum___init__, /*tp_init*/
+  0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_Enum, /*tp_new*/
+  __pyx_tp_new_memoryview, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -31720,216 +27078,112 @@ static PyTypeObject __pyx_type___pyx_MemviewEnum = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
-static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;
 
-static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
-  struct __pyx_memoryview_obj *p;
-  PyObject *o = (*t->tp_alloc)(t, 0);
-  if (!o) return 0;
-  p = ((struct __pyx_memoryview_obj *)o);
-  p->__pyx_vtab = __pyx_vtabptr_memoryview;
-  p->obj = Py_None; Py_INCREF(Py_None);
-  p->_size = Py_None; Py_INCREF(Py_None);
-  p->_array_interface = Py_None; Py_INCREF(Py_None);
-  p->view.obj = NULL;
-  if (__pyx_memoryview___cinit__(o, a, k) < 0) {
+static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
+  struct __pyx_array_obj *p;
+  PyObject *o;
+  o = (*t->tp_alloc)(t, 0);
+  if (unlikely(!o)) return 0;
+  p = ((struct __pyx_array_obj *)o);
+  p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
+  p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
+  if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) {
     Py_DECREF(o); o = 0;
   }
   return o;
 }
 
-static void __pyx_tp_dealloc_memoryview(PyObject *o) {
-  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
+static void __pyx_tp_dealloc_array(PyObject *o) {
+  struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
   PyObject_GC_UnTrack(o);
   {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
     ++Py_REFCNT(o);
-    __pyx_memoryview___dealloc__(o);
+    __pyx_array___dealloc__(o);
     if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
     --Py_REFCNT(o);
     PyErr_Restore(etype, eval, etb);
   }
-  Py_CLEAR(p->obj);
-  Py_CLEAR(p->_size);
-  Py_CLEAR(p->_array_interface);
-  PyObject_GC_Track(o);
+  Py_CLEAR(p->mode);
+  Py_CLEAR(p->_format);
   (*Py_TYPE(o)->tp_free)(o);
 }
 
-static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_array(PyObject *o, visitproc v, void *a) {
   int e;
-  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
-  if (p->obj) {
-    e = (*v)(p->obj, a); if (e) return e;
-  }
-  if (p->_size) {
-    e = (*v)(p->_size, a); if (e) return e;
-  }
-  if (p->_array_interface) {
-    e = (*v)(p->_array_interface, a); if (e) return e;
+  struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
+  if (p->mode) {
+    e = (*v)(p->mode, a); if (e) return e;
   }
-  if (p->view.obj) {
-    e = (*v)(p->view.obj, a); if (e) return e;
+  if (p->_format) {
+    e = (*v)(p->_format, a); if (e) return e;
   }
   return 0;
 }
 
-static int __pyx_tp_clear_memoryview(PyObject *o) {
-  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
+static int __pyx_tp_clear_array(PyObject *o) {
+  struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
   PyObject* tmp;
-  tmp = ((PyObject*)p->obj);
-  p->obj = Py_None; Py_INCREF(Py_None);
-  Py_XDECREF(tmp);
-  tmp = ((PyObject*)p->_size);
-  p->_size = Py_None; Py_INCREF(Py_None);
-  Py_XDECREF(tmp);
-  tmp = ((PyObject*)p->_array_interface);
-  p->_array_interface = Py_None; Py_INCREF(Py_None);
+  tmp = ((PyObject*)p->mode);
+  p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
   Py_XDECREF(tmp);
-  Py_CLEAR(p->view.obj);
-  return 0;
-}
-static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
-  PyObject *r;
-  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
-  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
-  Py_DECREF(x);
-  return r;
-}
-
-static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) {
-  if (v) {
-    return __pyx_memoryview___setitem__(o, i, v);
-  }
-  else {
-    PyErr_Format(PyExc_NotImplementedError,
-      "Subscript deletion not supported by %s", Py_TYPE(o)->tp_name);
-    return -1;
-  }
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_transpose(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview__get__base(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_shape(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_strides(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_suboffsets(o);
+  tmp = ((PyObject*)p->_format);
+  p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
+  Py_XDECREF(tmp);
+  return 0;
 }
-
-static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_ndim(o);
+static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
+  PyObject *r;
+  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
+  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
+  Py_DECREF(x);
+  return r;
 }
 
-static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_itemsize(o);
+static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) {
+  if (v) {
+    return __pyx_array___setitem__(o, i, v);
+  }
+  else {
+    PyErr_Format(PyExc_NotImplementedError,
+      "Subscript deletion not supported by %s", Py_TYPE(o)->tp_name);
+    return -1;
+  }
 }
 
-static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_nbytes(o);
+static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) {
+  PyObject *v = PyObject_GenericGetAttr(o, n);
+  if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
+    PyErr_Clear();
+    v = __pyx_array___getattr__(o, n);
+  }
+  return v;
 }
 
-static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_size(o);
+static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) {
+  return get_memview(o);
 }
 
-static PyMethodDef __pyx_methods_memoryview[] = {
-  {__Pyx_NAMESTR("is_c_contig"), (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, __Pyx_DOCSTR(0)},
-  {__Pyx_NAMESTR("is_f_contig"), (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, __Pyx_DOCSTR(0)},
-  {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, __Pyx_DOCSTR(0)},
-  {__Pyx_NAMESTR("copy_fortran"), (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, __Pyx_DOCSTR(0)},
+static PyMethodDef __pyx_methods_array[] = {
+  {__Pyx_NAMESTR("__getattr__"), (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, __Pyx_DOCSTR(0)},
   {0, 0, 0, 0}
 };
 
-static struct PyGetSetDef __pyx_getsets_memoryview[] = {
-  {(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, 0, 0},
-  {(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, 0, 0},
-  {(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, 0, 0},
-  {(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, 0, 0},
-  {(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, 0, 0},
-  {(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, 0, 0},
-  {(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, 0, 0},
-  {(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, 0, 0},
-  {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, 0, 0},
+static struct PyGetSetDef __pyx_getsets_array[] = {
+  {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, 0, 0},
   {0, 0, 0, 0, 0}
 };
 
-static PyNumberMethods __pyx_tp_as_number_memoryview = {
-  0, /*nb_add*/
-  0, /*nb_subtract*/
-  0, /*nb_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_divide*/
-  #endif
-  0, /*nb_remainder*/
-  0, /*nb_divmod*/
-  0, /*nb_power*/
-  0, /*nb_negative*/
-  0, /*nb_positive*/
-  0, /*nb_absolute*/
-  0, /*nb_nonzero*/
-  0, /*nb_invert*/
-  0, /*nb_lshift*/
-  0, /*nb_rshift*/
-  0, /*nb_and*/
-  0, /*nb_xor*/
-  0, /*nb_or*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_coerce*/
-  #endif
-  0, /*nb_int*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_long*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*nb_float*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_oct*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_hex*/
-  #endif
-  0, /*nb_inplace_add*/
-  0, /*nb_inplace_subtract*/
-  0, /*nb_inplace_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_inplace_divide*/
-  #endif
-  0, /*nb_inplace_remainder*/
-  0, /*nb_inplace_power*/
-  0, /*nb_inplace_lshift*/
-  0, /*nb_inplace_rshift*/
-  0, /*nb_inplace_and*/
-  0, /*nb_inplace_xor*/
-  0, /*nb_inplace_or*/
-  0, /*nb_floor_divide*/
-  0, /*nb_true_divide*/
-  0, /*nb_inplace_floor_divide*/
-  0, /*nb_inplace_true_divide*/
-  #if PY_VERSION_HEX >= 0x02050000
-  0, /*nb_index*/
-  #endif
-};
-
-static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
-  __pyx_memoryview___len__, /*sq_length*/
+static PySequenceMethods __pyx_tp_as_sequence_array = {
+  0, /*sq_length*/
   0, /*sq_concat*/
   0, /*sq_repeat*/
-  __pyx_sq_item_memoryview, /*sq_item*/
+  __pyx_sq_item_array, /*sq_item*/
   0, /*sq_slice*/
   0, /*sq_ass_item*/
   0, /*sq_ass_slice*/
@@ -31938,13 +27192,13 @@ static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
   0, /*sq_inplace_repeat*/
 };
 
-static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
-  __pyx_memoryview___len__, /*mp_length*/
-  __pyx_memoryview___getitem__, /*mp_subscript*/
-  __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/
+static PyMappingMethods __pyx_tp_as_mapping_array = {
+  0, /*mp_length*/
+  __pyx_array___getitem__, /*mp_subscript*/
+  __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/
 };
 
-static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
+static PyBufferProcs __pyx_tp_as_buffer_array = {
   #if PY_MAJOR_VERSION < 3
   0, /*bf_getreadbuffer*/
   #endif
@@ -31958,19 +27212,19 @@ static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
   0, /*bf_getcharbuffer*/
   #endif
   #if PY_VERSION_HEX >= 0x02060000
-  __pyx_memoryview_getbuffer, /*bf_getbuffer*/
+  __pyx_array_getbuffer, /*bf_getbuffer*/
   #endif
   #if PY_VERSION_HEX >= 0x02060000
   0, /*bf_releasebuffer*/
   #endif
 };
 
-static PyTypeObject __pyx_type___pyx_memoryview = {
+static PyTypeObject __pyx_type___pyx_array = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("splitBBoxLUT.memoryview"), /*tp_name*/
-  sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/
+  __Pyx_NAMESTR("splitBBoxLUT.array"), /*tp_name*/
+  sizeof(struct __pyx_array_obj), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_memoryview, /*tp_dealloc*/
+  __pyx_tp_dealloc_array, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -31979,27 +27233,27 @@ static PyTypeObject __pyx_type___pyx_memoryview = {
   #else
   0, /*reserved*/
   #endif
-  __pyx_memoryview___repr__, /*tp_repr*/
-  &__pyx_tp_as_number_memoryview, /*tp_as_number*/
-  &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/
+  0, /*tp_repr*/
+  0, /*tp_as_number*/
+  &__pyx_tp_as_sequence_array, /*tp_as_sequence*/
+  &__pyx_tp_as_mapping_array, /*tp_as_mapping*/
   0, /*tp_hash*/
   0, /*tp_call*/
-  __pyx_memoryview___str__, /*tp_str*/
-  0, /*tp_getattro*/
+  0, /*tp_str*/
+  __pyx_tp_getattro_array, /*tp_getattro*/
   0, /*tp_setattro*/
-  &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+  &__pyx_tp_as_buffer_array, /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
   0, /*tp_doc*/
-  __pyx_tp_traverse_memoryview, /*tp_traverse*/
-  __pyx_tp_clear_memoryview, /*tp_clear*/
+  __pyx_tp_traverse_array, /*tp_traverse*/
+  __pyx_tp_clear_array, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
   0, /*tp_iter*/
   0, /*tp_iternext*/
-  __pyx_methods_memoryview, /*tp_methods*/
+  __pyx_methods_array, /*tp_methods*/
   0, /*tp_members*/
-  __pyx_getsets_memoryview, /*tp_getset*/
+  __pyx_getsets_array, /*tp_getset*/
   0, /*tp_base*/
   0, /*tp_dict*/
   0, /*tp_descr_get*/
@@ -32007,7 +27261,105 @@ static PyTypeObject __pyx_type___pyx_memoryview = {
   0, /*tp_dictoffset*/
   0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_memoryview, /*tp_new*/
+  __pyx_tp_new_array, /*tp_new*/
+  0, /*tp_free*/
+  0, /*tp_is_gc*/
+  0, /*tp_bases*/
+  0, /*tp_mro*/
+  0, /*tp_cache*/
+  0, /*tp_subclasses*/
+  0, /*tp_weaklist*/
+  0, /*tp_del*/
+  #if PY_VERSION_HEX >= 0x02060000
+  0, /*tp_version_tag*/
+  #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
+};
+
+static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+  struct __pyx_MemviewEnum_obj *p;
+  PyObject *o;
+  o = (*t->tp_alloc)(t, 0);
+  if (unlikely(!o)) return 0;
+  p = ((struct __pyx_MemviewEnum_obj *)o);
+  p->name = Py_None; Py_INCREF(Py_None);
+  return o;
+}
+
+static void __pyx_tp_dealloc_Enum(PyObject *o) {
+  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
+  PyObject_GC_UnTrack(o);
+  Py_CLEAR(p->name);
+  (*Py_TYPE(o)->tp_free)(o);
+}
+
+static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) {
+  int e;
+  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
+  if (p->name) {
+    e = (*v)(p->name, a); if (e) return e;
+  }
+  return 0;
+}
+
+static int __pyx_tp_clear_Enum(PyObject *o) {
+  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
+  PyObject* tmp;
+  tmp = ((PyObject*)p->name);
+  p->name = Py_None; Py_INCREF(Py_None);
+  Py_XDECREF(tmp);
+  return 0;
+}
+
+static PyMethodDef __pyx_methods_Enum[] = {
+  {0, 0, 0, 0}
+};
+
+static PyTypeObject __pyx_type___pyx_MemviewEnum = {
+  PyVarObject_HEAD_INIT(0, 0)
+  __Pyx_NAMESTR("splitBBoxLUT.Enum"), /*tp_name*/
+  sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/
+  0, /*tp_itemsize*/
+  __pyx_tp_dealloc_Enum, /*tp_dealloc*/
+  0, /*tp_print*/
+  0, /*tp_getattr*/
+  0, /*tp_setattr*/
+  #if PY_MAJOR_VERSION < 3
+  0, /*tp_compare*/
+  #else
+  0, /*reserved*/
+  #endif
+  __pyx_MemviewEnum___repr__, /*tp_repr*/
+  0, /*tp_as_number*/
+  0, /*tp_as_sequence*/
+  0, /*tp_as_mapping*/
+  0, /*tp_hash*/
+  0, /*tp_call*/
+  0, /*tp_str*/
+  0, /*tp_getattro*/
+  0, /*tp_setattro*/
+  0, /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+  0, /*tp_doc*/
+  __pyx_tp_traverse_Enum, /*tp_traverse*/
+  __pyx_tp_clear_Enum, /*tp_clear*/
+  0, /*tp_richcompare*/
+  0, /*tp_weaklistoffset*/
+  0, /*tp_iter*/
+  0, /*tp_iternext*/
+  __pyx_methods_Enum, /*tp_methods*/
+  0, /*tp_members*/
+  0, /*tp_getset*/
+  0, /*tp_base*/
+  0, /*tp_dict*/
+  0, /*tp_descr_get*/
+  0, /*tp_descr_set*/
+  0, /*tp_dictoffset*/
+  __pyx_MemviewEnum___init__, /*tp_init*/
+  0, /*tp_alloc*/
+  __pyx_tp_new_Enum, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -32019,13 +27371,16 @@ static PyTypeObject __pyx_type___pyx_memoryview = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice;
 
 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) {
   struct __pyx_memoryviewslice_obj *p;
   PyObject *o = __pyx_tp_new_memoryview(t, a, k);
-  if (!o) return 0;
+  if (unlikely(!o)) return 0;
   p = ((struct __pyx_memoryviewslice_obj *)o);
   p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice;
   p->from_object = Py_None; Py_INCREF(Py_None);
@@ -32079,123 +27434,9 @@ static PyMethodDef __pyx_methods__memoryviewslice[] = {
   {0, 0, 0, 0}
 };
 
-static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = {
-  {(char *)"base", __pyx_getprop___pyx_memoryviewslice_base, 0, 0, 0},
-  {0, 0, 0, 0, 0}
-};
-
-static PyNumberMethods __pyx_tp_as_number__memoryviewslice = {
-  0, /*nb_add*/
-  0, /*nb_subtract*/
-  0, /*nb_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_divide*/
-  #endif
-  0, /*nb_remainder*/
-  0, /*nb_divmod*/
-  0, /*nb_power*/
-  0, /*nb_negative*/
-  0, /*nb_positive*/
-  0, /*nb_absolute*/
-  0, /*nb_nonzero*/
-  0, /*nb_invert*/
-  0, /*nb_lshift*/
-  0, /*nb_rshift*/
-  0, /*nb_and*/
-  0, /*nb_xor*/
-  0, /*nb_or*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_coerce*/
-  #endif
-  0, /*nb_int*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_long*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*nb_float*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_oct*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_hex*/
-  #endif
-  0, /*nb_inplace_add*/
-  0, /*nb_inplace_subtract*/
-  0, /*nb_inplace_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_inplace_divide*/
-  #endif
-  0, /*nb_inplace_remainder*/
-  0, /*nb_inplace_power*/
-  0, /*nb_inplace_lshift*/
-  0, /*nb_inplace_rshift*/
-  0, /*nb_inplace_and*/
-  0, /*nb_inplace_xor*/
-  0, /*nb_inplace_or*/
-  0, /*nb_floor_divide*/
-  0, /*nb_true_divide*/
-  0, /*nb_inplace_floor_divide*/
-  0, /*nb_inplace_true_divide*/
-  #if PY_VERSION_HEX >= 0x02050000
-  0, /*nb_index*/
-  #endif
-};
-
-static PySequenceMethods __pyx_tp_as_sequence__memoryviewslice = {
-  #if CYTHON_COMPILING_IN_PYPY
-  __pyx_memoryview___len__, /*sq_length*/
-  #else
-  0, /*sq_length*/
-  #endif
-  0, /*sq_concat*/
-  0, /*sq_repeat*/
-  0, /*sq_item*/
-  0, /*sq_slice*/
-  0, /*sq_ass_item*/
-  0, /*sq_ass_slice*/
-  0, /*sq_contains*/
-  0, /*sq_inplace_concat*/
-  0, /*sq_inplace_repeat*/
-};
-
-static PyMappingMethods __pyx_tp_as_mapping__memoryviewslice = {
-  #if CYTHON_COMPILING_IN_PYPY
-  __pyx_memoryview___len__, /*mp_length*/
-  #else
-  0, /*mp_length*/
-  #endif
-  #if CYTHON_COMPILING_IN_PYPY
-  __pyx_memoryview___getitem__, /*mp_subscript*/
-  #else
-  0, /*mp_subscript*/
-  #endif
-  0, /*mp_ass_subscript*/
-};
-
-static PyBufferProcs __pyx_tp_as_buffer__memoryviewslice = {
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getreadbuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getwritebuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getsegcount*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getcharbuffer*/
-  #endif
-  #if CYTHON_COMPILING_IN_PYPY
-  __pyx_memoryview_getbuffer, /*bf_getbuffer*/
-  #else
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_getbuffer*/
-  #endif
-  #endif
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_releasebuffer*/
-  #endif
+static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = {
+  {(char *)"base", __pyx_getprop___pyx_memoryviewslice_base, 0, 0, 0},
+  {0, 0, 0, 0, 0}
 };
 
 static PyTypeObject __pyx_type___pyx_memoryviewslice = {
@@ -32217,9 +27458,9 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = {
   #else
   0, /*tp_repr*/
   #endif
-  &__pyx_tp_as_number__memoryviewslice, /*tp_as_number*/
-  &__pyx_tp_as_sequence__memoryviewslice, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping__memoryviewslice, /*tp_as_mapping*/
+  0, /*tp_as_number*/
+  0, /*tp_as_sequence*/
+  0, /*tp_as_mapping*/
   0, /*tp_hash*/
   0, /*tp_call*/
   #if CYTHON_COMPILING_IN_PYPY
@@ -32229,8 +27470,8 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = {
   #endif
   0, /*tp_getattro*/
   0, /*tp_setattro*/
-  &__pyx_tp_as_buffer__memoryviewslice, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+  0, /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
   __Pyx_DOCSTR("Internal class for passing memoryview slices to Python"), /*tp_doc*/
   __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/
   __pyx_tp_clear__memoryviewslice, /*tp_clear*/
@@ -32260,6 +27501,9 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
 static PyMethodDef __pyx_methods[] = {
@@ -32285,41 +27529,43 @@ static struct PyModuleDef __pyx_moduledef = {
 #endif
 
 static __Pyx_StringTabEntry __pyx_string_tab[] = {
-  {&__pyx_kp_u_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 1, 0, 0},
-  {&__pyx_kp_u_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 1, 0, 0},
+  {&__pyx_kp_u_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 1, 0, 0},
+  {&__pyx_kp_u_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 1, 0, 0},
+  {&__pyx_kp_u_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 1, 0, 0},
   {&__pyx_kp_u_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 1, 0, 0},
-  {&__pyx_kp_u_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 1, 0, 0},
-  {&__pyx_kp_u_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 1, 0, 0},
-  {&__pyx_kp_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 0},
-  {&__pyx_kp_s_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 1, 0},
-  {&__pyx_kp_s_26, __pyx_k_26, sizeof(__pyx_k_26), 0, 0, 1, 0},
+  {&__pyx_kp_u_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 1, 0, 0},
+  {&__pyx_kp_s_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 1, 0},
+  {&__pyx_kp_s_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 0, 1, 0},
+  {&__pyx_kp_s_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 1, 0},
+  {&__pyx_kp_s_27, __pyx_k_27, sizeof(__pyx_k_27), 0, 0, 1, 0},
   {&__pyx_kp_s_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 0, 1, 0},
-  {&__pyx_kp_s_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 0, 1, 0},
   {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0},
-  {&__pyx_kp_s_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 0, 1, 0},
-  {&__pyx_kp_s_33, __pyx_k_33, sizeof(__pyx_k_33), 0, 0, 1, 0},
-  {&__pyx_kp_s_35, __pyx_k_35, sizeof(__pyx_k_35), 0, 0, 1, 0},
-  {&__pyx_kp_s_37, __pyx_k_37, sizeof(__pyx_k_37), 0, 0, 1, 0},
+  {&__pyx_kp_s_30, __pyx_k_30, sizeof(__pyx_k_30), 0, 0, 1, 0},
+  {&__pyx_kp_s_32, __pyx_k_32, sizeof(__pyx_k_32), 0, 0, 1, 0},
+  {&__pyx_kp_s_34, __pyx_k_34, sizeof(__pyx_k_34), 0, 0, 1, 0},
+  {&__pyx_kp_s_36, __pyx_k_36, sizeof(__pyx_k_36), 0, 0, 1, 0},
+  {&__pyx_kp_s_38, __pyx_k_38, sizeof(__pyx_k_38), 0, 0, 1, 0},
   {&__pyx_kp_s_39, __pyx_k_39, sizeof(__pyx_k_39), 0, 0, 1, 0},
-  {&__pyx_kp_s_40, __pyx_k_40, sizeof(__pyx_k_40), 0, 0, 1, 0},
-  {&__pyx_kp_s_43, __pyx_k_43, sizeof(__pyx_k_43), 0, 0, 1, 0},
-  {&__pyx_kp_s_45, __pyx_k_45, sizeof(__pyx_k_45), 0, 0, 1, 0},
-  {&__pyx_kp_s_50, __pyx_k_50, sizeof(__pyx_k_50), 0, 0, 1, 0},
-  {&__pyx_kp_s_52, __pyx_k_52, sizeof(__pyx_k_52), 0, 0, 1, 0},
-  {&__pyx_kp_s_56, __pyx_k_56, sizeof(__pyx_k_56), 0, 0, 1, 0},
-  {&__pyx_n_s_57, __pyx_k_57, sizeof(__pyx_k_57), 0, 0, 1, 1},
-  {&__pyx_n_s_60, __pyx_k_60, sizeof(__pyx_k_60), 0, 0, 1, 1},
-  {&__pyx_n_s_64, __pyx_k_64, sizeof(__pyx_k_64), 0, 0, 1, 1},
-  {&__pyx_n_s_67, __pyx_k_67, sizeof(__pyx_k_67), 0, 0, 1, 1},
+  {&__pyx_kp_s_42, __pyx_k_42, sizeof(__pyx_k_42), 0, 0, 1, 0},
+  {&__pyx_kp_s_44, __pyx_k_44, sizeof(__pyx_k_44), 0, 0, 1, 0},
+  {&__pyx_kp_s_49, __pyx_k_49, sizeof(__pyx_k_49), 0, 0, 1, 0},
+  {&__pyx_kp_s_51, __pyx_k_51, sizeof(__pyx_k_51), 0, 0, 1, 0},
+  {&__pyx_kp_s_55, __pyx_k_55, sizeof(__pyx_k_55), 0, 0, 1, 0},
+  {&__pyx_n_s_56, __pyx_k_56, sizeof(__pyx_k_56), 0, 0, 1, 1},
+  {&__pyx_n_s_59, __pyx_k_59, sizeof(__pyx_k_59), 0, 0, 1, 1},
+  {&__pyx_n_s_62, __pyx_k_62, sizeof(__pyx_k_62), 0, 0, 1, 1},
+  {&__pyx_n_s_66, __pyx_k_66, sizeof(__pyx_k_66), 0, 0, 1, 1},
+  {&__pyx_n_s_69, __pyx_k_69, sizeof(__pyx_k_69), 0, 0, 1, 1},
   {&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 0},
-  {&__pyx_n_s_70, __pyx_k_70, sizeof(__pyx_k_70), 0, 0, 1, 1},
-  {&__pyx_n_s_74, __pyx_k_74, sizeof(__pyx_k_74), 0, 0, 1, 1},
-  {&__pyx_kp_s_80, __pyx_k_80, sizeof(__pyx_k_80), 0, 0, 1, 0},
-  {&__pyx_kp_s_82, __pyx_k_82, sizeof(__pyx_k_82), 0, 0, 1, 0},
-  {&__pyx_kp_s_84, __pyx_k_84, sizeof(__pyx_k_84), 0, 0, 1, 0},
-  {&__pyx_kp_s_86, __pyx_k_86, sizeof(__pyx_k_86), 0, 0, 1, 0},
-  {&__pyx_kp_s_88, __pyx_k_88, sizeof(__pyx_k_88), 0, 0, 1, 0},
-  {&__pyx_kp_u_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 1, 0, 0},
+  {&__pyx_n_s_72, __pyx_k_72, sizeof(__pyx_k_72), 0, 0, 1, 1},
+  {&__pyx_n_s_75, __pyx_k_75, sizeof(__pyx_k_75), 0, 0, 1, 1},
+  {&__pyx_n_s_79, __pyx_k_79, sizeof(__pyx_k_79), 0, 0, 1, 1},
+  {&__pyx_kp_u_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 1, 0, 0},
+  {&__pyx_kp_s_81, __pyx_k_81, sizeof(__pyx_k_81), 0, 0, 1, 0},
+  {&__pyx_kp_s_83, __pyx_k_83, sizeof(__pyx_k_83), 0, 0, 1, 0},
+  {&__pyx_kp_s_85, __pyx_k_85, sizeof(__pyx_k_85), 0, 0, 1, 0},
+  {&__pyx_kp_s_87, __pyx_k_87, sizeof(__pyx_k_87), 0, 0, 1, 0},
+  {&__pyx_kp_s_89, __pyx_k_89, sizeof(__pyx_k_89), 0, 0, 1, 0},
   {&__pyx_n_s__ASCII, __pyx_k__ASCII, sizeof(__pyx_k__ASCII), 0, 0, 1, 1},
   {&__pyx_n_s__EPS32, __pyx_k__EPS32, sizeof(__pyx_k__EPS32), 0, 0, 1, 1},
   {&__pyx_n_s__Ellipsis, __pyx_k__Ellipsis, sizeof(__pyx_k__Ellipsis), 0, 0, 1, 1},
@@ -32335,16 +27581,21 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s__TypeError, __pyx_k__TypeError, sizeof(__pyx_k__TypeError), 0, 0, 1, 1},
   {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1},
   {&__pyx_n_s____class__, __pyx_k____class__, sizeof(__pyx_k____class__), 0, 0, 1, 1},
+  {&__pyx_n_s____import__, __pyx_k____import__, sizeof(__pyx_k____import__), 0, 0, 1, 1},
   {&__pyx_n_s____init__, __pyx_k____init__, sizeof(__pyx_k____init__), 0, 0, 1, 1},
   {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
+  {&__pyx_n_s____metaclass__, __pyx_k____metaclass__, sizeof(__pyx_k____metaclass__), 0, 0, 1, 1},
+  {&__pyx_n_s____module__, __pyx_k____module__, sizeof(__pyx_k____module__), 0, 0, 1, 1},
   {&__pyx_n_s____name__, __pyx_k____name__, sizeof(__pyx_k____name__), 0, 0, 1, 1},
   {&__pyx_n_s____pyx_getbuffer, __pyx_k____pyx_getbuffer, sizeof(__pyx_k____pyx_getbuffer), 0, 0, 1, 1},
+  {&__pyx_n_s____pyx_releasebuffer, __pyx_k____pyx_releasebuffer, sizeof(__pyx_k____pyx_releasebuffer), 0, 0, 1, 1},
+  {&__pyx_n_s____pyx_vtable__, __pyx_k____pyx_vtable__, sizeof(__pyx_k____pyx_vtable__), 0, 0, 1, 1},
+  {&__pyx_n_s____qualname__, __pyx_k____qualname__, sizeof(__pyx_k____qualname__), 0, 0, 1, 1},
   {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
   {&__pyx_n_s__allocate_buffer, __pyx_k__allocate_buffer, sizeof(__pyx_k__allocate_buffer), 0, 0, 1, 1},
   {&__pyx_n_s__allow_pos0_neg, __pyx_k__allow_pos0_neg, sizeof(__pyx_k__allow_pos0_neg), 0, 0, 1, 1},
   {&__pyx_n_s__ascontiguousarray, __pyx_k__ascontiguousarray, sizeof(__pyx_k__ascontiguousarray), 0, 0, 1, 1},
   {&__pyx_n_s__base, __pyx_k__base, sizeof(__pyx_k__base), 0, 0, 1, 1},
-  {&__pyx_n_s__bin, __pyx_k__bin, sizeof(__pyx_k__bin), 0, 0, 1, 1},
   {&__pyx_n_s__bin0, __pyx_k__bin0, sizeof(__pyx_k__bin0), 0, 0, 1, 1},
   {&__pyx_n_s__bin0_max, __pyx_k__bin0_max, sizeof(__pyx_k__bin0_max), 0, 0, 1, 1},
   {&__pyx_n_s__bin0_min, __pyx_k__bin0_min, sizeof(__pyx_k__bin0_min), 0, 0, 1, 1},
@@ -32357,23 +27608,24 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_b__c, __pyx_k__c, sizeof(__pyx_k__c), 0, 0, 0, 1},
   {&__pyx_n_s__c, __pyx_k__c, sizeof(__pyx_k__c), 0, 0, 1, 1},
   {&__pyx_n_u__c, __pyx_k__c, sizeof(__pyx_k__c), 0, 1, 0, 1},
+  {&__pyx_n_s__c0, __pyx_k__c0, sizeof(__pyx_k__c0), 0, 0, 1, 1},
+  {&__pyx_n_s__c1, __pyx_k__c1, sizeof(__pyx_k__c1), 0, 0, 1, 1},
+  {&__pyx_n_s__calc_boundaries, __pyx_k__calc_boundaries, sizeof(__pyx_k__calc_boundaries), 0, 0, 1, 1},
   {&__pyx_n_s__calc_lut, __pyx_k__calc_lut, sizeof(__pyx_k__calc_lut), 0, 0, 1, 1},
   {&__pyx_n_s__cdark, __pyx_k__cdark, sizeof(__pyx_k__cdark), 0, 0, 1, 1},
   {&__pyx_n_s__cdata, __pyx_k__cdata, sizeof(__pyx_k__cdata), 0, 0, 1, 1},
   {&__pyx_n_s__cddummy, __pyx_k__cddummy, sizeof(__pyx_k__cddummy), 0, 0, 1, 1},
   {&__pyx_n_s__cdummy, __pyx_k__cdummy, sizeof(__pyx_k__cdummy), 0, 0, 1, 1},
   {&__pyx_n_s__cflat, __pyx_k__cflat, sizeof(__pyx_k__cflat), 0, 0, 1, 1},
-  {&__pyx_n_s__check_dummy, __pyx_k__check_dummy, sizeof(__pyx_k__check_dummy), 0, 0, 1, 1},
   {&__pyx_n_s__check_mask, __pyx_k__check_mask, sizeof(__pyx_k__check_mask), 0, 0, 1, 1},
   {&__pyx_n_s__check_pos1, __pyx_k__check_pos1, sizeof(__pyx_k__check_pos1), 0, 0, 1, 1},
+  {&__pyx_n_s__chiDiscAtPi, __pyx_k__chiDiscAtPi, sizeof(__pyx_k__chiDiscAtPi), 0, 0, 1, 1},
   {&__pyx_n_s__cmask, __pyx_k__cmask, sizeof(__pyx_k__cmask), 0, 0, 1, 1},
   {&__pyx_n_s__coef, __pyx_k__coef, sizeof(__pyx_k__coef), 0, 0, 1, 1},
   {&__pyx_n_s__cpolarization, __pyx_k__cpolarization, sizeof(__pyx_k__cpolarization), 0, 0, 1, 1},
   {&__pyx_n_s__cpos0, __pyx_k__cpos0, sizeof(__pyx_k__cpos0), 0, 0, 1, 1},
   {&__pyx_n_s__cpos0_inf, __pyx_k__cpos0_inf, sizeof(__pyx_k__cpos0_inf), 0, 0, 1, 1},
-  {&__pyx_n_s__cpos0_lower, __pyx_k__cpos0_lower, sizeof(__pyx_k__cpos0_lower), 0, 0, 1, 1},
   {&__pyx_n_s__cpos0_sup, __pyx_k__cpos0_sup, sizeof(__pyx_k__cpos0_sup), 0, 0, 1, 1},
-  {&__pyx_n_s__cpos0_upper, __pyx_k__cpos0_upper, sizeof(__pyx_k__cpos0_upper), 0, 0, 1, 1},
   {&__pyx_n_s__cpos1, __pyx_k__cpos1, sizeof(__pyx_k__cpos1), 0, 0, 1, 1},
   {&__pyx_n_s__cpos1_inf, __pyx_k__cpos1_inf, sizeof(__pyx_k__cpos1_inf), 0, 0, 1, 1},
   {&__pyx_n_s__cpos1_max, __pyx_k__cpos1_max, sizeof(__pyx_k__cpos1_max), 0, 0, 1, 1},
@@ -32381,10 +27633,11 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s__cpos1_sup, __pyx_k__cpos1_sup, sizeof(__pyx_k__cpos1_sup), 0, 0, 1, 1},
   {&__pyx_n_s__crc32, __pyx_k__crc32, sizeof(__pyx_k__crc32), 0, 0, 1, 1},
   {&__pyx_n_s__csolidAngle, __pyx_k__csolidAngle, sizeof(__pyx_k__csolidAngle), 0, 0, 1, 1},
-  {&__pyx_n_s__csolidangle, __pyx_k__csolidangle, sizeof(__pyx_k__csolidangle), 0, 0, 1, 1},
+  {&__pyx_n_s__d, __pyx_k__d, sizeof(__pyx_k__d), 0, 0, 1, 1},
+  {&__pyx_n_s__d0, __pyx_k__d0, sizeof(__pyx_k__d0), 0, 0, 1, 1},
+  {&__pyx_n_s__d1, __pyx_k__d1, sizeof(__pyx_k__d1), 0, 0, 1, 1},
   {&__pyx_n_s__dark, __pyx_k__dark, sizeof(__pyx_k__dark), 0, 0, 1, 1},
   {&__pyx_n_s__data, __pyx_k__data, sizeof(__pyx_k__data), 0, 0, 1, 1},
-  {&__pyx_n_s__ddummy, __pyx_k__ddummy, sizeof(__pyx_k__ddummy), 0, 0, 1, 1},
   {&__pyx_n_s__decode, __pyx_k__decode, sizeof(__pyx_k__decode), 0, 0, 1, 1},
   {&__pyx_n_s__delta, __pyx_k__delta, sizeof(__pyx_k__delta), 0, 0, 1, 1},
   {&__pyx_n_s__delta0, __pyx_k__delta0, sizeof(__pyx_k__delta0), 0, 0, 1, 1},
@@ -32402,15 +27655,12 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s__do_flat, __pyx_k__do_flat, sizeof(__pyx_k__do_flat), 0, 0, 1, 1},
   {&__pyx_n_s__do_polarization, __pyx_k__do_polarization, sizeof(__pyx_k__do_polarization), 0, 0, 1, 1},
   {&__pyx_n_s__do_solidAngle, __pyx_k__do_solidAngle, sizeof(__pyx_k__do_solidAngle), 0, 0, 1, 1},
-  {&__pyx_n_s__do_solidangle, __pyx_k__do_solidangle, sizeof(__pyx_k__do_solidangle), 0, 0, 1, 1},
   {&__pyx_n_s__dpos0, __pyx_k__dpos0, sizeof(__pyx_k__dpos0), 0, 0, 1, 1},
   {&__pyx_n_s__dpos1, __pyx_k__dpos1, sizeof(__pyx_k__dpos1), 0, 0, 1, 1},
   {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1},
   {&__pyx_n_s__dtype_is_object, __pyx_k__dtype_is_object, sizeof(__pyx_k__dtype_is_object), 0, 0, 1, 1},
   {&__pyx_n_s__dummy, __pyx_k__dummy, sizeof(__pyx_k__dummy), 0, 0, 1, 1},
-  {&__pyx_n_s__edges0, __pyx_k__edges0, sizeof(__pyx_k__edges0), 0, 0, 1, 1},
-  {&__pyx_n_s__edges1, __pyx_k__edges1, sizeof(__pyx_k__edges1), 0, 0, 1, 1},
-  {&__pyx_n_s__empty, __pyx_k__empty, sizeof(__pyx_k__empty), 0, 0, 1, 1},
+  {&__pyx_n_s__empty_like, __pyx_k__empty_like, sizeof(__pyx_k__empty_like), 0, 0, 1, 1},
   {&__pyx_n_s__encode, __pyx_k__encode, sizeof(__pyx_k__encode), 0, 0, 1, 1},
   {&__pyx_n_s__enumerate, __pyx_k__enumerate, sizeof(__pyx_k__enumerate), 0, 0, 1, 1},
   {&__pyx_n_s__eps, __pyx_k__eps, sizeof(__pyx_k__eps), 0, 0, 1, 1},
@@ -32430,19 +27680,19 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s__format, __pyx_k__format, sizeof(__pyx_k__format), 0, 0, 1, 1},
   {&__pyx_n_b__fortran, __pyx_k__fortran, sizeof(__pyx_k__fortran), 0, 0, 0, 1},
   {&__pyx_n_s__fortran, __pyx_k__fortran, sizeof(__pyx_k__fortran), 0, 0, 1, 1},
-  {&__pyx_n_s__histoBBox1d, __pyx_k__histoBBox1d, sizeof(__pyx_k__histoBBox1d), 0, 0, 1, 1},
-  {&__pyx_n_s__histoBBox2d, __pyx_k__histoBBox2d, sizeof(__pyx_k__histoBBox2d), 0, 0, 1, 1},
   {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1},
   {&__pyx_n_s__id, __pyx_k__id, sizeof(__pyx_k__id), 0, 0, 1, 1},
   {&__pyx_n_s__idx, __pyx_k__idx, sizeof(__pyx_k__idx), 0, 0, 1, 1},
   {&__pyx_n_s__int32, __pyx_k__int32, sizeof(__pyx_k__int32), 0, 0, 1, 1},
-  {&__pyx_n_s__int64, __pyx_k__int64, sizeof(__pyx_k__int64), 0, 0, 1, 1},
   {&__pyx_n_s__int8, __pyx_k__int8, sizeof(__pyx_k__int8), 0, 0, 1, 1},
   {&__pyx_n_s__integrate, __pyx_k__integrate, sizeof(__pyx_k__integrate), 0, 0, 1, 1},
   {&__pyx_n_s__itemsize, __pyx_k__itemsize, sizeof(__pyx_k__itemsize), 0, 0, 1, 1},
   {&__pyx_n_s__j, __pyx_k__j, sizeof(__pyx_k__j), 0, 0, 1, 1},
   {&__pyx_n_s__k, __pyx_k__k, sizeof(__pyx_k__k), 0, 0, 1, 1},
   {&__pyx_n_s__linspace, __pyx_k__linspace, sizeof(__pyx_k__linspace), 0, 0, 1, 1},
+  {&__pyx_n_s__lower, __pyx_k__lower, sizeof(__pyx_k__lower), 0, 0, 1, 1},
+  {&__pyx_n_s__lower0, __pyx_k__lower0, sizeof(__pyx_k__lower0), 0, 0, 1, 1},
+  {&__pyx_n_s__lower1, __pyx_k__lower1, sizeof(__pyx_k__lower1), 0, 0, 1, 1},
   {&__pyx_n_s__lut, __pyx_k__lut, sizeof(__pyx_k__lut), 0, 0, 1, 1},
   {&__pyx_n_s__lut_checksum, __pyx_k__lut_checksum, sizeof(__pyx_k__lut_checksum), 0, 0, 1, 1},
   {&__pyx_n_s__lut_max_idx, __pyx_k__lut_max_idx, sizeof(__pyx_k__lut_max_idx), 0, 0, 1, 1},
@@ -32495,7 +27745,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1},
   {&__pyx_n_s__size, __pyx_k__size, sizeof(__pyx_k__size), 0, 0, 1, 1},
   {&__pyx_n_s__solidAngle, __pyx_k__solidAngle, sizeof(__pyx_k__solidAngle), 0, 0, 1, 1},
-  {&__pyx_n_s__solidangle, __pyx_k__solidangle, sizeof(__pyx_k__solidangle), 0, 0, 1, 1},
   {&__pyx_n_s__splitBBoxLUT, __pyx_k__splitBBoxLUT, sizeof(__pyx_k__splitBBoxLUT), 0, 0, 1, 1},
   {&__pyx_n_s__start, __pyx_k__start, sizeof(__pyx_k__start), 0, 0, 1, 1},
   {&__pyx_n_s__step, __pyx_k__step, sizeof(__pyx_k__step), 0, 0, 1, 1},
@@ -32506,10 +27755,12 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s__sysconf, __pyx_k__sysconf, sizeof(__pyx_k__sysconf), 0, 0, 1, 1},
   {&__pyx_n_s__sysconf_names, __pyx_k__sysconf_names, sizeof(__pyx_k__sysconf_names), 0, 0, 1, 1},
   {&__pyx_n_s__tdata, __pyx_k__tdata, sizeof(__pyx_k__tdata), 0, 0, 1, 1},
-  {&__pyx_n_s__tmp, __pyx_k__tmp, sizeof(__pyx_k__tmp), 0, 0, 1, 1},
   {&__pyx_n_s__undefined, __pyx_k__undefined, sizeof(__pyx_k__undefined), 0, 0, 1, 1},
   {&__pyx_n_s__unit, __pyx_k__unit, sizeof(__pyx_k__unit), 0, 0, 1, 1},
   {&__pyx_n_s__unpack, __pyx_k__unpack, sizeof(__pyx_k__unpack), 0, 0, 1, 1},
+  {&__pyx_n_s__upper, __pyx_k__upper, sizeof(__pyx_k__upper), 0, 0, 1, 1},
+  {&__pyx_n_s__upper0, __pyx_k__upper0, sizeof(__pyx_k__upper0), 0, 0, 1, 1},
+  {&__pyx_n_s__upper1, __pyx_k__upper1, sizeof(__pyx_k__upper1), 0, 0, 1, 1},
   {&__pyx_n_s__weights, __pyx_k__weights, sizeof(__pyx_k__weights), 0, 0, 1, 1},
   {&__pyx_n_s__xrange, __pyx_k__xrange, sizeof(__pyx_k__xrange), 0, 0, 1, 1},
   {&__pyx_n_s__zeros, __pyx_k__zeros, sizeof(__pyx_k__zeros), 0, 0, 1, 1},
@@ -32517,23 +27768,23 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {0, 0, 0, 0, 0, 0, 0}
 };
 static int __Pyx_InitCachedBuiltins(void) {
-  __pyx_builtin_object = __Pyx_GetName(__pyx_b, __pyx_n_s__object); if (!__pyx_builtin_object) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_min = __Pyx_GetName(__pyx_b, __pyx_n_s__min); if (!__pyx_builtin_min) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_max = __Pyx_GetName(__pyx_b, __pyx_n_s__max); if (!__pyx_builtin_max) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_MemoryError = __Pyx_GetName(__pyx_b, __pyx_n_s__MemoryError); if (!__pyx_builtin_MemoryError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_enumerate = __Pyx_GetName(__pyx_b, __pyx_n_s__enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_Ellipsis = __Pyx_GetName(__pyx_b, __pyx_n_s__Ellipsis); if (!__pyx_builtin_Ellipsis) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_n_s__object); if (!__pyx_builtin_object) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_min = __Pyx_GetBuiltinName(__pyx_n_s__min); if (!__pyx_builtin_min) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_max = __Pyx_GetBuiltinName(__pyx_n_s__max); if (!__pyx_builtin_max) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s__MemoryError); if (!__pyx_builtin_MemoryError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s__enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s__Ellipsis); if (!__pyx_builtin_Ellipsis) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   #if PY_MAJOR_VERSION >= 3
-  __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   #else
-  __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__xrange); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s__xrange); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   #endif
-  __pyx_builtin_id = __Pyx_GetName(__pyx_b, __pyx_n_s__id); if (!__pyx_builtin_id) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_IndexError = __Pyx_GetName(__pyx_b, __pyx_n_s__IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s__id); if (!__pyx_builtin_id) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s__IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   return 0;
   __pyx_L1_error:;
   return -1;
@@ -32543,56 +27794,45 @@ static int __Pyx_InitCachedConstants(void) {
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
 
-  /* "splitBBoxLUT.pyx":192
+  /* "splitBBoxLUT.pyx":231
  *         lut_nbytes = bins*lut_size*sizeof(lut_point)
  *         if (os.name == "posix") and ("SC_PAGE_SIZE" in os.sysconf_names) and ("SC_PHYS_PAGES" in os.sysconf_names):
  *             memsize =  os.sysconf("SC_PAGE_SIZE")*os.sysconf("SC_PHYS_PAGES")             # <<<<<<<<<<<<<<
  *             if memsize <  lut_nbytes:
  *                 raise MemoryError("Lookup-table (%i, %i) is %.3fGB whereas the memory of the system is only %s"%(bins,lut_size,lut_nbytes,memsize))
  */
-  __pyx_k_tuple_1 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__SC_PAGE_SIZE)); if (unlikely(!__pyx_k_tuple_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_1 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__SC_PAGE_SIZE)); if (unlikely(!__pyx_k_tuple_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_1);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_1));
-  __pyx_k_tuple_2 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__SC_PHYS_PAGES)); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_2 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__SC_PHYS_PAGES)); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_2);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2));
 
-  /* "splitBBoxLUT.pyx":395
+  /* "splitBBoxLUT.pyx":434
  *                  pos1,
  *                  delta_pos1,
  *                  bins=(100,36),             # <<<<<<<<<<<<<<
  *                  pos0Range=None,
  *                  pos1Range=None,
  */
-  __pyx_k_tuple_4 = PyTuple_Pack(2, __pyx_int_100, __pyx_int_36); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_4 = PyTuple_Pack(2, __pyx_int_100, __pyx_int_36); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_4);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4));
 
-  /* "splitBBoxLUT.pyx":531
+  /* "splitBBoxLUT.pyx":653
  *         lut_nbytes = bins0 * bins1 * lut_size * sizeof(lut_point)
  *         if (os.name == "posix") and ("SC_PAGE_SIZE" in os.sysconf_names) and ("SC_PHYS_PAGES" in os.sysconf_names):
  *             memsize =  os.sysconf("SC_PAGE_SIZE")*os.sysconf("SC_PHYS_PAGES")             # <<<<<<<<<<<<<<
  *             if memsize <  lut_nbytes:
  *                 raise MemoryError("Lookup-table (%i, %i, %i) is %.3fGB whereas the memory of the system is only %s"%(bins0, bins1, lut_size, lut_nbytes, memsize))
  */
-  __pyx_k_tuple_5 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__SC_PAGE_SIZE)); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_5 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__SC_PAGE_SIZE)); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_5);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5));
-  __pyx_k_tuple_6 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__SC_PHYS_PAGES)); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_6 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__SC_PHYS_PAGES)); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_6);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6));
 
-  /* "splitBBoxLUT.pyx":822
- *                 numpy.ndarray pos1 not None,
- *                 numpy.ndarray delta_pos1 not None,
- *                 bins=(100, 36),             # <<<<<<<<<<<<<<
- *                 pos0Range=None,
- *                 pos1Range=None,
- */
-  __pyx_k_tuple_8 = PyTuple_Pack(2, __pyx_int_100, __pyx_int_36); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_8);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8));
-
   /* "numpy.pxd":215
  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
  *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
@@ -32600,9 +27840,9 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
  */
-  __pyx_k_tuple_10 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_9)); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_10);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10));
+  __pyx_k_tuple_9 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_8)); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_9);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9));
 
   /* "numpy.pxd":219
  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
@@ -32611,9 +27851,9 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *             info.buf = PyArray_DATA(self)
  */
-  __pyx_k_tuple_12 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_11)); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_12);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12));
+  __pyx_k_tuple_11 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_10)); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_11);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11));
 
   /* "numpy.pxd":257
  *                 if ((descr.byteorder == c'>' and little_endian) or
@@ -32622,9 +27862,9 @@ static int __Pyx_InitCachedConstants(void) {
  *                 if   t == NPY_BYTE:        f = "b"
  *                 elif t == NPY_UBYTE:       f = "B"
  */
-  __pyx_k_tuple_14 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_13)); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_14);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14));
+  __pyx_k_tuple_13 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_12)); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_13);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_13));
 
   /* "numpy.pxd":799
  * 
@@ -32633,9 +27873,9 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *         if ((child.byteorder == c'>' and little_endian) or
  */
-  __pyx_k_tuple_17 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_16)); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_17);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17));
+  __pyx_k_tuple_16 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_15)); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_16);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16));
 
   /* "numpy.pxd":803
  *         if ((child.byteorder == c'>' and little_endian) or
@@ -32644,9 +27884,9 @@ static int __Pyx_InitCachedConstants(void) {
  *             # One could encode it in the format string and have Cython
  *             # complain instead, BUT: < and > in format strings also imply
  */
-  __pyx_k_tuple_18 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_13)); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_18);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18));
+  __pyx_k_tuple_17 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_12)); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_17);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17));
 
   /* "numpy.pxd":823
  *             t = child.type_num
@@ -32655,9 +27895,9 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *             # Until ticket #99 is fixed, use integers to avoid warnings
  */
-  __pyx_k_tuple_20 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_19)); if (unlikely(!__pyx_k_tuple_20)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_20);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_20));
+  __pyx_k_tuple_19 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_18)); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_19);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_19));
 
   /* "View.MemoryView":124
  * 
@@ -32666,9 +27906,9 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *         if self.itemsize <= 0:
  */
-  __pyx_k_tuple_22 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_21)); if (unlikely(!__pyx_k_tuple_22)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_22);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_22));
+  __pyx_k_tuple_21 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_20)); if (unlikely(!__pyx_k_tuple_21)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_21);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_21));
 
   /* "View.MemoryView":127
  * 
@@ -32677,9 +27917,9 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *         encode = getattr(format, 'encode', None)
  */
-  __pyx_k_tuple_24 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_23)); if (unlikely(!__pyx_k_tuple_24)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_24);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_24));
+  __pyx_k_tuple_23 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_22)); if (unlikely(!__pyx_k_tuple_23)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_23);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_23));
 
   /* "View.MemoryView":131
  *         encode = getattr(format, 'encode', None)
@@ -32688,9 +27928,9 @@ static int __Pyx_InitCachedConstants(void) {
  *         self._format = format
  *         self.format = self._format
  */
-  __pyx_k_tuple_25 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__ASCII)); if (unlikely(!__pyx_k_tuple_25)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_25);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_25));
+  __pyx_k_tuple_24 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__ASCII)); if (unlikely(!__pyx_k_tuple_24)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_24);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_24));
 
   /* "View.MemoryView":141
  *             free(self._shape)
@@ -32699,9 +27939,9 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  * 
  */
-  __pyx_k_tuple_27 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_26)); if (unlikely(!__pyx_k_tuple_27)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_27);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_27));
+  __pyx_k_tuple_26 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_25)); if (unlikely(!__pyx_k_tuple_26)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_26);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_26));
 
   /* "View.MemoryView":166
  *         decode = getattr(mode, 'decode', None)
@@ -32710,9 +27950,9 @@ static int __Pyx_InitCachedConstants(void) {
  *         self.mode = mode
  * 
  */
-  __pyx_k_tuple_30 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__ASCII)); if (unlikely(!__pyx_k_tuple_30)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_30);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_30));
+  __pyx_k_tuple_29 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__ASCII)); if (unlikely(!__pyx_k_tuple_29)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_29);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_29));
 
   /* "View.MemoryView":174
  *             self.data = <char *>malloc(self.len)
@@ -32721,9 +27961,9 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *             if self.dtype_is_object:
  */
-  __pyx_k_tuple_32 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_31)); if (unlikely(!__pyx_k_tuple_32)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_32);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_32));
+  __pyx_k_tuple_31 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_30)); if (unlikely(!__pyx_k_tuple_31)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_31);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_31));
 
   /* "View.MemoryView":190
  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
@@ -32732,9 +27972,9 @@ static int __Pyx_InitCachedConstants(void) {
  *         info.buf = self.data
  *         info.len = self.len
  */
-  __pyx_k_tuple_34 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_33)); if (unlikely(!__pyx_k_tuple_34)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_34);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_34));
+  __pyx_k_tuple_33 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_32)); if (unlikely(!__pyx_k_tuple_33)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_33);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_33));
 
   /* "View.MemoryView":452
  *             result = struct.unpack(self.view.format, bytesitem)
@@ -32743,9 +27983,9 @@ static int __Pyx_InitCachedConstants(void) {
  *         else:
  *             if len(self.view.format) == 1:
  */
-  __pyx_k_tuple_36 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_35)); if (unlikely(!__pyx_k_tuple_36)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_36);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_36));
+  __pyx_k_tuple_35 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_34)); if (unlikely(!__pyx_k_tuple_35)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_35);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_35));
 
   /* "View.MemoryView":528
  *             if self.view.strides == NULL:
@@ -32754,9 +27994,9 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *             return tuple([self.view.strides[i] for i in xrange(self.view.ndim)])
  */
-  __pyx_k_tuple_38 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_37)); if (unlikely(!__pyx_k_tuple_38)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_38);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_38));
+  __pyx_k_tuple_37 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_36)); if (unlikely(!__pyx_k_tuple_37)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_37);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_37));
 
   /* "View.MemoryView":643
  *         if item is Ellipsis:
@@ -32765,9 +28005,9 @@ static int __Pyx_InitCachedConstants(void) {
  *                 seen_ellipsis = True
  *             else:
  */
-  __pyx_k_tuple_41 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_k_tuple_41)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_41);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_41));
+  __pyx_k_tuple_40 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_k_tuple_40)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_40);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_40));
 
   /* "View.MemoryView":646
  *                 seen_ellipsis = True
@@ -32776,9 +28016,9 @@ static int __Pyx_InitCachedConstants(void) {
  *             have_slices = True
  *         else:
  */
-  __pyx_k_tuple_42 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_k_tuple_42)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_42);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_42));
+  __pyx_k_tuple_41 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_k_tuple_41)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_41);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_41));
 
   /* "View.MemoryView":657
  *     nslices = ndim - len(result)
@@ -32787,9 +28027,9 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *     return have_slices or nslices, tuple(result)
  */
-  __pyx_k_tuple_44 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_k_tuple_44)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_44);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_44));
+  __pyx_k_tuple_43 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_k_tuple_43)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_43);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_43));
 
   /* "View.MemoryView":665
  *     for i in range(ndim):
@@ -32798,111 +28038,111 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  * 
  */
-  __pyx_k_tuple_46 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_45)); if (unlikely(!__pyx_k_tuple_46)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_46);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_46));
+  __pyx_k_tuple_45 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_44)); if (unlikely(!__pyx_k_tuple_45)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_45);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_45));
 
-  /* "splitBBoxLUT.pyx":56
+  /* "splitBBoxLUT.pyx":57
  * class HistoBBox1d(object):
  *     @cython.boundscheck(False)
  *     def __init__(self,             # <<<<<<<<<<<<<<
  *                  pos0,
  *                  delta_pos0,
  */
-  __pyx_k_tuple_54 = PyTuple_Pack(16, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__pos0), ((PyObject *)__pyx_n_s__delta_pos0), ((PyObject *)__pyx_n_s__pos1), ((PyObject *)__pyx_n_s__delta_pos1), ((PyObject *)__pyx_n_s__bins), ((PyObject *)__pyx_n_s__pos0Range), ((PyObject *)__pyx_n_s__pos1Range), ((PyObject *)__pyx_n_s__mask), ((PyObject *)__pyx_n_s__mask_checksum), ((PyObject *)__pyx_n_s__allow_pos0_neg), ((PyObject *)__pyx_n_s__unit), ((PyObject *)__pyx_n_s__i), ((PyObject *) [...]
-  __Pyx_GOTREF(__pyx_k_tuple_54);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_54));
-  __pyx_k_codeobj_55 = (PyObject*)__Pyx_PyCode_New(12, 0, 16, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_54, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_56, __pyx_n_s____init__, 56, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_55)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_53 = PyTuple_Pack(13, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__pos0), ((PyObject *)__pyx_n_s__delta_pos0), ((PyObject *)__pyx_n_s__pos1), ((PyObject *)__pyx_n_s__delta_pos1), ((PyObject *)__pyx_n_s__bins), ((PyObject *)__pyx_n_s__pos0Range), ((PyObject *)__pyx_n_s__pos1Range), ((PyObject *)__pyx_n_s__mask), ((PyObject *)__pyx_n_s__mask_checksum), ((PyObject *)__pyx_n_s__allow_pos0_neg), ((PyObject *)__pyx_n_s__unit), ((PyObject *)__pyx_n_s__pos1_maxin)); if  [...]
+  __Pyx_GOTREF(__pyx_k_tuple_53);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_53));
+  __pyx_k_codeobj_54 = (PyObject*)__Pyx_PyCode_New(12, 0, 13, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_53, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_55, __pyx_n_s____init__, 57, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_54)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "splitBBoxLUT.pyx":124
+  /* "splitBBoxLUT.pyx":116
+ *     @cython.boundscheck(False)
+ *     @cython.wraparound(False)
+ *     def calc_boundaries(self,pos0Range):             # <<<<<<<<<<<<<<
+ *         cdef int size = self.cpos0.size
+ *         cdef bint check_mask = self.check_mask
+ */
+  __pyx_k_tuple_57 = PyTuple_Pack(17, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__pos0Range), ((PyObject *)__pyx_n_s__size), ((PyObject *)__pyx_n_s__check_mask), ((PyObject *)__pyx_n_s__cmask), ((PyObject *)__pyx_n_s__cpos0), ((PyObject *)__pyx_n_s__dpos0), ((PyObject *)__pyx_n_s__cpos0_sup), ((PyObject *)__pyx_n_s__cpos0_inf), ((PyObject *)__pyx_n_s__upper), ((PyObject *)__pyx_n_s__lower), ((PyObject *)__pyx_n_s__pos0_max), ((PyObject *)__pyx_n_s__pos0_min), ((PyObject *)__py [...]
+  __Pyx_GOTREF(__pyx_k_tuple_57);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_57));
+  __pyx_k_codeobj_58 = (PyObject*)__Pyx_PyCode_New(2, 0, 17, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_57, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_55, __pyx_n_s__calc_boundaries, 116, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_58)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "splitBBoxLUT.pyx":163
  *     @cython.boundscheck(False)
  *     @cython.wraparound(False)
  *     def calc_lut(self):             # <<<<<<<<<<<<<<
  *         'calculate the max number of elements in the LUT and populate it'
  *         cdef float delta=self.delta, pos0_min=self.pos0_min, pos1_min, pos1_max, min0, max0, fbin0_min, fbin0_max, deltaL, deltaR, deltaA
  */
-  __pyx_k_tuple_58 = PyTuple_Pack(31, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__delta), ((PyObject *)__pyx_n_s__pos0_min), ((PyObject *)__pyx_n_s__pos1_min), ((PyObject *)__pyx_n_s__pos1_max), ((PyObject *)__pyx_n_s__min0), ((PyObject *)__pyx_n_s__max0), ((PyObject *)__pyx_n_s__fbin0_min), ((PyObject *)__pyx_n_s__fbin0_max), ((PyObject *)__pyx_n_s__deltaL), ((PyObject *)__pyx_n_s__deltaR), ((PyObject *)__pyx_n_s__deltaA), ((PyObject *)__pyx_n_s__bin0_min), ((PyObject *)__pyx [...]
-  __Pyx_GOTREF(__pyx_k_tuple_58);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_58));
-  __pyx_k_codeobj_59 = (PyObject*)__Pyx_PyCode_New(1, 0, 31, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_58, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_56, __pyx_n_s__calc_lut, 124, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_59)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_60 = PyTuple_Pack(31, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__delta), ((PyObject *)__pyx_n_s__pos0_min), ((PyObject *)__pyx_n_s__pos1_min), ((PyObject *)__pyx_n_s__pos1_max), ((PyObject *)__pyx_n_s__min0), ((PyObject *)__pyx_n_s__max0), ((PyObject *)__pyx_n_s__fbin0_min), ((PyObject *)__pyx_n_s__fbin0_max), ((PyObject *)__pyx_n_s__deltaL), ((PyObject *)__pyx_n_s__deltaR), ((PyObject *)__pyx_n_s__deltaA), ((PyObject *)__pyx_n_s__bin0_min), ((PyObject *)__pyx [...]
+  __Pyx_GOTREF(__pyx_k_tuple_60);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_60));
+  __pyx_k_codeobj_61 = (PyObject*)__Pyx_PyCode_New(1, 0, 31, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_60, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_55, __pyx_n_s__calc_lut, 163, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_61)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "splitBBoxLUT.pyx":257
+  /* "splitBBoxLUT.pyx":296
  *     @cython.boundscheck(False)
  *     @cython.wraparound(False)
  *     def integrate(self, weights, dummy=None, delta_dummy=None, dark=None, flat=None, solidAngle=None, polarization=None):             # <<<<<<<<<<<<<<
  *         """
  *         Actually perform the integration which in this case looks more like a matrix-vector product
  */
-  __pyx_k_tuple_61 = PyTuple_Pack(36, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__weights), ((PyObject *)__pyx_n_s__dummy), ((PyObject *)__pyx_n_s__delta_dummy), ((PyObject *)__pyx_n_s__dark), ((PyObject *)__pyx_n_s__flat), ((PyObject *)__pyx_n_s__solidAngle), ((PyObject *)__pyx_n_s__polarization), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__j), ((PyObject *)__pyx_n_s__idx), ((PyObject *)__pyx_n_s__bins), ((PyObject *)__pyx_n_s__lut_size), ((PyObject *)__pyx_n_s__size) [...]
-  __Pyx_GOTREF(__pyx_k_tuple_61);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_61));
-  __pyx_k_codeobj_62 = (PyObject*)__Pyx_PyCode_New(8, 0, 36, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_61, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_56, __pyx_n_s__integrate, 257, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_62)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_k_tuple_63 = PyTuple_Pack(6, ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_k_tuple_63)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_63 = PyTuple_Pack(36, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__weights), ((PyObject *)__pyx_n_s__dummy), ((PyObject *)__pyx_n_s__delta_dummy), ((PyObject *)__pyx_n_s__dark), ((PyObject *)__pyx_n_s__flat), ((PyObject *)__pyx_n_s__solidAngle), ((PyObject *)__pyx_n_s__polarization), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__j), ((PyObject *)__pyx_n_s__idx), ((PyObject *)__pyx_n_s__bins), ((PyObject *)__pyx_n_s__lut_size), ((PyObject *)__pyx_n_s__size) [...]
   __Pyx_GOTREF(__pyx_k_tuple_63);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_63));
+  __pyx_k_codeobj_64 = (PyObject*)__Pyx_PyCode_New(8, 0, 36, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_63, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_55, __pyx_n_s__integrate, 296, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_64)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_65 = PyTuple_Pack(6, ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_k_tuple_65)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_65);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_65));
 
-  /* "splitBBoxLUT.pyx":390
+  /* "splitBBoxLUT.pyx":429
  * class HistoBBox2d(object):
  *     @cython.boundscheck(False)
  *     def __init__(self,             # <<<<<<<<<<<<<<
  *                  pos0,
  *                  delta_pos0,
  */
-  __pyx_k_tuple_65 = PyTuple_Pack(20, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__pos0), ((PyObject *)__pyx_n_s__delta_pos0), ((PyObject *)__pyx_n_s__pos1), ((PyObject *)__pyx_n_s__delta_pos1), ((PyObject *)__pyx_n_s__bins), ((PyObject *)__pyx_n_s__pos0Range), ((PyObject *)__pyx_n_s__pos1Range), ((PyObject *)__pyx_n_s__mask), ((PyObject *)__pyx_n_s__mask_checksum), ((PyObject *)__pyx_n_s__allow_pos0_neg), ((PyObject *)__pyx_n_s__unit), ((PyObject *)__pyx_n_s__i), ((PyObject *) [...]
-  __Pyx_GOTREF(__pyx_k_tuple_65);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_65));
-  __pyx_k_codeobj_66 = (PyObject*)__Pyx_PyCode_New(12, 0, 20, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_65, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_56, __pyx_n_s____init__, 390, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_66)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_67 = PyTuple_Pack(19, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__pos0), ((PyObject *)__pyx_n_s__delta_pos0), ((PyObject *)__pyx_n_s__pos1), ((PyObject *)__pyx_n_s__delta_pos1), ((PyObject *)__pyx_n_s__bins), ((PyObject *)__pyx_n_s__pos0Range), ((PyObject *)__pyx_n_s__pos1Range), ((PyObject *)__pyx_n_s__mask), ((PyObject *)__pyx_n_s__mask_checksum), ((PyObject *)__pyx_n_s__allow_pos0_neg), ((PyObject *)__pyx_n_s__unit), ((PyObject *)__pyx_n_s__chiDiscAtPi), ((P [...]
+  __Pyx_GOTREF(__pyx_k_tuple_67);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_67));
+  __pyx_k_codeobj_68 = (PyObject*)__Pyx_PyCode_New(13, 0, 19, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_67, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_55, __pyx_n_s____init__, 429, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_68)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "splitBBoxLUT.pyx":508
+ *     @cython.boundscheck(False)
+ *     @cython.wraparound(False)
+ *     def calc_boundaries(self, pos0Range, pos1Range):             # <<<<<<<<<<<<<<
+ *         cdef int size = self.cpos0.size
+ *         cdef bint check_mask = self.check_mask
+ */
+  __pyx_k_tuple_70 = PyTuple_Pack(29, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__pos0Range), ((PyObject *)__pyx_n_s__pos1Range), ((PyObject *)__pyx_n_s__size), ((PyObject *)__pyx_n_s__check_mask), ((PyObject *)__pyx_n_s__cmask), ((PyObject *)__pyx_n_s__cpos0), ((PyObject *)__pyx_n_s__dpos0), ((PyObject *)__pyx_n_s__cpos0_sup), ((PyObject *)__pyx_n_s__cpos0_inf), ((PyObject *)__pyx_n_s__cpos1), ((PyObject *)__pyx_n_s__dpos1), ((PyObject *)__pyx_n_s__cpos1_sup), ((PyObject *)__ [...]
+  __Pyx_GOTREF(__pyx_k_tuple_70);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_70));
+  __pyx_k_codeobj_71 = (PyObject*)__Pyx_PyCode_New(3, 0, 29, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_70, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_55, __pyx_n_s__calc_boundaries, 508, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_71)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "splitBBoxLUT.pyx":470
+  /* "splitBBoxLUT.pyx":592
  *     @cython.wraparound(False)
  *     @cython.cdivision(True)
  *     def calc_lut(self):             # <<<<<<<<<<<<<<
  *         'calculate the max number of elements in the LUT and populate it'
  *         cdef float delta0=self.delta0, pos0_min=self.pos0_min, min0, max0, fbin0_min, fbin0_max
  */
-  __pyx_k_tuple_68 = PyTuple_Pack(40, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__delta0), ((PyObject *)__pyx_n_s__pos0_min), ((PyObject *)__pyx_n_s__min0), ((PyObject *)__pyx_n_s__max0), ((PyObject *)__pyx_n_s__fbin0_min), ((PyObject *)__pyx_n_s__fbin0_max), ((PyObject *)__pyx_n_s__delta1), ((PyObject *)__pyx_n_s__pos1_min), ((PyObject *)__pyx_n_s__min1), ((PyObject *)__pyx_n_s__max1), ((PyObject *)__pyx_n_s__fbin1_min), ((PyObject *)__pyx_n_s__fbin1_max), ((PyObject *)__pyx_ [...]
-  __Pyx_GOTREF(__pyx_k_tuple_68);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_68));
-  __pyx_k_codeobj_69 = (PyObject*)__Pyx_PyCode_New(1, 0, 40, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_68, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_56, __pyx_n_s__calc_lut, 470, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_69)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_73 = PyTuple_Pack(40, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__delta0), ((PyObject *)__pyx_n_s__pos0_min), ((PyObject *)__pyx_n_s__min0), ((PyObject *)__pyx_n_s__max0), ((PyObject *)__pyx_n_s__fbin0_min), ((PyObject *)__pyx_n_s__fbin0_max), ((PyObject *)__pyx_n_s__delta1), ((PyObject *)__pyx_n_s__pos1_min), ((PyObject *)__pyx_n_s__min1), ((PyObject *)__pyx_n_s__max1), ((PyObject *)__pyx_n_s__fbin1_min), ((PyObject *)__pyx_n_s__fbin1_max), ((PyObject *)__pyx_ [...]
+  __Pyx_GOTREF(__pyx_k_tuple_73);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_73));
+  __pyx_k_codeobj_74 = (PyObject*)__Pyx_PyCode_New(1, 0, 40, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_73, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_55, __pyx_n_s__calc_lut, 592, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_74)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "splitBBoxLUT.pyx":685
+  /* "splitBBoxLUT.pyx":807
  *     @cython.boundscheck(False)
  *     @cython.wraparound(False)
  *     def integrate(self, weights, dummy=None, delta_dummy=None, dark=None, flat=None, solidAngle=None, polarization=None):             # <<<<<<<<<<<<<<
  *         """
  *         Actually perform the 2D integration which in this case looks more like a matrix-vector product
  */
-  __pyx_k_tuple_71 = PyTuple_Pack(41, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__weights), ((PyObject *)__pyx_n_s__dummy), ((PyObject *)__pyx_n_s__delta_dummy), ((PyObject *)__pyx_n_s__dark), ((PyObject *)__pyx_n_s__flat), ((PyObject *)__pyx_n_s__solidAngle), ((PyObject *)__pyx_n_s__polarization), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__j), ((PyObject *)__pyx_n_s__idx), ((PyObject *)__pyx_n_s__bins0), ((PyObject *)__pyx_n_s__bins1), ((PyObject *)__pyx_n_s__bins),  [...]
-  __Pyx_GOTREF(__pyx_k_tuple_71);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_71));
-  __pyx_k_codeobj_72 = (PyObject*)__Pyx_PyCode_New(8, 0, 41, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_71, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_56, __pyx_n_s__integrate, 685, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_72)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_k_tuple_73 = PyTuple_Pack(6, ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_k_tuple_73)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_73);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_73));
-
-  /* "splitBBoxLUT.pyx":817
- * @cython.boundscheck(False)
- * @cython.wraparound(False)
- * def histoBBox2d(numpy.ndarray weights not None,             # <<<<<<<<<<<<<<
- *                 numpy.ndarray pos0 not None,
- *                 numpy.ndarray delta_pos0 not None,
- */
-  __pyx_k_tuple_75 = PyTuple_Pack(74, ((PyObject *)__pyx_n_s__weights), ((PyObject *)__pyx_n_s__pos0), ((PyObject *)__pyx_n_s__delta_pos0), ((PyObject *)__pyx_n_s__pos1), ((PyObject *)__pyx_n_s__delta_pos1), ((PyObject *)__pyx_n_s__bins), ((PyObject *)__pyx_n_s__pos0Range), ((PyObject *)__pyx_n_s__pos1Range), ((PyObject *)__pyx_n_s__dummy), ((PyObject *)__pyx_n_s__delta_dummy), ((PyObject *)__pyx_n_s__mask), ((PyObject *)__pyx_n_s__dark), ((PyObject *)__pyx_n_s__flat), ((PyObject *)__pyx [...]
-  __Pyx_GOTREF(__pyx_k_tuple_75);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_75));
-  __pyx_k_codeobj_76 = (PyObject*)__Pyx_PyCode_New(15, 0, 74, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_75, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_56, __pyx_n_s__histoBBox2d, 817, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_76)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
-  /* "splitBBoxLUT.pyx":1081
- * 
- * 
- * def histoBBox1d(weights ,             # <<<<<<<<<<<<<<
- *                 pos0,
- *                 delta_pos0,
- */
-  __pyx_k_tuple_77 = PyTuple_Pack(57, ((PyObject *)__pyx_n_s__weights), ((PyObject *)__pyx_n_s__pos0), ((PyObject *)__pyx_n_s__delta_pos0), ((PyObject *)__pyx_n_s__pos1), ((PyObject *)__pyx_n_s__delta_pos1), ((PyObject *)__pyx_n_s__bins), ((PyObject *)__pyx_n_s__pos0Range), ((PyObject *)__pyx_n_s__pos1Range), ((PyObject *)__pyx_n_s__dummy), ((PyObject *)__pyx_n_s__delta_dummy), ((PyObject *)__pyx_n_s__mask), ((PyObject *)__pyx_n_s__dark), ((PyObject *)__pyx_n_s__flat), ((PyObject *)__pyx [...]
-  __Pyx_GOTREF(__pyx_k_tuple_77);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_77));
-  __pyx_k_codeobj_78 = (PyObject*)__Pyx_PyCode_New(13, 0, 57, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_77, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_56, __pyx_n_s__histoBBox1d, 1081, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_78)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_76 = PyTuple_Pack(41, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__weights), ((PyObject *)__pyx_n_s__dummy), ((PyObject *)__pyx_n_s__delta_dummy), ((PyObject *)__pyx_n_s__dark), ((PyObject *)__pyx_n_s__flat), ((PyObject *)__pyx_n_s__solidAngle), ((PyObject *)__pyx_n_s__polarization), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__j), ((PyObject *)__pyx_n_s__idx), ((PyObject *)__pyx_n_s__bins0), ((PyObject *)__pyx_n_s__bins1), ((PyObject *)__pyx_n_s__bins),  [...]
+  __Pyx_GOTREF(__pyx_k_tuple_76);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_76));
+  __pyx_k_codeobj_77 = (PyObject*)__Pyx_PyCode_New(8, 0, 41, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_76, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_55, __pyx_n_s__integrate, 807, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_77)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_78 = PyTuple_Pack(6, ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_k_tuple_78)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_78);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_78));
 
   /* "View.MemoryView":282
  *         return self.name
@@ -32911,9 +28151,9 @@ static int __Pyx_InitCachedConstants(void) {
  * cdef strided = Enum("<strided and direct>") # default
  * cdef indirect = Enum("<strided and indirect>")
  */
-  __pyx_k_tuple_81 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_80)); if (unlikely(!__pyx_k_tuple_81)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_81);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_81));
+  __pyx_k_tuple_82 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_81)); if (unlikely(!__pyx_k_tuple_82)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_82);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_82));
 
   /* "View.MemoryView":283
  * 
@@ -32922,9 +28162,9 @@ static int __Pyx_InitCachedConstants(void) {
  * cdef indirect = Enum("<strided and indirect>")
  * 
  */
-  __pyx_k_tuple_83 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_82)); if (unlikely(!__pyx_k_tuple_83)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_83);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_83));
+  __pyx_k_tuple_84 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_83)); if (unlikely(!__pyx_k_tuple_84)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_84);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_84));
 
   /* "View.MemoryView":284
  * cdef generic = Enum("<strided and direct or indirect>")
@@ -32933,9 +28173,9 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  * 
  */
-  __pyx_k_tuple_85 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_84)); if (unlikely(!__pyx_k_tuple_85)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_85);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_85));
+  __pyx_k_tuple_86 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_85)); if (unlikely(!__pyx_k_tuple_86)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_86);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_86));
 
   /* "View.MemoryView":287
  * 
@@ -32944,9 +28184,9 @@ static int __Pyx_InitCachedConstants(void) {
  * cdef indirect_contiguous = Enum("<contiguous and indirect>")
  * 
  */
-  __pyx_k_tuple_87 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_86)); if (unlikely(!__pyx_k_tuple_87)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_87);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_87));
+  __pyx_k_tuple_88 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_87)); if (unlikely(!__pyx_k_tuple_88)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_88);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_88));
 
   /* "View.MemoryView":288
  * 
@@ -32955,9 +28195,9 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  * 
  */
-  __pyx_k_tuple_89 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_88)); if (unlikely(!__pyx_k_tuple_89)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_89);
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_89));
+  __pyx_k_tuple_90 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_89)); if (unlikely(!__pyx_k_tuple_90)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_90);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_90));
   __Pyx_RefNannyFinishContext();
   return 0;
   __pyx_L1_error:;
@@ -32966,14 +28206,6 @@ static int __Pyx_InitCachedConstants(void) {
 }
 
 static int __Pyx_InitGlobals(void) {
-  /* None.init */
-  /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and
-   a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is
-   a quiet NaN. */
-    memset(&__PYX_NAN, 0xFF, sizeof(__PYX_NAN));
-
-if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
   /* InitThreads.init */
   #ifdef WITH_THREAD
 PyEval_InitThreads();
@@ -33009,6 +28241,9 @@ PyMODINIT_FUNC PyInit_splitBBoxLUT(void)
   PyObject *__pyx_t_6 = NULL;
   PyObject *__pyx_t_7 = NULL;
   PyObject *__pyx_t_8 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannyDeclarations
   #if CYTHON_REFNANNY
   __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
@@ -33046,6 +28281,8 @@ PyMODINIT_FUNC PyInit_splitBBoxLUT(void)
   __pyx_m = PyModule_Create(&__pyx_moduledef);
   #endif
   if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  Py_INCREF(__pyx_d);
   #if PY_MAJOR_VERSION >= 3
   {
     PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -33061,6 +28298,9 @@ PyMODINIT_FUNC PyInit_splitBBoxLUT(void)
   if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
   /*--- Initialize various global constants etc. ---*/
   if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
+  if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  #endif
   if (__pyx_module_is_main_splitBBoxLUT) {
     if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
   }
@@ -33077,12 +28317,6 @@ PyMODINIT_FUNC PyInit_splitBBoxLUT(void)
   /*--- Variable export code ---*/
   /*--- Function export code ---*/
   /*--- Type init code ---*/
-  if (PyType_Ready(&__pyx_type___pyx_array) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "array", (PyObject *)&__pyx_type___pyx_array) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_array_type = &__pyx_type___pyx_array;
-  if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "Enum", (PyObject *)&__pyx_type___pyx_MemviewEnum) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
   __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview;
   __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer;
   __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice;
@@ -33093,8 +28327,11 @@ PyMODINIT_FUNC PyInit_splitBBoxLUT(void)
   __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object;
   if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "memoryview", (PyObject *)&__pyx_type___pyx_memoryview) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_memoryview_type = &__pyx_type___pyx_memoryview;
+  if (PyType_Ready(&__pyx_type___pyx_array) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_array_type = &__pyx_type___pyx_array;
+  if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
   __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice;
   __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview;
   __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object;
@@ -33102,7 +28339,6 @@ PyMODINIT_FUNC PyInit_splitBBoxLUT(void)
   __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type;
   if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "_memoryviewslice", (PyObject *)&__pyx_type___pyx_memoryviewslice) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice;
   /*--- Type import code ---*/
   __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", 
@@ -33130,7 +28366,7 @@ PyMODINIT_FUNC PyInit_splitBBoxLUT(void)
  */
   __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__os), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__os, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s__os, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
   /* "splitBBoxLUT.pyx":32
@@ -33138,14 +28374,23 @@ PyMODINIT_FUNC PyInit_splitBBoxLUT(void)
  * from libc.string cimport memset
  * import numpy             # <<<<<<<<<<<<<<
  * cimport numpy
- * from libc.math cimport fabs
+ * from libc.math cimport fabs, M_PI
  */
   __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__numpy, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  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;
 
-  /* "splitBBoxLUT.pyx":38
+  /* "splitBBoxLUT.pyx":35
+ * cimport numpy
+ * from libc.math cimport fabs, M_PI
+ * cdef float pi=<float> M_PI             # <<<<<<<<<<<<<<
+ * cdef struct lut_point:
+ *     numpy.int32_t idx
+ */
+  __pyx_v_12splitBBoxLUT_pi = ((float)M_PI);
+
+  /* "splitBBoxLUT.pyx":39
  *     numpy.int32_t idx
  *     numpy.float32_t coef
  * try:             # <<<<<<<<<<<<<<
@@ -33159,28 +28404,24 @@ PyMODINIT_FUNC PyInit_splitBBoxLUT(void)
     __Pyx_XGOTREF(__pyx_t_4);
     /*try:*/ {
 
-      /* "splitBBoxLUT.pyx":39
+      /* "splitBBoxLUT.pyx":40
  *     numpy.float32_t coef
  * try:
  *     from fastcrc import crc32             # <<<<<<<<<<<<<<
  * except:
  *     from zlib import crc32
  */
-      __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
+      __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
       __Pyx_GOTREF(__pyx_t_1);
       __Pyx_INCREF(((PyObject *)__pyx_n_s__crc32));
       PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__crc32));
       __Pyx_GIVEREF(((PyObject *)__pyx_n_s__crc32));
-      __pyx_t_5 = __Pyx_Import(((PyObject *)__pyx_n_s__fastcrc), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
+      __pyx_t_5 = __Pyx_Import(((PyObject *)__pyx_n_s__fastcrc), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
       __Pyx_GOTREF(__pyx_t_5);
       __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-      __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__crc32);
-      if (__pyx_t_1 == NULL) {
-        if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__crc32);
-        if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
-      }
+      __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_5, __pyx_n_s__crc32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
       __Pyx_GOTREF(__pyx_t_1);
-      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__crc32, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
+      if (PyDict_SetItem(__pyx_d, __pyx_n_s__crc32, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     }
@@ -33192,7 +28433,7 @@ PyMODINIT_FUNC PyInit_splitBBoxLUT(void)
     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
 
-    /* "splitBBoxLUT.pyx":40
+    /* "splitBBoxLUT.pyx":41
  * try:
  *     from fastcrc import crc32
  * except:             # <<<<<<<<<<<<<<
@@ -33201,33 +28442,29 @@ PyMODINIT_FUNC PyInit_splitBBoxLUT(void)
  */
     /*except:*/ {
       __Pyx_AddTraceback("splitBBoxLUT", __pyx_clineno, __pyx_lineno, __pyx_filename);
-      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_1, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L4_except_error;}
+      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_1, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L4_except_error;}
       __Pyx_GOTREF(__pyx_t_5);
       __Pyx_GOTREF(__pyx_t_1);
       __Pyx_GOTREF(__pyx_t_6);
 
-      /* "splitBBoxLUT.pyx":41
+      /* "splitBBoxLUT.pyx":42
  *     from fastcrc import crc32
  * except:
  *     from zlib import crc32             # <<<<<<<<<<<<<<
  * EPS32 = (1.0 + numpy.finfo(numpy.float32).eps)
  * 
  */
-      __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L4_except_error;}
+      __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L4_except_error;}
       __Pyx_GOTREF(__pyx_t_7);
       __Pyx_INCREF(((PyObject *)__pyx_n_s__crc32));
       PyList_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_n_s__crc32));
       __Pyx_GIVEREF(((PyObject *)__pyx_n_s__crc32));
-      __pyx_t_8 = __Pyx_Import(((PyObject *)__pyx_n_s__zlib), ((PyObject *)__pyx_t_7), -1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L4_except_error;}
+      __pyx_t_8 = __Pyx_Import(((PyObject *)__pyx_n_s__zlib), ((PyObject *)__pyx_t_7), -1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L4_except_error;}
       __Pyx_GOTREF(__pyx_t_8);
       __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
-      __pyx_t_7 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__crc32);
-      if (__pyx_t_7 == NULL) {
-        if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__crc32);
-        if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L4_except_error;}
-      }
+      __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_8, __pyx_n_s__crc32); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L4_except_error;}
       __Pyx_GOTREF(__pyx_t_7);
-      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__crc32, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L4_except_error;}
+      if (PyDict_SetItem(__pyx_d, __pyx_n_s__crc32, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L4_except_error;}
       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
@@ -33249,1107 +28486,575 @@ PyMODINIT_FUNC PyInit_splitBBoxLUT(void)
     __pyx_L9_try_end:;
   }
 
-  /* "splitBBoxLUT.pyx":42
+  /* "splitBBoxLUT.pyx":43
  * except:
  *     from zlib import crc32
  * EPS32 = (1.0 + numpy.finfo(numpy.float32).eps)             # <<<<<<<<<<<<<<
  * 
  * @cython.cdivision(True)
  */
-  __pyx_t_6 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__finfo); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__finfo); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_8 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float32); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__float32); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_8);
   __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 = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8);
   __Pyx_GIVEREF(__pyx_t_8);
   __pyx_t_8 = 0;
-  __pyx_t_8 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_8 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_8);
   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__eps); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__eps); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-  __pyx_t_8 = PyNumber_Add(__pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_8 = PyNumber_Add(__pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_8);
   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__EPS32, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s__EPS32, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
 
-  /* "splitBBoxLUT.pyx":54
+  /* "splitBBoxLUT.pyx":55
  *     return (x0 - pos0_min) / delta
  * 
  * class HistoBBox1d(object):             # <<<<<<<<<<<<<<
  *     @cython.boundscheck(False)
  *     def __init__(self,
  */
-  __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_8));
 
-  /* "splitBBoxLUT.pyx":56
+  /* "splitBBoxLUT.pyx":57
  * class HistoBBox1d(object):
  *     @cython.boundscheck(False)
  *     def __init__(self,             # <<<<<<<<<<<<<<
  *                  pos0,
  *                  delta_pos0,
  */
-  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_12splitBBoxLUT_11HistoBBox1d_1__init__, 0, __pyx_n_s_57, NULL, __pyx_n_s__splitBBoxLUT, ((PyObject *)__pyx_k_codeobj_55)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_12splitBBoxLUT_11HistoBBox1d_1__init__, 0, __pyx_n_s_56, NULL, __pyx_n_s__splitBBoxLUT, ((PyObject *)__pyx_k_codeobj_54)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  if (!__Pyx_CyFunction_InitDefaults(__pyx_t_1, sizeof(__pyx_defaults), 1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (!__Pyx_CyFunction_InitDefaults(__pyx_t_1, sizeof(__pyx_defaults), 1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-  /* "splitBBoxLUT.pyx":66
+  /* "splitBBoxLUT.pyx":67
  *                  mask=None,
  *                  mask_checksum=None,
  *                  allow_pos0_neg=False,             # <<<<<<<<<<<<<<
  *                  unit="undefined"):
  * 
  */
-  __pyx_t_6 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_PyBool_FromLong(0); 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_CyFunction_Defaults(__pyx_defaults, __pyx_t_1)->__pyx_arg_allow_pos0_neg = __pyx_t_6;
   __Pyx_GIVEREF(__pyx_t_6);
   __pyx_t_6 = 0;
-  __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_1, __pyx_pf_12splitBBoxLUT_11HistoBBox1d_6__defaults__);
-  if (PyObject_SetItem(__pyx_t_8, __pyx_n_s____init__, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-
-  /* "splitBBoxLUT.pyx":124
- *     @cython.boundscheck(False)
- *     @cython.wraparound(False)
- *     def calc_lut(self):             # <<<<<<<<<<<<<<
- *         'calculate the max number of elements in the LUT and populate it'
- *         cdef float delta=self.delta, pos0_min=self.pos0_min, pos1_min, pos1_max, min0, max0, fbin0_min, fbin0_max, deltaL, deltaR, deltaA
- */
-  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_12splitBBoxLUT_11HistoBBox1d_3calc_lut, 0, __pyx_n_s_60, NULL, __pyx_n_s__splitBBoxLUT, ((PyObject *)__pyx_k_codeobj_59)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetItem(__pyx_t_8, __pyx_n_s__calc_lut, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_1, __pyx_pf_12splitBBoxLUT_11HistoBBox1d_8__defaults__);
+  if (PyObject_SetItem(__pyx_t_8, __pyx_n_s____init__, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "splitBBoxLUT.pyx":257
+  /* "splitBBoxLUT.pyx":116
  *     @cython.boundscheck(False)
  *     @cython.wraparound(False)
- *     def integrate(self, weights, dummy=None, delta_dummy=None, dark=None, flat=None, solidAngle=None, polarization=None):             # <<<<<<<<<<<<<<
- *         """
- *         Actually perform the integration which in this case looks more like a matrix-vector product
+ *     def calc_boundaries(self,pos0Range):             # <<<<<<<<<<<<<<
+ *         cdef int size = self.cpos0.size
+ *         cdef bint check_mask = self.check_mask
  */
-  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_12splitBBoxLUT_11HistoBBox1d_5integrate, 0, __pyx_n_s_64, NULL, __pyx_n_s__splitBBoxLUT, ((PyObject *)__pyx_k_codeobj_62)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_12splitBBoxLUT_11HistoBBox1d_3calc_boundaries, 0, __pyx_n_s_59, NULL, __pyx_n_s__splitBBoxLUT, ((PyObject *)__pyx_k_codeobj_58)); 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_CyFunction_SetDefaultsTuple(__pyx_t_1, ((PyObject *)__pyx_k_tuple_63));
-  if (PyObject_SetItem(__pyx_t_8, __pyx_n_s__integrate, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyObject_SetItem(__pyx_t_8, __pyx_n_s__calc_boundaries, __pyx_t_1) < 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;
 
-  /* "splitBBoxLUT.pyx":54
- *     return (x0 - pos0_min) / delta
- * 
- * class HistoBBox1d(object):             # <<<<<<<<<<<<<<
- *     @cython.boundscheck(False)
- *     def __init__(self,
- */
-  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_INCREF(__pyx_builtin_object);
-  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_builtin_object);
-  __Pyx_GIVEREF(__pyx_builtin_object);
-  __pyx_t_6 = __Pyx_CreateClass(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_8), __pyx_n_s__HistoBBox1d, __pyx_n_s__HistoBBox1d, __pyx_n_s__splitBBoxLUT); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
-  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__HistoBBox1d, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
-
-  /* "splitBBoxLUT.pyx":388
- * ################################################################################
- * 
- * class HistoBBox2d(object):             # <<<<<<<<<<<<<<
- *     @cython.boundscheck(False)
- *     def __init__(self,
- */
-  __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_8));
-
-  /* "splitBBoxLUT.pyx":390
- * class HistoBBox2d(object):
+  /* "splitBBoxLUT.pyx":163
  *     @cython.boundscheck(False)
- *     def __init__(self,             # <<<<<<<<<<<<<<
- *                  pos0,
- *                  delta_pos0,
- */
-  __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_12splitBBoxLUT_11HistoBBox2d_1__init__, 0, __pyx_n_s_67, NULL, __pyx_n_s__splitBBoxLUT, ((PyObject *)__pyx_k_codeobj_66)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
-  if (!__Pyx_CyFunction_InitDefaults(__pyx_t_6, sizeof(__pyx_defaults1), 1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
-  /* "splitBBoxLUT.pyx":400
- *                  mask=None,
- *                  mask_checksum=None,
- *                  allow_pos0_neg=False,             # <<<<<<<<<<<<<<
- *                  unit="undefined"):
- * 
- */
-  __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_t_6)->__pyx_arg_allow_pos0_neg = __pyx_t_1;
-  __Pyx_GIVEREF(__pyx_t_1);
-  __pyx_t_1 = 0;
-  __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_6, __pyx_pf_12splitBBoxLUT_11HistoBBox2d_6__defaults__);
-  if (PyObject_SetItem(__pyx_t_8, __pyx_n_s____init__, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-
-  /* "splitBBoxLUT.pyx":470
  *     @cython.wraparound(False)
- *     @cython.cdivision(True)
  *     def calc_lut(self):             # <<<<<<<<<<<<<<
  *         'calculate the max number of elements in the LUT and populate it'
- *         cdef float delta0=self.delta0, pos0_min=self.pos0_min, min0, max0, fbin0_min, fbin0_max
+ *         cdef float delta=self.delta, pos0_min=self.pos0_min, pos1_min, pos1_max, min0, max0, fbin0_min, fbin0_max, deltaL, deltaR, deltaA
  */
-  __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_12splitBBoxLUT_11HistoBBox2d_3calc_lut, 0, __pyx_n_s_70, NULL, __pyx_n_s__splitBBoxLUT, ((PyObject *)__pyx_k_codeobj_69)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
-  if (PyObject_SetItem(__pyx_t_8, __pyx_n_s__calc_lut, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_12splitBBoxLUT_11HistoBBox1d_5calc_lut, 0, __pyx_n_s_62, NULL, __pyx_n_s__splitBBoxLUT, ((PyObject *)__pyx_k_codeobj_61)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetItem(__pyx_t_8, __pyx_n_s__calc_lut, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "splitBBoxLUT.pyx":685
+  /* "splitBBoxLUT.pyx":296
  *     @cython.boundscheck(False)
  *     @cython.wraparound(False)
  *     def integrate(self, weights, dummy=None, delta_dummy=None, dark=None, flat=None, solidAngle=None, polarization=None):             # <<<<<<<<<<<<<<
  *         """
- *         Actually perform the 2D integration which in this case looks more like a matrix-vector product
- */
-  __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_12splitBBoxLUT_11HistoBBox2d_5integrate, 0, __pyx_n_s_74, NULL, __pyx_n_s__splitBBoxLUT, ((PyObject *)__pyx_k_codeobj_72)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
-  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_6, ((PyObject *)__pyx_k_tuple_73));
-  if (PyObject_SetItem(__pyx_t_8, __pyx_n_s__integrate, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-
-  /* "splitBBoxLUT.pyx":388
- * ################################################################################
- * 
- * class HistoBBox2d(object):             # <<<<<<<<<<<<<<
- *     @cython.boundscheck(False)
- *     def __init__(self,
- */
-  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_6);
-  __Pyx_INCREF(__pyx_builtin_object);
-  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_builtin_object);
-  __Pyx_GIVEREF(__pyx_builtin_object);
-  __pyx_t_1 = __Pyx_CreateClass(((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_8), __pyx_n_s__HistoBBox2d, __pyx_n_s__HistoBBox2d, __pyx_n_s__splitBBoxLUT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__HistoBBox2d, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
-
-  /* "splitBBoxLUT.pyx":817
- * @cython.boundscheck(False)
- * @cython.wraparound(False)
- * def histoBBox2d(numpy.ndarray weights not None,             # <<<<<<<<<<<<<<
- *                 numpy.ndarray pos0 not None,
- *                 numpy.ndarray delta_pos0 not None,
- */
-  __pyx_t_8 = PyCFunction_NewEx(&__pyx_mdef_12splitBBoxLUT_1histoBBox2d, NULL, __pyx_n_s__splitBBoxLUT); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_8);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__histoBBox2d, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-
-  /* "splitBBoxLUT.pyx":1081
- * 
- * 
- * def histoBBox1d(weights ,             # <<<<<<<<<<<<<<
- *                 pos0,
- *                 delta_pos0,
- */
-  __pyx_t_8 = PyCFunction_NewEx(&__pyx_mdef_12splitBBoxLUT_3histoBBox1d, NULL, __pyx_n_s__splitBBoxLUT); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_8);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__histoBBox1d, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-
-  /* "splitBBoxLUT.pyx":1
- * #!/usr/bin/env python             # <<<<<<<<<<<<<<
- * # -*- coding: utf-8 -*-
- * #
- */
-  __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(((PyObject *)__pyx_t_8));
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_8)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
-
-  /* "View.MemoryView":207
- *         info.obj = self
- * 
- *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
- * 
- *     def __dealloc__(array self):
- */
-  __pyx_t_8 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), __pyx_k_79); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_8);
-  if (PyDict_SetItem(__pyx_array_type->tp_dict, __pyx_n_s____pyx_getbuffer, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-  PyType_Modified(__pyx_array_type);
-
-  /* "View.MemoryView":282
- *         return self.name
- * 
- * cdef generic = Enum("<strided and direct or indirect>")             # <<<<<<<<<<<<<<
- * cdef strided = Enum("<strided and direct>") # default
- * cdef indirect = Enum("<strided and indirect>")
- */
-  __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_81), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_8);
-  __Pyx_XGOTREF(generic);
-  __Pyx_DECREF(generic);
-  __Pyx_GIVEREF(__pyx_t_8);
-  generic = __pyx_t_8;
-  __pyx_t_8 = 0;
-
-  /* "View.MemoryView":283
- * 
- * cdef generic = Enum("<strided and direct or indirect>")
- * cdef strided = Enum("<strided and direct>") # default             # <<<<<<<<<<<<<<
- * cdef indirect = Enum("<strided and indirect>")
- * 
- */
-  __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_83), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_8);
-  __Pyx_XGOTREF(strided);
-  __Pyx_DECREF(strided);
-  __Pyx_GIVEREF(__pyx_t_8);
-  strided = __pyx_t_8;
-  __pyx_t_8 = 0;
-
-  /* "View.MemoryView":284
- * cdef generic = Enum("<strided and direct or indirect>")
- * cdef strided = Enum("<strided and direct>") # default
- * cdef indirect = Enum("<strided and indirect>")             # <<<<<<<<<<<<<<
- * 
- * 
- */
-  __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_85), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_8);
-  __Pyx_XGOTREF(indirect);
-  __Pyx_DECREF(indirect);
-  __Pyx_GIVEREF(__pyx_t_8);
-  indirect = __pyx_t_8;
-  __pyx_t_8 = 0;
-
-  /* "View.MemoryView":287
- * 
- * 
- * cdef contiguous = Enum("<contiguous and direct>")             # <<<<<<<<<<<<<<
- * cdef indirect_contiguous = Enum("<contiguous and indirect>")
- * 
- */
-  __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_87), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_8);
-  __Pyx_XGOTREF(contiguous);
-  __Pyx_DECREF(contiguous);
-  __Pyx_GIVEREF(__pyx_t_8);
-  contiguous = __pyx_t_8;
-  __pyx_t_8 = 0;
-
-  /* "View.MemoryView":288
- * 
- * cdef contiguous = Enum("<contiguous and direct>")
- * cdef indirect_contiguous = Enum("<contiguous and indirect>")             # <<<<<<<<<<<<<<
- * 
- * 
+ *         Actually perform the integration which in this case looks more like a matrix-vector product
  */
-  __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_89), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_8);
-  __Pyx_XGOTREF(indirect_contiguous);
-  __Pyx_DECREF(indirect_contiguous);
-  __Pyx_GIVEREF(__pyx_t_8);
-  indirect_contiguous = __pyx_t_8;
-  __pyx_t_8 = 0;
+  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_12splitBBoxLUT_11HistoBBox1d_7integrate, 0, __pyx_n_s_66, NULL, __pyx_n_s__splitBBoxLUT, ((PyObject *)__pyx_k_codeobj_64)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, ((PyObject *)__pyx_k_tuple_65));
+  if (PyObject_SetItem(__pyx_t_8, __pyx_n_s__integrate, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-  /* "View.MemoryView":503
- *         info.obj = self
- * 
- *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
- * 
+  /* "splitBBoxLUT.pyx":55
+ *     return (x0 - pos0_min) / delta
  * 
+ * class HistoBBox1d(object):             # <<<<<<<<<<<<<<
+ *     @cython.boundscheck(False)
+ *     def __init__(self,
  */
-  __pyx_t_8 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), __pyx_k_79); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_8);
-  if (PyDict_SetItem(__pyx_memoryview_type->tp_dict, __pyx_n_s____pyx_getbuffer, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-  PyType_Modified(__pyx_memoryview_type);
+  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_INCREF(__pyx_builtin_object);
+  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_builtin_object);
+  __Pyx_GIVEREF(__pyx_builtin_object);
+  __pyx_t_6 = __Pyx_CreateClass(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_8), __pyx_n_s__HistoBBox1d, __pyx_n_s__HistoBBox1d, __pyx_n_s__splitBBoxLUT); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_6);
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s__HistoBBox1d, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
 
-  /* "View.MemoryView":958
- *             return self.from_object
- * 
- *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
- * 
+  /* "splitBBoxLUT.pyx":427
+ * ################################################################################
  * 
+ * class HistoBBox2d(object):             # <<<<<<<<<<<<<<
+ *     @cython.boundscheck(False)
+ *     def __init__(self,
  */
-  __pyx_t_8 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), __pyx_k_79); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_8);
-  if (PyDict_SetItem(__pyx_memoryviewslice_type->tp_dict, __pyx_n_s____pyx_getbuffer, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-  PyType_Modified(__pyx_memoryviewslice_type);
+  __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_8));
 
-  /* "View.MemoryView":1365
- * 
- * @cname('__pyx_memoryview__slice_assign_scalar')
- * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
- *                               Py_ssize_t *strides, int ndim,
- *                               size_t itemsize, void *item) nogil:
+  /* "splitBBoxLUT.pyx":429
+ * class HistoBBox2d(object):
+ *     @cython.boundscheck(False)
+ *     def __init__(self,             # <<<<<<<<<<<<<<
+ *                  pos0,
+ *                  delta_pos0,
  */
-  goto __pyx_L0;
-  __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_5);
-  __Pyx_XDECREF(__pyx_t_6);
-  __Pyx_XDECREF(__pyx_t_7);
-  __Pyx_XDECREF(__pyx_t_8);
-  if (__pyx_m) {
-    __Pyx_AddTraceback("init splitBBoxLUT", __pyx_clineno, __pyx_lineno, __pyx_filename);
-    Py_DECREF(__pyx_m); __pyx_m = 0;
-  } else if (!PyErr_Occurred()) {
-    PyErr_SetString(PyExc_ImportError, "init splitBBoxLUT");
-  }
-  __pyx_L0:;
-  __Pyx_RefNannyFinishContext();
-  #if PY_MAJOR_VERSION < 3
-  return;
-  #else
-  return __pyx_m;
-  #endif
-}
-
-/* Runtime support code */
-#if CYTHON_REFNANNY
-static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
-    PyObject *m = NULL, *p = NULL;
-    void *r = NULL;
-    m = PyImport_ImportModule((char *)modname);
-    if (!m) goto end;
-    p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
-    if (!p) goto end;
-    r = PyLong_AsVoidPtr(p);
-end:
-    Py_XDECREF(p);
-    Py_XDECREF(m);
-    return (__Pyx_RefNannyAPIStruct *)r;
-}
-#endif /* CYTHON_REFNANNY */
+  __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_12splitBBoxLUT_11HistoBBox2d_1__init__, 0, __pyx_n_s_69, NULL, __pyx_n_s__splitBBoxLUT, ((PyObject *)__pyx_k_codeobj_68)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_6);
+  if (!__Pyx_CyFunction_InitDefaults(__pyx_t_6, sizeof(__pyx_defaults1), 2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
-static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
-    PyObject *result;
-    result = PyObject_GetAttr(dict, name);
-    if (!result) {
-        if (dict != __pyx_b) {
-            PyErr_Clear();
-            result = PyObject_GetAttr(__pyx_b, name);
-        }
-        if (!result) {
-            PyErr_SetObject(PyExc_NameError, name);
-        }
-    }
-    return result;
-}
+  /* "splitBBoxLUT.pyx":439
+ *                  mask=None,
+ *                  mask_checksum=None,
+ *                  allow_pos0_neg=False,             # <<<<<<<<<<<<<<
+ *                  unit="undefined",
+ *                  chiDiscAtPi=True
+ */
+  __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_t_6)->__pyx_arg_allow_pos0_neg = __pyx_t_1;
+  __Pyx_GIVEREF(__pyx_t_1);
+  __pyx_t_1 = 0;
 
-static void __Pyx_RaiseArgtupleInvalid(
-    const char* func_name,
-    int exact,
-    Py_ssize_t num_min,
-    Py_ssize_t num_max,
-    Py_ssize_t num_found)
-{
-    Py_ssize_t num_expected;
-    const char *more_or_less;
-    if (num_found < num_min) {
-        num_expected = num_min;
-        more_or_less = "at least";
-    } else {
-        num_expected = num_max;
-        more_or_less = "at most";
-    }
-    if (exact) {
-        more_or_less = "exactly";
-    }
-    PyErr_Format(PyExc_TypeError,
-                 "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)",
-                 func_name, more_or_less, num_expected,
-                 (num_expected == 1) ? "" : "s", num_found);
-}
+  /* "splitBBoxLUT.pyx":441
+ *                  allow_pos0_neg=False,
+ *                  unit="undefined",
+ *                  chiDiscAtPi=True             # <<<<<<<<<<<<<<
+ *                  ):
+ *         """
+ */
+  __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_t_6)->__pyx_arg_chiDiscAtPi = __pyx_t_1;
+  __Pyx_GIVEREF(__pyx_t_1);
+  __pyx_t_1 = 0;
+  __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_6, __pyx_pf_12splitBBoxLUT_11HistoBBox2d_8__defaults__);
+  if (PyObject_SetItem(__pyx_t_8, __pyx_n_s____init__, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
 
-static void __Pyx_RaiseDoubleKeywordsError(
-    const char* func_name,
-    PyObject* kw_name)
-{
-    PyErr_Format(PyExc_TypeError,
-        #if PY_MAJOR_VERSION >= 3
-        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
-        #else
-        "%s() got multiple values for keyword argument '%s'", func_name,
-        PyString_AsString(kw_name));
-        #endif
-}
+  /* "splitBBoxLUT.pyx":508
+ *     @cython.boundscheck(False)
+ *     @cython.wraparound(False)
+ *     def calc_boundaries(self, pos0Range, pos1Range):             # <<<<<<<<<<<<<<
+ *         cdef int size = self.cpos0.size
+ *         cdef bint check_mask = self.check_mask
+ */
+  __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_12splitBBoxLUT_11HistoBBox2d_3calc_boundaries, 0, __pyx_n_s_72, NULL, __pyx_n_s__splitBBoxLUT, ((PyObject *)__pyx_k_codeobj_71)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_6);
+  if (PyObject_SetItem(__pyx_t_8, __pyx_n_s__calc_boundaries, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
 
-static int __Pyx_ParseOptionalKeywords(
-    PyObject *kwds,
-    PyObject **argnames[],
-    PyObject *kwds2,
-    PyObject *values[],
-    Py_ssize_t num_pos_args,
-    const char* function_name)
-{
-    PyObject *key = 0, *value = 0;
-    Py_ssize_t pos = 0;
-    PyObject*** name;
-    PyObject*** first_kw_arg = argnames + num_pos_args;
-    while (PyDict_Next(kwds, &pos, &key, &value)) {
-        name = first_kw_arg;
-        while (*name && (**name != key)) name++;
-        if (*name) {
-            values[name-argnames] = value;
-            continue;
-        }
-        name = first_kw_arg;
-        #if PY_MAJOR_VERSION < 3
-        if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
-            while (*name) {
-                if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
-                        && _PyString_Eq(**name, key)) {
-                    values[name-argnames] = value;
-                    break;
-                }
-                name++;
-            }
-            if (*name) continue;
-            else {
-                PyObject*** argname = argnames;
-                while (argname != first_kw_arg) {
-                    if ((**argname == key) || (
-                            (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
-                             && _PyString_Eq(**argname, key))) {
-                        goto arg_passed_twice;
-                    }
-                    argname++;
-                }
-            }
-        } else
-        #endif
-        if (likely(PyUnicode_Check(key))) {
-            while (*name) {
-                int cmp = (**name == key) ? 0 :
-                #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
-                    (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
-                #endif
-                    PyUnicode_Compare(**name, key);
-                if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
-                if (cmp == 0) {
-                    values[name-argnames] = value;
-                    break;
-                }
-                name++;
-            }
-            if (*name) continue;
-            else {
-                PyObject*** argname = argnames;
-                while (argname != first_kw_arg) {
-                    int cmp = (**argname == key) ? 0 :
-                    #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
-                        (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
-                    #endif
-                        PyUnicode_Compare(**argname, key);
-                    if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
-                    if (cmp == 0) goto arg_passed_twice;
-                    argname++;
-                }
-            }
-        } else
-            goto invalid_keyword_type;
-        if (kwds2) {
-            if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
-        } else {
-            goto invalid_keyword;
-        }
-    }
-    return 0;
-arg_passed_twice:
-    __Pyx_RaiseDoubleKeywordsError(function_name, key);
-    goto bad;
-invalid_keyword_type:
-    PyErr_Format(PyExc_TypeError,
-        "%s() keywords must be strings", function_name);
-    goto bad;
-invalid_keyword:
-    PyErr_Format(PyExc_TypeError,
-    #if PY_MAJOR_VERSION < 3
-        "%s() got an unexpected keyword argument '%s'",
-        function_name, PyString_AsString(key));
-    #else
-        "%s() got an unexpected keyword argument '%U'",
-        function_name, key);
-    #endif
-bad:
-    return -1;
-}
+  /* "splitBBoxLUT.pyx":592
+ *     @cython.wraparound(False)
+ *     @cython.cdivision(True)
+ *     def calc_lut(self):             # <<<<<<<<<<<<<<
+ *         'calculate the max number of elements in the LUT and populate it'
+ *         cdef float delta0=self.delta0, pos0_min=self.pos0_min, min0, max0, fbin0_min, fbin0_max
+ */
+  __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_12splitBBoxLUT_11HistoBBox2d_5calc_lut, 0, __pyx_n_s_75, NULL, __pyx_n_s__splitBBoxLUT, ((PyObject *)__pyx_k_codeobj_74)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_6);
+  if (PyObject_SetItem(__pyx_t_8, __pyx_n_s__calc_lut, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
 
-static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
-    if (unlikely(!type)) {
-        PyErr_Format(PyExc_SystemError, "Missing type object");
-        return 0;
-    }
-    if (likely(PyObject_TypeCheck(obj, type)))
-        return 1;
-    PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
-                 Py_TYPE(obj)->tp_name, type->tp_name);
-    return 0;
-}
+  /* "splitBBoxLUT.pyx":807
+ *     @cython.boundscheck(False)
+ *     @cython.wraparound(False)
+ *     def integrate(self, weights, dummy=None, delta_dummy=None, dark=None, flat=None, solidAngle=None, polarization=None):             # <<<<<<<<<<<<<<
+ *         """
+ *         Actually perform the 2D integration which in this case looks more like a matrix-vector product
+ */
+  __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_12splitBBoxLUT_11HistoBBox2d_7integrate, 0, __pyx_n_s_79, NULL, __pyx_n_s__splitBBoxLUT, ((PyObject *)__pyx_k_codeobj_77)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_6);
+  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_6, ((PyObject *)__pyx_k_tuple_78));
+  if (PyObject_SetItem(__pyx_t_8, __pyx_n_s__integrate, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
 
-static CYTHON_INLINE int __Pyx_IsLittleEndian(void) {
-  unsigned int n = 1;
-  return *(unsigned char*)(&n) != 0;
-}
-static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
-                              __Pyx_BufFmt_StackElem* stack,
-                              __Pyx_TypeInfo* type) {
-  stack[0].field = &ctx->root;
-  stack[0].parent_offset = 0;
-  ctx->root.type = type;
-  ctx->root.name = "buffer dtype";
-  ctx->root.offset = 0;
-  ctx->head = stack;
-  ctx->head->field = &ctx->root;
-  ctx->fmt_offset = 0;
-  ctx->head->parent_offset = 0;
-  ctx->new_packmode = '@';
-  ctx->enc_packmode = '@';
-  ctx->new_count = 1;
-  ctx->enc_count = 0;
-  ctx->enc_type = 0;
-  ctx->is_complex = 0;
-  ctx->is_valid_array = 0;
-  ctx->struct_alignment = 0;
-  while (type->typegroup == 'S') {
-    ++ctx->head;
-    ctx->head->field = type->fields;
-    ctx->head->parent_offset = 0;
-    type = type->fields->type;
-  }
-}
-static int __Pyx_BufFmt_ParseNumber(const char** ts) {
-    int count;
-    const char* t = *ts;
-    if (*t < '0' || *t > '9') {
-      return -1;
-    } else {
-        count = *t++ - '0';
-        while (*t >= '0' && *t < '9') {
-            count *= 10;
-            count += *t++ - '0';
-        }
-    }
-    *ts = t;
-    return count;
-}
-static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
-    int number = __Pyx_BufFmt_ParseNumber(ts);
-    if (number == -1) /* First char was not a digit */
-        PyErr_Format(PyExc_ValueError,\
-                     "Does not understand character buffer dtype format string ('%c')", **ts);
-    return number;
-}
-static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
-  PyErr_Format(PyExc_ValueError,
-               "Unexpected format string character: '%c'", ch);
-}
-static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
-  switch (ch) {
-    case 'c': return "'char'";
-    case 'b': return "'signed char'";
-    case 'B': return "'unsigned char'";
-    case 'h': return "'short'";
-    case 'H': return "'unsigned short'";
-    case 'i': return "'int'";
-    case 'I': return "'unsigned int'";
-    case 'l': return "'long'";
-    case 'L': return "'unsigned long'";
-    case 'q': return "'long long'";
-    case 'Q': return "'unsigned long long'";
-    case 'f': return (is_complex ? "'complex float'" : "'float'");
-    case 'd': return (is_complex ? "'complex double'" : "'double'");
-    case 'g': return (is_complex ? "'complex long double'" : "'long double'");
-    case 'T': return "a struct";
-    case 'O': return "Python object";
-    case 'P': return "a pointer";
-    case 's': case 'p': return "a string";
-    case 0: return "end";
-    default: return "unparseable format string";
-  }
-}
-static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
-  switch (ch) {
-    case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
-    case 'h': case 'H': return 2;
-    case 'i': case 'I': case 'l': case 'L': return 4;
-    case 'q': case 'Q': return 8;
-    case 'f': return (is_complex ? 8 : 4);
-    case 'd': return (is_complex ? 16 : 8);
-    case 'g': {
-      PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
-      return 0;
-    }
-    case 'O': case 'P': return sizeof(void*);
-    default:
-      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
-      return 0;
-    }
-}
-static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
-  switch (ch) {
-    case 'c': case 'b': case 'B': case 's': case 'p': return 1;
-    case 'h': case 'H': return sizeof(short);
-    case 'i': case 'I': return sizeof(int);
-    case 'l': case 'L': return sizeof(long);
-    #ifdef HAVE_LONG_LONG
-    case 'q': case 'Q': return sizeof(PY_LONG_LONG);
-    #endif
-    case 'f': return sizeof(float) * (is_complex ? 2 : 1);
-    case 'd': return sizeof(double) * (is_complex ? 2 : 1);
-    case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
-    case 'O': case 'P': return sizeof(void*);
-    default: {
-      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
-      return 0;
-    }
-  }
-}
-typedef struct { char c; short x; } __Pyx_st_short;
-typedef struct { char c; int x; } __Pyx_st_int;
-typedef struct { char c; long x; } __Pyx_st_long;
-typedef struct { char c; float x; } __Pyx_st_float;
-typedef struct { char c; double x; } __Pyx_st_double;
-typedef struct { char c; long double x; } __Pyx_st_longdouble;
-typedef struct { char c; void *x; } __Pyx_st_void_p;
-#ifdef HAVE_LONG_LONG
-typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
-#endif
-static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
-  switch (ch) {
-    case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
-    case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
-    case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
-    case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
-#ifdef HAVE_LONG_LONG
-    case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
-#endif
-    case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
-    case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
-    case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
-    case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
-    default:
-      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
-      return 0;
-    }
-}
-/* These are for computing the padding at the end of the struct to align
-   on the first member of the struct. This will probably the same as above,
-   but we don't have any guarantees.
+  /* "splitBBoxLUT.pyx":427
+ * ################################################################################
+ * 
+ * class HistoBBox2d(object):             # <<<<<<<<<<<<<<
+ *     @cython.boundscheck(False)
+ *     def __init__(self,
+ */
+  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_6);
+  __Pyx_INCREF(__pyx_builtin_object);
+  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_builtin_object);
+  __Pyx_GIVEREF(__pyx_builtin_object);
+  __pyx_t_1 = __Pyx_CreateClass(((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_8), __pyx_n_s__HistoBBox2d, __pyx_n_s__HistoBBox2d, __pyx_n_s__splitBBoxLUT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s__HistoBBox2d, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
+
+  /* "splitBBoxLUT.pyx":1
+ * #!/usr/bin/env python             # <<<<<<<<<<<<<<
+ * # -*- coding: utf-8 -*-
+ * #
+ */
+  __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_8));
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s____test__, ((PyObject *)__pyx_t_8)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
+
+  /* "View.MemoryView":207
+ *         info.obj = self
+ * 
+ *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
+ * 
+ *     def __dealloc__(array self):
+ */
+  __pyx_t_8 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), __pyx_k_80); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_8);
+  if (PyDict_SetItem(__pyx_array_type->tp_dict, __pyx_n_s____pyx_getbuffer, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+  PyType_Modified(__pyx_array_type);
+
+  /* "View.MemoryView":282
+ *         return self.name
+ * 
+ * cdef generic = Enum("<strided and direct or indirect>")             # <<<<<<<<<<<<<<
+ * cdef strided = Enum("<strided and direct>") # default
+ * cdef indirect = Enum("<strided and indirect>")
+ */
+  __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_82), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_8);
+  __Pyx_XGOTREF(generic);
+  __Pyx_DECREF_SET(generic, __pyx_t_8);
+  __Pyx_GIVEREF(__pyx_t_8);
+  __pyx_t_8 = 0;
+
+  /* "View.MemoryView":283
+ * 
+ * cdef generic = Enum("<strided and direct or indirect>")
+ * cdef strided = Enum("<strided and direct>") # default             # <<<<<<<<<<<<<<
+ * cdef indirect = Enum("<strided and indirect>")
+ * 
+ */
+  __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_84), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_8);
+  __Pyx_XGOTREF(strided);
+  __Pyx_DECREF_SET(strided, __pyx_t_8);
+  __Pyx_GIVEREF(__pyx_t_8);
+  __pyx_t_8 = 0;
+
+  /* "View.MemoryView":284
+ * cdef generic = Enum("<strided and direct or indirect>")
+ * cdef strided = Enum("<strided and direct>") # default
+ * cdef indirect = Enum("<strided and indirect>")             # <<<<<<<<<<<<<<
+ * 
+ * 
+ */
+  __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_86), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_8);
+  __Pyx_XGOTREF(indirect);
+  __Pyx_DECREF_SET(indirect, __pyx_t_8);
+  __Pyx_GIVEREF(__pyx_t_8);
+  __pyx_t_8 = 0;
+
+  /* "View.MemoryView":287
+ * 
+ * 
+ * cdef contiguous = Enum("<contiguous and direct>")             # <<<<<<<<<<<<<<
+ * cdef indirect_contiguous = Enum("<contiguous and indirect>")
+ * 
+ */
+  __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_88), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_8);
+  __Pyx_XGOTREF(contiguous);
+  __Pyx_DECREF_SET(contiguous, __pyx_t_8);
+  __Pyx_GIVEREF(__pyx_t_8);
+  __pyx_t_8 = 0;
+
+  /* "View.MemoryView":288
+ * 
+ * cdef contiguous = Enum("<contiguous and direct>")
+ * cdef indirect_contiguous = Enum("<contiguous and indirect>")             # <<<<<<<<<<<<<<
+ * 
+ * 
  */
-typedef struct { short x; char c; } __Pyx_pad_short;
-typedef struct { int x; char c; } __Pyx_pad_int;
-typedef struct { long x; char c; } __Pyx_pad_long;
-typedef struct { float x; char c; } __Pyx_pad_float;
-typedef struct { double x; char c; } __Pyx_pad_double;
-typedef struct { long double x; char c; } __Pyx_pad_longdouble;
-typedef struct { void *x; char c; } __Pyx_pad_void_p;
-#ifdef HAVE_LONG_LONG
-typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
-#endif
-static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
-  switch (ch) {
-    case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
-    case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
-    case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
-    case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
-#ifdef HAVE_LONG_LONG
-    case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
-#endif
-    case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
-    case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
-    case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
-    case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
-    default:
-      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
-      return 0;
-    }
-}
-static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
-  switch (ch) {
-    case 'c':
-        return 'H';
-    case 'b': case 'h': case 'i':
-    case 'l': case 'q': case 's': case 'p':
-        return 'I';
-    case 'B': case 'H': case 'I': case 'L': case 'Q':
-        return 'U';
-    case 'f': case 'd': case 'g':
-        return (is_complex ? 'C' : 'R');
-    case 'O':
-        return 'O';
-    case 'P':
-        return 'P';
-    default: {
-      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
-      return 0;
-    }
+  __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_90), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_8);
+  __Pyx_XGOTREF(indirect_contiguous);
+  __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_8);
+  __Pyx_GIVEREF(__pyx_t_8);
+  __pyx_t_8 = 0;
+
+  /* "View.MemoryView":503
+ *         info.obj = self
+ * 
+ *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
+ * 
+ * 
+ */
+  __pyx_t_8 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), __pyx_k_80); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_8);
+  if (PyDict_SetItem(__pyx_memoryview_type->tp_dict, __pyx_n_s____pyx_getbuffer, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+  PyType_Modified(__pyx_memoryview_type);
+
+  /* "View.MemoryView":958
+ *             return self.from_object
+ * 
+ *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
+ * 
+ * 
+ */
+  __pyx_t_8 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), __pyx_k_80); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_8);
+  if (PyDict_SetItem(__pyx_memoryviewslice_type->tp_dict, __pyx_n_s____pyx_getbuffer, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+  PyType_Modified(__pyx_memoryviewslice_type);
+
+  /* "View.MemoryView":1365
+ * 
+ * @cname('__pyx_memoryview__slice_assign_scalar')
+ * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
+ *                               Py_ssize_t *strides, int ndim,
+ *                               size_t itemsize, void *item) nogil:
+ */
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_XDECREF(__pyx_t_5);
+  __Pyx_XDECREF(__pyx_t_6);
+  __Pyx_XDECREF(__pyx_t_7);
+  __Pyx_XDECREF(__pyx_t_8);
+  if (__pyx_m) {
+    __Pyx_AddTraceback("init splitBBoxLUT", __pyx_clineno, __pyx_lineno, __pyx_filename);
+    Py_DECREF(__pyx_m); __pyx_m = 0;
+  } else if (!PyErr_Occurred()) {
+    PyErr_SetString(PyExc_ImportError, "init splitBBoxLUT");
   }
+  __pyx_L0:;
+  __Pyx_RefNannyFinishContext();
+  #if PY_MAJOR_VERSION < 3
+  return;
+  #else
+  return __pyx_m;
+  #endif
 }
-static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
-  if (ctx->head == NULL || ctx->head->field == &ctx->root) {
-    const char* expected;
-    const char* quote;
-    if (ctx->head == NULL) {
-      expected = "end";
-      quote = "";
-    } else {
-      expected = ctx->head->field->type->name;
-      quote = "'";
-    }
-    PyErr_Format(PyExc_ValueError,
-                 "Buffer dtype mismatch, expected %s%s%s but got %s",
-                 quote, expected, quote,
-                 __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
-  } else {
-    __Pyx_StructField* field = ctx->head->field;
-    __Pyx_StructField* parent = (ctx->head - 1)->field;
-    PyErr_Format(PyExc_ValueError,
-                 "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
-                 field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
-                 parent->type->name, field->name);
-  }
+
+/* Runtime support code */
+#if CYTHON_REFNANNY
+static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
+    PyObject *m = NULL, *p = NULL;
+    void *r = NULL;
+    m = PyImport_ImportModule((char *)modname);
+    if (!m) goto end;
+    p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
+    if (!p) goto end;
+    r = PyLong_AsVoidPtr(p);
+end:
+    Py_XDECREF(p);
+    Py_XDECREF(m);
+    return (__Pyx_RefNannyAPIStruct *)r;
 }
-static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
-  char group;
-  size_t size, offset, arraysize = 1;
-  if (ctx->enc_type == 0) return 0;
-  if (ctx->head->field->type->arraysize[0]) {
-    int i, ndim = 0;
-    if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
-        ctx->is_valid_array = ctx->head->field->type->ndim == 1;
-        ndim = 1;
-        if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
-            PyErr_Format(PyExc_ValueError,
-                         "Expected a dimension of size %zu, got %zu",
-                         ctx->head->field->type->arraysize[0], ctx->enc_count);
-            return -1;
-        }
-    }
-    if (!ctx->is_valid_array) {
-      PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
-                   ctx->head->field->type->ndim, ndim);
-      return -1;
-    }
-    for (i = 0; i < ctx->head->field->type->ndim; i++) {
-      arraysize *= ctx->head->field->type->arraysize[i];
-    }
-    ctx->is_valid_array = 0;
-    ctx->enc_count = 1;
-  }
-  group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
-  do {
-    __Pyx_StructField* field = ctx->head->field;
-    __Pyx_TypeInfo* type = field->type;
-    if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
-      size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
-    } else {
-      size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
-    }
-    if (ctx->enc_packmode == '@') {
-      size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
-      size_t align_mod_offset;
-      if (align_at == 0) return -1;
-      align_mod_offset = ctx->fmt_offset % align_at;
-      if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
-      if (ctx->struct_alignment == 0)
-          ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
-                                                                 ctx->is_complex);
-    }
-    if (type->size != size || type->typegroup != group) {
-      if (type->typegroup == 'C' && type->fields != NULL) {
-        size_t parent_offset = ctx->head->parent_offset + field->offset;
-        ++ctx->head;
-        ctx->head->field = type->fields;
-        ctx->head->parent_offset = parent_offset;
-        continue;
-      }
-      if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
-      } else {
-          __Pyx_BufFmt_RaiseExpected(ctx);
-          return -1;
-      }
-    }
-    offset = ctx->head->parent_offset + field->offset;
-    if (ctx->fmt_offset != offset) {
-      PyErr_Format(PyExc_ValueError,
-                   "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
-                   (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
-      return -1;
-    }
-    ctx->fmt_offset += size;
-    if (arraysize)
-      ctx->fmt_offset += (arraysize - 1) * size;
-    --ctx->enc_count; /* Consume from buffer string */
-    while (1) {
-      if (field == &ctx->root) {
-        ctx->head = NULL;
-        if (ctx->enc_count != 0) {
-          __Pyx_BufFmt_RaiseExpected(ctx);
-          return -1;
-        }
-        break; /* breaks both loops as ctx->enc_count == 0 */
-      }
-      ctx->head->field = ++field;
-      if (field->type == NULL) {
-        --ctx->head;
-        field = ctx->head->field;
-        continue;
-      } else if (field->type->typegroup == 'S') {
-        size_t parent_offset = ctx->head->parent_offset + field->offset;
-        if (field->type->fields->type == NULL) continue; /* empty struct */
-        field = field->type->fields;
-        ++ctx->head;
-        ctx->head->field = field;
-        ctx->head->parent_offset = parent_offset;
-        break;
-      } else {
-        break;
-      }
+#endif /* CYTHON_REFNANNY */
+
+static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
+    PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
+    if (unlikely(!result)) {
+        PyErr_Format(PyExc_NameError,
+#if PY_MAJOR_VERSION >= 3
+            "name '%U' is not defined", name);
+#else
+            "name '%s' is not defined", PyString_AS_STRING(name));
+#endif
     }
-  } while (ctx->enc_count);
-  ctx->enc_type = 0;
-  ctx->is_complex = 0;
-  return 0;
+    return result;
 }
-static CYTHON_INLINE PyObject *
-__pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
+
+static void __Pyx_RaiseArgtupleInvalid(
+    const char* func_name,
+    int exact,
+    Py_ssize_t num_min,
+    Py_ssize_t num_max,
+    Py_ssize_t num_found)
 {
-    const char *ts = *tsp;
-    int i = 0, number;
-    int ndim = ctx->head->field->type->ndim;
-;
-    ++ts;
-    if (ctx->new_count != 1) {
-        PyErr_SetString(PyExc_ValueError,
-                        "Cannot handle repeated arrays in format string");
-        return NULL;
-    }
-    if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
-    while (*ts && *ts != ')') {
-        if (isspace(*ts))
-            continue;
-        number = __Pyx_BufFmt_ExpectNumber(&ts);
-        if (number == -1) return NULL;
-        if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i])
-            return PyErr_Format(PyExc_ValueError,
-                        "Expected a dimension of size %zu, got %d",
-                        ctx->head->field->type->arraysize[i], number);
-        if (*ts != ',' && *ts != ')')
-            return PyErr_Format(PyExc_ValueError,
-                                "Expected a comma in format string, got '%c'", *ts);
-        if (*ts == ',') ts++;
-        i++;
+    Py_ssize_t num_expected;
+    const char *more_or_less;
+    if (num_found < num_min) {
+        num_expected = num_min;
+        more_or_less = "at least";
+    } else {
+        num_expected = num_max;
+        more_or_less = "at most";
     }
-    if (i != ndim)
-        return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
-                            ctx->head->field->type->ndim, i);
-    if (!*ts) {
-        PyErr_SetString(PyExc_ValueError,
-                        "Unexpected end of format string, expected ')'");
-        return NULL;
+    if (exact) {
+        more_or_less = "exactly";
     }
-    ctx->is_valid_array = 1;
-    ctx->new_count = 1;
-    *tsp = ++ts;
-    return Py_None;
+    PyErr_Format(PyExc_TypeError,
+                 "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)",
+                 func_name, more_or_less, num_expected,
+                 (num_expected == 1) ? "" : "s", num_found);
 }
-static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
-  int got_Z = 0;
-  while (1) {
-    switch(*ts) {
-      case 0:
-        if (ctx->enc_type != 0 && ctx->head == NULL) {
-          __Pyx_BufFmt_RaiseExpected(ctx);
-          return NULL;
-        }
-        if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
-        if (ctx->head != NULL) {
-          __Pyx_BufFmt_RaiseExpected(ctx);
-          return NULL;
-        }
-                return ts;
-      case ' ':
-      case 10:
-      case 13:
-        ++ts;
-        break;
-      case '<':
-        if (!__Pyx_IsLittleEndian()) {
-          PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
-          return NULL;
-        }
-        ctx->new_packmode = '=';
-        ++ts;
-        break;
-      case '>':
-      case '!':
-        if (__Pyx_IsLittleEndian()) {
-          PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
-          return NULL;
-        }
-        ctx->new_packmode = '=';
-        ++ts;
-        break;
-      case '=':
-      case '@':
-      case '^':
-        ctx->new_packmode = *ts++;
-        break;
-      case 'T': /* substruct */
-        {
-          const char* ts_after_sub;
-          size_t i, struct_count = ctx->new_count;
-          size_t struct_alignment = ctx->struct_alignment;
-          ctx->new_count = 1;
-          ++ts;
-          if (*ts != '{') {
-            PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
-            return NULL;
-          }
-          if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
-          ctx->enc_type = 0; /* Erase processed last struct element */
-          ctx->enc_count = 0;
-          ctx->struct_alignment = 0;
-          ++ts;
-          ts_after_sub = ts;
-          for (i = 0; i != struct_count; ++i) {
-            ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
-            if (!ts_after_sub) return NULL;
-          }
-          ts = ts_after_sub;
-          if (struct_alignment) ctx->struct_alignment = struct_alignment;
-        }
-        break;
-      case '}': /* end of substruct; either repeat or move on */
-        {
-          size_t alignment = ctx->struct_alignment;
-          ++ts;
-          if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
-          ctx->enc_type = 0; /* Erase processed last struct element */
-          if (alignment && ctx->fmt_offset % alignment) {
-            ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
-          }
-        }
-        return ts;
-      case 'x':
-        if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
-        ctx->fmt_offset += ctx->new_count;
-        ctx->new_count = 1;
-        ctx->enc_count = 0;
-        ctx->enc_type = 0;
-        ctx->enc_packmode = ctx->new_packmode;
-        ++ts;
-        break;
-      case 'Z':
-        got_Z = 1;
-        ++ts;
-        if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
-          __Pyx_BufFmt_RaiseUnexpectedChar('Z');
-          return NULL;
-        }        /* fall through */
-      case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
-      case 'l': case 'L': case 'q': case 'Q':
-      case 'f': case 'd': case 'g':
-      case 'O': case 's': case 'p':
-        if (ctx->enc_type == *ts && got_Z == ctx->is_complex &&
-            ctx->enc_packmode == ctx->new_packmode) {
-          ctx->enc_count += ctx->new_count;
-        } else {
-          if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
-          ctx->enc_count = ctx->new_count;
-          ctx->enc_packmode = ctx->new_packmode;
-          ctx->enc_type = *ts;
-          ctx->is_complex = got_Z;
+
+static void __Pyx_RaiseDoubleKeywordsError(
+    const char* func_name,
+    PyObject* kw_name)
+{
+    PyErr_Format(PyExc_TypeError,
+        #if PY_MAJOR_VERSION >= 3
+        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
+        #else
+        "%s() got multiple values for keyword argument '%s'", func_name,
+        PyString_AsString(kw_name));
+        #endif
+}
+
+static int __Pyx_ParseOptionalKeywords(
+    PyObject *kwds,
+    PyObject **argnames[],
+    PyObject *kwds2,
+    PyObject *values[],
+    Py_ssize_t num_pos_args,
+    const char* function_name)
+{
+    PyObject *key = 0, *value = 0;
+    Py_ssize_t pos = 0;
+    PyObject*** name;
+    PyObject*** first_kw_arg = argnames + num_pos_args;
+    while (PyDict_Next(kwds, &pos, &key, &value)) {
+        name = first_kw_arg;
+        while (*name && (**name != key)) name++;
+        if (*name) {
+            values[name-argnames] = value;
+            continue;
         }
-        ++ts;
-        ctx->new_count = 1;
-        got_Z = 0;
-        break;
-      case ':':
-        ++ts;
-        while(*ts != ':') ++ts;
-        ++ts;
-        break;
-      case '(':
-        if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
-        break;
-      default:
-        {
-          int number = __Pyx_BufFmt_ExpectNumber(&ts);
-          if (number == -1) return NULL;
-          ctx->new_count = (size_t)number;
+        name = first_kw_arg;
+        #if PY_MAJOR_VERSION < 3
+        if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
+            while (*name) {
+                if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
+                        && _PyString_Eq(**name, key)) {
+                    values[name-argnames] = value;
+                    break;
+                }
+                name++;
+            }
+            if (*name) continue;
+            else {
+                PyObject*** argname = argnames;
+                while (argname != first_kw_arg) {
+                    if ((**argname == key) || (
+                            (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
+                             && _PyString_Eq(**argname, key))) {
+                        goto arg_passed_twice;
+                    }
+                    argname++;
+                }
+            }
+        } else
+        #endif
+        if (likely(PyUnicode_Check(key))) {
+            while (*name) {
+                int cmp = (**name == key) ? 0 :
+                #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
+                    (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
+                #endif
+                    PyUnicode_Compare(**name, key);
+                if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
+                if (cmp == 0) {
+                    values[name-argnames] = value;
+                    break;
+                }
+                name++;
+            }
+            if (*name) continue;
+            else {
+                PyObject*** argname = argnames;
+                while (argname != first_kw_arg) {
+                    int cmp = (**argname == key) ? 0 :
+                    #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
+                        (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
+                    #endif
+                        PyUnicode_Compare(**argname, key);
+                    if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
+                    if (cmp == 0) goto arg_passed_twice;
+                    argname++;
+                }
+            }
+        } else
+            goto invalid_keyword_type;
+        if (kwds2) {
+            if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
+        } else {
+            goto invalid_keyword;
         }
     }
-  }
-}
-static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) {
-  buf->buf = NULL;
-  buf->obj = NULL;
-  buf->strides = __Pyx_zeros;
-  buf->shape = __Pyx_zeros;
-  buf->suboffsets = __Pyx_minusones;
-}
-static CYTHON_INLINE int __Pyx_GetBufferAndValidate(
-        Py_buffer* buf, PyObject* obj,  __Pyx_TypeInfo* dtype, int flags,
-        int nd, int cast, __Pyx_BufFmt_StackElem* stack)
-{
-  if (obj == Py_None || obj == NULL) {
-    __Pyx_ZeroBuffer(buf);
     return 0;
-  }
-  buf->buf = NULL;
-  if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail;
-  if (buf->ndim != nd) {
-    PyErr_Format(PyExc_ValueError,
-                 "Buffer has wrong number of dimensions (expected %d, got %d)",
-                 nd, buf->ndim);
-    goto fail;
-  }
-  if (!cast) {
-    __Pyx_BufFmt_Context ctx;
-    __Pyx_BufFmt_Init(&ctx, stack, dtype);
-    if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
-  }
-  if ((unsigned)buf->itemsize != dtype->size) {
-    PyErr_Format(PyExc_ValueError,
-      "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)",
-      buf->itemsize, (buf->itemsize > 1) ? "s" : "",
-      dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : "");
-    goto fail;
-  }
-  if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
-  return 0;
-fail:;
-  __Pyx_ZeroBuffer(buf);
-  return -1;
+arg_passed_twice:
+    __Pyx_RaiseDoubleKeywordsError(function_name, key);
+    goto bad;
+invalid_keyword_type:
+    PyErr_Format(PyExc_TypeError,
+        "%s() keywords must be strings", function_name);
+    goto bad;
+invalid_keyword:
+    PyErr_Format(PyExc_TypeError,
+    #if PY_MAJOR_VERSION < 3
+        "%s() got an unexpected keyword argument '%s'",
+        function_name, PyString_AsString(key));
+    #else
+        "%s() got an unexpected keyword argument '%U'",
+        function_name, key);
+    #endif
+bad:
+    return -1;
 }
-static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
-  if (info->buf == NULL) return;
-  if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
-  __Pyx_ReleaseBuffer(info);
+
+static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
+    PyObject *result;
+#if CYTHON_COMPILING_IN_CPYTHON
+    result = PyDict_GetItem(__pyx_d, name);
+    if (result) {
+        Py_INCREF(result);
+    } else {
+#else
+    result = PyObject_GetItem(__pyx_d, name);
+    if (!result) {
+        PyErr_Clear();
+#endif
+        result = __Pyx_GetBuiltinName(name);
+    }
+    return result;
 }
 
 static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
@@ -34366,378 +29071,549 @@ static void __Pyx_RaiseUnboundMemoryviewSliceNogil(const char *varname) {
     #endif
 }
 
-static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
-#if CYTHON_COMPILING_IN_CPYTHON
-    PyObject *tmp_type, *tmp_value, *tmp_tb;
-    PyThreadState *tstate = PyThreadState_GET();
-    tmp_type = tstate->curexc_type;
-    tmp_value = tstate->curexc_value;
-    tmp_tb = tstate->curexc_traceback;
-    tstate->curexc_type = type;
-    tstate->curexc_value = value;
-    tstate->curexc_traceback = tb;
-    Py_XDECREF(tmp_type);
-    Py_XDECREF(tmp_value);
-    Py_XDECREF(tmp_tb);
-#else
-    PyErr_Restore(type, value, tb);
+static CYTHON_INLINE int __Pyx_IsLittleEndian(void) {
+  unsigned int n = 1;
+  return *(unsigned char*)(&n) != 0;
+}
+static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
+                              __Pyx_BufFmt_StackElem* stack,
+                              __Pyx_TypeInfo* type) {
+  stack[0].field = &ctx->root;
+  stack[0].parent_offset = 0;
+  ctx->root.type = type;
+  ctx->root.name = "buffer dtype";
+  ctx->root.offset = 0;
+  ctx->head = stack;
+  ctx->head->field = &ctx->root;
+  ctx->fmt_offset = 0;
+  ctx->head->parent_offset = 0;
+  ctx->new_packmode = '@';
+  ctx->enc_packmode = '@';
+  ctx->new_count = 1;
+  ctx->enc_count = 0;
+  ctx->enc_type = 0;
+  ctx->is_complex = 0;
+  ctx->is_valid_array = 0;
+  ctx->struct_alignment = 0;
+  while (type->typegroup == 'S') {
+    ++ctx->head;
+    ctx->head->field = type->fields;
+    ctx->head->parent_offset = 0;
+    type = type->fields->type;
+  }
+}
+static int __Pyx_BufFmt_ParseNumber(const char** ts) {
+    int count;
+    const char* t = *ts;
+    if (*t < '0' || *t > '9') {
+      return -1;
+    } else {
+        count = *t++ - '0';
+        while (*t >= '0' && *t < '9') {
+            count *= 10;
+            count += *t++ - '0';
+        }
+    }
+    *ts = t;
+    return count;
+}
+static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
+    int number = __Pyx_BufFmt_ParseNumber(ts);
+    if (number == -1) /* First char was not a digit */
+        PyErr_Format(PyExc_ValueError,\
+                     "Does not understand character buffer dtype format string ('%c')", **ts);
+    return number;
+}
+static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
+  PyErr_Format(PyExc_ValueError,
+               "Unexpected format string character: '%c'", ch);
+}
+static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
+  switch (ch) {
+    case 'c': return "'char'";
+    case 'b': return "'signed char'";
+    case 'B': return "'unsigned char'";
+    case 'h': return "'short'";
+    case 'H': return "'unsigned short'";
+    case 'i': return "'int'";
+    case 'I': return "'unsigned int'";
+    case 'l': return "'long'";
+    case 'L': return "'unsigned long'";
+    case 'q': return "'long long'";
+    case 'Q': return "'unsigned long long'";
+    case 'f': return (is_complex ? "'complex float'" : "'float'");
+    case 'd': return (is_complex ? "'complex double'" : "'double'");
+    case 'g': return (is_complex ? "'complex long double'" : "'long double'");
+    case 'T': return "a struct";
+    case 'O': return "Python object";
+    case 'P': return "a pointer";
+    case 's': case 'p': return "a string";
+    case 0: return "end";
+    default: return "unparseable format string";
+  }
+}
+static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
+  switch (ch) {
+    case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
+    case 'h': case 'H': return 2;
+    case 'i': case 'I': case 'l': case 'L': return 4;
+    case 'q': case 'Q': return 8;
+    case 'f': return (is_complex ? 8 : 4);
+    case 'd': return (is_complex ? 16 : 8);
+    case 'g': {
+      PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
+      return 0;
+    }
+    case 'O': case 'P': return sizeof(void*);
+    default:
+      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
+      return 0;
+    }
+}
+static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
+  switch (ch) {
+    case 'c': case 'b': case 'B': case 's': case 'p': return 1;
+    case 'h': case 'H': return sizeof(short);
+    case 'i': case 'I': return sizeof(int);
+    case 'l': case 'L': return sizeof(long);
+    #ifdef HAVE_LONG_LONG
+    case 'q': case 'Q': return sizeof(PY_LONG_LONG);
+    #endif
+    case 'f': return sizeof(float) * (is_complex ? 2 : 1);
+    case 'd': return sizeof(double) * (is_complex ? 2 : 1);
+    case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
+    case 'O': case 'P': return sizeof(void*);
+    default: {
+      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
+      return 0;
+    }
+  }
+}
+typedef struct { char c; short x; } __Pyx_st_short;
+typedef struct { char c; int x; } __Pyx_st_int;
+typedef struct { char c; long x; } __Pyx_st_long;
+typedef struct { char c; float x; } __Pyx_st_float;
+typedef struct { char c; double x; } __Pyx_st_double;
+typedef struct { char c; long double x; } __Pyx_st_longdouble;
+typedef struct { char c; void *x; } __Pyx_st_void_p;
+#ifdef HAVE_LONG_LONG
+typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
+#endif
+static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
+  switch (ch) {
+    case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
+    case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
+    case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
+    case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
+#ifdef HAVE_LONG_LONG
+    case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
+#endif
+    case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
+    case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
+    case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
+    case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
+    default:
+      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
+      return 0;
+    }
+}
+/* These are for computing the padding at the end of the struct to align
+   on the first member of the struct. This will probably the same as above,
+   but we don't have any guarantees.
+ */
+typedef struct { short x; char c; } __Pyx_pad_short;
+typedef struct { int x; char c; } __Pyx_pad_int;
+typedef struct { long x; char c; } __Pyx_pad_long;
+typedef struct { float x; char c; } __Pyx_pad_float;
+typedef struct { double x; char c; } __Pyx_pad_double;
+typedef struct { long double x; char c; } __Pyx_pad_longdouble;
+typedef struct { void *x; char c; } __Pyx_pad_void_p;
+#ifdef HAVE_LONG_LONG
+typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
 #endif
-}
-static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
-#if CYTHON_COMPILING_IN_CPYTHON
-    PyThreadState *tstate = PyThreadState_GET();
-    *type = tstate->curexc_type;
-    *value = tstate->curexc_value;
-    *tb = tstate->curexc_traceback;
-    tstate->curexc_type = 0;
-    tstate->curexc_value = 0;
-    tstate->curexc_traceback = 0;
-#else
-    PyErr_Fetch(type, value, tb);
+static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
+  switch (ch) {
+    case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
+    case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
+    case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
+    case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
+#ifdef HAVE_LONG_LONG
+    case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
 #endif
+    case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
+    case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
+    case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
+    case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
+    default:
+      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
+      return 0;
+    }
 }
-
-#if PY_MAJOR_VERSION < 3
-static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
-                        CYTHON_UNUSED PyObject *cause) {
-    Py_XINCREF(type);
-    if (!value || value == Py_None)
-        value = NULL;
-    else
-        Py_INCREF(value);
-    if (!tb || tb == Py_None)
-        tb = NULL;
-    else {
-        Py_INCREF(tb);
-        if (!PyTraceBack_Check(tb)) {
-            PyErr_SetString(PyExc_TypeError,
-                "raise: arg 3 must be a traceback or None");
-            goto raise_error;
-        }
+static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
+  switch (ch) {
+    case 'c':
+        return 'H';
+    case 'b': case 'h': case 'i':
+    case 'l': case 'q': case 's': case 'p':
+        return 'I';
+    case 'B': case 'H': case 'I': case 'L': case 'Q':
+        return 'U';
+    case 'f': case 'd': case 'g':
+        return (is_complex ? 'C' : 'R');
+    case 'O':
+        return 'O';
+    case 'P':
+        return 'P';
+    default: {
+      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
+      return 0;
     }
-    #if PY_VERSION_HEX < 0x02050000
-    if (PyClass_Check(type)) {
-    #else
-    if (PyType_Check(type)) {
-    #endif
-#if CYTHON_COMPILING_IN_PYPY
-        if (!value) {
-            Py_INCREF(Py_None);
-            value = Py_None;
-        }
-#endif
-        PyErr_NormalizeException(&type, &value, &tb);
+  }
+}
+static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
+  if (ctx->head == NULL || ctx->head->field == &ctx->root) {
+    const char* expected;
+    const char* quote;
+    if (ctx->head == NULL) {
+      expected = "end";
+      quote = "";
     } else {
-        if (value) {
-            PyErr_SetString(PyExc_TypeError,
-                "instance exception may not have a separate value");
-            goto raise_error;
-        }
-        value = type;
-        #if PY_VERSION_HEX < 0x02050000
-            if (PyInstance_Check(type)) {
-                type = (PyObject*) ((PyInstanceObject*)type)->in_class;
-                Py_INCREF(type);
-            }
-            else {
-                type = 0;
-                PyErr_SetString(PyExc_TypeError,
-                    "raise: exception must be an old-style class or instance");
-                goto raise_error;
-            }
-        #else
-            type = (PyObject*) Py_TYPE(type);
-            Py_INCREF(type);
-            if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
-                PyErr_SetString(PyExc_TypeError,
-                    "raise: exception class must be a subclass of BaseException");
-                goto raise_error;
-            }
-        #endif
+      expected = ctx->head->field->type->name;
+      quote = "'";
     }
-    __Pyx_ErrRestore(type, value, tb);
-    return;
-raise_error:
-    Py_XDECREF(value);
-    Py_XDECREF(type);
-    Py_XDECREF(tb);
-    return;
+    PyErr_Format(PyExc_ValueError,
+                 "Buffer dtype mismatch, expected %s%s%s but got %s",
+                 quote, expected, quote,
+                 __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
+  } else {
+    __Pyx_StructField* field = ctx->head->field;
+    __Pyx_StructField* parent = (ctx->head - 1)->field;
+    PyErr_Format(PyExc_ValueError,
+                 "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
+                 field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
+                 parent->type->name, field->name);
+  }
 }
-#else /* Python 3+ */
-static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
-    PyObject* owned_instance = NULL;
-    if (tb == Py_None) {
-        tb = 0;
-    } else if (tb && !PyTraceBack_Check(tb)) {
-        PyErr_SetString(PyExc_TypeError,
-            "raise: arg 3 must be a traceback or None");
-        goto bad;
-    }
-    if (value == Py_None)
-        value = 0;
-    if (PyExceptionInstance_Check(type)) {
-        if (value) {
-            PyErr_SetString(PyExc_TypeError,
-                "instance exception may not have a separate value");
-            goto bad;
-        }
-        value = type;
-        type = (PyObject*) Py_TYPE(value);
-    } else if (PyExceptionClass_Check(type)) {
-        PyObject *args;
-        if (!value)
-            args = PyTuple_New(0);
-        else if (PyTuple_Check(value)) {
-            Py_INCREF(value);
-            args = value;
-        }
-        else
-            args = PyTuple_Pack(1, value);
-        if (!args)
-            goto bad;
-        owned_instance = PyEval_CallObject(type, args);
-        Py_DECREF(args);
-        if (!owned_instance)
-            goto bad;
-        value = owned_instance;
-        if (!PyExceptionInstance_Check(value)) {
-            PyErr_Format(PyExc_TypeError,
-                         "calling %R should have returned an instance of "
-                         "BaseException, not %R",
-                         type, Py_TYPE(value));
-            goto bad;
+static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
+  char group;
+  size_t size, offset, arraysize = 1;
+  if (ctx->enc_type == 0) return 0;
+  if (ctx->head->field->type->arraysize[0]) {
+    int i, ndim = 0;
+    if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
+        ctx->is_valid_array = ctx->head->field->type->ndim == 1;
+        ndim = 1;
+        if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
+            PyErr_Format(PyExc_ValueError,
+                         "Expected a dimension of size %zu, got %zu",
+                         ctx->head->field->type->arraysize[0], ctx->enc_count);
+            return -1;
         }
-    } else {
-        PyErr_SetString(PyExc_TypeError,
-            "raise: exception class must be a subclass of BaseException");
-        goto bad;
     }
-    if (cause && cause != Py_None) {
-        PyObject *fixed_cause;
-        if (PyExceptionClass_Check(cause)) {
-            fixed_cause = PyObject_CallObject(cause, NULL);
-            if (fixed_cause == NULL)
-                goto bad;
-        }
-        else if (PyExceptionInstance_Check(cause)) {
-            fixed_cause = cause;
-            Py_INCREF(fixed_cause);
-        }
-        else {
-            PyErr_SetString(PyExc_TypeError,
-                            "exception causes must derive from "
-                            "BaseException");
-            goto bad;
-        }
-        PyException_SetCause(value, fixed_cause);
+    if (!ctx->is_valid_array) {
+      PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
+                   ctx->head->field->type->ndim, ndim);
+      return -1;
     }
-    PyErr_SetObject(type, value);
-    if (tb) {
-        PyThreadState *tstate = PyThreadState_GET();
-        PyObject* tmp_tb = tstate->curexc_traceback;
-        if (tb != tmp_tb) {
-            Py_INCREF(tb);
-            tstate->curexc_traceback = tb;
-            Py_XDECREF(tmp_tb);
-        }
+    for (i = 0; i < ctx->head->field->type->ndim; i++) {
+      arraysize *= ctx->head->field->type->arraysize[i];
     }
-bad:
-    Py_XDECREF(owned_instance);
-    return;
-}
-#endif
-
-static void __Pyx_RaiseBufferFallbackError(void) {
-  PyErr_Format(PyExc_ValueError,
-     "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!");
-}
-
-static int
-__pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b)
-{
-    int i;
-    if (!a || !b)
-        return 0;
-    if (a == b)
-        return 1;
-    if (a->size != b->size || a->typegroup != b->typegroup ||
-            a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) {
-        if (a->typegroup == 'H' || b->typegroup == 'H') {
-            return a->size == b->size;
-        } else {
-            return 0;
-        }
+    ctx->is_valid_array = 0;
+    ctx->enc_count = 1;
+  }
+  group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
+  do {
+    __Pyx_StructField* field = ctx->head->field;
+    __Pyx_TypeInfo* type = field->type;
+    if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
+      size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
+    } else {
+      size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
+    }
+    if (ctx->enc_packmode == '@') {
+      size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
+      size_t align_mod_offset;
+      if (align_at == 0) return -1;
+      align_mod_offset = ctx->fmt_offset % align_at;
+      if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
+      if (ctx->struct_alignment == 0)
+          ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
+                                                                 ctx->is_complex);
+    }
+    if (type->size != size || type->typegroup != group) {
+      if (type->typegroup == 'C' && type->fields != NULL) {
+        size_t parent_offset = ctx->head->parent_offset + field->offset;
+        ++ctx->head;
+        ctx->head->field = type->fields;
+        ctx->head->parent_offset = parent_offset;
+        continue;
+      }
+      if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
+      } else {
+          __Pyx_BufFmt_RaiseExpected(ctx);
+          return -1;
+      }
     }
-    if (a->ndim) {
-        for (i = 0; i < a->ndim; i++)
-            if (a->arraysize[i] != b->arraysize[i])
-                return 0;
+    offset = ctx->head->parent_offset + field->offset;
+    if (ctx->fmt_offset != offset) {
+      PyErr_Format(PyExc_ValueError,
+                   "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
+                   (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
+      return -1;
     }
-    if (a->typegroup == 'S') {
-        if (a->flags != b->flags)
-            return 0;
-        if (a->fields || b->fields) {
-            if (!(a->fields && b->fields))
-                return 0;
-            for (i = 0; a->fields[i].type && b->fields[i].type; i++) {
-                __Pyx_StructField *field_a = a->fields + i;
-                __Pyx_StructField *field_b = b->fields + i;
-                if (field_a->offset != field_b->offset ||
-                    !__pyx_typeinfo_cmp(field_a->type, field_b->type))
-                    return 0;
-            }
-            return !a->fields[i].type && !b->fields[i].type;
+    ctx->fmt_offset += size;
+    if (arraysize)
+      ctx->fmt_offset += (arraysize - 1) * size;
+    --ctx->enc_count; /* Consume from buffer string */
+    while (1) {
+      if (field == &ctx->root) {
+        ctx->head = NULL;
+        if (ctx->enc_count != 0) {
+          __Pyx_BufFmt_RaiseExpected(ctx);
+          return -1;
         }
+        break; /* breaks both loops as ctx->enc_count == 0 */
+      }
+      ctx->head->field = ++field;
+      if (field->type == NULL) {
+        --ctx->head;
+        field = ctx->head->field;
+        continue;
+      } else if (field->type->typegroup == 'S') {
+        size_t parent_offset = ctx->head->parent_offset + field->offset;
+        if (field->type->fields->type == NULL) continue; /* empty struct */
+        field = field->type->fields;
+        ++ctx->head;
+        ctx->head->field = field;
+        ctx->head->parent_offset = parent_offset;
+        break;
+      } else {
+        break;
+      }
     }
-    return 1;
+  } while (ctx->enc_count);
+  ctx->enc_type = 0;
+  ctx->is_complex = 0;
+  return 0;
 }
-
-static int __Pyx_ValidateAndInit_memviewslice(
-                int *axes_specs,
-                int c_or_f_flag,
-                int buf_flags,
-                int ndim,
-                __Pyx_TypeInfo *dtype,
-                __Pyx_BufFmt_StackElem stack[],
-                __Pyx_memviewslice *memviewslice,
-                PyObject *original_obj)
+static CYTHON_INLINE PyObject *
+__pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
 {
-    struct __pyx_memoryview_obj *memview, *new_memview;
-    __Pyx_RefNannyDeclarations
-    Py_buffer *buf;
-    int i, spec = 0, retval = -1;
-    __Pyx_BufFmt_Context ctx;
-    int from_memoryview = __pyx_memoryview_check(original_obj);
-    __Pyx_RefNannySetupContext("ValidateAndInit_memviewslice", 0);
-    if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((struct __pyx_memoryview_obj *)
-                                                            original_obj)->typeinfo)) {
-        memview = (struct __pyx_memoryview_obj *) original_obj;
-        new_memview = NULL;
-    } else {
-        memview = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
-                                            original_obj, buf_flags, 0, dtype);
-        new_memview = memview;
-        if (unlikely(!memview))
-            goto fail;
-    }
-    buf = &memview->view;
-    if (buf->ndim != ndim) {
-        PyErr_Format(PyExc_ValueError,
-                "Buffer has wrong number of dimensions (expected %d, got %d)",
-                ndim, buf->ndim);
-        goto fail;
+    const char *ts = *tsp;
+    int i = 0, number;
+    int ndim = ctx->head->field->type->ndim;
+;
+    ++ts;
+    if (ctx->new_count != 1) {
+        PyErr_SetString(PyExc_ValueError,
+                        "Cannot handle repeated arrays in format string");
+        return NULL;
     }
-    if (new_memview) {
-        __Pyx_BufFmt_Init(&ctx, stack, dtype);
-        if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
+    if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
+    while (*ts && *ts != ')') {
+        if (isspace(*ts))
+            continue;
+        number = __Pyx_BufFmt_ExpectNumber(&ts);
+        if (number == -1) return NULL;
+        if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i])
+            return PyErr_Format(PyExc_ValueError,
+                        "Expected a dimension of size %zu, got %d",
+                        ctx->head->field->type->arraysize[i], number);
+        if (*ts != ',' && *ts != ')')
+            return PyErr_Format(PyExc_ValueError,
+                                "Expected a comma in format string, got '%c'", *ts);
+        if (*ts == ',') ts++;
+        i++;
     }
-    if ((unsigned)buf->itemsize != dtype->size) {
-        PyErr_Format(PyExc_ValueError,
-                     "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "u byte%s) "
-                     "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "u byte%s)",
-                     buf->itemsize,
-                     (buf->itemsize > 1) ? "s" : "",
-                     dtype->name,
-                     dtype->size,
-                     (dtype->size > 1) ? "s" : "");
-        goto fail;
+    if (i != ndim)
+        return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
+                            ctx->head->field->type->ndim, i);
+    if (!*ts) {
+        PyErr_SetString(PyExc_ValueError,
+                        "Unexpected end of format string, expected ')'");
+        return NULL;
     }
-    for (i = 0; i < ndim; i++) {
-        spec = axes_specs[i];
-        if (buf->strides) {
-            if (spec & __Pyx_MEMVIEW_CONTIG) {
-                if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) {
-                    if (buf->strides[i] != sizeof(void *)) {
-                        PyErr_Format(PyExc_ValueError,
-                            "Buffer is not indirectly contiguous in dimension %d.", i);
-                        goto fail;
-                    }
-                } else if (buf->strides[i] != buf->itemsize) {
-                    PyErr_SetString(PyExc_ValueError,
-                        "Buffer and memoryview are not contiguous in the same dimension.");
-                    goto fail;
-                }
-            }
-            if (spec & __Pyx_MEMVIEW_FOLLOW) {
-                Py_ssize_t stride = buf->strides[i];
-                if (stride < 0)
-                    stride = -stride;
-                if (stride < buf->itemsize) {
-                    PyErr_SetString(PyExc_ValueError,
-                        "Buffer and memoryview are not contiguous in the same dimension.");
-                    goto fail;
-                }
-            }
+    ctx->is_valid_array = 1;
+    ctx->new_count = 1;
+    *tsp = ++ts;
+    return Py_None;
+}
+static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
+  int got_Z = 0;
+  while (1) {
+    switch(*ts) {
+      case 0:
+        if (ctx->enc_type != 0 && ctx->head == NULL) {
+          __Pyx_BufFmt_RaiseExpected(ctx);
+          return NULL;
+        }
+        if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
+        if (ctx->head != NULL) {
+          __Pyx_BufFmt_RaiseExpected(ctx);
+          return NULL;
+        }
+                return ts;
+      case ' ':
+      case 10:
+      case 13:
+        ++ts;
+        break;
+      case '<':
+        if (!__Pyx_IsLittleEndian()) {
+          PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
+          return NULL;
+        }
+        ctx->new_packmode = '=';
+        ++ts;
+        break;
+      case '>':
+      case '!':
+        if (__Pyx_IsLittleEndian()) {
+          PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
+          return NULL;
+        }
+        ctx->new_packmode = '=';
+        ++ts;
+        break;
+      case '=':
+      case '@':
+      case '^':
+        ctx->new_packmode = *ts++;
+        break;
+      case 'T': /* substruct */
+        {
+          const char* ts_after_sub;
+          size_t i, struct_count = ctx->new_count;
+          size_t struct_alignment = ctx->struct_alignment;
+          ctx->new_count = 1;
+          ++ts;
+          if (*ts != '{') {
+            PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
+            return NULL;
+          }
+          if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
+          ctx->enc_type = 0; /* Erase processed last struct element */
+          ctx->enc_count = 0;
+          ctx->struct_alignment = 0;
+          ++ts;
+          ts_after_sub = ts;
+          for (i = 0; i != struct_count; ++i) {
+            ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
+            if (!ts_after_sub) return NULL;
+          }
+          ts = ts_after_sub;
+          if (struct_alignment) ctx->struct_alignment = struct_alignment;
+        }
+        break;
+      case '}': /* end of substruct; either repeat or move on */
+        {
+          size_t alignment = ctx->struct_alignment;
+          ++ts;
+          if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
+          ctx->enc_type = 0; /* Erase processed last struct element */
+          if (alignment && ctx->fmt_offset % alignment) {
+            ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
+          }
+        }
+        return ts;
+      case 'x':
+        if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
+        ctx->fmt_offset += ctx->new_count;
+        ctx->new_count = 1;
+        ctx->enc_count = 0;
+        ctx->enc_type = 0;
+        ctx->enc_packmode = ctx->new_packmode;
+        ++ts;
+        break;
+      case 'Z':
+        got_Z = 1;
+        ++ts;
+        if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
+          __Pyx_BufFmt_RaiseUnexpectedChar('Z');
+          return NULL;
+        }        /* fall through */
+      case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
+      case 'l': case 'L': case 'q': case 'Q':
+      case 'f': case 'd': case 'g':
+      case 'O': case 's': case 'p':
+        if (ctx->enc_type == *ts && got_Z == ctx->is_complex &&
+            ctx->enc_packmode == ctx->new_packmode) {
+          ctx->enc_count += ctx->new_count;
         } else {
-            if (spec & __Pyx_MEMVIEW_CONTIG && i != ndim - 1) {
-                PyErr_Format(PyExc_ValueError,
-                             "C-contiguous buffer is not contiguous in "
-                             "dimension %d", i);
-                goto fail;
-            } else if (spec & (__Pyx_MEMVIEW_PTR)) {
-                PyErr_Format(PyExc_ValueError,
-                             "C-contiguous buffer is not indirect in "
-                             "dimension %d", i);
-                goto fail;
-            } else if (buf->suboffsets) {
-                PyErr_SetString(PyExc_ValueError,
-                                "Buffer exposes suboffsets but no strides");
-                goto fail;
-            }
-        }
-        /* Todo: without PyBUF_INDIRECT we may not have suboffset information, i.e., the
-           ptr may not be set to NULL but may be uninitialized? */
-        if (spec & __Pyx_MEMVIEW_DIRECT) {
-            if (buf->suboffsets && buf->suboffsets[i] >= 0) {
-                PyErr_Format(PyExc_ValueError,
-                    "Buffer not compatible with direct access in dimension %d.", i);
-                goto fail;
-            }
-        }
-        if (spec & __Pyx_MEMVIEW_PTR) {
-            if (!buf->suboffsets || (buf->suboffsets && buf->suboffsets[i] < 0)) {
-                PyErr_Format(PyExc_ValueError,
-                    "Buffer is not indirectly accessisble in dimension %d.", i);
-                goto fail;
-            }
+          if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
+          ctx->enc_count = ctx->new_count;
+          ctx->enc_packmode = ctx->new_packmode;
+          ctx->enc_type = *ts;
+          ctx->is_complex = got_Z;
         }
-    }
-    if (buf->strides) {
-        if (c_or_f_flag & __Pyx_IS_F_CONTIG) {
-            Py_ssize_t stride = 1;
-            for (i=0; i<ndim; i++) {
-                if (stride * buf->itemsize != buf->strides[i]) {
-                    PyErr_SetString(PyExc_ValueError,
-                        "Buffer not fortran contiguous.");
-                    goto fail;
-                }
-                stride = stride * buf->shape[i];
-            }
-        } else if (c_or_f_flag & __Pyx_IS_C_CONTIG) {
-            Py_ssize_t stride = 1;
-            for (i = ndim-1; i>-1; i--) {
-                if(stride * buf->itemsize != buf->strides[i]) {
-                    PyErr_SetString(PyExc_ValueError,
-                        "Buffer not C contiguous.");
-                    goto fail;
-                }
-                stride = stride * buf->shape[i];
-            }
+        ++ts;
+        ctx->new_count = 1;
+        got_Z = 0;
+        break;
+      case ':':
+        ++ts;
+        while(*ts != ':') ++ts;
+        ++ts;
+        break;
+      case '(':
+        if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
+        break;
+      default:
+        {
+          int number = __Pyx_BufFmt_ExpectNumber(&ts);
+          if (number == -1) return NULL;
+          ctx->new_count = (size_t)number;
         }
     }
-    if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice,
-                                         new_memview != NULL) == -1)) {
-        goto fail;
-    }
-    retval = 0;
-    goto no_fail;
-fail:
-    Py_XDECREF(new_memview);
-    retval = -1;
-no_fail:
-    __Pyx_RefNannyFinishContext();
-    return retval;
+  }
+}
+static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) {
+  buf->buf = NULL;
+  buf->obj = NULL;
+  buf->strides = __Pyx_zeros;
+  buf->shape = __Pyx_zeros;
+  buf->suboffsets = __Pyx_minusones;
+}
+static CYTHON_INLINE int __Pyx_GetBufferAndValidate(
+        Py_buffer* buf, PyObject* obj,  __Pyx_TypeInfo* dtype, int flags,
+        int nd, int cast, __Pyx_BufFmt_StackElem* stack)
+{
+  if (obj == Py_None || obj == NULL) {
+    __Pyx_ZeroBuffer(buf);
+    return 0;
+  }
+  buf->buf = NULL;
+  if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail;
+  if (buf->ndim != nd) {
+    PyErr_Format(PyExc_ValueError,
+                 "Buffer has wrong number of dimensions (expected %d, got %d)",
+                 nd, buf->ndim);
+    goto fail;
+  }
+  if (!cast) {
+    __Pyx_BufFmt_Context ctx;
+    __Pyx_BufFmt_Init(&ctx, stack, dtype);
+    if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
+  }
+  if ((unsigned)buf->itemsize != dtype->size) {
+    PyErr_Format(PyExc_ValueError,
+      "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)",
+      buf->itemsize, (buf->itemsize > 1) ? "s" : "",
+      dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : "");
+    goto fail;
+  }
+  if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
+  return 0;
+fail:;
+  __Pyx_ZeroBuffer(buf);
+  return -1;
+}
+static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
+  if (info->buf == NULL) return;
+  if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
+  __Pyx_ReleaseBuffer(info);
 }
+
 static int
 __Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview,
                         int ndim,
@@ -34844,33 +29720,246 @@ __Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno)
             PyGILState_Release(_gilstate);
         }
     }
-}
-static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice,
-                                             int have_gil, int lineno) {
-    int last_time;
-    struct __pyx_memoryview_obj *memview = memslice->memview;
-    if (!memview ) {
-        return;
-    } else if ((PyObject *) memview == Py_None) {
-        memslice->memview = NULL;
-        return;
-    }
-    if (__pyx_get_slice_count(memview) <= 0)
-        __pyx_fatalerror("Acquisition count is %d (line %d)",
-                         __pyx_get_slice_count(memview), lineno);
-    last_time = __pyx_sub_acquisition_count(memview) == 1;
-    memslice->data = NULL;
-    if (last_time) {
-        if (have_gil) {
-            Py_CLEAR(memslice->memview);
+}
+static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice,
+                                             int have_gil, int lineno) {
+    int last_time;
+    struct __pyx_memoryview_obj *memview = memslice->memview;
+    if (!memview ) {
+        return;
+    } else if ((PyObject *) memview == Py_None) {
+        memslice->memview = NULL;
+        return;
+    }
+    if (__pyx_get_slice_count(memview) <= 0)
+        __pyx_fatalerror("Acquisition count is %d (line %d)",
+                         __pyx_get_slice_count(memview), lineno);
+    last_time = __pyx_sub_acquisition_count(memview) == 1;
+    memslice->data = NULL;
+    if (last_time) {
+        if (have_gil) {
+            Py_CLEAR(memslice->memview);
+        } else {
+            PyGILState_STATE _gilstate = PyGILState_Ensure();
+            Py_CLEAR(memslice->memview);
+            PyGILState_Release(_gilstate);
+        }
+    } else {
+        memslice->memview = NULL;
+    }
+}
+
+static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
+    if (unlikely(!type)) {
+        PyErr_Format(PyExc_SystemError, "Missing type object");
+        return 0;
+    }
+    if (likely(PyObject_TypeCheck(obj, type)))
+        return 1;
+    PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
+                 Py_TYPE(obj)->tp_name, type->tp_name);
+    return 0;
+}
+
+static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
+#if CYTHON_COMPILING_IN_CPYTHON
+    PyObject *tmp_type, *tmp_value, *tmp_tb;
+    PyThreadState *tstate = PyThreadState_GET();
+    tmp_type = tstate->curexc_type;
+    tmp_value = tstate->curexc_value;
+    tmp_tb = tstate->curexc_traceback;
+    tstate->curexc_type = type;
+    tstate->curexc_value = value;
+    tstate->curexc_traceback = tb;
+    Py_XDECREF(tmp_type);
+    Py_XDECREF(tmp_value);
+    Py_XDECREF(tmp_tb);
+#else
+    PyErr_Restore(type, value, tb);
+#endif
+}
+static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
+#if CYTHON_COMPILING_IN_CPYTHON
+    PyThreadState *tstate = PyThreadState_GET();
+    *type = tstate->curexc_type;
+    *value = tstate->curexc_value;
+    *tb = tstate->curexc_traceback;
+    tstate->curexc_type = 0;
+    tstate->curexc_value = 0;
+    tstate->curexc_traceback = 0;
+#else
+    PyErr_Fetch(type, value, tb);
+#endif
+}
+
+#if PY_MAJOR_VERSION < 3
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
+                        CYTHON_UNUSED PyObject *cause) {
+    Py_XINCREF(type);
+    if (!value || value == Py_None)
+        value = NULL;
+    else
+        Py_INCREF(value);
+    if (!tb || tb == Py_None)
+        tb = NULL;
+    else {
+        Py_INCREF(tb);
+        if (!PyTraceBack_Check(tb)) {
+            PyErr_SetString(PyExc_TypeError,
+                "raise: arg 3 must be a traceback or None");
+            goto raise_error;
+        }
+    }
+    #if PY_VERSION_HEX < 0x02050000
+    if (PyClass_Check(type)) {
+    #else
+    if (PyType_Check(type)) {
+    #endif
+#if CYTHON_COMPILING_IN_PYPY
+        if (!value) {
+            Py_INCREF(Py_None);
+            value = Py_None;
+        }
+#endif
+        PyErr_NormalizeException(&type, &value, &tb);
+    } else {
+        if (value) {
+            PyErr_SetString(PyExc_TypeError,
+                "instance exception may not have a separate value");
+            goto raise_error;
+        }
+        value = type;
+        #if PY_VERSION_HEX < 0x02050000
+        if (PyInstance_Check(type)) {
+            type = (PyObject*) ((PyInstanceObject*)type)->in_class;
+            Py_INCREF(type);
+        } else {
+            type = 0;
+            PyErr_SetString(PyExc_TypeError,
+                "raise: exception must be an old-style class or instance");
+            goto raise_error;
+        }
+        #else
+        type = (PyObject*) Py_TYPE(type);
+        Py_INCREF(type);
+        if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
+            PyErr_SetString(PyExc_TypeError,
+                "raise: exception class must be a subclass of BaseException");
+            goto raise_error;
+        }
+        #endif
+    }
+    __Pyx_ErrRestore(type, value, tb);
+    return;
+raise_error:
+    Py_XDECREF(value);
+    Py_XDECREF(type);
+    Py_XDECREF(tb);
+    return;
+}
+#else /* Python 3+ */
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
+    PyObject* owned_instance = NULL;
+    if (tb == Py_None) {
+        tb = 0;
+    } else if (tb && !PyTraceBack_Check(tb)) {
+        PyErr_SetString(PyExc_TypeError,
+            "raise: arg 3 must be a traceback or None");
+        goto bad;
+    }
+    if (value == Py_None)
+        value = 0;
+    if (PyExceptionInstance_Check(type)) {
+        if (value) {
+            PyErr_SetString(PyExc_TypeError,
+                "instance exception may not have a separate value");
+            goto bad;
+        }
+        value = type;
+        type = (PyObject*) Py_TYPE(value);
+    } else if (PyExceptionClass_Check(type)) {
+        PyObject *instance_class = NULL;
+        if (value && PyExceptionInstance_Check(value)) {
+            instance_class = (PyObject*) Py_TYPE(value);
+            if (instance_class != type) {
+                if (PyObject_IsSubclass(instance_class, type)) {
+                    type = instance_class;
+                } else {
+                    instance_class = NULL;
+                }
+            }
+        }
+        if (!instance_class) {
+            PyObject *args;
+            if (!value)
+                args = PyTuple_New(0);
+            else if (PyTuple_Check(value)) {
+                Py_INCREF(value);
+                args = value;
+            } else
+                args = PyTuple_Pack(1, value);
+            if (!args)
+                goto bad;
+            owned_instance = PyObject_Call(type, args, NULL);
+            Py_DECREF(args);
+            if (!owned_instance)
+                goto bad;
+            value = owned_instance;
+            if (!PyExceptionInstance_Check(value)) {
+                PyErr_Format(PyExc_TypeError,
+                             "calling %R should have returned an instance of "
+                             "BaseException, not %R",
+                             type, Py_TYPE(value));
+                goto bad;
+            }
+        }
+    } else {
+        PyErr_SetString(PyExc_TypeError,
+            "raise: exception class must be a subclass of BaseException");
+        goto bad;
+    }
+#if PY_VERSION_HEX >= 0x03030000
+    if (cause) {
+#else
+    if (cause && cause != Py_None) {
+#endif
+        PyObject *fixed_cause;
+        if (cause == Py_None) {
+            fixed_cause = NULL;
+        } else if (PyExceptionClass_Check(cause)) {
+            fixed_cause = PyObject_CallObject(cause, NULL);
+            if (fixed_cause == NULL)
+                goto bad;
+        } else if (PyExceptionInstance_Check(cause)) {
+            fixed_cause = cause;
+            Py_INCREF(fixed_cause);
         } else {
-            PyGILState_STATE _gilstate = PyGILState_Ensure();
-            Py_CLEAR(memslice->memview);
-            PyGILState_Release(_gilstate);
+            PyErr_SetString(PyExc_TypeError,
+                            "exception causes must derive from "
+                            "BaseException");
+            goto bad;
+        }
+        PyException_SetCause(value, fixed_cause);
+    }
+    PyErr_SetObject(type, value);
+    if (tb) {
+        PyThreadState *tstate = PyThreadState_GET();
+        PyObject* tmp_tb = tstate->curexc_traceback;
+        if (tb != tmp_tb) {
+            Py_INCREF(tb);
+            tstate->curexc_traceback = tb;
+            Py_XDECREF(tmp_tb);
         }
-    } else {
-        memslice->memview = NULL;
     }
+bad:
+    Py_XDECREF(owned_instance);
+    return;
+}
+#endif
+
+static void __Pyx_RaiseBufferFallbackError(void) {
+  PyErr_Format(PyExc_ValueError,
+     "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!");
 }
 
 static double __Pyx__PyObject_AsDouble(PyObject* obj) {
@@ -34878,8 +29967,16 @@ static double __Pyx__PyObject_AsDouble(PyObject* obj) {
 #if CYTHON_COMPILING_IN_PYPY
     float_value = PyNumber_Float(obj);
 #else
-    if (Py_TYPE(obj)->tp_as_number && Py_TYPE(obj)->tp_as_number->nb_float) {
-        return PyFloat_AsDouble(obj);
+    PyNumberMethods *nb = Py_TYPE(obj)->tp_as_number;
+    if (likely(nb) && likely(nb->nb_float)) {
+        float_value = nb->nb_float(obj);
+        if (likely(float_value) && unlikely(!PyFloat_Check(float_value))) {
+            PyErr_Format(PyExc_TypeError,
+                "__float__ returned non-float (type %.200s)",
+                Py_TYPE(float_value)->tp_name);
+            Py_DECREF(float_value);
+            goto bad;
+        }
     } else if (PyUnicode_CheckExact(obj) || PyBytes_CheckExact(obj)) {
 #if PY_MAJOR_VERSION >= 3
         float_value = PyFloat_FromString(obj);
@@ -35021,6 +30118,84 @@ bad:
     return -1;
 }
 
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
+    PyObject *r;
+    if (!j) return NULL;
+    r = PyObject_GetItem(o, j);
+    Py_DECREF(j);
+    return r;
+}
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
+                                                              int wraparound, int boundscheck) {
+#if CYTHON_COMPILING_IN_CPYTHON
+    if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o);
+    if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
+        PyObject *r = PyList_GET_ITEM(o, i);
+        Py_INCREF(r);
+        return r;
+    }
+    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+#else
+    return PySequence_GetItem(o, i);
+#endif
+}
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
+                                                              int wraparound, int boundscheck) {
+#if CYTHON_COMPILING_IN_CPYTHON
+    if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o);
+    if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
+        PyObject *r = PyTuple_GET_ITEM(o, i);
+        Py_INCREF(r);
+        return r;
+    }
+    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+#else
+    return PySequence_GetItem(o, i);
+#endif
+}
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
+                                                     int is_list, int wraparound, int boundscheck) {
+#if CYTHON_COMPILING_IN_CPYTHON
+    if (is_list || PyList_CheckExact(o)) {
+        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
+        if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) {
+            PyObject *r = PyList_GET_ITEM(o, n);
+            Py_INCREF(r);
+            return r;
+        }
+    }
+    else if (PyTuple_CheckExact(o)) {
+        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
+        if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
+            PyObject *r = PyTuple_GET_ITEM(o, n);
+            Py_INCREF(r);
+            return r;
+        }
+    } else {
+        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
+        if (likely(m && m->sq_item)) {
+            if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
+                Py_ssize_t l = m->sq_length(o);
+                if (likely(l >= 0)) {
+                    i += l;
+                } else {
+                    if (PyErr_ExceptionMatches(PyExc_OverflowError))
+                        PyErr_Clear();
+                    else
+                        return NULL;
+                }
+            }
+            return m->sq_item(o, i);
+        }
+    }
+#else
+    if (is_list || PySequence_Check(o)) {
+        return PySequence_GetItem(o, i);
+    }
+#endif
+    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+}
+
 static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
     const char *name, int exact)
 {
@@ -35041,8 +30216,20 @@ static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed
     return 0;
 }
 
+static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
+#if CYTHON_COMPILING_IN_CPYTHON
+#if PY_MAJOR_VERSION >= 3
+    if (likely(PyUnicode_Check(n)))
+#else
+    if (likely(PyString_Check(n)))
+#endif
+        return __Pyx_PyObject_GetAttrStr(o, n);
+#endif
+    return PyObject_GetAttr(o, n);
+}
+
 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
-    PyObject *r = PyObject_GetAttr(o, n);
+    PyObject *r = __Pyx_GetAttr(o, n);
     if (!r) {
         if (!PyErr_ExceptionMatches(PyExc_AttributeError))
             goto bad;
@@ -35088,298 +30275,106 @@ static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int
         #endif
         } else {
             int result = PyUnicode_Compare(s1, s2);
-            if ((result == -1) && unlikely(PyErr_Occurred()))
-                return -1;
-            return (equals == Py_EQ) ? (result == 0) : (result != 0);
-        }
-    } else if ((s1 == Py_None) & PyUnicode_CheckExact(s2)) {
-        return (equals == Py_NE);
-    } else if ((s2 == Py_None) & PyUnicode_CheckExact(s1)) {
-        return (equals == Py_NE);
-    } else {
-        int result;
-        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
-        if (!py_result)
-            return -1;
-        result = __Pyx_PyObject_IsTrue(py_result);
-        Py_DECREF(py_result);
-        return result;
-    }
-#endif
-}
-
-static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
-         const char* cstring, Py_ssize_t start, Py_ssize_t stop,
-         const char* encoding, const char* errors,
-         PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
-    Py_ssize_t length;
-    if (unlikely((start < 0) | (stop < 0))) {
-        length = strlen(cstring);
-        if (start < 0) {
-            start += length;
-            if (start < 0)
-                start = 0;
-        }
-        if (stop < 0)
-            stop += length;
-    }
-    length = stop - start;
-    if (unlikely(length <= 0))
-        return PyUnicode_FromUnicode(NULL, 0);
-    cstring += start;
-    if (decode_func) {
-        return decode_func(cstring, length, errors);
-    } else {
-        return PyUnicode_Decode(cstring, length, encoding, errors);
-    }
-}
-
-static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
-    long q = a / b;
-    long r = a - q*b;
-    q -= ((r != 0) & ((r ^ b) < 0));
-    return q;
-}
-
-static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
-#if CYTHON_COMPILING_IN_CPYTHON
-    PyThreadState *tstate = PyThreadState_GET();
-    *type = tstate->exc_type;
-    *value = tstate->exc_value;
-    *tb = tstate->exc_traceback;
-    Py_XINCREF(*type);
-    Py_XINCREF(*value);
-    Py_XINCREF(*tb);
-#else
-    PyErr_GetExcInfo(type, value, tb);
-#endif
-}
-static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) {
-#if CYTHON_COMPILING_IN_CPYTHON
-    PyObject *tmp_type, *tmp_value, *tmp_tb;
-    PyThreadState *tstate = PyThreadState_GET();
-    tmp_type = tstate->exc_type;
-    tmp_value = tstate->exc_value;
-    tmp_tb = tstate->exc_traceback;
-    tstate->exc_type = type;
-    tstate->exc_value = value;
-    tstate->exc_traceback = tb;
-    Py_XDECREF(tmp_type);
-    Py_XDECREF(tmp_value);
-    Py_XDECREF(tmp_tb);
-#else
-    PyErr_SetExcInfo(type, value, tb);
-#endif
-}
-
-#if PY_MAJOR_VERSION < 3
-static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
-    CYTHON_UNUSED PyObject *getbuffer_cobj;
-  #if PY_VERSION_HEX >= 0x02060000
-    if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
-  #endif
-        if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags);
-        if (PyObject_TypeCheck(obj, __pyx_array_type)) return __pyx_array_getbuffer(obj, view, flags);
-        if (PyObject_TypeCheck(obj, __pyx_memoryview_type)) return __pyx_memoryview_getbuffer(obj, view, flags);
-  #if PY_VERSION_HEX < 0x02060000
-    if (obj->ob_type->tp_dict &&
-        (getbuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict,
-                                             "__pyx_getbuffer"))) {
-        getbufferproc func;
-      #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0)
-        func = (getbufferproc) PyCapsule_GetPointer(getbuffer_cobj, "getbuffer(obj, view, flags)");
-      #else
-        func = (getbufferproc) PyCObject_AsVoidPtr(getbuffer_cobj);
-      #endif
-        Py_DECREF(getbuffer_cobj);
-        if (!func)
-            goto fail;
-        return func(obj, view, flags);
-    } else {
-        PyErr_Clear();
-    }
-  #endif
-    PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
-#if PY_VERSION_HEX < 0x02060000
-fail:
-#endif
-    return -1;
-}
-static void __Pyx_ReleaseBuffer(Py_buffer *view) {
-    PyObject *obj = view->obj;
-    CYTHON_UNUSED PyObject *releasebuffer_cobj;
-    if (!obj) return;
-  #if PY_VERSION_HEX >= 0x02060000
-    if (PyObject_CheckBuffer(obj)) {
-        PyBuffer_Release(view);
-        return;
-    }
-  #endif
-        if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) { __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view); return; }
-  #if PY_VERSION_HEX < 0x02060000
-    if (obj->ob_type->tp_dict &&
-        (releasebuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict,
-                                                      "__pyx_releasebuffer"))) {
-        releasebufferproc func;
-      #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0)
-        func = (releasebufferproc) PyCapsule_GetPointer(releasebuffer_cobj, "releasebuffer(obj, view)");
-      #else
-        func = (releasebufferproc) PyCObject_AsVoidPtr(releasebuffer_cobj);
-      #endif
-        Py_DECREF(releasebuffer_cobj);
-        if (!func)
-            goto fail;
-        func(obj, view);
-        return;
+            if ((result == -1) && unlikely(PyErr_Occurred()))
+                return -1;
+            return (equals == Py_EQ) ? (result == 0) : (result != 0);
+        }
+    } else if ((s1 == Py_None) & PyUnicode_CheckExact(s2)) {
+        return (equals == Py_NE);
+    } else if ((s2 == Py_None) & PyUnicode_CheckExact(s1)) {
+        return (equals == Py_NE);
     } else {
-        PyErr_Clear();
+        int result;
+        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
+        if (!py_result)
+            return -1;
+        result = __Pyx_PyObject_IsTrue(py_result);
+        Py_DECREF(py_result);
+        return result;
     }
-  #endif
-    goto nofail;
-#if PY_VERSION_HEX < 0x02060000
-fail:
 #endif
-    PyErr_WriteUnraisable(obj);
-nofail:
-    Py_DECREF(obj);
-    view->obj = NULL;
 }
-#endif /*  PY_MAJOR_VERSION < 3 */
-
 
-      static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
-    PyObject *empty_list = 0;
-    PyObject *module = 0;
-    PyObject *global_dict = 0;
-    PyObject *empty_dict = 0;
-    PyObject *list;
-    #if PY_VERSION_HEX < 0x03030000
-    PyObject *py_import = 0;
-    py_import = __Pyx_GetAttrString(__pyx_b, "__import__");
-    if (!py_import)
-        goto bad;
-    #endif
-    if (from_list)
-        list = from_list;
-    else {
-        empty_list = PyList_New(0);
-        if (!empty_list)
-            goto bad;
-        list = empty_list;
-    }
-    global_dict = PyModule_GetDict(__pyx_m);
-    if (!global_dict)
-        goto bad;
-    empty_dict = PyDict_New();
-    if (!empty_dict)
-        goto bad;
-    #if PY_VERSION_HEX >= 0x02050000
-    {
-        #if PY_MAJOR_VERSION >= 3
-        if (level == -1) {
-            if (strchr(__Pyx_MODULE_NAME, '.')) {
-                #if PY_VERSION_HEX < 0x03030000
-                PyObject *py_level = PyInt_FromLong(1);
-                if (!py_level)
-                    goto bad;
-                module = PyObject_CallFunctionObjArgs(py_import,
-                    name, global_dict, empty_dict, list, py_level, NULL);
-                Py_DECREF(py_level);
-                #else
-                module = PyImport_ImportModuleLevelObject(
-                    name, global_dict, empty_dict, list, 1);
-                #endif
-                if (!module) {
-                    if (!PyErr_ExceptionMatches(PyExc_ImportError))
-                        goto bad;
-                    PyErr_Clear();
-                }
-            }
-            level = 0; /* try absolute import on failure */
-        }
-        #endif
-        if (!module) {
-            #if PY_VERSION_HEX < 0x03030000
-            PyObject *py_level = PyInt_FromLong(level);
-            if (!py_level)
-                goto bad;
-            module = PyObject_CallFunctionObjArgs(py_import,
-                name, global_dict, empty_dict, list, py_level, NULL);
-            Py_DECREF(py_level);
-            #else
-            module = PyImport_ImportModuleLevelObject(
-                name, global_dict, empty_dict, list, level);
-            #endif
+static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
+         const char* cstring, Py_ssize_t start, Py_ssize_t stop,
+         const char* encoding, const char* errors,
+         PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
+    Py_ssize_t length;
+    if (unlikely((start < 0) | (stop < 0))) {
+        length = strlen(cstring);
+        if (start < 0) {
+            start += length;
+            if (start < 0)
+                start = 0;
         }
+        if (stop < 0)
+            stop += length;
     }
-    #else
-    if (level>0) {
-        PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4.");
-        goto bad;
+    length = stop - start;
+    if (unlikely(length <= 0))
+        return PyUnicode_FromUnicode(NULL, 0);
+    cstring += start;
+    if (decode_func) {
+        return decode_func(cstring, length, errors);
+    } else {
+        return PyUnicode_Decode(cstring, length, encoding, errors);
     }
-    module = PyObject_CallFunctionObjArgs(py_import,
-        name, global_dict, empty_dict, list, NULL);
-    #endif
-bad:
-    #if PY_VERSION_HEX < 0x03030000
-    Py_XDECREF(py_import);
-    #endif
-    Py_XDECREF(empty_list);
-    Py_XDECREF(empty_dict);
-    return module;
 }
 
-static CYTHON_INLINE void __Pyx_RaiseImportError(PyObject *name) {
-#if PY_MAJOR_VERSION < 3
-    PyErr_Format(PyExc_ImportError, "cannot import name %.230s",
-                 PyString_AsString(name));
-#else
-    PyErr_Format(PyExc_ImportError, "cannot import name %S", name);
-#endif
+static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
+    long q = a / b;
+    long r = a - q*b;
+    q -= ((r != 0) & ((r ^ b) < 0));
+    return q;
 }
 
-static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases) {
-    PyObject *metaclass;
-#if PY_MAJOR_VERSION < 3
-    if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
-        PyObject *base = PyTuple_GET_ITEM(bases, 0);
-        metaclass = PyObject_GetAttrString(base, (char *)"__class__");
-        if (!metaclass) {
-            PyErr_Clear();
-            metaclass = (PyObject*) Py_TYPE(base);
-        }
+static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
+                                  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename) {
+    PyObject *old_exc, *old_val, *old_tb;
+    PyObject *ctx;
+    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
+    #if PY_MAJOR_VERSION < 3
+    ctx = PyString_FromString(name);
+    #else
+    ctx = PyUnicode_FromString(name);
+    #endif
+    __Pyx_ErrRestore(old_exc, old_val, old_tb);
+    if (!ctx) {
+        PyErr_WriteUnraisable(Py_None);
     } else {
-        metaclass = (PyObject *) &PyClass_Type;
+        PyErr_WriteUnraisable(ctx);
+        Py_DECREF(ctx);
     }
+}
+
+static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
+#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
+    PyObject *ob = PyCapsule_New(vtable, 0, 0);
 #else
-    if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
-        PyObject *base = PyTuple_GET_ITEM(bases, 0);
-        metaclass = (PyObject*) Py_TYPE(base);
-    } else {
-        metaclass = (PyObject *) &PyType_Type;
-    }
+    PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
 #endif
-    Py_INCREF(metaclass);
-    return metaclass;
+    if (!ob)
+        goto bad;
+    if (PyDict_SetItem(dict, __pyx_n_s____pyx_vtable__, ob) < 0)
+        goto bad;
+    Py_DECREF(ob);
+    return 0;
+bad:
+    Py_XDECREF(ob);
+    return -1;
 }
 
-static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name,
-                                   PyObject *qualname, PyObject *modname) {
-    PyObject *result;
-    PyObject *metaclass;
-    if (PyDict_SetItemString(dict, "__module__", modname) < 0)
-        return NULL;
-    if (PyDict_SetItemString(dict, "__qualname__", qualname) < 0)
-        return NULL;
-    metaclass = PyDict_GetItemString(dict, "__metaclass__");
-    if (metaclass) {
-        Py_INCREF(metaclass);
-    } else {
-        metaclass = __Pyx_FindPy2Metaclass(bases);
+static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
+    PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
+    if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
+        PyErr_Format(PyExc_ImportError,
+        #if PY_MAJOR_VERSION < 3
+            "cannot import name %.230s", PyString_AS_STRING(name));
+        #else
+            "cannot import name %S", name);
+        #endif
     }
-    result = PyObject_CallFunctionObjArgs(metaclass, name, bases, dict, NULL);
-    Py_DECREF(metaclass);
-    return result;
+    return value;
 }
 
 static PyObject *
@@ -35504,53 +30499,134 @@ __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value)
     }
     if (unlikely(!PyDict_Check(value))) {
         PyErr_SetString(PyExc_TypeError,
-               "setting function's dictionary to a non-dict");
+               "setting function's dictionary to a non-dict");
+        return -1;
+    }
+    tmp = op->func_dict;
+    Py_INCREF(value);
+    op->func_dict = value;
+    Py_XDECREF(tmp);
+    return 0;
+}
+static PyObject *
+__Pyx_CyFunction_get_globals(CYTHON_UNUSED __pyx_CyFunctionObject *op)
+{
+    PyObject* dict = PyModule_GetDict(__pyx_m);
+    Py_XINCREF(dict);
+    return dict;
+}
+static PyObject *
+__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op)
+{
+    Py_INCREF(Py_None);
+    return Py_None;
+}
+static PyObject *
+__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op)
+{
+    PyObject* result = (op->func_code) ? op->func_code : Py_None;
+    Py_INCREF(result);
+    return result;
+}
+static int
+__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
+    PyObject *res = op->defaults_getter((PyObject *) op);
+    if (unlikely(!res))
+        return -1;
+    op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
+    Py_INCREF(op->defaults_tuple);
+    op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
+    Py_INCREF(op->defaults_kwdict);
+    Py_DECREF(res);
+    return 0;
+}
+static int
+__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value) {
+    PyObject* tmp;
+    if (!value) {
+        value = Py_None;
+    } else if (value != Py_None && !PyTuple_Check(value)) {
+        PyErr_SetString(PyExc_TypeError,
+                        "__defaults__ must be set to a tuple object");
+        return -1;
+    }
+    Py_INCREF(value);
+    tmp = op->defaults_tuple;
+    op->defaults_tuple = value;
+    Py_XDECREF(tmp);
+    return 0;
+}
+static PyObject *
+__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op) {
+    PyObject* result = op->defaults_tuple;
+    if (unlikely(!result)) {
+        if (op->defaults_getter) {
+            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
+            result = op->defaults_tuple;
+        } else {
+            result = Py_None;
+        }
+    }
+    Py_INCREF(result);
+    return result;
+}
+static int
+__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value) {
+    PyObject* tmp;
+    if (!value) {
+        value = Py_None;
+    } else if (value != Py_None && !PyDict_Check(value)) {
+        PyErr_SetString(PyExc_TypeError,
+                        "__kwdefaults__ must be set to a dict object");
+        return -1;
+    }
+    Py_INCREF(value);
+    tmp = op->defaults_kwdict;
+    op->defaults_kwdict = value;
+    Py_XDECREF(tmp);
+    return 0;
+}
+static PyObject *
+__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op) {
+    PyObject* result = op->defaults_kwdict;
+    if (unlikely(!result)) {
+        if (op->defaults_getter) {
+            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
+            result = op->defaults_kwdict;
+        } else {
+            result = Py_None;
+        }
+    }
+    Py_INCREF(result);
+    return result;
+}
+static int
+__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value) {
+    PyObject* tmp;
+    if (!value || value == Py_None) {
+        value = NULL;
+    } else if (!PyDict_Check(value)) {
+        PyErr_SetString(PyExc_TypeError,
+                        "__annotations__ must be set to a dict object");
         return -1;
     }
-    tmp = op->func_dict;
-    Py_INCREF(value);
-    op->func_dict = value;
+    Py_XINCREF(value);
+    tmp = op->func_annotations;
+    op->func_annotations = value;
     Py_XDECREF(tmp);
     return 0;
 }
 static PyObject *
-__Pyx_CyFunction_get_globals(CYTHON_UNUSED __pyx_CyFunctionObject *op)
-{
-    PyObject* dict = PyModule_GetDict(__pyx_m);
-    Py_XINCREF(dict);
-    return dict;
-}
-static PyObject *
-__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op)
-{
-    Py_INCREF(Py_None);
-    return Py_None;
-}
-static PyObject *
-__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op)
-{
-    PyObject* result = (op->func_code) ? op->func_code : Py_None;
+__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op) {
+    PyObject* result = op->func_annotations;
+    if (unlikely(!result)) {
+        result = PyDict_New();
+        if (unlikely(!result)) return NULL;
+        op->func_annotations = result;
+    }
     Py_INCREF(result);
     return result;
 }
-static PyObject *
-__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op)
-{
-    if (op->defaults_tuple) {
-        Py_INCREF(op->defaults_tuple);
-        return op->defaults_tuple;
-    }
-    if (op->defaults_getter) {
-        PyObject *res = op->defaults_getter((PyObject *) op);
-        if (likely(res)) {
-            Py_INCREF(res);
-            op->defaults_tuple = res;
-        }
-        return res;
-    }
-    Py_INCREF(Py_None);
-    return Py_None;
-}
 static PyGetSetDef __pyx_CyFunction_getsets[] = {
     {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
     {(char *) "__doc__",  (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
@@ -35566,8 +30642,10 @@ static PyGetSetDef __pyx_CyFunction_getsets[] = {
     {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
     {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
     {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
-    {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, 0, 0, 0},
-    {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, 0, 0, 0},
+    {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
+    {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
+    {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
+    {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
     {0, 0, 0, 0, 0}
 };
 #ifndef PY_WRITE_RESTRICTED /* < Py2.5 */
@@ -35614,7 +30692,9 @@ static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int f
     op->defaults_pyobjects = 0;
     op->defaults = NULL;
     op->defaults_tuple = NULL;
+    op->defaults_kwdict = NULL;
     op->defaults_getter = NULL;
+    op->func_annotations = NULL;
     PyObject_GC_Track(op);
     return (PyObject *) op;
 }
@@ -35630,6 +30710,8 @@ __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
     Py_CLEAR(m->func_code);
     Py_CLEAR(m->func_classobj);
     Py_CLEAR(m->defaults_tuple);
+    Py_CLEAR(m->defaults_kwdict);
+    Py_CLEAR(m->func_annotations);
     if (m->defaults) {
         PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
         int i;
@@ -35659,6 +30741,7 @@ static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit,
     Py_VISIT(m->func_code);
     Py_VISIT(m->func_classobj);
     Py_VISIT(m->defaults_tuple);
+    Py_VISIT(m->defaults_kwdict);
     if (m->defaults) {
         PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
         int i;
@@ -35718,110 +30801,374 @@ static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject
                 f->m_ml->ml_name, size);
             return NULL;
         }
-        break;
-    case METH_O:
-        if (likely(kw == NULL) || PyDict_Size(kw) == 0) {
-            size = PyTuple_GET_SIZE(arg);
-            if (size == 1)
-                return (*meth)(self, PyTuple_GET_ITEM(arg, 0));
-            PyErr_Format(PyExc_TypeError,
-                "%.200s() takes exactly one argument (%zd given)",
-                f->m_ml->ml_name, size);
-            return NULL;
+        break;
+    case METH_O:
+        if (likely(kw == NULL) || PyDict_Size(kw) == 0) {
+            size = PyTuple_GET_SIZE(arg);
+            if (size == 1)
+                return (*meth)(self, PyTuple_GET_ITEM(arg, 0));
+            PyErr_Format(PyExc_TypeError,
+                "%.200s() takes exactly one argument (%zd given)",
+                f->m_ml->ml_name, size);
+            return NULL;
+        }
+        break;
+    default:
+        PyErr_SetString(PyExc_SystemError, "Bad call flags in "
+                        "__Pyx_CyFunction_Call. METH_OLDARGS is no "
+                        "longer supported!");
+        return NULL;
+    }
+    PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
+                 f->m_ml->ml_name);
+    return NULL;
+}
+#else
+static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
+	return PyCFunction_Call(func, arg, kw);
+}
+#endif
+static PyTypeObject __pyx_CyFunctionType_type = {
+    PyVarObject_HEAD_INIT(0, 0)
+    __Pyx_NAMESTR("cython_function_or_method"), /*tp_name*/
+    sizeof(__pyx_CyFunctionObject),   /*tp_basicsize*/
+    0,                                  /*tp_itemsize*/
+    (destructor) __Pyx_CyFunction_dealloc, /*tp_dealloc*/
+    0,                                  /*tp_print*/
+    0,                                  /*tp_getattr*/
+    0,                                  /*tp_setattr*/
+#if PY_MAJOR_VERSION < 3
+    0,                                  /*tp_compare*/
+#else
+    0,                                  /*reserved*/
+#endif
+    (reprfunc) __Pyx_CyFunction_repr,   /*tp_repr*/
+    0,                                  /*tp_as_number*/
+    0,                                  /*tp_as_sequence*/
+    0,                                  /*tp_as_mapping*/
+    0,                                  /*tp_hash*/
+    __Pyx_CyFunction_Call,              /*tp_call*/
+    0,                                  /*tp_str*/
+    0,                                  /*tp_getattro*/
+    0,                                  /*tp_setattro*/
+    0,                                  /*tp_as_buffer*/
+    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags*/
+    0,                                  /*tp_doc*/
+    (traverseproc) __Pyx_CyFunction_traverse,   /*tp_traverse*/
+    (inquiry) __Pyx_CyFunction_clear,   /*tp_clear*/
+    0,                                  /*tp_richcompare*/
+    offsetof(__pyx_CyFunctionObject, func_weakreflist), /* tp_weaklistoffse */
+    0,                                  /*tp_iter*/
+    0,                                  /*tp_iternext*/
+    __pyx_CyFunction_methods,           /*tp_methods*/
+    __pyx_CyFunction_members,           /*tp_members*/
+    __pyx_CyFunction_getsets,           /*tp_getset*/
+    0,                                  /*tp_base*/
+    0,                                  /*tp_dict*/
+    __Pyx_CyFunction_descr_get,         /*tp_descr_get*/
+    0,                                  /*tp_descr_set*/
+    offsetof(__pyx_CyFunctionObject, func_dict),/*tp_dictoffset*/
+    0,                                  /*tp_init*/
+    0,                                  /*tp_alloc*/
+    0,                                  /*tp_new*/
+    0,                                  /*tp_free*/
+    0,                                  /*tp_is_gc*/
+    0,                                  /*tp_bases*/
+    0,                                  /*tp_mro*/
+    0,                                  /*tp_cache*/
+    0,                                  /*tp_subclasses*/
+    0,                                  /*tp_weaklist*/
+    0,                                  /*tp_del*/
+#if PY_VERSION_HEX >= 0x02060000
+    0,                                  /*tp_version_tag*/
+#endif
+#if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+    0,                                  /*tp_finalize*/
+#endif
+};
+static int __Pyx_CyFunction_init(void) {
+#if !CYTHON_COMPILING_IN_PYPY
+    __pyx_CyFunctionType_type.tp_call = PyCFunction_Call;
+#endif
+    if (PyType_Ready(&__pyx_CyFunctionType_type) < 0)
+        return -1;
+    __pyx_CyFunctionType = &__pyx_CyFunctionType_type;
+    return 0;
+}
+static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
+    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
+    m->defaults = PyMem_Malloc(size);
+    if (!m->defaults)
+        return PyErr_NoMemory();
+    memset(m->defaults, 0, size);
+    m->defaults_pyobjects = pyobjects;
+    return m->defaults;
+}
+static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
+    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
+    m->defaults_tuple = tuple;
+    Py_INCREF(tuple);
+}
+static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
+    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
+    m->defaults_kwdict = dict;
+    Py_INCREF(dict);
+}
+static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
+    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
+    m->func_annotations = dict;
+    Py_INCREF(dict);
+}
+
+static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
+#if CYTHON_COMPILING_IN_CPYTHON
+    PyThreadState *tstate = PyThreadState_GET();
+    *type = tstate->exc_type;
+    *value = tstate->exc_value;
+    *tb = tstate->exc_traceback;
+    Py_XINCREF(*type);
+    Py_XINCREF(*value);
+    Py_XINCREF(*tb);
+#else
+    PyErr_GetExcInfo(type, value, tb);
+#endif
+}
+static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) {
+#if CYTHON_COMPILING_IN_CPYTHON
+    PyObject *tmp_type, *tmp_value, *tmp_tb;
+    PyThreadState *tstate = PyThreadState_GET();
+    tmp_type = tstate->exc_type;
+    tmp_value = tstate->exc_value;
+    tmp_tb = tstate->exc_traceback;
+    tstate->exc_type = type;
+    tstate->exc_value = value;
+    tstate->exc_traceback = tb;
+    Py_XDECREF(tmp_type);
+    Py_XDECREF(tmp_value);
+    Py_XDECREF(tmp_tb);
+#else
+    PyErr_SetExcInfo(type, value, tb);
+#endif
+}
+
+#if PY_MAJOR_VERSION < 3
+static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
+  #if PY_VERSION_HEX >= 0x02060000
+    if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
+  #endif
+        if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags);
+        if (PyObject_TypeCheck(obj, __pyx_array_type)) return __pyx_array_getbuffer(obj, view, flags);
+        if (PyObject_TypeCheck(obj, __pyx_memoryview_type)) return __pyx_memoryview_getbuffer(obj, view, flags);
+  #if PY_VERSION_HEX < 0x02060000
+    if (obj->ob_type->tp_dict) {
+        PyObject *getbuffer_cobj = PyObject_GetItem(
+            obj->ob_type->tp_dict, __pyx_n_s____pyx_getbuffer);
+        if (getbuffer_cobj) {
+            getbufferproc func = (getbufferproc) PyCObject_AsVoidPtr(getbuffer_cobj);
+            Py_DECREF(getbuffer_cobj);
+            if (!func)
+                goto fail;
+            return func(obj, view, flags);
+        } else {
+            PyErr_Clear();
+        }
+    }
+  #endif
+    PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
+#if PY_VERSION_HEX < 0x02060000
+fail:
+#endif
+    return -1;
+}
+static void __Pyx_ReleaseBuffer(Py_buffer *view) {
+    PyObject *obj = view->obj;
+    if (!obj) return;
+  #if PY_VERSION_HEX >= 0x02060000
+    if (PyObject_CheckBuffer(obj)) {
+        PyBuffer_Release(view);
+        return;
+    }
+  #endif
+        if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) { __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view); return; }
+  #if PY_VERSION_HEX < 0x02060000
+    if (obj->ob_type->tp_dict) {
+        PyObject *releasebuffer_cobj = PyObject_GetItem(
+            obj->ob_type->tp_dict, __pyx_n_s____pyx_releasebuffer);
+        if (releasebuffer_cobj) {
+            releasebufferproc func = (releasebufferproc) PyCObject_AsVoidPtr(releasebuffer_cobj);
+            Py_DECREF(releasebuffer_cobj);
+            if (!func)
+                goto fail;
+            func(obj, view);
+            return;
+        } else {
+            PyErr_Clear();
+        }
+    }
+  #endif
+    goto nofail;
+#if PY_VERSION_HEX < 0x02060000
+fail:
+#endif
+    PyErr_WriteUnraisable(obj);
+nofail:
+    Py_DECREF(obj);
+    view->obj = NULL;
+}
+#endif /*  PY_MAJOR_VERSION < 3 */
+
+
+              static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
+    PyObject *empty_list = 0;
+    PyObject *module = 0;
+    PyObject *global_dict = 0;
+    PyObject *empty_dict = 0;
+    PyObject *list;
+    #if PY_VERSION_HEX < 0x03030000
+    PyObject *py_import;
+    py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s____import__);
+    if (!py_import)
+        goto bad;
+    #endif
+    if (from_list)
+        list = from_list;
+    else {
+        empty_list = PyList_New(0);
+        if (!empty_list)
+            goto bad;
+        list = empty_list;
+    }
+    global_dict = PyModule_GetDict(__pyx_m);
+    if (!global_dict)
+        goto bad;
+    empty_dict = PyDict_New();
+    if (!empty_dict)
+        goto bad;
+    #if PY_VERSION_HEX >= 0x02050000
+    {
+        #if PY_MAJOR_VERSION >= 3
+        if (level == -1) {
+            if (strchr(__Pyx_MODULE_NAME, '.')) {
+                #if PY_VERSION_HEX < 0x03030000
+                PyObject *py_level = PyInt_FromLong(1);
+                if (!py_level)
+                    goto bad;
+                module = PyObject_CallFunctionObjArgs(py_import,
+                    name, global_dict, empty_dict, list, py_level, NULL);
+                Py_DECREF(py_level);
+                #else
+                module = PyImport_ImportModuleLevelObject(
+                    name, global_dict, empty_dict, list, 1);
+                #endif
+                if (!module) {
+                    if (!PyErr_ExceptionMatches(PyExc_ImportError))
+                        goto bad;
+                    PyErr_Clear();
+                }
+            }
+            level = 0; /* try absolute import on failure */
+        }
+        #endif
+        if (!module) {
+            #if PY_VERSION_HEX < 0x03030000
+            PyObject *py_level = PyInt_FromLong(level);
+            if (!py_level)
+                goto bad;
+            module = PyObject_CallFunctionObjArgs(py_import,
+                name, global_dict, empty_dict, list, py_level, NULL);
+            Py_DECREF(py_level);
+            #else
+            module = PyImport_ImportModuleLevelObject(
+                name, global_dict, empty_dict, list, level);
+            #endif
         }
-        break;
-    default:
-        PyErr_SetString(PyExc_SystemError, "Bad call flags in "
-                        "__Pyx_CyFunction_Call. METH_OLDARGS is no "
-                        "longer supported!");
-        return NULL;
     }
-    PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
-                 f->m_ml->ml_name);
-    return NULL;
-}
-#else
-static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
-	return PyCFunction_Call(func, arg, kw);
+    #else
+    if (level>0) {
+        PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4.");
+        goto bad;
+    }
+    module = PyObject_CallFunctionObjArgs(py_import,
+        name, global_dict, empty_dict, list, NULL);
+    #endif
+bad:
+    #if PY_VERSION_HEX < 0x03030000
+    Py_XDECREF(py_import);
+    #endif
+    Py_XDECREF(empty_list);
+    Py_XDECREF(empty_dict);
+    return module;
 }
-#endif
-static PyTypeObject __pyx_CyFunctionType_type = {
-    PyVarObject_HEAD_INIT(0, 0)
-    __Pyx_NAMESTR("cython_function_or_method"), /*tp_name*/
-    sizeof(__pyx_CyFunctionObject),   /*tp_basicsize*/
-    0,                                  /*tp_itemsize*/
-    (destructor) __Pyx_CyFunction_dealloc, /*tp_dealloc*/
-    0,                                  /*tp_print*/
-    0,                                  /*tp_getattr*/
-    0,                                  /*tp_setattr*/
+
+static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases) {
+    PyObject *metaclass;
 #if PY_MAJOR_VERSION < 3
-    0,                                  /*tp_compare*/
+    if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
+        PyObject *base = PyTuple_GET_ITEM(bases, 0);
+        metaclass = __Pyx_PyObject_GetAttrStr(base, __pyx_n_s____class__);
+        if (!metaclass) {
+            PyErr_Clear();
+            metaclass = (PyObject*) Py_TYPE(base);
+            Py_INCREF(metaclass);
+        }
+    } else {
+        metaclass = (PyObject *) &PyClass_Type;
+        Py_INCREF(metaclass);
+    }
 #else
-    0,                                  /*reserved*/
-#endif
-    (reprfunc) __Pyx_CyFunction_repr,   /*tp_repr*/
-    0,                                  /*tp_as_number*/
-    0,                                  /*tp_as_sequence*/
-    0,                                  /*tp_as_mapping*/
-    0,                                  /*tp_hash*/
-    __Pyx_CyFunction_Call,              /*tp_call*/
-    0,                                  /*tp_str*/
-    0,                                  /*tp_getattro*/
-    0,                                  /*tp_setattro*/
-    0,                                  /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags*/
-    0,                                  /*tp_doc*/
-    (traverseproc) __Pyx_CyFunction_traverse,   /*tp_traverse*/
-    (inquiry) __Pyx_CyFunction_clear,   /*tp_clear*/
-    0,                                  /*tp_richcompare*/
-    offsetof(__pyx_CyFunctionObject, func_weakreflist), /* tp_weaklistoffse */
-    0,                                  /*tp_iter*/
-    0,                                  /*tp_iternext*/
-    __pyx_CyFunction_methods,           /*tp_methods*/
-    __pyx_CyFunction_members,           /*tp_members*/
-    __pyx_CyFunction_getsets,           /*tp_getset*/
-    0,                                  /*tp_base*/
-    0,                                  /*tp_dict*/
-    __Pyx_CyFunction_descr_get,         /*tp_descr_get*/
-    0,                                  /*tp_descr_set*/
-    offsetof(__pyx_CyFunctionObject, func_dict),/*tp_dictoffset*/
-    0,                                  /*tp_init*/
-    0,                                  /*tp_alloc*/
-    0,                                  /*tp_new*/
-    0,                                  /*tp_free*/
-    0,                                  /*tp_is_gc*/
-    0,                                  /*tp_bases*/
-    0,                                  /*tp_mro*/
-    0,                                  /*tp_cache*/
-    0,                                  /*tp_subclasses*/
-    0,                                  /*tp_weaklist*/
-    0,                                  /*tp_del*/
-#if PY_VERSION_HEX >= 0x02060000
-    0,                                  /*tp_version_tag*/
-#endif
-};
-static int __Pyx_CyFunction_init(void) {
-#if !CYTHON_COMPILING_IN_PYPY
-    __pyx_CyFunctionType_type.tp_call = PyCFunction_Call;
+    if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
+        PyObject *base = PyTuple_GET_ITEM(bases, 0);
+        metaclass = (PyObject*) Py_TYPE(base);
+    } else {
+        metaclass = (PyObject *) &PyType_Type;
+    }
+    Py_INCREF(metaclass);
 #endif
-    if (PyType_Ready(&__pyx_CyFunctionType_type) < 0)
-        return -1;
-    __pyx_CyFunctionType = &__pyx_CyFunctionType_type;
-    return 0;
+    return metaclass;
 }
-static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
-    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
-    m->defaults = PyMem_Malloc(size);
-    if (!m->defaults)
-        return PyErr_NoMemory();
-    memset(m->defaults, 0, sizeof(size));
-    m->defaults_pyobjects = pyobjects;
-    return m->defaults;
+
+static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name,
+                                   PyObject *qualname, PyObject *modname) {
+    PyObject *result;
+    PyObject *metaclass;
+    if (PyDict_SetItem(dict, __pyx_n_s____module__, modname) < 0)
+        return NULL;
+    if (PyDict_SetItem(dict, __pyx_n_s____qualname__, qualname) < 0)
+        return NULL;
+    metaclass = PyDict_GetItem(dict, __pyx_n_s____metaclass__);
+    if (metaclass) {
+        Py_INCREF(metaclass);
+    } else {
+        metaclass = __Pyx_FindPy2Metaclass(bases);
+    }
+    result = PyObject_CallFunctionObjArgs(metaclass, name, bases, dict, NULL);
+    Py_DECREF(metaclass);
+    return result;
 }
-static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
-    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
-    m->defaults_tuple = tuple;
-    Py_INCREF(tuple);
+
+static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_int8(npy_int8 val) {
+    const npy_int8 neg_one = (npy_int8)-1, const_zero = (npy_int8)0;
+    const int is_unsigned = const_zero < neg_one;
+    if ((sizeof(npy_int8) == sizeof(char))  ||
+        (sizeof(npy_int8) == sizeof(short))) {
+        return PyInt_FromLong((long)val);
+    } else if ((sizeof(npy_int8) == sizeof(int)) ||
+               (sizeof(npy_int8) == sizeof(long))) {
+        if (is_unsigned)
+            return PyLong_FromUnsignedLong((unsigned long)val);
+        else
+            return PyInt_FromLong((long)val);
+    } else if (sizeof(npy_int8) == sizeof(PY_LONG_LONG)) {
+        if (is_unsigned)
+            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val);
+        else
+            return PyLong_FromLongLong((PY_LONG_LONG)val);
+    } else {
+        int one = 1; int little = (int)*(unsigned char *)&one;
+        unsigned char *bytes = (unsigned char *)&val;
+        return _PyLong_FromByteArray(bytes, sizeof(npy_int8),
+                                     little, !is_unsigned);
+    }
 }
 
 static CYTHON_INLINE npy_int32 __Pyx_PyInt_from_py_npy_int32(PyObject* x) {
@@ -35859,7 +31206,7 @@ static CYTHON_INLINE npy_int32 __Pyx_PyInt_from_py_npy_int32(PyObject* x) {
         #else
         npy_int32 val;
         PyObject *v = __Pyx_PyNumber_Int(x);
-        #if PY_VERSION_HEX < 0x03000000
+        #if PY_MAJOR_VERSION < 3
         if (likely(v) && !PyLong_Check(v)) {
             PyObject *tmp = v;
             v = PyNumber_Long(tmp);
@@ -35881,29 +31228,15 @@ static CYTHON_INLINE npy_int32 __Pyx_PyInt_from_py_npy_int32(PyObject* x) {
     }
 }
 
-static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_int8(npy_int8 val) {
-    const npy_int8 neg_one = (npy_int8)-1, const_zero = (npy_int8)0;
-    const int is_unsigned = const_zero < neg_one;
-    if ((sizeof(npy_int8) == sizeof(char))  ||
-        (sizeof(npy_int8) == sizeof(short))) {
-        return PyInt_FromLong((long)val);
-    } else if ((sizeof(npy_int8) == sizeof(int)) ||
-               (sizeof(npy_int8) == sizeof(long))) {
-        if (is_unsigned)
-            return PyLong_FromUnsignedLong((unsigned long)val);
-        else
-            return PyInt_FromLong((long)val);
-    } else if (sizeof(npy_int8) == sizeof(PY_LONG_LONG)) {
-        if (is_unsigned)
-            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val);
-        else
-            return PyLong_FromLongLong((PY_LONG_LONG)val);
-    } else {
-        int one = 1; int little = (int)*(unsigned char *)&one;
-        unsigned char *bytes = (unsigned char *)&val;
-        return _PyLong_FromByteArray(bytes, sizeof(npy_int8),
-                                     little, !is_unsigned);
-    }
+static PyObject *__pyx_memview_get_float(const char *itemp) {
+    return (PyObject *) PyFloat_FromDouble(*(float *) itemp);
+}
+static int __pyx_memview_set_float(const char *itemp, PyObject *obj) {
+    float value = __pyx_PyFloat_AsFloat(obj);
+    if ((value == (float)-1) && PyErr_Occurred())
+        return 0;
+    *(float *) itemp = value;
+    return 1;
 }
 
 static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_int32(npy_int32 val) {
@@ -36257,7 +31590,7 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
     }
     __Pyx_GOTREF(shape_tuple);
     for(i = 0; i < ndim; i++) {
-        temp_int = PyInt_FromLong(from_mvs->shape[i]);
+        temp_int = PyInt_FromSsize_t(from_mvs->shape[i]);
         if(unlikely(!temp_int)) {
             goto fail;
         } else {
@@ -36295,7 +31628,7 @@ no_fail:
 }
 
 static CYTHON_INLINE PyObject *
-__pyx_capsule_create(void *p, const char *sig)
+__pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig)
 {
     PyObject *cobj;
 #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0)
@@ -36496,10 +31829,15 @@ static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) {
     return (int)__Pyx_PyInt_AsLong(x);
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
     const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -36512,6 +31850,16 @@ static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(unsigned long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (unsigned long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to unsigned long");
@@ -36519,6 +31867,17 @@ static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
             }
             return (unsigned long)PyLong_AsUnsignedLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(unsigned long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(unsigned long) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(unsigned long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (unsigned long)PyLong_AsLong(x);
         }
     } else {
@@ -36531,10 +31890,15 @@ static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
     }
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
     const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -36547,6 +31911,16 @@ static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObje
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to unsigned PY_LONG_LONG");
@@ -36554,6 +31928,17 @@ static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObje
             }
             return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x);
         }
     } else {
@@ -36566,10 +31951,15 @@ static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObje
     }
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
     const long neg_one = (long)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -36582,6 +31972,16 @@ static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to long");
@@ -36589,6 +31989,17 @@ static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
             }
             return (long)PyLong_AsUnsignedLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(long) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (long)PyLong_AsLong(x);
         }
     } else {
@@ -36601,10 +32012,15 @@ static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
     }
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
     const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -36617,6 +32033,16 @@ static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to PY_LONG_LONG");
@@ -36624,6 +32050,17 @@ static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
             }
             return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (PY_LONG_LONG)PyLong_AsLongLong(x);
         }
     } else {
@@ -36636,10 +32073,15 @@ static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
     }
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
     const signed long neg_one = (signed long)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -36652,6 +32094,16 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(signed long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (signed long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to signed long");
@@ -36659,6 +32111,17 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
             }
             return (signed long)PyLong_AsUnsignedLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(signed long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(signed long) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(signed long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (signed long)PyLong_AsLong(x);
         }
     } else {
@@ -36671,10 +32134,15 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
     }
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
     const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -36687,6 +32155,16 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject*
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to signed PY_LONG_LONG");
@@ -36694,6 +32172,17 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject*
             }
             return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (signed PY_LONG_LONG)PyLong_AsLongLong(x);
         }
     } else {
@@ -36706,6 +32195,227 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject*
     }
 }
 
+static int
+__pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b)
+{
+    int i;
+    if (!a || !b)
+        return 0;
+    if (a == b)
+        return 1;
+    if (a->size != b->size || a->typegroup != b->typegroup ||
+            a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) {
+        if (a->typegroup == 'H' || b->typegroup == 'H') {
+            return a->size == b->size;
+        } else {
+            return 0;
+        }
+    }
+    if (a->ndim) {
+        for (i = 0; i < a->ndim; i++)
+            if (a->arraysize[i] != b->arraysize[i])
+                return 0;
+    }
+    if (a->typegroup == 'S') {
+        if (a->flags != b->flags)
+            return 0;
+        if (a->fields || b->fields) {
+            if (!(a->fields && b->fields))
+                return 0;
+            for (i = 0; a->fields[i].type && b->fields[i].type; i++) {
+                __Pyx_StructField *field_a = a->fields + i;
+                __Pyx_StructField *field_b = b->fields + i;
+                if (field_a->offset != field_b->offset ||
+                    !__pyx_typeinfo_cmp(field_a->type, field_b->type))
+                    return 0;
+            }
+            return !a->fields[i].type && !b->fields[i].type;
+        }
+    }
+    return 1;
+}
+
+static int
+__pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec)
+{
+    if (buf->shape[dim] <= 1)
+        return 1;
+    if (buf->strides) {
+        if (spec & __Pyx_MEMVIEW_CONTIG) {
+            if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) {
+                if (buf->strides[dim] != sizeof(void *)) {
+                    PyErr_Format(PyExc_ValueError,
+                                 "Buffer is not indirectly contiguous "
+                                 "in dimension %d.", dim);
+                    goto fail;
+                }
+            } else if (buf->strides[dim] != buf->itemsize) {
+                PyErr_SetString(PyExc_ValueError,
+                                "Buffer and memoryview are not contiguous "
+                                "in the same dimension.");
+                goto fail;
+            }
+        }
+        if (spec & __Pyx_MEMVIEW_FOLLOW) {
+            Py_ssize_t stride = buf->strides[dim];
+            if (stride < 0)
+                stride = -stride;
+            if (stride < buf->itemsize) {
+                PyErr_SetString(PyExc_ValueError,
+                                "Buffer and memoryview are not contiguous "
+                                "in the same dimension.");
+                goto fail;
+            }
+        }
+    } else {
+        if (spec & __Pyx_MEMVIEW_CONTIG && dim != ndim - 1) {
+            PyErr_Format(PyExc_ValueError,
+                         "C-contiguous buffer is not contiguous in "
+                         "dimension %d", dim);
+            goto fail;
+        } else if (spec & (__Pyx_MEMVIEW_PTR)) {
+            PyErr_Format(PyExc_ValueError,
+                         "C-contiguous buffer is not indirect in "
+                         "dimension %d", dim);
+            goto fail;
+        } else if (buf->suboffsets) {
+            PyErr_SetString(PyExc_ValueError,
+                            "Buffer exposes suboffsets but no strides");
+            goto fail;
+        }
+    }
+    return 1;
+fail:
+    return 0;
+}
+static int
+__pyx_check_suboffsets(Py_buffer *buf, int dim, CYTHON_UNUSED int ndim, int spec)
+{
+    if (spec & __Pyx_MEMVIEW_DIRECT) {
+        if (buf->suboffsets && buf->suboffsets[dim] >= 0) {
+            PyErr_Format(PyExc_ValueError,
+                         "Buffer not compatible with direct access "
+                         "in dimension %d.", dim);
+            goto fail;
+        }
+    }
+    if (spec & __Pyx_MEMVIEW_PTR) {
+        if (!buf->suboffsets || (buf->suboffsets && buf->suboffsets[dim] < 0)) {
+            PyErr_Format(PyExc_ValueError,
+                         "Buffer is not indirectly accessisble "
+                         "in dimension %d.", dim);
+            goto fail;
+        }
+    }
+    return 1;
+fail:
+    return 0;
+}
+static int
+__pyx_verify_contig(Py_buffer *buf, int ndim, int c_or_f_flag)
+{
+    int i;
+    if (c_or_f_flag & __Pyx_IS_F_CONTIG) {
+        Py_ssize_t stride = 1;
+        for (i = 0; i < ndim; i++) {
+            if (stride * buf->itemsize != buf->strides[i] &&
+                    buf->shape[i] > 1)
+            {
+                PyErr_SetString(PyExc_ValueError,
+                    "Buffer not fortran contiguous.");
+                goto fail;
+            }
+            stride = stride * buf->shape[i];
+        }
+    } else if (c_or_f_flag & __Pyx_IS_C_CONTIG) {
+        Py_ssize_t stride = 1;
+        for (i = ndim - 1; i >- 1; i--) {
+            if (stride * buf->itemsize != buf->strides[i] &&
+                    buf->shape[i] > 1) {
+                PyErr_SetString(PyExc_ValueError,
+                    "Buffer not C contiguous.");
+                goto fail;
+            }
+            stride = stride * buf->shape[i];
+        }
+    }
+    return 1;
+fail:
+    return 0;
+}
+static int __Pyx_ValidateAndInit_memviewslice(
+                int *axes_specs,
+                int c_or_f_flag,
+                int buf_flags,
+                int ndim,
+                __Pyx_TypeInfo *dtype,
+                __Pyx_BufFmt_StackElem stack[],
+                __Pyx_memviewslice *memviewslice,
+                PyObject *original_obj)
+{
+    struct __pyx_memoryview_obj *memview, *new_memview;
+    __Pyx_RefNannyDeclarations
+    Py_buffer *buf;
+    int i, spec = 0, retval = -1;
+    __Pyx_BufFmt_Context ctx;
+    int from_memoryview = __pyx_memoryview_check(original_obj);
+    __Pyx_RefNannySetupContext("ValidateAndInit_memviewslice", 0);
+    if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((struct __pyx_memoryview_obj *)
+                                                            original_obj)->typeinfo)) {
+        memview = (struct __pyx_memoryview_obj *) original_obj;
+        new_memview = NULL;
+    } else {
+        memview = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
+                                            original_obj, buf_flags, 0, dtype);
+        new_memview = memview;
+        if (unlikely(!memview))
+            goto fail;
+    }
+    buf = &memview->view;
+    if (buf->ndim != ndim) {
+        PyErr_Format(PyExc_ValueError,
+                "Buffer has wrong number of dimensions (expected %d, got %d)",
+                ndim, buf->ndim);
+        goto fail;
+    }
+    if (new_memview) {
+        __Pyx_BufFmt_Init(&ctx, stack, dtype);
+        if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
+    }
+    if ((unsigned) buf->itemsize != dtype->size) {
+        PyErr_Format(PyExc_ValueError,
+                     "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "u byte%s) "
+                     "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "u byte%s)",
+                     buf->itemsize,
+                     (buf->itemsize > 1) ? "s" : "",
+                     dtype->name,
+                     dtype->size,
+                     (dtype->size > 1) ? "s" : "");
+        goto fail;
+    }
+    for (i = 0; i < ndim; i++) {
+        spec = axes_specs[i];
+        if (!__pyx_check_strides(buf, i, ndim, spec))
+            goto fail;
+        if (!__pyx_check_suboffsets(buf, i, ndim, spec))
+            goto fail;
+    }
+    if (buf->strides && !__pyx_verify_contig(buf, ndim, c_or_f_flag))
+        goto fail;
+    if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice,
+                                         new_memview != NULL) == -1)) {
+        goto fail;
+    }
+    retval = 0;
+    goto no_fail;
+fail:
+    Py_XDECREF(new_memview);
+    retval = -1;
+no_fail:
+    __Pyx_RefNannyFinishContext();
+    return retval;
+}
+
 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_float(PyObject *obj) {
     __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
     __Pyx_BufFmt_StackElem stack[1];
@@ -36772,25 +32482,6 @@ __pyx_fail:
     return result;
 }
 
-static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
-                                  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename) {
-    PyObject *old_exc, *old_val, *old_tb;
-    PyObject *ctx;
-    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
-    #if PY_MAJOR_VERSION < 3
-    ctx = PyString_FromString(name);
-    #else
-    ctx = PyUnicode_FromString(name);
-    #endif
-    __Pyx_ErrRestore(old_exc, old_val, old_tb);
-    if (!ctx) {
-        PyErr_WriteUnraisable(Py_None);
-    } else {
-        PyErr_WriteUnraisable(ctx);
-        Py_DECREF(ctx);
-    }
-}
-
 static int __Pyx_check_binary_version(void) {
     char ctversion[4], rtversion[4];
     PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
@@ -36810,23 +32501,6 @@ static int __Pyx_check_binary_version(void) {
     return 0;
 }
 
-static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
-#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
-    PyObject *ob = PyCapsule_New(vtable, 0, 0);
-#else
-    PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
-#endif
-    if (!ob)
-        goto bad;
-    if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0)
-        goto bad;
-    Py_DECREF(ob);
-    return 0;
-bad:
-    Py_XDECREF(ob);
-    return -1;
-}
-
 #ifndef __PYX_HAVE_RT_ImportModule
 #define __PYX_HAVE_RT_ImportModule
 static PyObject *__Pyx_ImportModule(const char *name) {
@@ -37104,6 +32778,65 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
     return 0;
 }
 
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char* c_str) {
+    return __Pyx_PyUnicode_FromStringAndSize(c_str, strlen(c_str));
+}
+static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
+    Py_ssize_t ignore;
+    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
+}
+static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
+    if (
+#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+            __Pyx_sys_getdefaultencoding_not_ascii &&
+#endif
+            PyUnicode_Check(o)) {
+#if PY_VERSION_HEX < 0x03030000
+        char* defenc_c;
+        PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
+        if (!defenc) return NULL;
+        defenc_c = PyBytes_AS_STRING(defenc);
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+        {
+            char* end = defenc_c + PyBytes_GET_SIZE(defenc);
+            char* c;
+            for (c = defenc_c; c < end; c++) {
+                if ((unsigned char) (*c) >= 128) {
+                    PyUnicode_AsASCIIString(o);
+                    return NULL;
+                }
+            }
+        }
+#endif /*__PYX_DEFAULT_STRING_ENCODING_IS_ASCII*/
+        *length = PyBytes_GET_SIZE(defenc);
+        return defenc_c;
+#else /* PY_VERSION_HEX < 0x03030000 */
+        if (PyUnicode_READY(o) == -1) return NULL;
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+        if (PyUnicode_IS_ASCII(o)) {
+            *length = PyUnicode_GET_DATA_SIZE(o);
+            return PyUnicode_AsUTF8(o);
+        } else {
+            PyUnicode_AsASCIIString(o);
+            return NULL;
+        }
+#else /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
+        return PyUnicode_AsUTF8AndSize(o, length);
+#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
+#endif /* PY_VERSION_HEX < 0x03030000 */
+    } else
+#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII  || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT */
+    {
+        char* result;
+        int r = PyBytes_AsStringAndSize(o, &result, length);
+        if (r < 0) {
+            return NULL;
+        } else {
+            return result;
+        }
+    }
+}
 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
    int is_true = x == Py_True;
    if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
@@ -37113,14 +32846,14 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
   PyNumberMethods *m;
   const char *name = NULL;
   PyObject *res = NULL;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
   if (PyInt_Check(x) || PyLong_Check(x))
 #else
   if (PyLong_Check(x))
 #endif
     return Py_INCREF(x), x;
   m = Py_TYPE(x)->tp_as_number;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
   if (m && m->nb_int) {
     name = "int";
     res = PyNumber_Int(x);
@@ -37136,7 +32869,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
   }
 #endif
   if (res) {
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (!PyInt_Check(res) && !PyLong_Check(res)) {
 #else
     if (!PyLong_Check(res)) {
@@ -37177,11 +32910,10 @@ static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
 }
 static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
    unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
-   if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) {
-       return (size_t)-1;
-   } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
-       PyErr_SetString(PyExc_OverflowError,
-                       "value too large to convert to size_t");
+   if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
+       if ((val != (unsigned PY_LONG_LONG)-1) || !PyErr_Occurred())
+           PyErr_SetString(PyExc_OverflowError,
+                           "value too large to convert to size_t");
        return (size_t)-1;
    }
    return (size_t)val;
diff --git a/src/splitBBoxLUT.pyx b/src/splitBBoxLUT.pyx
index 9361b0e..09f091a 100644
--- a/src/splitBBoxLUT.pyx
+++ b/src/splitBBoxLUT.pyx
@@ -31,7 +31,8 @@ from cython.parallel import prange
 from libc.string cimport memset
 import numpy
 cimport numpy
-from libc.math cimport fabs
+from libc.math cimport fabs, M_PI
+cdef float pi=<float> M_PI 
 cdef struct lut_point:
     numpy.int32_t idx
     numpy.float32_t coef
@@ -66,27 +67,30 @@ class HistoBBox1d(object):
                  allow_pos0_neg=False,
                  unit="undefined"):
 
-        cdef int i, size
         self.size = pos0.size
         assert delta_pos0.size == self.size
         self.bins = bins
         self.lut_size = 0
+        self.allow_pos0_neg =  allow_pos0_neg
+        if  mask is not None:
+            assert mask.size == self.size
+            self.check_mask = True
+            self.cmask = numpy.ascontiguousarray(mask.ravel(), dtype=numpy.int8)
+            if mask_checksum:
+                self.mask_checksum = mask_checksum
+            else:
+                self.mask_checksum = crc32(mask)
+        else:
+            self.check_mask = False
+            self.mask_checksum = None
+
         self.cpos0 = numpy.ascontiguousarray(pos0.ravel(), dtype=numpy.float32)
         self.dpos0 = numpy.ascontiguousarray(delta_pos0.ravel(), dtype=numpy.float32)
-        self.cpos0_sup = self.cpos0 + self.dpos0
-        self.cpos0_inf = self.cpos0 - self.dpos0
+        self.cpos0_sup = numpy.empty_like(self.cpos0) #self.cpos0 + self.dpos0
+        self.cpos0_inf = numpy.empty_like(self.cpos0) #self.cpos0 - self.dpos0
         self.pos0Range = pos0Range
         self.pos1Range = pos1Range
-        if pos0Range is not None and len(pos0Range) > 1:
-            self.pos0_min = min(pos0Range)
-            pos0_maxin = max(pos0Range)
-        else:
-            self.pos0_min = (self.cpos0_inf).min()
-            pos0_maxin = (self.cpos0_sup).max()
-        if (not allow_pos0_neg) and self.pos0_min < 0:
-            self.pos0_min = 0
-        self.pos0_max = pos0_maxin * EPS32
-
+        self.calc_boundaries(pos0Range)
         if pos1Range is not None and len(pos1Range) > 1:
             assert pos1.size == self.size
             assert delta_pos1.size == self.size
@@ -101,23 +105,58 @@ class HistoBBox1d(object):
             self.cpos1_min = None
             self.pos1_max = None
 
-        if  mask is not None:
-            assert mask.size == self.size
-            self.check_mask = True
-            self.cmask = numpy.ascontiguousarray(mask.ravel(), dtype=numpy.int8)
-            if mask_checksum:
-                self.mask_checksum = mask_checksum
-            else:
-                self.mask_checksum = crc32(mask)
-        else:
-            self.check_mask = False
-            self.mask_checksum = None
         self.delta = (self.pos0_max - self.pos0_min) / bins
         self.lut_max_idx = self.calc_lut()
-        self.outPos = numpy.linspace(self.pos0_min+0.5*self.delta, pos0_maxin-0.5*self.delta, self.bins)
+        self.outPos = numpy.linspace(self.pos0_min+0.5*self.delta, self.pos0_maxin-0.5*self.delta, self.bins)
         self.lut_checksum = crc32(self.lut)
         self.unit=unit
 
+    @cython.boundscheck(False)
+    @cython.wraparound(False)
+    def calc_boundaries(self,pos0Range):
+        cdef int size = self.cpos0.size
+        cdef bint check_mask = self.check_mask
+        cdef numpy.int8_t[:] cmask
+        cdef float[:] cpos0, dpos0, cpos0_sup, cpos0_inf,
+        cdef float upper, lower, pos0_max, pos0_min, c, d
+        cdef bint allow_pos0_neg=self.allow_pos0_neg
+
+        cpos0_sup = self.cpos0_sup
+        cpos0_inf = self.cpos0_inf
+        cpos0 = self.cpos0
+        dpos0 = self.dpos0
+        pos0_min=cpos0[0]
+        pos0_max=cpos0[0]
+
+        if check_mask:
+            cmask = self.cmask
+        with nogil:
+            for idx in range(size):
+                c = cpos0[idx]
+                d = dpos0[idx]
+                lower = c - d
+                upper = c + d
+                cpos0_sup[idx] = upper
+                cpos0_inf[idx] = lower
+                if not allow_pos0_neg and lower<0:
+                    lower=0
+                if not (check_mask and cmask[idx]):
+                    if upper>pos0_max:
+                        pos0_max = upper
+                    if lower<pos0_min:
+                        pos0_min = lower
+
+        if pos0Range is not None and len(pos0Range) > 1:
+            self.pos0_min = min(pos0Range)
+            self.pos0_maxin = max(pos0Range)
+        else:
+            self.pos0_min = pos0_min
+            self.pos0_maxin = pos0_max
+        if (not allow_pos0_neg) and self.pos0_min < 0:
+            self.pos0_min = 0
+        self.pos0_max = self.pos0_maxin * EPS32
+
+
     @cython.cdivision(True)
     @cython.boundscheck(False)
     @cython.wraparound(False)
@@ -257,8 +296,8 @@ class HistoBBox1d(object):
     def integrate(self, weights, dummy=None, delta_dummy=None, dark=None, flat=None, solidAngle=None, polarization=None):
         """
         Actually perform the integration which in this case looks more like a matrix-vector product
-        
-        @param weights: input image 
+
+        @param weights: input image
         @type weights: ndarray
         @param dummy: value for dead pixels (optional)
         @type dummy: float
@@ -274,7 +313,7 @@ class HistoBBox1d(object):
         @type polarization: ndarray
         @return : positions, pattern, weighted_histogram and unweighted_histogram
         @rtype: 4-tuple of ndarrays
-        
+
         """
         cdef int i=0, j=0, idx=0, bins=self.bins, lut_size=self.lut_size, size=self.size
         cdef double sum_data=0, sum_count=0, epsilon=1e-10
@@ -382,7 +421,7 @@ class HistoBBox1d(object):
 
 
 ################################################################################
-# Bidimensionnal regrouping 
+# Bidimensionnal regrouping
 ################################################################################
 
 class HistoBBox2d(object):
@@ -398,13 +437,28 @@ class HistoBBox2d(object):
                  mask=None,
                  mask_checksum=None,
                  allow_pos0_neg=False,
-                 unit="undefined"):
-
+                 unit="undefined",
+                 chiDiscAtPi=True
+                 ):
+        """
+        @param pos0: 1D array with pos0: tth or q_vect
+        @param delta_pos0: 1D array with delta pos0: max center-corner distance
+        @param pos1: 1D array with pos1: chi
+        @param delta_pos1: 1D array with max pos1: max center-corner distance, unused !
+        @param bins: number of output bins (tth=100, chi=36 by default)
+        @param pos0Range: minimum and maximum  of the 2th range
+        @param pos1Range: minimum and maximum  of the chi range
+        @param mask: array (of int8) with masked pixels with 1 (0=not masked)
+        @param allow_pos0_neg: enforce the q<0 is usually not possible  
+        @param chiDiscAtPi: boolean; by default the chi_range is in the range ]-pi,pi[ set to 0 to have the range ]0,2pi[
+        """
         cdef int i, size, bin0, bin1
         self.size = pos0.size
         assert delta_pos0.size == self.size
         assert pos1.size == self.size
         assert delta_pos1.size == self.size
+        self.chiDiscAtPi = 1 if chiDiscAtPi else 0
+        self.allow_pos0_neg =  allow_pos0_neg
 
         try:
             bins0, bins1 = tuple(bins)
@@ -416,34 +470,6 @@ class HistoBBox2d(object):
             bins1 = 1
         self.bins = (int(bins0),int(bins1))
         self.lut_size = 0
-        self.cpos0 = numpy.ascontiguousarray(pos0.ravel(), dtype=numpy.float32)
-        self.dpos0 = numpy.ascontiguousarray(delta_pos0.ravel(), dtype=numpy.float32)
-        self.cpos0_sup = self.cpos0 + self.dpos0
-        self.cpos0_inf = self.cpos0 - self.dpos0
-        self.pos0Range = pos0Range
-        self.pos1Range = pos1Range
-        if pos0Range is not None and len(pos0Range) > 1:
-            self.pos0_min = min(pos0Range)
-            pos0_maxin = max(pos0Range)
-        else:
-            self.pos0_min = (self.cpos0_inf).min()
-            pos0_maxin = (self.cpos0_sup).max()
-        if (not allow_pos0_neg) and self.pos0_min < 0:
-            self.pos0_min = 0
-        self.pos0_max = pos0_maxin * EPS32
-
-
-        self.cpos1_inf = numpy.ascontiguousarray((pos1-delta_pos1).ravel(), dtype=numpy.float32)
-        self.cpos1_sup = numpy.ascontiguousarray((pos1+delta_pos1).ravel(), dtype=numpy.float32)
-
-        if pos1Range is not None and len(pos1Range) > 1:
-            self.pos1_min = min(pos1Range)
-            pos1_maxin = max(pos1Range)
-        else:
-            self.pos1_min = pos1.min()
-            pos1_maxin = pos1.max()
-        self.pos1_max = pos1_maxin * EPS32
-
         if  mask is not None:
             assert mask.size == self.size
             self.check_mask = True
@@ -455,24 +481,120 @@ class HistoBBox2d(object):
         else:
             self.check_mask = False
             self.mask_checksum = None
+
+        self.cpos0 = numpy.ascontiguousarray(pos0.ravel(), dtype=numpy.float32)
+        self.dpos0 = numpy.ascontiguousarray(delta_pos0.ravel(), dtype=numpy.float32)
+        self.cpos0_sup = numpy.empty_like(self.cpos0)
+        self.cpos0_inf = numpy.empty_like(self.cpos0)
+        self.pos0Range = pos0Range
+        self.pos1Range = pos1Range
+
+        self.cpos1 = numpy.ascontiguousarray((pos1).ravel(), dtype=numpy.float32)
+        self.dpos1 = numpy.ascontiguousarray((delta_pos1).ravel(), dtype=numpy.float32)
+        self.cpos1_sup = numpy.empty_like(self.cpos1)
+        self.cpos1_inf = numpy.empty_like(self.cpos1)
+        self.calc_boundaries(pos0Range, pos1Range)
         self.delta0 = (self.pos0_max - self.pos0_min) / float(bins0)
         self.delta1 = (self.pos1_max - self.pos1_min) / float(bins1)
         self.lut_max_idx = self.calc_lut()
-        self.outPos0 = numpy.linspace(self.pos0_min+0.5*self.delta0, pos0_maxin-0.5*self.delta0, bins0)
-        self.outPos1 = numpy.linspace(self.pos1_min+0.5*self.delta1, pos1_maxin-0.5*self.delta1, bins1)
+        self.outPos0 = numpy.linspace(self.pos0_min+0.5*self.delta0, self.pos0_maxin-0.5*self.delta0, bins0)
+        self.outPos1 = numpy.linspace(self.pos1_min+0.5*self.delta1, self.pos1_maxin-0.5*self.delta1, bins1)
         self.unit=unit
         self.lut.shape = -1, self.lut_size #this makes integration look like a 1D integration
-        self.lut_checksum = crc32(self.lut) 
+        self.lut_checksum = crc32(self.lut)
+
+    @cython.boundscheck(False)
+    @cython.wraparound(False)
+    def calc_boundaries(self, pos0Range, pos1Range):
+        cdef int size = self.cpos0.size
+        cdef bint check_mask = self.check_mask
+        cdef numpy.int8_t[:] cmask
+        cdef float[:] cpos0, dpos0, cpos0_sup, cpos0_inf
+        cdef float[:] cpos1, dpos1, cpos1_sup, cpos1_inf,
+        cdef float upper0, lower0, pos0_max, pos0_min, c0, d0
+        cdef float upper1, lower1, pos1_max, pos1_min, c1, d1
+        cdef bint allow_pos0_neg=self.allow_pos0_neg
+        cdef bint chiDiscAtPi = self.chiDiscAtPi
         
+        cpos0_sup = self.cpos0_sup
+        cpos0_inf = self.cpos0_inf
+        cpos0 = self.cpos0
+        dpos0 = self.dpos0
+        cpos1_sup = self.cpos1_sup
+        cpos1_inf = self.cpos1_inf
+        cpos1 = self.cpos1
+        dpos1 = self.dpos1
+        pos0_min=cpos0[0]
+        pos0_max=cpos0[0]
+        pos1_min=cpos1[0]
+        pos1_max=cpos1[0]
+
+        if check_mask:
+            cmask = self.cmask
+        with nogil:
+            for idx in range(size):
+                c0 = cpos0[idx]
+                d0 = dpos0[idx]
+                lower0 = c0 - d0
+                upper0 = c0 + d0
+                c1 = cpos1[idx]
+                d1 = dpos1[idx]
+                lower1 = c1 - d1
+                upper1 = c1 + d1
+                if not allow_pos0_neg and lower0<0:
+                    lower0=0
+                if upper1 > (2-chiDiscAtPi)*pi:
+                    upper1 = (2-chiDiscAtPi)*pi
+                if lower1 < (-chiDiscAtPi)*pi:
+                    lower1 = (-chiDiscAtPi)*pi
+                cpos0_sup[idx] = upper0
+                cpos0_inf[idx] = lower0
+                cpos1_sup[idx] = upper1
+                cpos1_inf[idx] = lower1
+                if not (check_mask and cmask[idx]):
+                    if upper0>pos0_max:
+                        pos0_max = upper0
+                    if lower0<pos0_min:
+                        pos0_min = lower0
+                    if upper1>pos1_max:
+                        pos1_max = upper1
+                    if lower1<pos1_min:
+                        pos1_min = lower1
+
+        if pos0Range is not None and len(pos0Range) > 1:
+            self.pos0_min = min(pos0Range)
+            self.pos0_maxin = max(pos0Range)
+        else:
+            self.pos0_min = pos0_min
+            self.pos0_maxin = pos0_max
+
+
+        if pos1Range is not None and len(pos1Range) > 1:
+            self.pos1_min = min(pos1Range)
+            self.pos1_maxin = max(pos1Range)
+        else:
+            self.pos1_min = pos1_min
+            self.pos1_maxin = pos1_max
+
+        if (not allow_pos0_neg) and self.pos0_min < 0:
+            self.pos0_min = 0
+        self.pos0_max = self.pos0_maxin * EPS32
+        self.cpos0_sup = cpos0_sup
+        self.cpos0_inf = cpos0_inf
+        self.pos1_max = self.pos1_maxin * EPS32
+        self.cpos1_sup = cpos1_sup
+        self.cpos1_inf = cpos1_inf
+
+
     @cython.boundscheck(False)
     @cython.wraparound(False)
     @cython.cdivision(True)
     def calc_lut(self):
         'calculate the max number of elements in the LUT and populate it'
         cdef float delta0=self.delta0, pos0_min=self.pos0_min, min0, max0, fbin0_min, fbin0_max
-        cdef float delta1=self.delta1, pos1_min=self.pos1_min, min1, max1, fbin1_min, fbin1_max 
-        cdef int bin0_min, bin0_max, bins0 = self.bins[0] 
-        cdef int bin1_min, bin1_max, bins1 = self.bins[1] 
+        cdef float delta1=self.delta1, pos1_min=self.pos1_min, min1, max1, fbin1_min, fbin1_max
+        cdef int bin0_min, bin0_max, bins0 = self.bins[0]
+        cdef int bin1_min, bin1_max, bins1 = self.bins[1]
         cdef numpy.int32_t k, idx, lut_size, i, j, size=self.size
         cdef bint check_mask
         cdef float[:] cpos0_sup = self.cpos0_sup
@@ -487,7 +609,7 @@ class HistoBBox2d(object):
             check_mask = True
         else:
             check_mask = False
-        
+
 #NOGIL
         with nogil:
             for idx in range(size):
@@ -538,17 +660,17 @@ class HistoBBox2d(object):
             for idx in range(size):
                 if (check_mask) and cmask[idx]:
                     continue
-    
+
                 min0 = cpos0_inf[idx]
                 max0 = cpos0_sup[idx]
                 min1 = cpos1_inf[idx]
                 max1 = cpos1_sup[idx]
-       
+
                 fbin0_min = getBinNr(min0, pos0_min, delta0)
                 fbin0_max = getBinNr(max0, pos0_min, delta0)
                 fbin1_min = getBinNr(min1, pos1_min, delta1)
                 fbin1_max = getBinNr(max1, pos1_min, delta1)
-    
+
                 bin0_min = <int> fbin0_min
                 bin0_max = <int> fbin0_max
                 bin1_min = <int> fbin1_min
@@ -565,7 +687,7 @@ class HistoBBox2d(object):
                     bin1_max = bins1 - 1
                 if  bin1_min < 0:
                     bin1_min = 0
-     
+
                 if bin0_min == bin0_max:
                     if bin1_min == bin1_max:
                         #All pixel is within a single bin
@@ -573,53 +695,53 @@ class HistoBBox2d(object):
                         lut[bin0_min, bin1_min, k].idx = idx
                         lut[bin0_min, bin1_min, k].coef = 1.0
                         outMax[bin0_min, bin1_min]= k+1
-                    
+
                     else:
                         #spread on more than 2 bins
                         deltaD = (< float > (bin1_min + 1)) - fbin1_min
                         deltaU = fbin1_max - ( bin1_max)
                         deltaA = 1.0 / (fbin1_max - fbin1_min)
-    
+
                         k = outMax[bin0_min, bin1_min]
-                        lut[bin0_min, bin1_min, k].idx = idx 
+                        lut[bin0_min, bin1_min, k].idx = idx
                         lut[bin0_min, bin1_min, k].coef =  deltaA * deltaD
                         outMax[bin0_min, bin1_min] = k + 1
-    
+
                         k = outMax[bin0_min, bin1_max]
-                        lut[bin0_min, bin1_max, k].idx = idx 
+                        lut[bin0_min, bin1_max, k].idx = idx
                         lut[bin0_min, bin1_max, k].coef =  deltaA * deltaU
                         outMax[bin0_min, bin1_max] = k + 1
-                        
+
                         for j in range(bin1_min + 1, bin1_max):
                             k = outMax[bin0_min, j]
-                            lut[bin0_min, j, k].idx = idx 
+                            lut[bin0_min, j, k].idx = idx
                             lut[bin0_min, j, k].coef =  deltaA
                             outMax[bin0_min, j] = k + 1
-    
+
                 else: #spread on more than 2 bins in dim 0
                     if bin1_min == bin1_max:
                         #All pixel fall on 1 bins in dim 1
                         deltaA = 1.0 / (fbin0_max - fbin0_min)
                         deltaL = (< float > (bin0_min + 1)) - fbin0_min
-                        
+
                         k = outMax[bin0_min, bin1_min]
-                        lut[bin0_min, bin1_min, k].idx = idx 
+                        lut[bin0_min, bin1_min, k].idx = idx
                         lut[bin0_min, bin1_min, k].coef =  deltaA * deltaL
                         outMax[bin0_min, bin1_min] = k+1
-                        
+
                         deltaR = fbin0_max - (< float > bin0_max)
-                        
-                        k = outMax[bin0_max, bin1_min]                        
-                        lut[bin0_max, bin1_min, k].idx = idx 
+
+                        k = outMax[bin0_max, bin1_min]
+                        lut[bin0_max, bin1_min, k].idx = idx
                         lut[bin0_max, bin1_min, k].coef =  deltaA * deltaR
                         outMax[bin0_max, bin1_min] = k + 1
-                        
+
                         for i in range(bin0_min + 1, bin0_max):
                             k = outMax[i, bin1_min]
-                            lut[i, bin1_min ,k].idx = idx 
+                            lut[i, bin1_min ,k].idx = idx
                             lut[i, bin1_min, k].coef =  deltaA
                             outMax[i, bin1_min] = k + 1
-                                
+
                     else:
                         #spread on n pix in dim0 and m pixel in dim1:
                         deltaL = (< float > (bin0_min + 1)) - fbin0_min
@@ -627,66 +749,66 @@ class HistoBBox2d(object):
                         deltaD = (< float > (bin1_min + 1)) - fbin1_min
                         deltaU = fbin1_max - (< float > bin1_max)
                         deltaA = 1.0 / ((fbin0_max - fbin0_min) * (fbin1_max - fbin1_min))
-    
-                        k = outMax[bin0_min, bin1_min] 
+
+                        k = outMax[bin0_min, bin1_min]
                         lut[bin0_min, bin1_min ,k].idx = idx
                         lut[bin0_min, bin1_min, k].coef =  deltaA * deltaL * deltaD
-                        outMax[bin0_min, bin1_min] = k + 1 
-                        
+                        outMax[bin0_min, bin1_min] = k + 1
+
                         k = outMax[bin0_min, bin1_max]
                         lut[bin0_min, bin1_max, k].idx = idx
                         lut[bin0_min, bin1_max, k].coef =  deltaA * deltaL * deltaU
                         outMax[bin0_min, bin1_max] = k + 1
-                        
+
                         k = outMax[bin0_max, bin1_min]
                         lut[bin0_max, bin1_min, k].idx = idx
                         lut[bin0_max, bin1_min, k].coef =  deltaA * deltaR * deltaD
                         outMax[bin0_max, bin1_min] = k + 1
-                        
+
                         k = outMax[bin0_max, bin1_max]
                         lut[bin0_max, bin1_max, k].idx = idx
                         lut[bin0_max, bin1_max, k].coef =  deltaA * deltaR * deltaU
                         outMax[bin0_max, bin1_max] = k + 1
-                        
+
                         for i in range(bin0_min + 1, bin0_max):
                             k = outMax[i, bin1_min]
                             lut[i, bin1_min, k].idx = idx
                             lut[i, bin1_min, k].coef =  deltaA * deltaD
                             outMax[i, bin1_min] = k + 1
-                            
+
                             for j in range(bin1_min + 1, bin1_max):
                                 k = outMax[i, j]
                                 lut[i, j, k].idx = idx
                                 lut[i, j, k].coef =  deltaA
                                 outMax[i, j] = k + 1
-                                
-                            k = outMax[i, bin1_max]    
+
+                            k = outMax[i, bin1_max]
                             lut[i, bin1_max, k].idx = idx
                             lut[i, bin1_max, k].coef =  deltaA * deltaU
                             outMax[i, bin1_max] = k + 1
-                            
+
                         for j in range(bin1_min + 1, bin1_max):
                             k = outMax[bin0_min, j]
                             lut[bin0_min, j, k].idx = idx
                             lut[bin0_min, j, k].coef =  deltaA * deltaL
                             outMax[bin0_min, j] = k + 1
-                            
+
                             k = outMax[bin0_max, j]
                             lut[bin0_max, j, k].idx = idx
                             lut[bin0_max, j, k].coef =  deltaA * deltaR
-                            outMax[bin0_max, j] = k + 1    
-        
+                            outMax[bin0_max, j] = k + 1
+
         self.lut=lut
         return outMax
-    
+
     @cython.cdivision(True)
     @cython.boundscheck(False)
     @cython.wraparound(False)
     def integrate(self, weights, dummy=None, delta_dummy=None, dark=None, flat=None, solidAngle=None, polarization=None):
         """
         Actually perform the 2D integration which in this case looks more like a matrix-vector product
-        
-        @param weights: input image 
+
+        @param weights: input image
         @type weights: ndarray
         @param dummy: value for dead pixels (optional)
         @type dummy: float
@@ -702,7 +824,7 @@ class HistoBBox2d(object):
         @type polarization: ndarray
         @return:  I(2d), edges0(1d), edges1(1d), weighted histogram(2d), unweighted histogram (2d)
         @rtype: 5-tuple of ndarrays
-        
+
         """
         cdef int i=0, j=0, idx=0, bins0=self.bins[0], bins1=self.bins[1], bins=bins0*bins1, lut_size=self.lut_size, size=self.size
         cdef double sum_data=0, sum_count=0, epsilon=1e-10
@@ -811,459 +933,3 @@ class HistoBBox2d(object):
                 outMerge_1d[i] += cdummy
         return  outMerge.T, self.outPos0, self.outPos1, outData.T, outCount.T
 
- at cython.cdivision(True)
- at cython.boundscheck(False)
- at cython.wraparound(False)
-def histoBBox2d(numpy.ndarray weights not None,
-                numpy.ndarray pos0 not None,
-                numpy.ndarray delta_pos0 not None,
-                numpy.ndarray pos1 not None,
-                numpy.ndarray delta_pos1 not None,
-                bins=(100, 36),
-                pos0Range=None,
-                pos1Range=None,
-                dummy=None,
-                delta_dummy=None,
-                mask=None,
-                dark=None,
-                flat=None,
-                solidangle=None,
-                polarization=None):
-    """
-    Calculate 2D histogram of pos0(tth),pos1(chi) weighted by weights
-
-    Splitting is done on the pixel's bounding box like fit2D
-
-
-    @param weights: array with intensities
-    @param pos0: 1D array with pos0: tth or q_vect
-    @param delta_pos0: 1D array with delta pos0: max center-corner distance
-    @param pos1: 1D array with pos1: chi
-    @param delta_pos1: 1D array with max pos1: max center-corner distance, unused !
-    @param bins: number of output bins (tth=100, chi=36 by default)
-    @param pos0Range: minimum and maximum  of the 2th range
-    @param pos1Range: minimum and maximum  of the chi range
-    @param dummy: value for bins without pixels & value of "no good" pixels
-    @param delta_dummy: precision of dummy value
-    @param mask: array (of int8) with masked pixels with 1 (0=not masked)
-    @param dark: array (of float32) with dark noise to be subtracted (or None)
-    @param flat: array (of float32) with flat-field image 
-    @param polarization: array (of float32) with polarization corrections
-    @param solidangle: array (of float32) with solid angle corrections
-
-    @return  I, edges0, edges1, weighted histogram(2D), unweighted histogram (2D)
-    """
-
-    cdef int bins0, bins1, i, j, idx
-    cdef size_t size = weights.size
-    assert pos0.size == size
-    assert pos1.size == size
-    assert delta_pos0.size == size
-    assert delta_pos1.size == size
-    try:
-        bins0, bins1 = tuple(bins)
-    except:
-        bins0 = bins1 = bins
-    if bins0 <= 0:
-        bins0 = 1
-    if bins1 <= 0:
-        bins1 = 1
-    cdef numpy.ndarray[numpy.float32_t, ndim = 1] cdata = numpy.ascontiguousarray(weights.ravel(),dtype=numpy.float32)
-    cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos0 = numpy.ascontiguousarray(pos0.ravel(),dtype=numpy.float32)
-    cdef numpy.ndarray[numpy.float32_t, ndim = 1] dpos0 = numpy.ascontiguousarray(delta_pos0.ravel(),dtype=numpy.float32)
-    cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos1 = numpy.ascontiguousarray(pos1.ravel(),dtype=numpy.float32)
-    cdef numpy.ndarray[numpy.float32_t, ndim = 1] dpos1 = numpy.ascontiguousarray(delta_pos1.ravel(),dtype=numpy.float32)
-    cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos0_upper = numpy.empty(size,dtype=numpy.float32)
-    cdef numpy.ndarray[numpy.float32_t, ndim = 1] cpos0_lower = numpy.empty(size,dtype=numpy.float32)
-    cdef numpy.ndarray[numpy.float64_t, ndim = 2] outData = numpy.zeros((bins0, bins1), dtype=numpy.float64)
-    cdef numpy.ndarray[numpy.float64_t, ndim = 2] outCount = numpy.zeros((bins0, bins1), dtype=numpy.float64)
-    cdef numpy.ndarray[numpy.float32_t, ndim = 2] outMerge = numpy.zeros((bins0, bins1), dtype=numpy.float32)
-
-    cdef float min0, max0, min1, max1, deltaR, deltaL, deltaU, deltaD, deltaA, tmp, delta0, delta1
-    cdef float pos0_min, pos0_max, pos1_min, pos1_max, pos0_maxin, pos1_maxin
-    cdef float fbin0_min, fbin0_max, fbin1_min, fbin1_max, data, epsilon = 1e-10, cdummy, ddummy
-    cdef int  bin0_max, bin0_min, bin1_max, bin1_min
-    cdef bint check_mask=False, check_dummy=False, do_dark=False, do_flat=False, do_polarization=False, do_solidangle=False
-    cdef numpy.int8_t[:] cmask
-    cdef float[:] cflat, cdark, cpolarization, csolidangle
-    
-    if  mask is not None:
-        assert mask.size == size
-        check_mask = True
-        cmask = numpy.ascontiguousarray(mask.ravel(),dtype=numpy.int8)
-
-    if (dummy is not None) and delta_dummy is not None:
-        check_dummy = True
-        cdummy =  float(dummy)
-        ddummy =  float(delta_dummy)
-    elif (dummy is not None):
-        cdummy = float(dummy)
-    else:
-        cdummy=0.0
-
-    if dark is not None:
-        assert dark.size == size
-        do_dark = True
-        cdark = numpy.ascontiguousarray(dark.ravel(),dtype=numpy.float32)
-    if flat is not None:
-        assert flat.size == size
-        do_flat = True
-        cflat = numpy.ascontiguousarray(flat.ravel(),dtype=numpy.float32)
-    if polarization is not None:
-        do_polarization = True
-        assert polarization.size == size
-        cpolarization = numpy.ascontiguousarray(polarization.ravel(), dtype=numpy.float32)
-    if solidangle is not None:
-        do_solidangle = True
-        assert solidangle.size == size
-        csolidangle = numpy.ascontiguousarray(solidangle.ravel(), dtype=numpy.float32)
-
-
-    pos0_min=cpos0[0]
-    pos0_max=cpos0[0]
-
-    with nogil:
-        for idx in range(size):
-            min0 = cpos0[idx] - dpos0[idx]
-            max0 = cpos0[idx] + dpos0[idx]
-            cpos0_upper[idx]=max0
-            cpos0_lower[idx]=min0
-            if max0>pos0_max:
-                pos0_max=max0
-            if min0<pos0_min:
-                pos0_min=min0
-
-    if (pos0Range is not None) and (len(pos0Range) == 2):
-        pos0_min = min(pos0Range)
-        pos0_maxin = max(pos0Range)
-    else:
-#        pos0_min = pos0_min
-        pos0_maxin = pos0_max
-    if pos0_min<0:
-        pos0_min=0
-    pos0_max = pos0_maxin * EPS32
-
-    if (pos1Range is not None) and (len(pos1Range) == 2):
-        pos1_min = min(pos1Range)
-        pos1_maxin = max(pos1Range)
-    else:
-        pos1_min = cpos1.min()
-        pos1_maxin = cpos1.max()
-    pos1_max = pos1_maxin * EPS32
-
-    delta0 = (pos0_max - pos0_min) / (< float > (bins0))
-    delta1 = (pos1_max - pos1_min) / (< float > (bins1))
-    edges0 = numpy.linspace(pos0_min+0.5*delta0, pos0_maxin-0.5*delta0, bins0)
-    edges1 = numpy.linspace(pos1_min+0.5*delta1, pos1_maxin-0.5*delta1, bins1)
-    with nogil:
-        for idx in range(size):
-            if (check_mask) and cmask[idx]:
-                continue
-
-            data = cdata[idx]
-            if (check_dummy) and (fabs(data-cdummy)<=ddummy):
-                continue
-
-            if do_dark:
-                data -= cdark[idx]
-            if do_flat:
-                data /= cflat[idx]
-            if do_polarization:
-                data /= cpolarization[idx]
-            if do_solidangle:
-                data /= csolidangle[idx]
-
-            min0 = cpos0_lower[idx]
-            max0 = cpos0_upper[idx]
-            min1 = cpos1[idx] - dpos1[idx]
-            max1 = cpos1[idx] + dpos1[idx]
-
-            if (max0 < pos0_min) or (max1 < pos1_min) or (min0 > pos0_maxin) or (min1 > pos1_maxin) :
-                continue
-
-            if min0 < pos0_min:
-                min0 = pos0_min
-            if min1 < pos1_min:
-                min1 = pos1_min
-            if max0 > pos0_maxin:
-                max0 = pos0_maxin
-            if max1 > pos1_maxin:
-                max1 = pos1_maxin
-
-
-            fbin0_min = getBinNr(min0, pos0_min, delta0)
-            fbin0_max = getBinNr(max0, pos0_min, delta0)
-            fbin1_min = getBinNr(min1, pos1_min, delta1)
-            fbin1_max = getBinNr(max1, pos1_min, delta1)
-
-            bin0_min = <int> fbin0_min
-            bin0_max = <int> fbin0_max
-            bin1_min = <int> fbin1_min
-            bin1_max = <int> fbin1_max
-
-
-            if bin0_min == bin0_max:
-                if bin1_min == bin1_max:
-                    #All pixel is within a single bin
-                    outCount[bin0_min, bin1_min] += 1.0
-                    outData[bin0_min, bin1_min] += data
-                else:
-                    #spread on more than 2 bins
-                    deltaD = (< float > (bin1_min + 1)) - fbin1_min
-                    deltaU = fbin1_max - ( bin1_max)
-                    deltaA = 1.0 / (fbin1_max - fbin1_min)
-
-                    outCount[bin0_min, bin1_min] +=  deltaA * deltaD
-                    outData[bin0_min, bin1_min] += data * deltaA * deltaD
-
-                    outCount[bin0_min, bin1_max] +=  deltaA * deltaU
-                    outData[bin0_min, bin1_max] += data * deltaA * deltaU
-                    for j in range(bin1_min + 1, bin1_max):
-                        outCount[bin0_min, j] +=  deltaA
-                        outData[bin0_min, j] += data * deltaA
-
-            else: #spread on more than 2 bins in dim 0
-                if bin1_min == bin1_max:
-                    #All pixel fall on 1 bins in dim 1
-                    deltaA = 1.0 / (fbin0_max - fbin0_min)
-                    deltaL = (< float > (bin0_min + 1)) - fbin0_min
-                    outCount[bin0_min, bin1_min] +=  deltaA * deltaL
-                    outData[bin0_min, bin1_min] +=  data * deltaA * deltaL
-                    deltaR = fbin0_max - (< float > bin0_max)
-                    outCount[bin0_max, bin1_min] +=  deltaA * deltaR
-                    outData[bin0_max, bin1_min] +=  data * deltaA * deltaR
-                    for i in range(bin0_min + 1, bin0_max):
-                            outCount[i, bin1_min] +=  deltaA
-                            outData[i, bin1_min] +=  data * deltaA
-                else:
-                    #spread on n pix in dim0 and m pixel in dim1:
-                    deltaL = (< float > (bin0_min + 1)) - fbin0_min
-                    deltaR = fbin0_max - (< float > bin0_max)
-                    deltaD = (< float > (bin1_min + 1)) - fbin1_min
-                    deltaU = fbin1_max - (< float > bin1_max)
-                    deltaA = 1.0 / ((fbin0_max - fbin0_min) * (fbin1_max - fbin1_min))
-
-                    outCount[bin0_min, bin1_min] +=  deltaA * deltaL * deltaD
-                    outData[bin0_min, bin1_min] +=  data * deltaA * deltaL * deltaD
-
-                    outCount[bin0_min, bin1_max] +=  deltaA * deltaL * deltaU
-                    outData[bin0_min, bin1_max] +=  data * deltaA * deltaL * deltaU
-
-                    outCount[bin0_max, bin1_min] +=  deltaA * deltaR * deltaD
-                    outData[bin0_max, bin1_min] +=  data * deltaA * deltaR * deltaD
-
-                    outCount[bin0_max, bin1_max] +=  deltaA * deltaR * deltaU
-                    outData[bin0_max, bin1_max] +=  data * deltaA * deltaR * deltaU
-                    for i in range(bin0_min + 1, bin0_max):
-                            outCount[i, bin1_min] +=  deltaA * deltaD
-                            outData[i, bin1_min] +=  data * deltaA * deltaD
-                            for j in range(bin1_min + 1, bin1_max):
-                                outCount[i, j] +=  deltaA
-                                outData[i, j] +=  data * deltaA
-                            outCount[i, bin1_max] +=  deltaA * deltaU
-                            outData[i, bin1_max] +=  data * deltaA * deltaU
-                    for j in range(bin1_min + 1, bin1_max):
-                            outCount[bin0_min, j] +=  deltaA * deltaL
-                            outData[bin0_min, j] +=  data * deltaA * deltaL
-
-                            outCount[bin0_max, j] +=  deltaA * deltaR
-                            outData[bin0_max, j] +=  data * deltaA * deltaR
-
-        for i in range(bins0):
-            for j in range(bins1):
-                if outCount[i, j] > epsilon:
-                    outMerge[i, j] = <float> (outData[i, j] / outCount[i, j])
-                else:
-                    outMerge[i, j] = cdummy
-    return outMerge.T, edges0, edges1, outData.T, outCount.T
-
-
-def histoBBox1d(weights ,
-                pos0,
-                delta_pos0,
-                pos1=None,
-                delta_pos1=None,
-                bins=100,
-                pos0Range=None,
-                pos1Range=None,
-                dummy=None,
-                delta_dummy=None,
-                mask=None,
-                dark=None,
-                flat=None
-              ):
-    """
-    Calculates histogram of pos0 (tth) weighted by weights
-
-    Splitting is done on the pixel's bounding box like fit2D
-
-    @param weights: array with intensities
-    @param pos0: 1D array with pos0: tth or q_vect
-    @param delta_pos0: 1D array with delta pos0: max center-corner distance
-    @param pos1: 1D array with pos1: chi
-    @param delta_pos1: 1D array with max pos1: max center-corner distance, unused !
-    @param bins: number of output bins
-    @param pos0Range: minimum and maximum  of the 2th range
-    @param pos1Range: minimum and maximum  of the chi range
-    @param dummy: value for bins without pixels & value of "no good" pixels
-    @param delta_dummy: precision of dummy value
-    @param mask: array (of int8) with masked pixels with 1 (0=not masked)
-    @param dark: array (of float32) with dark noise to be subtracted (or None)
-    @param flat: array (of float32) with flat image (including solid angle correctons or not...)
-    @return 2theta, I, weighted histogram, unweighted histogram
-    """
-    size = weights.size
-    assert pos0.size == size
-    assert delta_pos0.size == size
-    assert  bins > 1
-    bin = 0
-    epsilon = 1e-10
-    cdummy = 0
-    ddummy = 0
-
-    check_pos1 = 0
-    check_mask = 0
-    do_dummy = 0
-    do_dark = 0
-    do_flat = 0
-
-    cdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float32)
-    cpos0 = numpy.ascontiguousarray(pos0.ravel(), dtype=numpy.float32)
-    dpos0 = numpy.ascontiguousarray(delta_pos0.ravel(), dtype=numpy.float32)
-
-
-    outData = numpy.zeros(bins, dtype=numpy.float64)
-    outCount = numpy.zeros(bins, dtype=numpy.float64)
-    outMax = numpy.zeros(bins, dtype=numpy.int64)
-    outMerge = numpy.zeros(bins, dtype=numpy.float32)
-#    outPos = numpy.zeros(bins, dtype=numpy.float32)
-
-    if  mask is not None:
-        assert mask.size == size
-        check_mask = 1
-        cmask = numpy.ascontiguousarray(mask.ravel(), dtype=numpy.int8)
-
-    if (dummy is not None) and delta_dummy is not None:
-        do_dummy = 1
-        cdummy = float(dummy)
-        ddummy = float(delta_dummy)
-    elif (dummy is not None):
-        cdummy = float(dummy)
-    else:
-        cdummy = 0.0
-
-    if dark is not None:
-        assert dark.size == size
-        do_dark = 1
-        cdark = numpy.ascontiguousarray(dark.ravel(), dtype=numpy.float32)
-
-    if flat is not None:
-        assert flat.size == size
-        do_flat = 1
-        cflat = numpy.ascontiguousarray(flat.ravel(), dtype=numpy.float32)
-
-
-    cpos0_lower = numpy.zeros(size, dtype=numpy.float32)
-    cpos0_upper = numpy.zeros(size, dtype=numpy.float32)
-    pos0_min = cpos0[0]
-    pos0_max = cpos0[0]
-    for idx in range(size):
-            min0 = cpos0[idx] - dpos0[idx]
-            max0 = cpos0[idx] + dpos0[idx]
-            cpos0_upper[idx] = max0
-            cpos0_lower[idx] = min0
-            if max0 > pos0_max:
-                pos0_max = max0
-            if min0 < pos0_min:
-                pos0_min = min0
-
-    if pos0Range is not None and len(pos0Range) > 1:
-        pos0_min = min(pos0Range)
-        pos0_maxin = max(pos0Range)
-    else:
-        pos0_maxin = pos0_max
-    if pos0_min < 0: pos0_min = 0
-    pos0_max = pos0_maxin * EPS32
-
-    if pos1Range is not None and len(pos1Range) > 1:
-        assert pos1.size == size
-        assert delta_pos1.size == size
-        check_pos1 = 1
-        cpos1 = numpy.ascontiguousarray(pos1.ravel(), dtype=numpy.float32)
-        dpos1 = numpy.ascontiguousarray(delta_pos1.ravel(), dtype=numpy.float32)
-        pos1_min = min(pos1Range)
-        pos1_maxin = max(pos1Range)
-        pos1_max = pos1_maxin * EPS32
-
-    delta = (pos0_max - pos0_min) / ((bins))
-
-#    for i in range(bins):
-#                outPos[i] = pos0_min + (0.5 + i) * delta
-    outPos = numpy.linspace(pos0_min+0.5*delta,pos0_max-0.5*delta, bins)
-    for idx in range(size):
-            if (check_mask) and (cmask[idx]):
-                continue
-
-            data = cdata[idx]
-            if do_dummy and (fabs(data - cdummy) <= ddummy):
-                continue
-
-            min0 = cpos0_lower[idx]
-            max0 = cpos0_upper[idx]
-
-            if check_pos1 and (((cpos1[idx] + dpos1[idx]) < pos1_min) or ((cpos1[idx] - dpos1[idx]) > pos1_max)):
-                    continue
-
-            fbin0_min = getBinNr(min0, pos0_min, delta)
-            fbin0_max = getBinNr(max0, pos0_min, delta)
-            bin0_min = <int> (fbin0_min)
-            bin0_max = <int> (fbin0_max)
-
-            if (bin0_max < 0) or (bin0_min >= bins):
-                continue
-            if bin0_max >= bins:
-                bin0_max = bins - 1
-            if  bin0_min < 0:
-                bin0_min = 0
-
-            if do_dark:
-                data -= cdark[idx]
-            if do_flat:
-                data /= cflat[idx]
-
-            if bin0_min == bin0_max:
-                #All pixel is within a single bin
-                outCount[bin0_min] += 1.0
-                outData[bin0_min] += data
-                outMax[bin0_min] += 1
-
-            else: #we have pixel spliting.
-                deltaA = 1.0 / (fbin0_max - fbin0_min)
-
-                deltaL = (bin0_min + 1) - fbin0_min
-                deltaR = fbin0_max - (bin0_max)
-
-                outCount[bin0_min] += (deltaA * deltaL)
-                outData[bin0_min] += (data * deltaA * deltaL)
-                outMax[bin0_min] += 1
-
-                outCount[bin0_max] += (deltaA * deltaR)
-                outData[bin0_max] += (data * deltaA * deltaR)
-                outMax[bin0_max] += 1
-                if bin0_min + 1 < bin0_max:
-                    for i in range(bin0_min + 1, bin0_max):
-                        outCount[i] += deltaA
-                        outData[i] += (data * deltaA)
-                        outMax[i] += 1
-
-    for i in range(bins):
-                if outCount[i] > epsilon:
-                    outMerge[i] = (outData[i] / outCount[i])
-                else:
-                    outMerge[i] = cdummy
-
-    return  outPos, outMerge, outData, outCount, outMax
-
-
-
-
diff --git a/src/splitPixel.c b/src/splitPixel.c
index 44deb7d..86d8c3e 100644
--- a/src/splitPixel.c
+++ b/src/splitPixel.c
@@ -1,6 +1,18 @@
-/* Generated by Cython 0.17.1 on Tue Dec 11 13:42:42 2012 */
+/* Generated by Cython 0.19.2 on Mon Jan  6 15:01:35 2014 */
 
 #define PY_SSIZE_T_CLEAN
+#ifndef CYTHON_USE_PYLONG_INTERNALS
+#ifdef PYLONG_BITS_IN_DIGIT
+#define CYTHON_USE_PYLONG_INTERNALS 0
+#else
+#include "pyconfig.h"
+#ifdef PYLONG_BITS_IN_DIGIT
+#define CYTHON_USE_PYLONG_INTERNALS 1
+#else
+#define CYTHON_USE_PYLONG_INTERNALS 0
+#endif
+#endif
+#endif
 #include "Python.h"
 #ifndef Py_PYTHON_H
     #error Python headers needed to compile C extensions, please install development version of Python.
@@ -53,12 +65,15 @@
                                 (PyErr_Format(PyExc_TypeError, \
                                               "expected index value, got %.200s", Py_TYPE(o)->tp_name), \
                                  (PyObject*)0))
-  #define PyIndex_Check(o)     (PyNumber_Check(o) && !PyFloat_Check(o) && !PyComplex_Check(o))
+  #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \
+                                  !PyComplex_Check(o))
+  #define PyIndex_Check __Pyx_PyIndex_Check
   #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
   #define __PYX_BUILD_PY_SSIZE_T "i"
 #else
   #define __PYX_BUILD_PY_SSIZE_T "n"
   #define CYTHON_FORMAT_SSIZE_T "z"
+  #define __Pyx_PyIndex_Check PyIndex_Check
 #endif
 #if PY_VERSION_HEX < 0x02060000
   #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
@@ -113,6 +128,9 @@
 #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
   #define Py_TPFLAGS_HAVE_NEWBUFFER 0
 #endif
+#if PY_VERSION_HEX < 0x02060000
+  #define Py_TPFLAGS_HAVE_VERSION_TAG 0
+#endif
 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
   #define CYTHON_PEP393_ENABLED 1
   #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ? \
@@ -152,6 +170,14 @@
   #define PyBytes_Concat               PyString_Concat
   #define PyBytes_ConcatAndDel         PyString_ConcatAndDel
 #endif
+#if PY_MAJOR_VERSION >= 3
+  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
+  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
+#else
+  #define __Pyx_PyBaseString_Check(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj) || \
+                                         PyString_Check(obj) || PyUnicode_Check(obj))
+  #define __Pyx_PyBaseString_CheckExact(obj) (Py_TYPE(obj) == &PyBaseString_Type)
+#endif
 #if PY_VERSION_HEX < 0x02060000
   #define PySet_Check(obj)             PyObject_TypeCheck(obj, &PySet_Type)
   #define PyFrozenSet_Check(obj)       PyObject_TypeCheck(obj, &PyFrozenSet_Type)
@@ -224,6 +250,40 @@
   #define __Pyx_NAMESTR(n) (n)
   #define __Pyx_DOCSTR(n)  (n)
 #endif
+#ifndef CYTHON_INLINE
+  #if defined(__GNUC__)
+    #define CYTHON_INLINE __inline__
+  #elif defined(_MSC_VER)
+    #define CYTHON_INLINE __inline
+  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+    #define CYTHON_INLINE inline
+  #else
+    #define CYTHON_INLINE
+  #endif
+#endif
+#ifndef CYTHON_RESTRICT
+  #if defined(__GNUC__)
+    #define CYTHON_RESTRICT __restrict__
+  #elif defined(_MSC_VER) && _MSC_VER >= 1400
+    #define CYTHON_RESTRICT __restrict
+  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+    #define CYTHON_RESTRICT restrict
+  #else
+    #define CYTHON_RESTRICT
+  #endif
+#endif
+#ifdef NAN
+#define __PYX_NAN() ((float) NAN)
+#else
+static CYTHON_INLINE float __PYX_NAN() {
+  /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and
+   a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is
+   a quiet NaN. */
+  float value;
+  memset(&value, 0xFF, sizeof(value));
+  return value;
+}
+#endif
 
 
 #if PY_MAJOR_VERSION >= 3
@@ -248,13 +308,13 @@
 #include <math.h>
 #define __PYX_HAVE__splitPixel
 #define __PYX_HAVE_API__splitPixel
+#include "string.h"
 #include "stdio.h"
 #include "stdlib.h"
 #include "numpy/arrayobject.h"
 #include "numpy/ufuncobject.h"
 #include "math.h"
 #include "pythread.h"
-#include "string.h"
 #include "pystate.h"
 #ifdef _OPENMP
 #include <omp.h>
@@ -264,21 +324,6 @@
 #define CYTHON_WITHOUT_ASSERTIONS
 #endif
 
-
-/* inline attribute */
-#ifndef CYTHON_INLINE
-  #if defined(__GNUC__)
-    #define CYTHON_INLINE __inline__
-  #elif defined(_MSC_VER)
-    #define CYTHON_INLINE __inline
-  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
-    #define CYTHON_INLINE inline
-  #else
-    #define CYTHON_INLINE
-  #endif
-#endif
-
-/* unused attribute */
 #ifndef CYTHON_UNUSED
 # if defined(__GNUC__)
 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
@@ -292,30 +337,130 @@
 #   define CYTHON_UNUSED
 # endif
 #endif
-
-typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/
-
-
-/* Type Conversion Predeclarations */
-
-#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
-#define __Pyx_PyBytes_AsUString(s)   ((unsigned char*) PyBytes_AsString(s))
-
+typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding;
+                const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/
+
+#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
+#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
+#define __PYX_DEFAULT_STRING_ENCODING ""
+#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
+#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
+static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
+static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
+#define __Pyx_PyBytes_FromString        PyBytes_FromString
+#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char*);
+#if PY_MAJOR_VERSION < 3
+    #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
+    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
+#else
+    #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
+    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
+#endif
+#define __Pyx_PyObject_AsUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
+#define __Pyx_PyObject_FromUString(s)  __Pyx_PyObject_FromString((char*)s)
+#define __Pyx_PyBytes_FromUString(s)   __Pyx_PyBytes_FromString((char*)s)
+#define __Pyx_PyStr_FromUString(s)     __Pyx_PyStr_FromString((char*)s)
+#define __Pyx_PyUnicode_FromUString(s) __Pyx_PyUnicode_FromString((char*)s)
+#if PY_MAJOR_VERSION < 3
+static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
+{
+    const Py_UNICODE *u_end = u;
+    while (*u_end++) ;
+    return u_end - u - 1;
+}
+#else
+#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
+#endif
+#define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
+#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
+#define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
 #define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
 #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
 static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
-
 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
 static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
-
 #if CYTHON_COMPILING_IN_CPYTHON
 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
 #else
 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
 #endif
 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
+#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+static int __Pyx_sys_getdefaultencoding_not_ascii;
+static int __Pyx_init_sys_getdefaultencoding_params() {
+    PyObject* sys = NULL;
+    PyObject* default_encoding = NULL;
+    PyObject* ascii_chars_u = NULL;
+    PyObject* ascii_chars_b = NULL;
+    sys = PyImport_ImportModule("sys");
+    if (sys == NULL) goto bad;
+    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
+    if (default_encoding == NULL) goto bad;
+    if (strcmp(PyBytes_AsString(default_encoding), "ascii") == 0) {
+        __Pyx_sys_getdefaultencoding_not_ascii = 0;
+    } else {
+        const char* default_encoding_c = PyBytes_AS_STRING(default_encoding);
+        char ascii_chars[128];
+        int c;
+        for (c = 0; c < 128; c++) {
+            ascii_chars[c] = c;
+        }
+        __Pyx_sys_getdefaultencoding_not_ascii = 1;
+        ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
+        if (ascii_chars_u == NULL) goto bad;
+        ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
+        if (ascii_chars_b == NULL || strncmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
+            PyErr_Format(
+                PyExc_ValueError,
+                "This module compiled with c_string_encoding=ascii, but default encoding '%s' is not a superset of ascii.",
+                default_encoding_c);
+            goto bad;
+        }
+    }
+    Py_XDECREF(sys);
+    Py_XDECREF(default_encoding);
+    Py_XDECREF(ascii_chars_u);
+    Py_XDECREF(ascii_chars_b);
+    return 0;
+bad:
+    Py_XDECREF(sys);
+    Py_XDECREF(default_encoding);
+    Py_XDECREF(ascii_chars_u);
+    Py_XDECREF(ascii_chars_b);
+    return -1;
+}
+#endif
+#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
+#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
+#else
+#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
+#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
+static char* __PYX_DEFAULT_STRING_ENCODING;
+static int __Pyx_init_sys_getdefaultencoding_params() {
+    PyObject* sys = NULL;
+    PyObject* default_encoding = NULL;
+    char* default_encoding_c;
+    sys = PyImport_ImportModule("sys");
+    if (sys == NULL) goto bad;
+    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
+    if (default_encoding == NULL) goto bad;
+    default_encoding_c = PyBytes_AS_STRING(default_encoding);
+    __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
+    strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
+    Py_DECREF(sys);
+    Py_DECREF(default_encoding);
+    return 0;
+bad:
+    Py_XDECREF(sys);
+    Py_XDECREF(default_encoding);
+    return -1;
+}
+#endif
+#endif
+
 
 #ifdef __GNUC__
   /* Test for GCC > 2.95 */
@@ -330,8 +475,9 @@ static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
   #define likely(x)   (x)
   #define unlikely(x) (x)
 #endif /* __GNUC__ */
-    
+
 static PyObject *__pyx_m;
+static PyObject *__pyx_d;
 static PyObject *__pyx_b;
 static PyObject *__pyx_empty_tuple;
 static PyObject *__pyx_empty_bytes;
@@ -417,10 +563,9 @@ typedef struct {
     #define CYTHON_ATOMICS 1
 #endif
 #define __pyx_atomic_int_type int
-/* todo: Portland pgcc, maybe OS X's OSAtomicIncrement32,
-   libatomic + autotools-like distutils support? Such a pain... */
-#if CYTHON_ATOMICS && __GNUC__ >= 4 && (__GNUC_MINOR__ > 1 || \
-                    (__GNUC_MINOR__ == 1 && __GNUC_PATHLEVEL >= 2))
+#if CYTHON_ATOMICS && __GNUC__ >= 4 && (__GNUC_MINOR__ > 1 ||           \
+                    (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL >= 2)) && \
+                    !defined(__i386__)
     #define __pyx_atomic_incr_aligned(value, lock) __sync_fetch_and_add(value, 1)
     #define __pyx_atomic_decr_aligned(value, lock) __sync_fetch_and_sub(value, 1)
     #ifdef __PYX_DEBUG_ATOMICS
@@ -873,10 +1018,33 @@ static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice;
   #define __Pyx_XGOTREF(r)
   #define __Pyx_XGIVEREF(r)
 #endif /* CYTHON_REFNANNY */
+#define __Pyx_XDECREF_SET(r, v) do {                            \
+        PyObject *tmp = (PyObject *) r;                         \
+        r = v; __Pyx_XDECREF(tmp);                              \
+    } while (0)
+#define __Pyx_DECREF_SET(r, v) do {                             \
+        PyObject *tmp = (PyObject *) r;                         \
+        r = v; __Pyx_DECREF(tmp);                               \
+    } while (0)
 #define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
 #define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
 
-static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
+    PyTypeObject* tp = Py_TYPE(obj);
+    if (likely(tp->tp_getattro))
+        return tp->tp_getattro(obj, attr_name);
+#if PY_MAJOR_VERSION < 3
+    if (likely(tp->tp_getattr))
+        return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
+#endif
+    return PyObject_GetAttr(obj, attr_name);
+}
+#else
+#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
+#endif
+
+static PyObject *__Pyx_GetBuiltinName(PyObject *name); /*proto*/
 
 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
     Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/
@@ -892,6 +1060,8 @@ static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed
 
 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/
 
+static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); /*proto*/
+
 static CYTHON_INLINE int  __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj,
     __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack);
 static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);
@@ -914,8 +1084,6 @@ static void __Pyx_RaiseUnboundMemoryviewSliceNogil(const char *varname);
 
 #define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0)
 #define __Pyx_BufPtrStrided3d(type, buf, i0, s0, i1, s1, i2, s2) (type)((char*)buf + i0 * s0 + i1 * s1 + i2 * s2)
-static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
-
 #define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d
 #define __Pyx_MEMVIEW_DIRECT   1
 #define __Pyx_MEMVIEW_PTR      2
@@ -925,24 +1093,15 @@ static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
 #define __Pyx_MEMVIEW_FOLLOW   32
 #define __Pyx_IS_C_CONTIG 1
 #define __Pyx_IS_F_CONTIG 2
-static int __Pyx_ValidateAndInit_memviewslice(
-                int *axes_specs,
-                int c_or_f_flag,
-                int buf_flags,
-                int ndim,
-                __Pyx_TypeInfo *dtype,
-                __Pyx_BufFmt_StackElem stack[],
-                __Pyx_memviewslice *memviewslice,
-                PyObject *original_obj);
 static int __Pyx_init_memviewslice(
                 struct __pyx_memoryview_obj *memview,
                 int ndim,
                 __Pyx_memviewslice *memviewslice,
                 int memview_is_new_reference);
-static CYTHON_INLINE int __pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
-                                                            PyThread_type_lock lock);
-static CYTHON_INLINE int __pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
-                                                            PyThread_type_lock lock);
+static CYTHON_INLINE int __pyx_add_acquisition_count_locked(
+    __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
+static CYTHON_INLINE int __pyx_sub_acquisition_count_locked(
+    __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
 #define __pyx_get_slice_count_pointer(memview) (memview->acquisition_count_aligned_p)
 #define __pyx_get_slice_count(memview) (*__pyx_get_slice_count_pointer(memview))
 #define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__)
@@ -970,13 +1129,19 @@ static void __Pyx_RaiseBufferFallbackError(void); /*proto*/
 #define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1)
 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/
 
+static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); /*proto*/
+
 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); /*proto*/
 
 static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t); /* proto */
 
+#ifndef __PYX_FORCE_INIT_THREADS
+  #define __PYX_FORCE_INIT_THREADS 0
+#endif
+
 #define UNARY_NEG_WOULD_OVERFLOW(x)            (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))
 
-static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
+static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/
 
 static PyObject *get_memview(PyObject *__pyx_v_self); /*proto*/
@@ -987,98 +1152,32 @@ static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
 
 #include <string.h>
 
-static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
-    PyObject *r;
-    if (!j) return NULL;
-    r = PyObject_GetItem(o, j);
-    Py_DECREF(j);
-    return r;
-}
-#define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
-                                                    __Pyx_GetItemInt_List_Fast(o, i) : \
-                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
-static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) {
-#if CYTHON_COMPILING_IN_CPYTHON
-    if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
-        PyObject *r = PyList_GET_ITEM(o, i);
-        Py_INCREF(r);
-        return r;
-    }
-    else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
-        PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
-        Py_INCREF(r);
-        return r;
-    }
-    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
-#else
-    return PySequence_GetItem(o, i);
-#endif
-}
-#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
-                                                    __Pyx_GetItemInt_Tuple_Fast(o, i) : \
-                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
-static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) {
-#if CYTHON_COMPILING_IN_CPYTHON
-    if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
-        PyObject *r = PyTuple_GET_ITEM(o, i);
-        Py_INCREF(r);
-        return r;
-    }
-    else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
-        PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
-        Py_INCREF(r);
-        return r;
-    }
-    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
-#else
-    return PySequence_GetItem(o, i);
-#endif
-}
-#define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
-                                                    __Pyx_GetItemInt_Fast(o, i) : \
-                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
-static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) {
-#if CYTHON_COMPILING_IN_CPYTHON
-    if (PyList_CheckExact(o)) {
-        Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
-        if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) {
-            PyObject *r = PyList_GET_ITEM(o, n);
-            Py_INCREF(r);
-            return r;
-        }
-    }
-    else if (PyTuple_CheckExact(o)) {
-        Py_ssize_t n = (likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
-        if (likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
-            PyObject *r = PyTuple_GET_ITEM(o, n);
-            Py_INCREF(r);
-            return r;
-        }
-    } else {  /* inlined PySequence_GetItem() */
-        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
-        if (likely(m && m->sq_item)) {
-            if (unlikely(i < 0) && likely(m->sq_length)) {
-                Py_ssize_t l = m->sq_length(o);
-                if (unlikely(l < 0)) return NULL;
-                i += l;
-            }
-            return m->sq_item(o, i);
-        }
-    }
-#else
-    if (PySequence_Check(o)) {
-        return PySequence_GetItem(o, i);
-    }
-#endif
-    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
-}
-
-static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
+#define __Pyx_GetItemInt(o, i, size, to_py_func, is_list, wraparound, boundscheck) \
+    (((size) <= sizeof(Py_ssize_t)) ? \
+    __Pyx_GetItemInt_Fast(o, i, is_list, wraparound, boundscheck) : \
+    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
+#define __Pyx_GetItemInt_List(o, i, size, to_py_func, is_list, wraparound, boundscheck) \
+    (((size) <= sizeof(Py_ssize_t)) ? \
+    __Pyx_GetItemInt_List_Fast(o, i, wraparound, boundscheck) : \
+    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
+                                                              int wraparound, int boundscheck);
+#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func, is_list, wraparound, boundscheck) \
+    (((size) <= sizeof(Py_ssize_t)) ? \
+    __Pyx_GetItemInt_Tuple_Fast(o, i, wraparound, boundscheck) : \
+    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
+                                                              int wraparound, int boundscheck);
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
+                                                     int is_list, int wraparound, int boundscheck);
+
+static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
 static PyObject *__pyx_memoryview_transpose(PyObject *__pyx_v_self); /*proto*/
 static PyObject *__pyx_memoryview__get__base(PyObject *__pyx_v_self); /*proto*/
 static PyObject *__pyx_memoryview_get_shape(PyObject *__pyx_v_self); /*proto*/
 #if CYTHON_COMPILING_IN_CPYTHON
-static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
+static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
     PyListObject* L = (PyListObject*) list;
     Py_ssize_t len = Py_SIZE(list);
     if (likely(L->allocated > len)) {
@@ -1090,7 +1189,7 @@ static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
     return PyList_Append(list, x);
 }
 #else
-#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
+#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
 #endif
 
 static PyObject *__pyx_memoryview_get_strides(PyObject *__pyx_v_self); /*proto*/
@@ -1099,13 +1198,30 @@ static PyObject *__pyx_memoryview_get_ndim(PyObject *__pyx_v_self); /*proto*/
 static PyObject *__pyx_memoryview_get_itemsize(PyObject *__pyx_v_self); /*proto*/
 static PyObject *__pyx_memoryview_get_nbytes(PyObject *__pyx_v_self); /*proto*/
 static PyObject *__pyx_memoryview_get_size(PyObject *__pyx_v_self); /*proto*/
-#ifndef __PYX_FORCE_INIT_THREADS
-  #define __PYX_FORCE_INIT_THREADS 0
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
+    PyListObject* L = (PyListObject*) list;
+    Py_ssize_t len = Py_SIZE(list);
+    if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
+        Py_INCREF(x);
+        PyList_SET_ITEM(list, len, x);
+        Py_SIZE(list) = len+1;
+        return 0;
+    }
+    return PyList_Append(list, x);
+}
+#else
+#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
 #endif
 
 static CYTHON_INLINE long __Pyx_div_long(long, long); /* proto */
 
 static PyObject *__pyx_memoryviewslice__get__base(PyObject *__pyx_v_self); /*proto*/
+static void __Pyx_WriteUnraisable(const char *name, int clineno,
+                                  int lineno, const char *filename); /*proto*/
+
+static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
+
 static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
 static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
 
@@ -1134,7 +1250,7 @@ typedef struct {
 static Py_ssize_t __Pyx_zeros[] = {0, 0, 0, 0, 0, 0, 0, 0};
 static Py_ssize_t __Pyx_minusones[] = {-1, -1, -1, -1, -1, -1, -1, -1};
 
-static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/
+static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /*proto*/
 
 static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_int8(npy_int8);
 
@@ -1283,17 +1399,24 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);
 
 static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);
 
+static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
+
+static int __Pyx_ValidateAndInit_memviewslice(
+                int *axes_specs,
+                int c_or_f_flag,
+                int buf_flags,
+                int ndim,
+                __Pyx_TypeInfo *dtype,
+                __Pyx_BufFmt_StackElem stack[],
+                __Pyx_memviewslice *memviewslice,
+                PyObject *original_obj);
+
 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int8_t(PyObject *);
 
 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_double(PyObject *);
 
-static void __Pyx_WriteUnraisable(const char *name, int clineno,
-                                  int lineno, const char *filename); /*proto*/
-
 static int __Pyx_check_binary_version(void);
 
-static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
-
 #if !defined(__Pyx_PyIdentifier_FromString)
 #if PY_MAJOR_VERSION < 3
   #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
@@ -1334,6 +1457,8 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
 
 /* Module declarations from 'cpython.ref' */
 
+/* Module declarations from 'libc.string' */
+
 /* Module declarations from 'libc.stdio' */
 
 /* Module declarations from 'cpython.object' */
@@ -1358,9 +1483,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, cha
 /* Module declarations from 'libc.math' */
 
 /* Module declarations from 'splitPixel' */
+static PyTypeObject *__pyx_memoryview_type = 0;
 static PyTypeObject *__pyx_array_type = 0;
 static PyTypeObject *__pyx_MemviewEnum_type = 0;
-static PyTypeObject *__pyx_memoryview_type = 0;
 static PyTypeObject *__pyx_memoryviewslice_type = 0;
 static PyObject *generic = 0;
 static PyObject *strided = 0;
@@ -1373,12 +1498,12 @@ static double __pyx_f_10splitPixel_max4f(double, double, double, double); /*prot
 static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/
 static void *__pyx_align_pointer(void *, size_t); /*proto*/
 static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo *); /*proto*/
-static int __pyx_memoryview_check(PyObject *); /*proto*/
+static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/
 static PyObject *_unellipsify(PyObject *, int); /*proto*/
 static PyObject *assert_direct_dimensions(Py_ssize_t *, int); /*proto*/
 static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/
 static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int, int); /*proto*/
-static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, int); /*proto*/
+static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/
 static int __pyx_memslice_transpose(__Pyx_memviewslice *); /*proto*/
 static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice, int, PyObject *(*)(char *), int (*)(char *, PyObject *), int); /*proto*/
 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
@@ -1457,6 +1582,10 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_20copy(struct __pyx_me
 static PyObject *__pyx_memoryview_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
 static void __pyx_memoryviewslice_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
 static PyObject *__pyx_memoryviewslice__get__base_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
+static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
 static char __pyx_k_29[] = "ndarray is not C contiguous";
 static char __pyx_k_31[] = "ndarray is not Fortran contiguous";
 static char __pyx_k_33[] = "Non-native byte order not supported";
@@ -1625,6 +1754,7 @@ static char __pyx_k__pos0Range[] = "pos0Range";
 static char __pyx_k__pos1Range[] = "pos1Range";
 static char __pyx_k__IndexError[] = "IndexError";
 static char __pyx_k__ValueError[] = "ValueError";
+static char __pyx_k____import__[] = "__import__";
 static char __pyx_k__check_mask[] = "check_mask";
 static char __pyx_k__check_pos1[] = "check_pos1";
 static char __pyx_k__pos0_maxin[] = "pos0_maxin";
@@ -1641,11 +1771,13 @@ static char __pyx_k__RuntimeError[] = "RuntimeError";
 static char __pyx_k__polarization[] = "polarization";
 static char __pyx_k__cpolarization[] = "cpolarization";
 static char __pyx_k__do_solidangle[] = "do_solidangle";
+static char __pyx_k____pyx_vtable__[] = "__pyx_vtable__";
 static char __pyx_k____pyx_getbuffer[] = "__pyx_getbuffer";
 static char __pyx_k__allocate_buffer[] = "allocate_buffer";
 static char __pyx_k__do_polarization[] = "do_polarization";
 static char __pyx_k__dtype_is_object[] = "dtype_is_object";
 static char __pyx_k__ascontiguousarray[] = "ascontiguousarray";
+static char __pyx_k____pyx_releasebuffer[] = "__pyx_releasebuffer";
 static PyObject *__pyx_kp_u_29;
 static PyObject *__pyx_kp_u_31;
 static PyObject *__pyx_kp_u_33;
@@ -1683,9 +1815,12 @@ static PyObject *__pyx_n_s__T;
 static PyObject *__pyx_n_s__TypeError;
 static PyObject *__pyx_n_s__ValueError;
 static PyObject *__pyx_n_s____class__;
+static PyObject *__pyx_n_s____import__;
 static PyObject *__pyx_n_s____main__;
 static PyObject *__pyx_n_s____name__;
 static PyObject *__pyx_n_s____pyx_getbuffer;
+static PyObject *__pyx_n_s____pyx_releasebuffer;
+static PyObject *__pyx_n_s____pyx_vtable__;
 static PyObject *__pyx_n_s____test__;
 static PyObject *__pyx_n_s__a0;
 static PyObject *__pyx_n_s__a1;
@@ -1928,11 +2063,11 @@ static double __pyx_f_10splitPixel_min4f(double __pyx_v_a, double __pyx_v_b, dou
  *         return a
  *     if (b <= a) and (b <= c) and (b <= d):
  */
-  __pyx_t_1 = (__pyx_v_a <= __pyx_v_b);
+  __pyx_t_1 = ((__pyx_v_a <= __pyx_v_b) != 0);
   if (__pyx_t_1) {
-    __pyx_t_2 = (__pyx_v_a <= __pyx_v_c);
+    __pyx_t_2 = ((__pyx_v_a <= __pyx_v_c) != 0);
     if (__pyx_t_2) {
-      __pyx_t_3 = (__pyx_v_a <= __pyx_v_d);
+      __pyx_t_3 = ((__pyx_v_a <= __pyx_v_d) != 0);
       __pyx_t_4 = __pyx_t_3;
     } else {
       __pyx_t_4 = __pyx_t_2;
@@ -1963,11 +2098,11 @@ static double __pyx_f_10splitPixel_min4f(double __pyx_v_a, double __pyx_v_b, dou
  *         return b
  *     if (c <= a) and (c <= b) and (c <= d):
  */
-  __pyx_t_2 = (__pyx_v_b <= __pyx_v_a);
+  __pyx_t_2 = ((__pyx_v_b <= __pyx_v_a) != 0);
   if (__pyx_t_2) {
-    __pyx_t_1 = (__pyx_v_b <= __pyx_v_c);
+    __pyx_t_1 = ((__pyx_v_b <= __pyx_v_c) != 0);
     if (__pyx_t_1) {
-      __pyx_t_4 = (__pyx_v_b <= __pyx_v_d);
+      __pyx_t_4 = ((__pyx_v_b <= __pyx_v_d) != 0);
       __pyx_t_3 = __pyx_t_4;
     } else {
       __pyx_t_3 = __pyx_t_1;
@@ -1998,11 +2133,11 @@ static double __pyx_f_10splitPixel_min4f(double __pyx_v_a, double __pyx_v_b, dou
  *         return c
  *     else:
  */
-  __pyx_t_1 = (__pyx_v_c <= __pyx_v_a);
+  __pyx_t_1 = ((__pyx_v_c <= __pyx_v_a) != 0);
   if (__pyx_t_1) {
-    __pyx_t_2 = (__pyx_v_c <= __pyx_v_b);
+    __pyx_t_2 = ((__pyx_v_c <= __pyx_v_b) != 0);
     if (__pyx_t_2) {
-      __pyx_t_3 = (__pyx_v_c <= __pyx_v_d);
+      __pyx_t_3 = ((__pyx_v_c <= __pyx_v_d) != 0);
       __pyx_t_4 = __pyx_t_3;
     } else {
       __pyx_t_4 = __pyx_t_2;
@@ -2065,11 +2200,11 @@ static double __pyx_f_10splitPixel_max4f(double __pyx_v_a, double __pyx_v_b, dou
  *         return a
  *     if (b >= a) and (b >= c) and (b >= d):
  */
-  __pyx_t_1 = (__pyx_v_a >= __pyx_v_b);
+  __pyx_t_1 = ((__pyx_v_a >= __pyx_v_b) != 0);
   if (__pyx_t_1) {
-    __pyx_t_2 = (__pyx_v_a >= __pyx_v_c);
+    __pyx_t_2 = ((__pyx_v_a >= __pyx_v_c) != 0);
     if (__pyx_t_2) {
-      __pyx_t_3 = (__pyx_v_a >= __pyx_v_d);
+      __pyx_t_3 = ((__pyx_v_a >= __pyx_v_d) != 0);
       __pyx_t_4 = __pyx_t_3;
     } else {
       __pyx_t_4 = __pyx_t_2;
@@ -2100,11 +2235,11 @@ static double __pyx_f_10splitPixel_max4f(double __pyx_v_a, double __pyx_v_b, dou
  *         return b
  *     if (c >= a) and (c >= b) and (c >= d):
  */
-  __pyx_t_2 = (__pyx_v_b >= __pyx_v_a);
+  __pyx_t_2 = ((__pyx_v_b >= __pyx_v_a) != 0);
   if (__pyx_t_2) {
-    __pyx_t_1 = (__pyx_v_b >= __pyx_v_c);
+    __pyx_t_1 = ((__pyx_v_b >= __pyx_v_c) != 0);
     if (__pyx_t_1) {
-      __pyx_t_4 = (__pyx_v_b >= __pyx_v_d);
+      __pyx_t_4 = ((__pyx_v_b >= __pyx_v_d) != 0);
       __pyx_t_3 = __pyx_t_4;
     } else {
       __pyx_t_3 = __pyx_t_1;
@@ -2135,11 +2270,11 @@ static double __pyx_f_10splitPixel_max4f(double __pyx_v_a, double __pyx_v_b, dou
  *         return c
  *     else:
  */
-  __pyx_t_1 = (__pyx_v_c >= __pyx_v_a);
+  __pyx_t_1 = ((__pyx_v_c >= __pyx_v_a) != 0);
   if (__pyx_t_1) {
-    __pyx_t_2 = (__pyx_v_c >= __pyx_v_b);
+    __pyx_t_2 = ((__pyx_v_c >= __pyx_v_b) != 0);
     if (__pyx_t_2) {
-      __pyx_t_3 = (__pyx_v_c >= __pyx_v_d);
+      __pyx_t_3 = ((__pyx_v_c >= __pyx_v_d) != 0);
       __pyx_t_4 = __pyx_t_3;
     } else {
       __pyx_t_4 = __pyx_t_2;
@@ -2197,6 +2332,9 @@ static PyObject *__pyx_pw_10splitPixel_1fullSplit1D(PyObject *__pyx_self, PyObje
   PyObject *__pyx_v_flat = 0;
   PyObject *__pyx_v_solidangle = 0;
   PyObject *__pyx_v_polarization = 0;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("fullSplit1D (wrapper)", 0);
@@ -2594,7 +2732,7 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
  *     if pos.ndim>3: #create a view
  *         pos = pos.reshape((-1,4,2))
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_weights), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_weights), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = __Pyx_PyInt_AsSize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -2607,7 +2745,7 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
  *         pos = pos.reshape((-1,4,2))
  *     assert pos.shape[0] == size
  */
-  __pyx_t_3 = (__pyx_v_pos->nd > 3);
+  __pyx_t_3 = ((__pyx_v_pos->nd > 3) != 0);
   if (__pyx_t_3) {
 
     /* "splitPixel.pyx":137
@@ -2617,14 +2755,13 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
  *     assert pos.shape[0] == size
  *     assert pos.shape[1] == 4
  */
-    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_pos), __pyx_n_s__reshape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_pos), __pyx_n_s__reshape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(((PyObject *)__pyx_v_pos));
-    __pyx_v_pos = ((PyArrayObject *)__pyx_t_4);
+    __Pyx_DECREF_SET(__pyx_v_pos, ((PyArrayObject *)__pyx_t_4));
     __pyx_t_4 = 0;
     goto __pyx_L3;
   }
@@ -2638,7 +2775,7 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
  *     assert pos.shape[2] == 2
  */
   #ifndef CYTHON_WITHOUT_ASSERTIONS
-  if (unlikely(!((__pyx_v_pos->dimensions[0]) == __pyx_v_size))) {
+  if (unlikely(!(((__pyx_v_pos->dimensions[0]) == __pyx_v_size) != 0))) {
     PyErr_SetNone(PyExc_AssertionError);
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
@@ -2652,7 +2789,7 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
  *     assert pos.ndim == 3
  */
   #ifndef CYTHON_WITHOUT_ASSERTIONS
-  if (unlikely(!((__pyx_v_pos->dimensions[1]) == 4))) {
+  if (unlikely(!(((__pyx_v_pos->dimensions[1]) == 4) != 0))) {
     PyErr_SetNone(PyExc_AssertionError);
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
@@ -2666,7 +2803,7 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
  *     assert  bins > 1
  */
   #ifndef CYTHON_WITHOUT_ASSERTIONS
-  if (unlikely(!((__pyx_v_pos->dimensions[2]) == 2))) {
+  if (unlikely(!(((__pyx_v_pos->dimensions[2]) == 2) != 0))) {
     PyErr_SetNone(PyExc_AssertionError);
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
@@ -2680,7 +2817,7 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
  * 
  */
   #ifndef CYTHON_WITHOUT_ASSERTIONS
-  if (unlikely(!(__pyx_v_pos->nd == 3))) {
+  if (unlikely(!((__pyx_v_pos->nd == 3) != 0))) {
     PyErr_SetNone(PyExc_AssertionError);
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
@@ -2694,7 +2831,7 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
  *     cdef numpy.ndarray[numpy.float64_t, ndim = 3] cpos = numpy.ascontiguousarray(pos,dtype=numpy.float64)
  */
   #ifndef CYTHON_WITHOUT_ASSERTIONS
-  if (unlikely(!(__pyx_v_bins > 1))) {
+  if (unlikely(!((__pyx_v_bins > 1) != 0))) {
     PyErr_SetNone(PyExc_AssertionError);
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
@@ -2707,9 +2844,9 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
  *     cdef numpy.ndarray[numpy.float64_t, ndim = 1] cdata = numpy.ascontiguousarray(weights.ravel(), dtype=numpy.float64)
  *     cdef numpy.ndarray[numpy.float64_t, ndim = 1] outData = numpy.zeros(bins, dtype=numpy.float64)
  */
-  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -2719,9 +2856,9 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
   __Pyx_GIVEREF(((PyObject *)__pyx_v_pos));
   __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_5));
-  __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
-  __pyx_t_7 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__float64); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __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 = 144; __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_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -2752,12 +2889,12 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
  *     cdef numpy.ndarray[numpy.float64_t, ndim = 1] outData = numpy.zeros(bins, dtype=numpy.float64)
  *     cdef numpy.ndarray[numpy.float64_t, ndim = 1] outCount = numpy.zeros(bins, dtype=numpy.float64)
  */
-  __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_7);
-  __pyx_t_5 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-  __pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_v_weights), __pyx_n_s__ravel); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __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 = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_7);
   __pyx_t_4 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
@@ -2769,9 +2906,9 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
   __pyx_t_4 = 0;
   __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_6 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__float64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -2802,9 +2939,9 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
  *     cdef numpy.ndarray[numpy.float64_t, ndim = 1] outCount = numpy.zeros(bins, dtype=numpy.float64)
  *     cdef numpy.ndarray[numpy.float64_t, ndim = 1] outMerge = numpy.zeros(bins, dtype=numpy.float64)
  */
-  __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s__zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
   __pyx_t_6 = __Pyx_PyInt_FromSize_t(__pyx_v_bins); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -2816,9 +2953,9 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
   __pyx_t_6 = 0;
   __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_6));
-  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__float64); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__float64); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
   if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -2849,9 +2986,9 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
  *     cdef numpy.ndarray[numpy.float64_t, ndim = 1] outMerge = numpy.zeros(bins, dtype=numpy.float64)
  *     cdef numpy.int8_t[:] cmask
  */
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_6 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __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 = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_bins); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -2863,9 +3000,9 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
   __pyx_t_1 = 0;
   __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__float64); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__float64); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -2896,9 +3033,9 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
  *     cdef numpy.int8_t[:] cmask
  *     cdef double[:] cflat, cdark, cpolarization, csolidangle
  */
-  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
   __pyx_t_5 = __Pyx_PyInt_FromSize_t(__pyx_v_bins); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -2910,9 +3047,9 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
   __pyx_t_5 = 0;
   __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_5));
-  __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__float64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s__float64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
   if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -3049,12 +3186,12 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
  *         pos0_maxin = max(pos0Range)
  */
   __pyx_t_3 = (__pyx_v_pos0Range != Py_None);
-  if (__pyx_t_3) {
+  if ((__pyx_t_3 != 0)) {
     __pyx_t_13 = PyObject_Length(__pyx_v_pos0Range); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_14 = (__pyx_t_13 > 1);
+    __pyx_t_14 = ((__pyx_t_13 > 1) != 0);
     __pyx_t_15 = __pyx_t_14;
   } else {
-    __pyx_t_15 = __pyx_t_3;
+    __pyx_t_15 = (__pyx_t_3 != 0);
   }
   if (__pyx_t_15) {
 
@@ -3108,7 +3245,7 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
  */
     __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_pos), ((PyObject *)__pyx_k_tuple_5)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__min); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__min); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -3127,7 +3264,7 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
  */
     __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_pos), ((PyObject *)__pyx_k_tuple_8)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__max); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__max); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -3148,14 +3285,14 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
  */
   __pyx_t_4 = PyFloat_FromDouble(__pyx_v_pos0_maxin); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_7 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__finfo); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__finfo); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_7);
   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__float32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__float32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
   __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -3167,7 +3304,7 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
-  __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__eps); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__eps); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __pyx_t_1 = PyNumber_Add(__pyx_int_1, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -3189,12 +3326,12 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
  *         pos1_maxin = max(pos1Range)
  */
   __pyx_t_15 = (__pyx_v_pos1Range != Py_None);
-  if (__pyx_t_15) {
+  if ((__pyx_t_15 != 0)) {
     __pyx_t_13 = PyObject_Length(__pyx_v_pos1Range); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_3 = (__pyx_t_13 > 1);
+    __pyx_t_3 = ((__pyx_t_13 > 1) != 0);
     __pyx_t_14 = __pyx_t_3;
   } else {
-    __pyx_t_14 = __pyx_t_15;
+    __pyx_t_14 = (__pyx_t_15 != 0);
   }
   if (__pyx_t_14) {
 
@@ -3257,7 +3394,7 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
  */
     __pyx_t_5 = PyObject_GetItem(((PyObject *)__pyx_v_pos), ((PyObject *)__pyx_k_tuple_11)); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__min); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__min); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -3276,7 +3413,7 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
  */
     __pyx_t_5 = PyObject_GetItem(((PyObject *)__pyx_v_pos), ((PyObject *)__pyx_k_tuple_14)); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__max); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__max); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -3297,14 +3434,14 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
  */
   __pyx_t_5 = PyFloat_FromDouble(__pyx_v_pos1_maxin); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__finfo); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__finfo); 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_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_7 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float32); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__float32); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_7);
   __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 = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -3316,7 +3453,7 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
   __Pyx_GOTREF(__pyx_t_7);
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__eps); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s__eps); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
   __pyx_t_7 = PyNumber_Add(__pyx_int_1, __pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -3346,9 +3483,9 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
  * 
  *     if (dummy is not None) and (delta_dummy is not None):
  */
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_7 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__linspace); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__linspace); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __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_pos0_min + (0.5 * __pyx_v_dpos))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -3383,11 +3520,11 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
  *         cdummy =  float(dummy)
  */
   __pyx_t_14 = (__pyx_v_dummy != Py_None);
-  if (__pyx_t_14) {
+  if ((__pyx_t_14 != 0)) {
     __pyx_t_15 = (__pyx_v_delta_dummy != Py_None);
-    __pyx_t_3 = __pyx_t_15;
+    __pyx_t_3 = (__pyx_t_15 != 0);
   } else {
-    __pyx_t_3 = __pyx_t_14;
+    __pyx_t_3 = (__pyx_t_14 != 0);
   }
   if (__pyx_t_3) {
 
@@ -3430,7 +3567,8 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
  *         cdummy = float(dummy)
  */
   __pyx_t_3 = (__pyx_v_dummy != Py_None);
-  if (__pyx_t_3) {
+  __pyx_t_14 = (__pyx_t_3 != 0);
+  if (__pyx_t_14) {
 
     /* "splitPixel.pyx":187
  *         cddummy =  float(delta_dummy)
@@ -3499,7 +3637,8 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
  *         check_mask = True
  *         assert mask.size == size
  */
-  __pyx_t_3 = (__pyx_v_mask != Py_None);
+  __pyx_t_14 = (__pyx_v_mask != Py_None);
+  __pyx_t_3 = (__pyx_t_14 != 0);
   if (__pyx_t_3) {
 
     /* "splitPixel.pyx":196
@@ -3519,7 +3658,7 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
  *     if dark is not None:
  */
     #ifndef CYTHON_WITHOUT_ASSERTIONS
-    __pyx_t_4 = PyObject_GetAttr(__pyx_v_mask, __pyx_n_s__size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_mask, __pyx_n_s__size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __pyx_t_6 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
@@ -3541,12 +3680,12 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
  *     if dark is not None:
  *         do_dark = True
  */
-    __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
-    __pyx_t_6 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-    __pyx_t_7 = PyObject_GetAttr(__pyx_v_mask, __pyx_n_s__ravel); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_mask, __pyx_n_s__ravel); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
     __pyx_t_4 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
@@ -3558,9 +3697,9 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
     __pyx_t_4 = 0;
     __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-    __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__int8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__int8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -3588,7 +3727,8 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
  *         assert dark.size == size
  */
   __pyx_t_3 = (__pyx_v_dark != Py_None);
-  if (__pyx_t_3) {
+  __pyx_t_14 = (__pyx_t_3 != 0);
+  if (__pyx_t_14) {
 
     /* "splitPixel.pyx":200
  *         cmask = numpy.ascontiguousarray(mask.ravel(), dtype=numpy.int8)
@@ -3607,16 +3747,16 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
  *     if flat is not None:
  */
     #ifndef CYTHON_WITHOUT_ASSERTIONS
-    __pyx_t_1 = PyObject_GetAttr(__pyx_v_dark, __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_dark, __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __pyx_t_7 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-    if (unlikely(!__pyx_t_3)) {
+    if (unlikely(!__pyx_t_14)) {
       PyErr_SetNone(PyExc_AssertionError);
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
@@ -3629,12 +3769,12 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
  *     if flat is not None:
  *         do_flat = True
  */
-    __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
-    __pyx_t_4 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-    __pyx_t_7 = PyObject_GetAttr(__pyx_v_dark, __pyx_n_s__ravel); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_dark, __pyx_n_s__ravel); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
     __pyx_t_1 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
@@ -3646,9 +3786,9 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
     __pyx_t_1 = 0;
     __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-    __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_5 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__float64); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s__float64); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
     if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -3675,7 +3815,8 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
  *         do_flat = True
  *         assert flat.size == size
  */
-  __pyx_t_3 = (__pyx_v_flat != Py_None);
+  __pyx_t_14 = (__pyx_v_flat != Py_None);
+  __pyx_t_3 = (__pyx_t_14 != 0);
   if (__pyx_t_3) {
 
     /* "splitPixel.pyx":204
@@ -3695,7 +3836,7 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
  *     if polarization is not None:
  */
     #ifndef CYTHON_WITHOUT_ASSERTIONS
-    __pyx_t_5 = PyObject_GetAttr(__pyx_v_flat, __pyx_n_s__size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_flat, __pyx_n_s__size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
@@ -3717,12 +3858,12 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
  *     if polarization is not None:
  *         do_polarization = True
  */
-    __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
-    __pyx_t_1 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __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 = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-    __pyx_t_7 = PyObject_GetAttr(__pyx_v_flat, __pyx_n_s__ravel); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_flat, __pyx_n_s__ravel); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
     __pyx_t_5 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
@@ -3734,9 +3875,9 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
     __pyx_t_5 = 0;
     __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_5));
-    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_6 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__float64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__float64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -3764,7 +3905,8 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
  *         assert polarization.size == size
  */
   __pyx_t_3 = (__pyx_v_polarization != Py_None);
-  if (__pyx_t_3) {
+  __pyx_t_14 = (__pyx_t_3 != 0);
+  if (__pyx_t_14) {
 
     /* "splitPixel.pyx":208
  *         cflat = numpy.ascontiguousarray(flat.ravel(), dtype=numpy.float64)
@@ -3783,16 +3925,16 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
  *     if solidangle is not None:
  */
     #ifndef CYTHON_WITHOUT_ASSERTIONS
-    __pyx_t_6 = PyObject_GetAttr(__pyx_v_polarization, __pyx_n_s__size); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_polarization, __pyx_n_s__size); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
     __pyx_t_5 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __pyx_t_7 = PyObject_RichCompare(__pyx_t_6, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-    if (unlikely(!__pyx_t_3)) {
+    if (unlikely(!__pyx_t_14)) {
       PyErr_SetNone(PyExc_AssertionError);
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
@@ -3805,12 +3947,12 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
  *     if solidangle is not None:
  *         do_solidangle = True
  */
-    __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
-    __pyx_t_5 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-    __pyx_t_7 = PyObject_GetAttr(__pyx_v_polarization, __pyx_n_s__ravel); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_polarization, __pyx_n_s__ravel); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __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 = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
@@ -3822,9 +3964,9 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
     __pyx_t_6 = 0;
     __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_6));
-    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); 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_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__float64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -3851,7 +3993,8 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
  *         do_solidangle = True
  *         assert solidangle.size == size
  */
-  __pyx_t_3 = (__pyx_v_solidangle != Py_None);
+  __pyx_t_14 = (__pyx_v_solidangle != Py_None);
+  __pyx_t_3 = (__pyx_t_14 != 0);
   if (__pyx_t_3) {
 
     /* "splitPixel.pyx":212
@@ -3871,7 +4014,7 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
  * 
  */
     #ifndef CYTHON_WITHOUT_ASSERTIONS
-    __pyx_t_4 = PyObject_GetAttr(__pyx_v_solidangle, __pyx_n_s__size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_solidangle, __pyx_n_s__size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __pyx_t_6 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
@@ -3893,12 +4036,12 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
  * 
  *     with nogil:
  */
-    __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
-    __pyx_t_6 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-    __pyx_t_7 = PyObject_GetAttr(__pyx_v_solidangle, __pyx_n_s__ravel); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_solidangle, __pyx_n_s__ravel); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
     __pyx_t_4 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
@@ -3910,9 +4053,9 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
     __pyx_t_4 = 0;
     __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-    __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__float64); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__float64); 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_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -3941,9 +4084,9 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
  */
   {
       #ifdef WITH_THREAD
-      PyThreadState *_save = NULL;
-      #endif
+      PyThreadState *_save;
       Py_UNBLOCK_THREADS
+      #endif
       /*try:*/ {
 
         /* "splitPixel.pyx":217
@@ -3968,7 +4111,7 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
           if (__pyx_t_3) {
             if (unlikely(!__pyx_v_cmask.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cmask"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L13;} }
             __pyx_t_20 = __pyx_v_idx;
-            __pyx_t_14 = (*((__pyx_t_5numpy_int8_t *) ( /* dim=0 */ (__pyx_v_cmask.data + __pyx_t_20 * __pyx_v_cmask.strides[0]) )));
+            __pyx_t_14 = ((*((__pyx_t_5numpy_int8_t *) ( /* dim=0 */ (__pyx_v_cmask.data + __pyx_t_20 * __pyx_v_cmask.strides[0]) ))) != 0);
           } else {
             __pyx_t_14 = __pyx_t_3;
           }
@@ -4003,18 +4146,18 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
  *                 continue
  * 
  */
-          if (__pyx_v_check_dummy) {
-            __pyx_t_14 = (__pyx_v_cddummy == 0.0);
+          if ((__pyx_v_check_dummy != 0)) {
+            __pyx_t_14 = ((__pyx_v_cddummy == 0.0) != 0);
             if (__pyx_t_14) {
-              __pyx_t_3 = (__pyx_v_data == __pyx_v_cdummy);
+              __pyx_t_3 = ((__pyx_v_data == __pyx_v_cdummy) != 0);
               __pyx_t_15 = __pyx_t_3;
             } else {
               __pyx_t_15 = __pyx_t_14;
             }
             if (!__pyx_t_15) {
-              __pyx_t_14 = (__pyx_v_cddummy != 0.0);
+              __pyx_t_14 = ((__pyx_v_cddummy != 0.0) != 0);
               if (__pyx_t_14) {
-                __pyx_t_3 = (fabs((__pyx_v_data - __pyx_v_cdummy)) <= __pyx_v_cddummy);
+                __pyx_t_3 = ((fabs((__pyx_v_data - __pyx_v_cdummy)) <= __pyx_v_cddummy) != 0);
                 __pyx_t_22 = __pyx_t_3;
               } else {
                 __pyx_t_22 = __pyx_t_14;
@@ -4025,7 +4168,7 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
             }
             __pyx_t_15 = __pyx_t_14;
           } else {
-            __pyx_t_15 = __pyx_v_check_dummy;
+            __pyx_t_15 = (__pyx_v_check_dummy != 0);
           }
           if (__pyx_t_15) {
 
@@ -4162,9 +4305,9 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
  *                 continue
  *             if check_pos1:
  */
-          __pyx_t_15 = (__pyx_v_max0 < __pyx_v_pos0_min);
+          __pyx_t_15 = ((__pyx_v_max0 < __pyx_v_pos0_min) != 0);
           if (!__pyx_t_15) {
-            __pyx_t_14 = (__pyx_v_min0 > __pyx_v_pos0_maxin);
+            __pyx_t_14 = ((__pyx_v_min0 > __pyx_v_pos0_maxin) != 0);
             __pyx_t_22 = __pyx_t_14;
           } else {
             __pyx_t_22 = __pyx_t_15;
@@ -4190,7 +4333,8 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
  *                 min1 = min4f(a1, b1, c1, d1)
  *                 max1 = max4f(a1, b1, c1, d1)
  */
-          if (__pyx_v_check_pos1) {
+          __pyx_t_22 = (__pyx_v_check_pos1 != 0);
+          if (__pyx_t_22) {
 
             /* "splitPixel.pyx":239
  *                 continue
@@ -4217,9 +4361,9 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
  *                     continue
  *             if min0<pos0_min:
  */
-            __pyx_t_22 = (__pyx_v_max1 < __pyx_v_pos1_min);
+            __pyx_t_22 = ((__pyx_v_max1 < __pyx_v_pos1_min) != 0);
             if (!__pyx_t_22) {
-              __pyx_t_15 = (__pyx_v_min1 > __pyx_v_pos1_maxin);
+              __pyx_t_15 = ((__pyx_v_min1 > __pyx_v_pos1_maxin) != 0);
               __pyx_t_14 = __pyx_t_15;
             } else {
               __pyx_t_14 = __pyx_t_22;
@@ -4248,7 +4392,7 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
  *                 min0=pos0_min
  *             if max0>pos0_maxin:
  */
-          __pyx_t_14 = (__pyx_v_min0 < __pyx_v_pos0_min);
+          __pyx_t_14 = ((__pyx_v_min0 < __pyx_v_pos0_min) != 0);
           if (__pyx_t_14) {
 
             /* "splitPixel.pyx":244
@@ -4270,7 +4414,7 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
  *                 max0=pos0_maxin
  * 
  */
-          __pyx_t_14 = (__pyx_v_max0 > __pyx_v_pos0_maxin);
+          __pyx_t_14 = ((__pyx_v_max0 > __pyx_v_pos0_maxin) != 0);
           if (__pyx_t_14) {
 
             /* "splitPixel.pyx":246
@@ -4292,7 +4436,8 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
  *                 data -= cdark[idx]
  *             if do_flat:
  */
-          if (__pyx_v_do_dark) {
+          __pyx_t_14 = (__pyx_v_do_dark != 0);
+          if (__pyx_t_14) {
 
             /* "splitPixel.pyx":249
  * 
@@ -4315,7 +4460,8 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
  *                 data /= cflat[idx]
  *             if do_polarization:
  */
-          if (__pyx_v_do_flat) {
+          __pyx_t_14 = (__pyx_v_do_flat != 0);
+          if (__pyx_t_14) {
 
             /* "splitPixel.pyx":251
  *                 data -= cdark[idx]
@@ -4338,7 +4484,8 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
  *                 data /= cpolarization[idx]
  *             if do_solidangle:
  */
-          if (__pyx_v_do_polarization) {
+          __pyx_t_14 = (__pyx_v_do_polarization != 0);
+          if (__pyx_t_14) {
 
             /* "splitPixel.pyx":253
  *                 data /= cflat[idx]
@@ -4361,7 +4508,8 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
  *                 data /= csolidangle[idx]
  * 
  */
-          if (__pyx_v_do_solidangle) {
+          __pyx_t_14 = (__pyx_v_do_solidangle != 0);
+          if (__pyx_t_14) {
 
             /* "splitPixel.pyx":255
  *                 data /= cpolarization[idx]
@@ -4420,7 +4568,7 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
  *                 #All pixel is within a single bin
  *                 outCount[bin0_min] += 1.0
  */
-          __pyx_t_14 = (__pyx_v_bin0_min == __pyx_v_bin0_max);
+          __pyx_t_14 = ((__pyx_v_bin0_min == __pyx_v_bin0_max) != 0);
           if (__pyx_t_14) {
 
             /* "splitPixel.pyx":264
@@ -4547,7 +4695,7 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
  *                     for i in range(bin0_min + 1, bin0_max):
  *                         outCount[i] += deltaA
  */
-            __pyx_t_14 = ((__pyx_v_bin0_min + 1) != __pyx_v_bin0_max);
+            __pyx_t_14 = (((__pyx_v_bin0_min + 1) != __pyx_v_bin0_max) != 0);
             if (__pyx_t_14) {
 
               /* "splitPixel.pyx":284
@@ -4608,7 +4756,7 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
  *             else:
  */
           __pyx_t_57 = __pyx_v_i;
-          __pyx_t_14 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_57, __pyx_pybuffernd_outCount.diminfo[0].strides)) > __pyx_v_epsilon);
+          __pyx_t_14 = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_57, __pyx_pybuffernd_outCount.diminfo[0].strides)) > __pyx_v_epsilon) != 0);
           if (__pyx_t_14) {
 
             /* "splitPixel.pyx":291
@@ -4652,7 +4800,9 @@ static PyObject *__pyx_pf_10splitPixel_fullSplit1D(CYTHON_UNUSED PyObject *__pyx
         __pyx_why = 0; goto __pyx_L14;
         __pyx_L13: __pyx_why = 4; goto __pyx_L14;
         __pyx_L14:;
+        #ifdef WITH_THREAD
         Py_BLOCK_THREADS
+        #endif
         switch (__pyx_why) {
           case 4: goto __pyx_L1_error;
         }
@@ -4747,6 +4897,9 @@ static PyObject *__pyx_pw_10splitPixel_3fullSplit2D(PyObject *__pyx_self, PyObje
   PyObject *__pyx_v_flat = 0;
   PyObject *__pyx_v_solidangle = 0;
   PyObject *__pyx_v_polarization = 0;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   PyObject *__pyx_r = 0;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("fullSplit2D (wrapper)", 0);
@@ -5235,7 +5388,7 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  */
   __pyx_v_bins0 = 0;
   __pyx_v_bins1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_weights), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_weights), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = __Pyx_PyInt_AsSize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -5248,7 +5401,7 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  *         pos = pos.reshape((-1,4,2))
  * 
  */
-  __pyx_t_3 = (__pyx_v_pos->nd > 3);
+  __pyx_t_3 = ((__pyx_v_pos->nd > 3) != 0);
   if (__pyx_t_3) {
 
     /* "splitPixel.pyx":340
@@ -5258,14 +5411,13 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  * 
  *     assert pos.shape[0] == size
  */
-    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_pos), __pyx_n_s__reshape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_pos), __pyx_n_s__reshape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_16), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(((PyObject *)__pyx_v_pos));
-    __pyx_v_pos = ((PyArrayObject *)__pyx_t_4);
+    __Pyx_DECREF_SET(__pyx_v_pos, ((PyArrayObject *)__pyx_t_4));
     __pyx_t_4 = 0;
     goto __pyx_L3;
   }
@@ -5279,7 +5431,7 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  *     assert pos.shape[2] == 2 # tth and chi
  */
   #ifndef CYTHON_WITHOUT_ASSERTIONS
-  if (unlikely(!((__pyx_v_pos->dimensions[0]) == __pyx_v_size))) {
+  if (unlikely(!(((__pyx_v_pos->dimensions[0]) == __pyx_v_size) != 0))) {
     PyErr_SetNone(PyExc_AssertionError);
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
@@ -5293,7 +5445,7 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  *     assert pos.ndim == 3
  */
   #ifndef CYTHON_WITHOUT_ASSERTIONS
-  if (unlikely(!((__pyx_v_pos->dimensions[1]) == 4))) {
+  if (unlikely(!(((__pyx_v_pos->dimensions[1]) == 4) != 0))) {
     PyErr_SetNone(PyExc_AssertionError);
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
@@ -5307,7 +5459,7 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  *     try:
  */
   #ifndef CYTHON_WITHOUT_ASSERTIONS
-  if (unlikely(!((__pyx_v_pos->dimensions[2]) == 2))) {
+  if (unlikely(!(((__pyx_v_pos->dimensions[2]) == 2) != 0))) {
     PyErr_SetNone(PyExc_AssertionError);
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
@@ -5321,7 +5473,7 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  *         bins0, bins1 = tuple(bins)
  */
   #ifndef CYTHON_WITHOUT_ASSERTIONS
-  if (unlikely(!(__pyx_v_pos->nd == 3))) {
+  if (unlikely(!((__pyx_v_pos->nd == 3) != 0))) {
     PyErr_SetNone(PyExc_AssertionError);
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
@@ -5375,7 +5527,9 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
         __Pyx_INCREF(__pyx_t_8);
         #else
         __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+        __Pyx_GOTREF(__pyx_t_4);
         __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+        __Pyx_GOTREF(__pyx_t_8);
         #endif
         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
       } else if (1) {
@@ -5469,7 +5623,7 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  *         bins0 = 1
  *     if bins1 <= 0:
  */
-  __pyx_t_3 = (__pyx_v_bins0 <= 0);
+  __pyx_t_3 = ((__pyx_v_bins0 <= 0) != 0);
   if (__pyx_t_3) {
 
     /* "splitPixel.pyx":351
@@ -5491,7 +5645,7 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  *         bins1 = 1
  * 
  */
-  __pyx_t_3 = (__pyx_v_bins1 <= 0);
+  __pyx_t_3 = ((__pyx_v_bins1 <= 0) != 0);
   if (__pyx_t_3) {
 
     /* "splitPixel.pyx":353
@@ -5513,11 +5667,11 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  *     cdef numpy.ndarray[numpy.float64_t, ndim = 1] cdata = weights.astype(numpy.float64).ravel()
  *     cdef numpy.ndarray[numpy.float64_t, ndim = 2] outData = numpy.zeros((bins0, bins1), dtype=numpy.float64)
  */
-  __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_pos), __pyx_n_s__astype); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_pos), __pyx_n_s__astype); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_8);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__float64); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__float64); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
   __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -5550,11 +5704,11 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  *     cdef numpy.ndarray[numpy.float64_t, ndim = 2] outData = numpy.zeros((bins0, bins1), dtype=numpy.float64)
  *     cdef numpy.ndarray[numpy.float64_t, ndim = 2] outCount = numpy.zeros((bins0, bins1), dtype=numpy.float64)
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_weights), __pyx_n_s__astype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_weights), __pyx_n_s__astype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_8);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__float64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__float64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
   __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -5566,7 +5720,7 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
-  __pyx_t_8 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__ravel); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__ravel); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_8);
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   __pyx_t_4 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -5593,9 +5747,9 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  *     cdef numpy.ndarray[numpy.float64_t, ndim = 2] outCount = numpy.zeros((bins0, bins1), dtype=numpy.float64)
  *     cdef numpy.ndarray[numpy.float64_t, ndim = 2] outMerge = numpy.zeros((bins0, bins1), dtype=numpy.float64)
  */
-  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_8 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__zeros); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__zeros); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_8);
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_v_bins0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -5617,9 +5771,9 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
   __pyx_t_9 = 0;
   __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_9));
-  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_14 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__float64); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__float64); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_14);
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__dtype), __pyx_t_14) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -5650,9 +5804,9 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  *     cdef numpy.ndarray[numpy.float64_t, ndim = 2] outMerge = numpy.zeros((bins0, bins1), dtype=numpy.float64)
  *     cdef numpy.ndarray[numpy.float64_t, ndim = 1] edges0 = numpy.zeros(bins0, dtype=numpy.float64)
  */
-  __pyx_t_14 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_14 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_14);
-  __pyx_t_9 = PyObject_GetAttr(__pyx_t_14, __pyx_n_s__zeros); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s__zeros); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_9);
   __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
   __pyx_t_14 = __Pyx_PyInt_FromSize_t(__pyx_v_bins0); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -5674,9 +5828,9 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
   __pyx_t_8 = 0;
   __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_8));
-  __pyx_t_14 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_14 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_14);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_14, __pyx_n_s__float64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s__float64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
   if (PyDict_SetItem(__pyx_t_8, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -5707,9 +5861,9 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  *     cdef numpy.ndarray[numpy.float64_t, ndim = 1] edges0 = numpy.zeros(bins0, dtype=numpy.float64)
  *     cdef numpy.ndarray[numpy.float64_t, ndim = 1] edges1 = numpy.zeros(bins1, dtype=numpy.float64)
  */
-  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_8 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__zeros); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__zeros); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_8);
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_v_bins0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -5731,9 +5885,9 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
   __pyx_t_9 = 0;
   __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_9));
-  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_14 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__float64); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__float64); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_14);
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__dtype), __pyx_t_14) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -5764,9 +5918,9 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  *     cdef numpy.ndarray[numpy.float64_t, ndim = 1] edges1 = numpy.zeros(bins1, dtype=numpy.float64)
  *     cdef numpy.int8_t[:] cmask
  */
-  __pyx_t_14 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_14 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_14);
-  __pyx_t_9 = PyObject_GetAttr(__pyx_t_14, __pyx_n_s__zeros); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s__zeros); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_9);
   __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
   __pyx_t_14 = __Pyx_PyInt_FromSize_t(__pyx_v_bins0); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -5778,9 +5932,9 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
   __pyx_t_14 = 0;
   __pyx_t_14 = PyDict_New(); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_14));
-  __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_8);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__float64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__float64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
   if (PyDict_SetItem(__pyx_t_14, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -5811,9 +5965,9 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  *     cdef numpy.int8_t[:] cmask
  *     cdef double[:] cflat, cdark, cpolarization, csolidangle
  */
-  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_14 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__zeros); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__zeros); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_14);
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_v_bins1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -5825,9 +5979,9 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
   __pyx_t_4 = 0;
   __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-  __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_9);
-  __pyx_t_8 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__float64); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s__float64); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_8);
   __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
   if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -5968,12 +6122,12 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  *         pos0_maxin = max(pos0Range)
  */
   __pyx_t_3 = (__pyx_v_pos0Range != Py_None);
-  if (__pyx_t_3) {
+  if ((__pyx_t_3 != 0)) {
     __pyx_t_20 = PyObject_Length(__pyx_v_pos0Range); if (unlikely(__pyx_t_20 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_21 = (__pyx_t_20 == 2);
+    __pyx_t_21 = ((__pyx_t_20 == 2) != 0);
     __pyx_t_22 = __pyx_t_21;
   } else {
-    __pyx_t_22 = __pyx_t_3;
+    __pyx_t_22 = (__pyx_t_3 != 0);
   }
   if (__pyx_t_22) {
 
@@ -6027,7 +6181,7 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  */
     __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_v_pos), ((PyObject *)__pyx_k_tuple_19)); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_8);
-    __pyx_t_4 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__min); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__min); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
     __pyx_t_8 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -6046,7 +6200,7 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  */
     __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_v_pos), ((PyObject *)__pyx_k_tuple_22)); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_8);
-    __pyx_t_4 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__max); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__max); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
     __pyx_t_8 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -6067,14 +6221,14 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  */
   __pyx_t_8 = PyFloat_FromDouble(__pyx_v_pos0_maxin); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_8);
-  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__finfo); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__finfo); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_14 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__float32); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__float32); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_14);
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -6086,7 +6240,7 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
   __Pyx_GOTREF(__pyx_t_14);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_14, __pyx_n_s__eps); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s__eps); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
   __pyx_t_14 = PyNumber_Add(__pyx_int_1, __pyx_t_4); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -6108,12 +6262,12 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  *         pos1_maxin = max(pos1Range)
  */
   __pyx_t_22 = (__pyx_v_pos1Range != Py_None);
-  if (__pyx_t_22) {
+  if ((__pyx_t_22 != 0)) {
     __pyx_t_20 = PyObject_Length(__pyx_v_pos1Range); if (unlikely(__pyx_t_20 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_3 = (__pyx_t_20 > 1);
+    __pyx_t_3 = ((__pyx_t_20 > 1) != 0);
     __pyx_t_21 = __pyx_t_3;
   } else {
-    __pyx_t_21 = __pyx_t_22;
+    __pyx_t_21 = (__pyx_t_22 != 0);
   }
   if (__pyx_t_21) {
 
@@ -6167,7 +6321,7 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  */
     __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_pos), ((PyObject *)__pyx_k_tuple_25)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_14 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__min); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__min); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_14);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     __pyx_t_4 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -6186,7 +6340,7 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  */
     __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_pos), ((PyObject *)__pyx_k_tuple_28)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_14 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__max); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__max); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_14);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     __pyx_t_4 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -6207,14 +6361,14 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  */
   __pyx_t_4 = PyFloat_FromDouble(__pyx_v_pos1_maxin); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_14 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_14 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_14);
-  __pyx_t_8 = PyObject_GetAttr(__pyx_t_14, __pyx_n_s__finfo); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s__finfo); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_8);
   __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
-  __pyx_t_14 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_14 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_14);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_14, __pyx_n_s__float32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s__float32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
   __pyx_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -6226,7 +6380,7 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0;
-  __pyx_t_14 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__eps); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__eps); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_14);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __pyx_t_1 = PyNumber_Add(__pyx_int_1, __pyx_t_14); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -6265,9 +6419,9 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  *     edges1 = numpy.linspace(pos1_min+0.5*dpos1, pos1_maxin-0.5*dpos1, bins1)
  * 
  */
-  __pyx_t_14 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_14 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_14);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_14, __pyx_n_s__linspace); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s__linspace); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
   __pyx_t_14 = PyFloat_FromDouble((__pyx_v_pos0_min + (0.5 * __pyx_v_dpos0))); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -6310,8 +6464,7 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
     if (unlikely(__pyx_t_24 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   __pyx_t_18 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_v_edges0));
-  __pyx_v_edges0 = ((PyArrayObject *)__pyx_t_8);
+  __Pyx_DECREF_SET(__pyx_v_edges0, ((PyArrayObject *)__pyx_t_8));
   __pyx_t_8 = 0;
 
   /* "splitPixel.pyx":395
@@ -6321,9 +6474,9 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  * 
  *     if (dummy is not None) and (delta_dummy is not None):
  */
-  __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_8);
-  __pyx_t_9 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__linspace); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__linspace); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_9);
   __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
   __pyx_t_8 = PyFloat_FromDouble((__pyx_v_pos1_min + (0.5 * __pyx_v_dpos1))); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -6366,8 +6519,7 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
     if (unlikely(__pyx_t_24 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   __pyx_t_19 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_v_edges1));
-  __pyx_v_edges1 = ((PyArrayObject *)__pyx_t_4);
+  __Pyx_DECREF_SET(__pyx_v_edges1, ((PyArrayObject *)__pyx_t_4));
   __pyx_t_4 = 0;
 
   /* "splitPixel.pyx":397
@@ -6378,11 +6530,11 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  *         cdummy =  float(dummy)
  */
   __pyx_t_21 = (__pyx_v_dummy != Py_None);
-  if (__pyx_t_21) {
+  if ((__pyx_t_21 != 0)) {
     __pyx_t_22 = (__pyx_v_delta_dummy != Py_None);
-    __pyx_t_3 = __pyx_t_22;
+    __pyx_t_3 = (__pyx_t_22 != 0);
   } else {
-    __pyx_t_3 = __pyx_t_21;
+    __pyx_t_3 = (__pyx_t_21 != 0);
   }
   if (__pyx_t_3) {
 
@@ -6425,7 +6577,8 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  *         cdummy = float(dummy)
  */
   __pyx_t_3 = (__pyx_v_dummy != Py_None);
-  if (__pyx_t_3) {
+  __pyx_t_21 = (__pyx_t_3 != 0);
+  if (__pyx_t_21) {
 
     /* "splitPixel.pyx":402
  *         cddummy =  float(delta_dummy)
@@ -6494,7 +6647,8 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  *         check_mask = True
  *         assert mask.size == size
  */
-  __pyx_t_3 = (__pyx_v_mask != Py_None);
+  __pyx_t_21 = (__pyx_v_mask != Py_None);
+  __pyx_t_3 = (__pyx_t_21 != 0);
   if (__pyx_t_3) {
 
     /* "splitPixel.pyx":411
@@ -6514,7 +6668,7 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  *     if dark is not None:
  */
     #ifndef CYTHON_WITHOUT_ASSERTIONS
-    __pyx_t_4 = PyObject_GetAttr(__pyx_v_mask, __pyx_n_s__size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_mask, __pyx_n_s__size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __pyx_t_14 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_14);
@@ -6536,12 +6690,12 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  *     if dark is not None:
  *         do_dark = True
  */
-    __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_9);
-    __pyx_t_14 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_14);
     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-    __pyx_t_9 = PyObject_GetAttr(__pyx_v_mask, __pyx_n_s__ravel); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_mask, __pyx_n_s__ravel); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_9);
     __pyx_t_4 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
@@ -6553,9 +6707,9 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
     __pyx_t_4 = 0;
     __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_8 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__int8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__int8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_8);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -6583,7 +6737,8 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  *         assert dark.size == size
  */
   __pyx_t_3 = (__pyx_v_dark != Py_None);
-  if (__pyx_t_3) {
+  __pyx_t_21 = (__pyx_t_3 != 0);
+  if (__pyx_t_21) {
 
     /* "splitPixel.pyx":415
  *         cmask = numpy.ascontiguousarray(mask.ravel(), dtype=numpy.int8)
@@ -6602,16 +6757,16 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  *     if flat is not None:
  */
     #ifndef CYTHON_WITHOUT_ASSERTIONS
-    __pyx_t_8 = PyObject_GetAttr(__pyx_v_dark, __pyx_n_s__size); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_dark, __pyx_n_s__size); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_8);
     __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __pyx_t_9 = PyObject_RichCompare(__pyx_t_8, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_21 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_21 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-    if (unlikely(!__pyx_t_3)) {
+    if (unlikely(!__pyx_t_21)) {
       PyErr_SetNone(PyExc_AssertionError);
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
@@ -6624,12 +6779,12 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  *     if flat is not None:
  *         do_flat = True
  */
-    __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_9);
-    __pyx_t_4 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-    __pyx_t_9 = PyObject_GetAttr(__pyx_v_dark, __pyx_n_s__ravel); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_dark, __pyx_n_s__ravel); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_9);
     __pyx_t_8 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_8);
@@ -6641,9 +6796,9 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
     __pyx_t_8 = 0;
     __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_8));
-    __pyx_t_14 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_14 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_14);
-    __pyx_t_1 = PyObject_GetAttr(__pyx_t_14, __pyx_n_s__float64); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s__float64); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
     if (PyDict_SetItem(__pyx_t_8, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -6670,7 +6825,8 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  *         do_flat = True
  *         assert flat.size == size
  */
-  __pyx_t_3 = (__pyx_v_flat != Py_None);
+  __pyx_t_21 = (__pyx_v_flat != Py_None);
+  __pyx_t_3 = (__pyx_t_21 != 0);
   if (__pyx_t_3) {
 
     /* "splitPixel.pyx":419
@@ -6690,7 +6846,7 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  *     if polarization is not None:
  */
     #ifndef CYTHON_WITHOUT_ASSERTIONS
-    __pyx_t_1 = PyObject_GetAttr(__pyx_v_flat, __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_flat, __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __pyx_t_8 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_8);
@@ -6712,12 +6868,12 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  *     if polarization is not None:
  *         do_polarization = True
  */
-    __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_9);
-    __pyx_t_8 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_8);
     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-    __pyx_t_9 = PyObject_GetAttr(__pyx_v_flat, __pyx_n_s__ravel); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_flat, __pyx_n_s__ravel); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __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 = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
@@ -6729,9 +6885,9 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
     __pyx_t_1 = 0;
     __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_14 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__float64); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__float64); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_14);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_14) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -6759,7 +6915,8 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  *         assert polarization.size == size
  */
   __pyx_t_3 = (__pyx_v_polarization != Py_None);
-  if (__pyx_t_3) {
+  __pyx_t_21 = (__pyx_t_3 != 0);
+  if (__pyx_t_21) {
 
     /* "splitPixel.pyx":423
  *         cflat = numpy.ascontiguousarray(flat.ravel(), dtype=numpy.float64)
@@ -6778,16 +6935,16 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  *     if solidangle is not None:
  */
     #ifndef CYTHON_WITHOUT_ASSERTIONS
-    __pyx_t_14 = PyObject_GetAttr(__pyx_v_polarization, __pyx_n_s__size); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_polarization, __pyx_n_s__size); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_14);
     __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __pyx_t_9 = PyObject_RichCompare(__pyx_t_14, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_21 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_21 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-    if (unlikely(!__pyx_t_3)) {
+    if (unlikely(!__pyx_t_21)) {
       PyErr_SetNone(PyExc_AssertionError);
       {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
@@ -6800,12 +6957,12 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  *     if solidangle is not None:
  *         do_solidangle = True
  */
-    __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_9);
-    __pyx_t_1 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __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 = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-    __pyx_t_9 = PyObject_GetAttr(__pyx_v_polarization, __pyx_n_s__ravel); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_polarization, __pyx_n_s__ravel); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_9);
     __pyx_t_14 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_14);
@@ -6817,9 +6974,9 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
     __pyx_t_14 = 0;
     __pyx_t_14 = PyDict_New(); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_14));
-    __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_8);
-    __pyx_t_4 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__float64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__float64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
     if (PyDict_SetItem(__pyx_t_14, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -6846,7 +7003,8 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  *         do_solidangle = True
  *         assert solidangle.size == size
  */
-  __pyx_t_3 = (__pyx_v_solidangle != Py_None);
+  __pyx_t_21 = (__pyx_v_solidangle != Py_None);
+  __pyx_t_3 = (__pyx_t_21 != 0);
   if (__pyx_t_3) {
 
     /* "splitPixel.pyx":427
@@ -6866,7 +7024,7 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  * 
  */
     #ifndef CYTHON_WITHOUT_ASSERTIONS
-    __pyx_t_4 = PyObject_GetAttr(__pyx_v_solidangle, __pyx_n_s__size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_solidangle, __pyx_n_s__size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __pyx_t_14 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_14);
@@ -6888,12 +7046,12 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  * 
  *     with nogil:
  */
-    __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_9);
-    __pyx_t_14 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_14);
     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-    __pyx_t_9 = PyObject_GetAttr(__pyx_v_solidangle, __pyx_n_s__ravel); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_solidangle, __pyx_n_s__ravel); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_9);
     __pyx_t_4 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
@@ -6905,9 +7063,9 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
     __pyx_t_4 = 0;
     __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_8 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float64); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__float64); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_8);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -6936,9 +7094,9 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  */
   {
       #ifdef WITH_THREAD
-      PyThreadState *_save = NULL;
-      #endif
+      PyThreadState *_save;
       Py_UNBLOCK_THREADS
+      #endif
       /*try:*/ {
 
         /* "splitPixel.pyx":432
@@ -6963,7 +7121,7 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
           if (__pyx_t_3) {
             if (unlikely(!__pyx_v_cmask.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("cmask"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L27;} }
             __pyx_t_27 = __pyx_v_idx;
-            __pyx_t_21 = (*((__pyx_t_5numpy_int8_t *) ( /* dim=0 */ (__pyx_v_cmask.data + __pyx_t_27 * __pyx_v_cmask.strides[0]) )));
+            __pyx_t_21 = ((*((__pyx_t_5numpy_int8_t *) ( /* dim=0 */ (__pyx_v_cmask.data + __pyx_t_27 * __pyx_v_cmask.strides[0]) ))) != 0);
           } else {
             __pyx_t_21 = __pyx_t_3;
           }
@@ -6998,18 +7156,18 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  *                 continue
  * 
  */
-          if (__pyx_v_check_dummy) {
-            __pyx_t_21 = (__pyx_v_cddummy == 0.0);
+          if ((__pyx_v_check_dummy != 0)) {
+            __pyx_t_21 = ((__pyx_v_cddummy == 0.0) != 0);
             if (__pyx_t_21) {
-              __pyx_t_3 = (__pyx_v_data == __pyx_v_cdummy);
+              __pyx_t_3 = ((__pyx_v_data == __pyx_v_cdummy) != 0);
               __pyx_t_22 = __pyx_t_3;
             } else {
               __pyx_t_22 = __pyx_t_21;
             }
             if (!__pyx_t_22) {
-              __pyx_t_21 = (__pyx_v_cddummy != 0.0);
+              __pyx_t_21 = ((__pyx_v_cddummy != 0.0) != 0);
               if (__pyx_t_21) {
-                __pyx_t_3 = (fabs((__pyx_v_data - __pyx_v_cdummy)) <= __pyx_v_cddummy);
+                __pyx_t_3 = ((fabs((__pyx_v_data - __pyx_v_cdummy)) <= __pyx_v_cddummy) != 0);
                 __pyx_t_29 = __pyx_t_3;
               } else {
                 __pyx_t_29 = __pyx_t_21;
@@ -7020,7 +7178,7 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
             }
             __pyx_t_22 = __pyx_t_21;
           } else {
-            __pyx_t_22 = __pyx_v_check_dummy;
+            __pyx_t_22 = (__pyx_v_check_dummy != 0);
           }
           if (__pyx_t_22) {
 
@@ -7175,13 +7333,13 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  *                     continue
  * 
  */
-          __pyx_t_22 = (__pyx_v_max0 < __pyx_v_pos0_min);
+          __pyx_t_22 = ((__pyx_v_max0 < __pyx_v_pos0_min) != 0);
           if (!__pyx_t_22) {
-            __pyx_t_21 = (__pyx_v_min0 > __pyx_v_pos0_maxin);
+            __pyx_t_21 = ((__pyx_v_min0 > __pyx_v_pos0_maxin) != 0);
             if (!__pyx_t_21) {
-              __pyx_t_29 = (__pyx_v_max1 < __pyx_v_pos1_min);
+              __pyx_t_29 = ((__pyx_v_max1 < __pyx_v_pos1_min) != 0);
               if (!__pyx_t_29) {
-                __pyx_t_3 = (__pyx_v_min1 > __pyx_v_pos1_maxin);
+                __pyx_t_3 = ((__pyx_v_min1 > __pyx_v_pos1_maxin) != 0);
                 __pyx_t_54 = __pyx_t_3;
               } else {
                 __pyx_t_54 = __pyx_t_29;
@@ -7215,7 +7373,8 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  *                 data -= cdark[idx]
  *             if do_flat:
  */
-          if (__pyx_v_do_dark) {
+          __pyx_t_21 = (__pyx_v_do_dark != 0);
+          if (__pyx_t_21) {
 
             /* "splitPixel.pyx":459
  * 
@@ -7238,7 +7397,8 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  *                 data /= cflat[idx]
  *             if do_polarization:
  */
-          if (__pyx_v_do_flat) {
+          __pyx_t_21 = (__pyx_v_do_flat != 0);
+          if (__pyx_t_21) {
 
             /* "splitPixel.pyx":461
  *                 data -= cdark[idx]
@@ -7261,7 +7421,8 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  *                 data /= cpolarization[idx]
  *             if do_solidangle:
  */
-          if (__pyx_v_do_polarization) {
+          __pyx_t_21 = (__pyx_v_do_polarization != 0);
+          if (__pyx_t_21) {
 
             /* "splitPixel.pyx":463
  *                 data /= cflat[idx]
@@ -7284,7 +7445,8 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  *                 data /= csolidangle[idx]
  * 
  */
-          if (__pyx_v_do_solidangle) {
+          __pyx_t_21 = (__pyx_v_do_solidangle != 0);
+          if (__pyx_t_21) {
 
             /* "splitPixel.pyx":465
  *                 data /= cpolarization[idx]
@@ -7307,7 +7469,7 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  *                 data = data * (pos0_min - min0) / (max0 - min0)
  *                 min0 = pos0_min
  */
-          __pyx_t_21 = (__pyx_v_min0 < __pyx_v_pos0_min);
+          __pyx_t_21 = ((__pyx_v_min0 < __pyx_v_pos0_min) != 0);
           if (__pyx_t_21) {
 
             /* "splitPixel.pyx":469
@@ -7338,7 +7500,7 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  *                 data = data * (pos1_min - min1) / (max1 - min1)
  *                 min1 = pos1_min
  */
-          __pyx_t_21 = (__pyx_v_min1 < __pyx_v_pos1_min);
+          __pyx_t_21 = ((__pyx_v_min1 < __pyx_v_pos1_min) != 0);
           if (__pyx_t_21) {
 
             /* "splitPixel.pyx":472
@@ -7369,7 +7531,7 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  *                 data = data * (max0 - pos0_maxin) / (max0 - min0)
  *                 max0 = pos0_maxin
  */
-          __pyx_t_21 = (__pyx_v_max0 > __pyx_v_pos0_maxin);
+          __pyx_t_21 = ((__pyx_v_max0 > __pyx_v_pos0_maxin) != 0);
           if (__pyx_t_21) {
 
             /* "splitPixel.pyx":475
@@ -7400,7 +7562,7 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  *                 data = data * (max1 - pos1_maxin) / (max1 - min1)
  *                 max1 = pos1_maxin
  */
-          __pyx_t_21 = (__pyx_v_max1 > __pyx_v_pos1_maxin);
+          __pyx_t_21 = ((__pyx_v_max1 > __pyx_v_pos1_maxin) != 0);
           if (__pyx_t_21) {
 
             /* "splitPixel.pyx":478
@@ -7431,7 +7593,7 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  *                 if pos1_maxin - max1 > min1 - pos1_min:
  *                     min1 = max1
  */
-          __pyx_t_21 = (((__pyx_v_max1 - __pyx_v_min1) / __pyx_v_dpos1) > (__pyx_v_bins1 / 2.0));
+          __pyx_t_21 = ((((__pyx_v_max1 - __pyx_v_min1) / __pyx_v_dpos1) > (__pyx_v_bins1 / 2.0)) != 0);
           if (__pyx_t_21) {
 
             /* "splitPixel.pyx":483
@@ -7441,7 +7603,7 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  *                     min1 = max1
  *                     max1 = pos1_maxin
  */
-            __pyx_t_21 = ((__pyx_v_pos1_maxin - __pyx_v_max1) > (__pyx_v_min1 - __pyx_v_pos1_min));
+            __pyx_t_21 = (((__pyx_v_pos1_maxin - __pyx_v_max1) > (__pyx_v_min1 - __pyx_v_pos1_min)) != 0);
             if (__pyx_t_21) {
 
               /* "splitPixel.pyx":484
@@ -7567,7 +7729,7 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  *                 if bin1_min == bin1_max:
  *                     #All pixel is within a single bin
  */
-          __pyx_t_21 = (__pyx_v_bin0_min == __pyx_v_bin0_max);
+          __pyx_t_21 = ((__pyx_v_bin0_min == __pyx_v_bin0_max) != 0);
           if (__pyx_t_21) {
 
             /* "splitPixel.pyx":502
@@ -7577,7 +7739,7 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  *                     #All pixel is within a single bin
  *                     outCount[bin0_min, bin1_min] += 1.0
  */
-            __pyx_t_21 = (__pyx_v_bin1_min == __pyx_v_bin1_max);
+            __pyx_t_21 = ((__pyx_v_bin1_min == __pyx_v_bin1_max) != 0);
             if (__pyx_t_21) {
 
               /* "splitPixel.pyx":504
@@ -7731,7 +7893,7 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  *                     #All pixel fall on 1 bins in dim 1
  *                     aeraPixel = fbin0_max - fbin0_min
  */
-            __pyx_t_21 = (__pyx_v_bin1_min == __pyx_v_bin1_max);
+            __pyx_t_21 = ((__pyx_v_bin1_min == __pyx_v_bin1_max) != 0);
             if (__pyx_t_21) {
 
               /* "splitPixel.pyx":526
@@ -8194,7 +8356,7 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  */
             __pyx_t_125 = __pyx_v_i;
             __pyx_t_126 = __pyx_v_j;
-            __pyx_t_21 = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_125, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_126, __pyx_pybuffernd_outCount.diminfo[1].strides)) > __pyx_v_epsilon);
+            __pyx_t_21 = (((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outCount.rcbuffer->pybuffer.buf, __pyx_t_125, __pyx_pybuffernd_outCount.diminfo[0].strides, __pyx_t_126, __pyx_pybuffernd_outCount.diminfo[1].strides)) > __pyx_v_epsilon) != 0);
             if (__pyx_t_21) {
 
               /* "splitPixel.pyx":578
@@ -8243,7 +8405,9 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
         __pyx_why = 0; goto __pyx_L28;
         __pyx_L27: __pyx_why = 4; goto __pyx_L28;
         __pyx_L28:;
+        #ifdef WITH_THREAD
         Py_BLOCK_THREADS
+        #endif
         switch (__pyx_why) {
           case 4: goto __pyx_L1_error;
         }
@@ -8257,11 +8421,11 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
  * 
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_8 = PyObject_GetAttr(((PyObject *)__pyx_v_outMerge), __pyx_n_s__T); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_outMerge), __pyx_n_s__T); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_8);
-  __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_outData), __pyx_n_s__T); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_outData), __pyx_n_s__T); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_9 = PyObject_GetAttr(((PyObject *)__pyx_v_outCount), __pyx_n_s__T); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_outCount), __pyx_n_s__T); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_9);
   __pyx_t_14 = PyTuple_New(5); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_14);
@@ -8335,8 +8499,8 @@ static PyObject *__pyx_pf_10splitPixel_2fullSplit2D(CYTHON_UNUSED PyObject *__py
 }
 
 /* Python wrapper */
-static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
-static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
+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);
@@ -8391,7 +8555,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  * 
  *             cdef int copy_shape, i, ndim
  */
-  __pyx_t_1 = (__pyx_v_info == NULL);
+  __pyx_t_1 = ((__pyx_v_info == NULL) != 0);
   if (__pyx_t_1) {
     __pyx_r = 0;
     goto __pyx_L0;
@@ -8433,7 +8597,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 copy_shape = 1
  *             else:
  */
-  __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t)));
+  __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":209
@@ -8466,7 +8630,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
  *                 raise ValueError(u"ndarray is not C contiguous")
  */
-  __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS);
+  __pyx_t_1 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":214
@@ -8476,7 +8640,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 raise ValueError(u"ndarray is not C contiguous")
  * 
  */
-    __pyx_t_2 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS));
+    __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS) != 0)) != 0);
     __pyx_t_3 = __pyx_t_2;
   } else {
     __pyx_t_3 = __pyx_t_1;
@@ -8506,7 +8670,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
  *                 raise ValueError(u"ndarray is not Fortran contiguous")
  */
-  __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS);
+  __pyx_t_3 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0);
   if (__pyx_t_3) {
 
     /* "numpy.pxd":218
@@ -8516,7 +8680,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 raise ValueError(u"ndarray is not Fortran contiguous")
  * 
  */
-    __pyx_t_1 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS));
+    __pyx_t_1 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS) != 0)) != 0);
     __pyx_t_2 = __pyx_t_1;
   } else {
     __pyx_t_2 = __pyx_t_3;
@@ -8564,7 +8728,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 # Allocate new buffer for strides and shape info.
  *                 # This is allocated as one block, strides first.
  */
-  if (__pyx_v_copy_shape) {
+  __pyx_t_2 = (__pyx_v_copy_shape != 0);
+  if (__pyx_t_2) {
 
     /* "numpy.pxd":226
  *                 # Allocate new buffer for strides and shape info.
@@ -8662,7 +8827,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  * 
  *             cdef int t
  */
-  __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self));
+  __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0));
 
   /* "numpy.pxd":239
  * 
@@ -8680,8 +8845,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *             cdef list stack
  *             cdef int offset
  */
-  __Pyx_INCREF(((PyObject *)__pyx_v_self->descr));
-  __pyx_v_descr = __pyx_v_self->descr;
+  __pyx_t_4 = ((PyObject *)__pyx_v_self->descr);
+  __Pyx_INCREF(__pyx_t_4);
+  __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4);
+  __pyx_t_4 = 0;
 
   /* "numpy.pxd":244
  *             cdef int offset
@@ -8699,9 +8866,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 # do not call releasebuffer
  *                 info.obj = None
  */
-  __pyx_t_2 = (!__pyx_v_hasfields);
+  __pyx_t_2 = ((!(__pyx_v_hasfields != 0)) != 0);
   if (__pyx_t_2) {
-    __pyx_t_3 = (!__pyx_v_copy_shape);
+    __pyx_t_3 = ((!(__pyx_v_copy_shape != 0)) != 0);
     __pyx_t_1 = __pyx_t_3;
   } else {
     __pyx_t_1 = __pyx_t_2;
@@ -8746,7 +8913,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 t = descr.type_num
  *                 if ((descr.byteorder == c'>' and little_endian) or
  */
-  __pyx_t_1 = (!__pyx_v_hasfields);
+  __pyx_t_1 = ((!(__pyx_v_hasfields != 0)) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":254
@@ -8756,7 +8923,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                 if ((descr.byteorder == c'>' and little_endian) or
  *                     (descr.byteorder == c'<' and not little_endian)):
  */
-    __pyx_v_t = __pyx_v_descr->type_num;
+    __pyx_t_5 = __pyx_v_descr->type_num;
+    __pyx_v_t = __pyx_t_5;
 
     /* "numpy.pxd":255
  *             if not hasfields:
@@ -8765,9 +8933,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                     (descr.byteorder == c'<' and not little_endian)):
  *                     raise ValueError(u"Non-native byte order not supported")
  */
-    __pyx_t_1 = (__pyx_v_descr->byteorder == '>');
+    __pyx_t_1 = ((__pyx_v_descr->byteorder == '>') != 0);
     if (__pyx_t_1) {
-      __pyx_t_2 = __pyx_v_little_endian;
+      __pyx_t_2 = (__pyx_v_little_endian != 0);
     } else {
       __pyx_t_2 = __pyx_t_1;
     }
@@ -8780,9 +8948,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
  *                     raise ValueError(u"Non-native byte order not supported")
  *                 if   t == NPY_BYTE:        f = "b"
  */
-      __pyx_t_1 = (__pyx_v_descr->byteorder == '<');
+      __pyx_t_1 = ((__pyx_v_descr->byteorder == '<') != 0);
       if (__pyx_t_1) {
-        __pyx_t_3 = (!__pyx_v_little_endian);
+        __pyx_t_3 = ((!(__pyx_v_little_endian != 0)) != 0);
         __pyx_t_7 = __pyx_t_3;
       } else {
         __pyx_t_7 = __pyx_t_1;
@@ -8809,227 +8977,202 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
     }
     __pyx_L12:;
 
-    /* "numpy.pxd":258
- *                     (descr.byteorder == c'<' and not little_endian)):
- *                     raise ValueError(u"Non-native byte order not supported")
- *                 if   t == NPY_BYTE:        f = "b"             # <<<<<<<<<<<<<<
- *                 elif t == NPY_UBYTE:       f = "B"
- *                 elif t == NPY_SHORT:       f = "h"
- */
-    __pyx_t_1 = (__pyx_v_t == NPY_BYTE);
-    if (__pyx_t_1) {
+    /* "numpy.pxd":274
+ *                 elif t == NPY_CDOUBLE:     f = "Zd"
+ *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
+ *                 elif t == NPY_OBJECT:      f = "O"             # <<<<<<<<<<<<<<
+ *                 else:
+ *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
+ */
+    switch (__pyx_v_t) {
+
+      /* "numpy.pxd":258
+ *                     (descr.byteorder == c'<' and not little_endian)):
+ *                     raise ValueError(u"Non-native byte order not supported")
+ *                 if   t == NPY_BYTE:        f = "b"             # <<<<<<<<<<<<<<
+ *                 elif t == NPY_UBYTE:       f = "B"
+ *                 elif t == NPY_SHORT:       f = "h"
+ */
+      case NPY_BYTE:
       __pyx_v_f = __pyx_k__b;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":259
+      /* "numpy.pxd":259
  *                     raise ValueError(u"Non-native byte order not supported")
  *                 if   t == NPY_BYTE:        f = "b"
  *                 elif t == NPY_UBYTE:       f = "B"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_SHORT:       f = "h"
  *                 elif t == NPY_USHORT:      f = "H"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_UBYTE);
-    if (__pyx_t_1) {
+      case NPY_UBYTE:
       __pyx_v_f = __pyx_k__B;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":260
+      /* "numpy.pxd":260
  *                 if   t == NPY_BYTE:        f = "b"
  *                 elif t == NPY_UBYTE:       f = "B"
  *                 elif t == NPY_SHORT:       f = "h"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_USHORT:      f = "H"
  *                 elif t == NPY_INT:         f = "i"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_SHORT);
-    if (__pyx_t_1) {
+      case NPY_SHORT:
       __pyx_v_f = __pyx_k__h;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":261
+      /* "numpy.pxd":261
  *                 elif t == NPY_UBYTE:       f = "B"
  *                 elif t == NPY_SHORT:       f = "h"
  *                 elif t == NPY_USHORT:      f = "H"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_INT:         f = "i"
  *                 elif t == NPY_UINT:        f = "I"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_USHORT);
-    if (__pyx_t_1) {
+      case NPY_USHORT:
       __pyx_v_f = __pyx_k__H;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":262
+      /* "numpy.pxd":262
  *                 elif t == NPY_SHORT:       f = "h"
  *                 elif t == NPY_USHORT:      f = "H"
  *                 elif t == NPY_INT:         f = "i"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_UINT:        f = "I"
  *                 elif t == NPY_LONG:        f = "l"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_INT);
-    if (__pyx_t_1) {
+      case NPY_INT:
       __pyx_v_f = __pyx_k__i;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":263
+      /* "numpy.pxd":263
  *                 elif t == NPY_USHORT:      f = "H"
  *                 elif t == NPY_INT:         f = "i"
  *                 elif t == NPY_UINT:        f = "I"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_LONG:        f = "l"
  *                 elif t == NPY_ULONG:       f = "L"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_UINT);
-    if (__pyx_t_1) {
+      case NPY_UINT:
       __pyx_v_f = __pyx_k__I;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":264
+      /* "numpy.pxd":264
  *                 elif t == NPY_INT:         f = "i"
  *                 elif t == NPY_UINT:        f = "I"
  *                 elif t == NPY_LONG:        f = "l"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_ULONG:       f = "L"
  *                 elif t == NPY_LONGLONG:    f = "q"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_LONG);
-    if (__pyx_t_1) {
+      case NPY_LONG:
       __pyx_v_f = __pyx_k__l;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":265
+      /* "numpy.pxd":265
  *                 elif t == NPY_UINT:        f = "I"
  *                 elif t == NPY_LONG:        f = "l"
  *                 elif t == NPY_ULONG:       f = "L"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_LONGLONG:    f = "q"
  *                 elif t == NPY_ULONGLONG:   f = "Q"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_ULONG);
-    if (__pyx_t_1) {
+      case NPY_ULONG:
       __pyx_v_f = __pyx_k__L;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":266
+      /* "numpy.pxd":266
  *                 elif t == NPY_LONG:        f = "l"
  *                 elif t == NPY_ULONG:       f = "L"
  *                 elif t == NPY_LONGLONG:    f = "q"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_ULONGLONG:   f = "Q"
  *                 elif t == NPY_FLOAT:       f = "f"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG);
-    if (__pyx_t_1) {
+      case NPY_LONGLONG:
       __pyx_v_f = __pyx_k__q;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":267
+      /* "numpy.pxd":267
  *                 elif t == NPY_ULONG:       f = "L"
  *                 elif t == NPY_LONGLONG:    f = "q"
  *                 elif t == NPY_ULONGLONG:   f = "Q"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_FLOAT:       f = "f"
  *                 elif t == NPY_DOUBLE:      f = "d"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG);
-    if (__pyx_t_1) {
+      case NPY_ULONGLONG:
       __pyx_v_f = __pyx_k__Q;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":268
+      /* "numpy.pxd":268
  *                 elif t == NPY_LONGLONG:    f = "q"
  *                 elif t == NPY_ULONGLONG:   f = "Q"
  *                 elif t == NPY_FLOAT:       f = "f"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_DOUBLE:      f = "d"
  *                 elif t == NPY_LONGDOUBLE:  f = "g"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_FLOAT);
-    if (__pyx_t_1) {
+      case NPY_FLOAT:
       __pyx_v_f = __pyx_k__f;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":269
+      /* "numpy.pxd":269
  *                 elif t == NPY_ULONGLONG:   f = "Q"
  *                 elif t == NPY_FLOAT:       f = "f"
  *                 elif t == NPY_DOUBLE:      f = "d"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_LONGDOUBLE:  f = "g"
  *                 elif t == NPY_CFLOAT:      f = "Zf"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE);
-    if (__pyx_t_1) {
+      case NPY_DOUBLE:
       __pyx_v_f = __pyx_k__d;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":270
+      /* "numpy.pxd":270
  *                 elif t == NPY_FLOAT:       f = "f"
  *                 elif t == NPY_DOUBLE:      f = "d"
  *                 elif t == NPY_LONGDOUBLE:  f = "g"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_CFLOAT:      f = "Zf"
  *                 elif t == NPY_CDOUBLE:     f = "Zd"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE);
-    if (__pyx_t_1) {
+      case NPY_LONGDOUBLE:
       __pyx_v_f = __pyx_k__g;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":271
+      /* "numpy.pxd":271
  *                 elif t == NPY_DOUBLE:      f = "d"
  *                 elif t == NPY_LONGDOUBLE:  f = "g"
  *                 elif t == NPY_CFLOAT:      f = "Zf"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_CDOUBLE:     f = "Zd"
  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT);
-    if (__pyx_t_1) {
+      case NPY_CFLOAT:
       __pyx_v_f = __pyx_k__Zf;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":272
+      /* "numpy.pxd":272
  *                 elif t == NPY_LONGDOUBLE:  f = "g"
  *                 elif t == NPY_CFLOAT:      f = "Zf"
  *                 elif t == NPY_CDOUBLE:     f = "Zd"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
  *                 elif t == NPY_OBJECT:      f = "O"
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE);
-    if (__pyx_t_1) {
+      case NPY_CDOUBLE:
       __pyx_v_f = __pyx_k__Zd;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":273
+      /* "numpy.pxd":273
  *                 elif t == NPY_CFLOAT:      f = "Zf"
  *                 elif t == NPY_CDOUBLE:     f = "Zd"
  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"             # <<<<<<<<<<<<<<
  *                 elif t == NPY_OBJECT:      f = "O"
  *                 else:
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE);
-    if (__pyx_t_1) {
+      case NPY_CLONGDOUBLE:
       __pyx_v_f = __pyx_k__Zg;
-      goto __pyx_L13;
-    }
+      break;
 
-    /* "numpy.pxd":274
+      /* "numpy.pxd":274
  *                 elif t == NPY_CDOUBLE:     f = "Zd"
  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
  *                 elif t == NPY_OBJECT:      f = "O"             # <<<<<<<<<<<<<<
  *                 else:
  *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
  */
-    __pyx_t_1 = (__pyx_v_t == NPY_OBJECT);
-    if (__pyx_t_1) {
+      case NPY_OBJECT:
       __pyx_v_f = __pyx_k__O;
-      goto __pyx_L13;
-    }
-    /*else*/ {
+      break;
+      default:
 
       /* "numpy.pxd":276
  *                 elif t == NPY_OBJECT:      f = "O"
@@ -9054,8 +9197,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
       {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      break;
     }
-    __pyx_L13:;
 
     /* "numpy.pxd":277
  *                 else:
@@ -9151,8 +9294,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P
 }
 
 /* Python wrapper */
-static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
-static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
+static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
+static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
   __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));
@@ -9179,7 +9322,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s
  *                 stdlib.free(info.format)
  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
  */
-  __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self);
+  __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":290
@@ -9201,7 +9344,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s
  *                 stdlib.free(info.strides)
  *                 # info.shape was stored after info.strides in the same block
  */
-  __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t)));
+  __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":292
@@ -9506,8 +9649,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
     #else
     __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     #endif
-    __Pyx_XDECREF(__pyx_v_childname);
-    __pyx_v_childname = __pyx_t_3;
+    __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3);
     __pyx_t_3 = 0;
 
     /* "numpy.pxd":795
@@ -9520,8 +9662,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
     __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_XDECREF(((PyObject *)__pyx_v_fields));
-    __pyx_v_fields = ((PyObject*)__pyx_t_3);
+    __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3));
     __pyx_t_3 = 0;
 
     /* "numpy.pxd":796
@@ -9550,7 +9691,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
       __Pyx_INCREF(__pyx_t_4);
       #else
       __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
       __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_4);
       #endif
     } else if (1) {
       __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -9576,11 +9719,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
       __pyx_L6_unpacking_done:;
     }
     if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_XDECREF(((PyObject *)__pyx_v_child));
-    __pyx_v_child = ((PyArray_Descr *)__pyx_t_3);
+    __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3));
     __pyx_t_3 = 0;
-    __Pyx_XDECREF(__pyx_v_new_offset);
-    __pyx_v_new_offset = __pyx_t_4;
+    __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4);
     __pyx_t_4 = 0;
 
     /* "numpy.pxd":798
@@ -9630,9 +9771,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  *             (child.byteorder == c'<' and not little_endian)):
  *             raise ValueError(u"Non-native byte order not supported")
  */
-    __pyx_t_7 = (__pyx_v_child->byteorder == '>');
+    __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0);
     if (__pyx_t_7) {
-      __pyx_t_8 = __pyx_v_little_endian;
+      __pyx_t_8 = (__pyx_v_little_endian != 0);
     } else {
       __pyx_t_8 = __pyx_t_7;
     }
@@ -9645,9 +9786,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  *             raise ValueError(u"Non-native byte order not supported")
  *             # One could encode it in the format string and have Cython
  */
-      __pyx_t_7 = (__pyx_v_child->byteorder == '<');
+      __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0);
       if (__pyx_t_7) {
-        __pyx_t_9 = (!__pyx_v_little_endian);
+        __pyx_t_9 = ((!(__pyx_v_little_endian != 0)) != 0);
         __pyx_t_10 = __pyx_t_9;
       } else {
         __pyx_t_10 = __pyx_t_7;
@@ -9736,7 +9877,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  *             t = child.type_num
  *             if end - f < 5:
  */
-    __pyx_t_7 = (!PyDataType_HASFIELDS(__pyx_v_child));
+    __pyx_t_7 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0);
     if (__pyx_t_7) {
 
       /* "numpy.pxd":821
@@ -9748,8 +9889,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  */
       __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
-      __Pyx_XDECREF(__pyx_v_t);
-      __pyx_v_t = __pyx_t_3;
+      __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_3);
       __pyx_t_3 = 0;
 
       /* "numpy.pxd":822
@@ -9759,7 +9899,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx
  *                 raise RuntimeError(u"Format string allocated too short.")
  * 
  */
-      __pyx_t_7 = ((__pyx_v_end - __pyx_v_f) < 5);
+      __pyx_t_7 = (((__pyx_v_end - __pyx_v_f) < 5) != 0);
       if (__pyx_t_7) {
 
         /* "numpy.pxd":823
@@ -10181,6 +10321,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a
   PyObject *__pyx_v_baseptr;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
+  int __pyx_t_2;
   __Pyx_RefNannySetupContext("set_array_base", 0);
 
   /* "numpy.pxd":967
@@ -10191,7 +10332,8 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a
  *      else:
  */
   __pyx_t_1 = (__pyx_v_base == Py_None);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
     /* "numpy.pxd":968
  *      cdef PyObject* baseptr
@@ -10267,7 +10409,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py
  *         return None
  *     else:
  */
-  __pyx_t_1 = (__pyx_v_arr->base == NULL);
+  __pyx_t_1 = ((__pyx_v_arr->base == NULL) != 0);
   if (__pyx_t_1) {
 
     /* "numpy.pxd":977
@@ -10312,6 +10454,9 @@ static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, P
   PyObject *__pyx_v_format = 0;
   PyObject *__pyx_v_mode = 0;
   int __pyx_v_allocate_buffer;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
@@ -10431,12 +10576,12 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
   Py_ssize_t __pyx_t_1;
   int __pyx_t_2;
   PyObject *__pyx_t_3 = NULL;
-  PyObject *__pyx_t_4 = NULL;
-  PyObject *__pyx_t_5 = NULL;
-  char *__pyx_t_6;
+  char *__pyx_t_4;
+  int __pyx_t_5;
+  int __pyx_t_6;
   int __pyx_t_7;
-  int __pyx_t_8;
-  int __pyx_t_9;
+  PyObject *__pyx_t_8 = NULL;
+  PyObject *__pyx_t_9 = NULL;
   Py_ssize_t __pyx_t_10;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
@@ -10448,7 +10593,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
   /* "View.MemoryView":120
  *         cdef PyObject **p
  * 
- *         self.ndim = len(shape)             # <<<<<<<<<<<<<<
+ *         self.ndim = <int> len(shape)             # <<<<<<<<<<<<<<
  *         self.itemsize = itemsize
  * 
  */
@@ -10457,11 +10602,11 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   __pyx_t_1 = PyTuple_GET_SIZE(((PyObject *)__pyx_v_shape)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_self->ndim = __pyx_t_1;
+  __pyx_v_self->ndim = ((int)__pyx_t_1);
 
   /* "View.MemoryView":121
  * 
- *         self.ndim = len(shape)
+ *         self.ndim = <int> len(shape)
  *         self.itemsize = itemsize             # <<<<<<<<<<<<<<
  * 
  *         if not self.ndim:
@@ -10475,7 +10620,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             raise ValueError("Empty shape tuple for cython.array")
  * 
  */
-  __pyx_t_2 = (!__pyx_v_self->ndim);
+  __pyx_t_2 = ((!(__pyx_v_self->ndim != 0)) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":124
@@ -10501,7 +10646,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             raise ValueError("itemsize <= 0 for cython.array")
  * 
  */
-  __pyx_t_2 = (__pyx_v_self->itemsize <= 0);
+  __pyx_t_2 = ((__pyx_v_self->itemsize <= 0) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":127
@@ -10527,16 +10672,10 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *         if encode:
  *             format = encode('ASCII')
  */
-  __pyx_t_3 = ((PyObject *)__pyx_n_s__encode);
-  __Pyx_INCREF(__pyx_t_3);
-  __pyx_t_4 = Py_None;
-  __Pyx_INCREF(__pyx_t_4);
-  __pyx_t_5 = __Pyx_GetAttr3(__pyx_v_format, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_5);
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_v_encode = __pyx_t_5;
-  __pyx_t_5 = 0;
+  __pyx_t_3 = __Pyx_GetAttr3(__pyx_v_format, ((PyObject *)__pyx_n_s__encode), Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_v_encode = __pyx_t_3;
+  __pyx_t_3 = 0;
 
   /* "View.MemoryView":130
  * 
@@ -10555,11 +10694,10 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *         self._format = format
  *         self.format = self._format
  */
-    __pyx_t_5 = PyObject_Call(__pyx_v_encode, ((PyObject *)__pyx_k_tuple_45), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_v_format);
-    __pyx_v_format = __pyx_t_5;
-    __pyx_t_5 = 0;
+    __pyx_t_3 = PyObject_Call(__pyx_v_encode, ((PyObject *)__pyx_k_tuple_45), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_3);
+    __pyx_t_3 = 0;
     goto __pyx_L5;
   }
   __pyx_L5:;
@@ -10585,8 +10723,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  *         self._shape = <Py_ssize_t *> malloc(sizeof(Py_ssize_t)*self.ndim)
  */
-  __pyx_t_6 = PyBytes_AsString(((PyObject *)__pyx_v_self->_format)); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_v_self->format = __pyx_t_6;
+  __pyx_t_4 = __Pyx_PyObject_AsString(((PyObject *)__pyx_v_self->_format)); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_v_self->format = __pyx_t_4;
 
   /* "View.MemoryView":135
  *         self.format = self._format
@@ -10613,14 +10751,14 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             free(self._shape)
  *             free(self._strides)
  */
-  __pyx_t_2 = (!(__pyx_v_self->_shape != 0));
+  __pyx_t_2 = ((!(__pyx_v_self->_shape != 0)) != 0);
   if (!__pyx_t_2) {
-    __pyx_t_7 = (!(__pyx_v_self->_strides != 0));
-    __pyx_t_8 = __pyx_t_7;
+    __pyx_t_5 = ((!(__pyx_v_self->_strides != 0)) != 0);
+    __pyx_t_6 = __pyx_t_5;
   } else {
-    __pyx_t_8 = __pyx_t_2;
+    __pyx_t_6 = __pyx_t_2;
   }
-  if (__pyx_t_8) {
+  if (__pyx_t_6) {
 
     /* "View.MemoryView":139
  * 
@@ -10647,10 +10785,10 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  * 
  */
-    __pyx_t_5 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_47), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_47), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L6;
   }
@@ -10672,20 +10810,19 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             if dim <= 0:
  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
  */
-  __pyx_t_9 = 0;
-  __pyx_t_5 = ((PyObject *)__pyx_v_shape); __Pyx_INCREF(__pyx_t_5); __pyx_t_1 = 0;
+  __pyx_t_7 = 0;
+  __pyx_t_3 = ((PyObject *)__pyx_v_shape); __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
   for (;;) {
-    if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
+    if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
     #if CYTHON_COMPILING_IN_CPYTHON
-    __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_1); __Pyx_INCREF(__pyx_t_4); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_8); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     #else
-    __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_8 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     #endif
-    __Pyx_XDECREF(__pyx_v_dim);
-    __pyx_v_dim = __pyx_t_4;
-    __pyx_t_4 = 0;
-    __pyx_v_idx = __pyx_t_9;
-    __pyx_t_9 = (__pyx_t_9 + 1);
+    __Pyx_XDECREF_SET(__pyx_v_dim, __pyx_t_8);
+    __pyx_t_8 = 0;
+    __pyx_v_idx = __pyx_t_7;
+    __pyx_t_7 = (__pyx_t_7 + 1);
 
     /* "View.MemoryView":146
  *         idx = 0
@@ -10694,10 +10831,10 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
  * 
  */
-    __pyx_t_4 = PyObject_RichCompare(__pyx_v_dim, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    if (__pyx_t_8) {
+    __pyx_t_8 = PyObject_RichCompare(__pyx_v_dim, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    if (__pyx_t_6) {
 
       /* "View.MemoryView":147
  *         for idx, dim in enumerate(shape):
@@ -10706,29 +10843,29 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  *             self._shape[idx] = dim
  */
-      __pyx_t_4 = PyInt_FromLong(__pyx_v_idx); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
-      __Pyx_GIVEREF(__pyx_t_4);
+      __pyx_t_8 = PyInt_FromLong(__pyx_v_idx); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_8);
+      __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
+      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8);
+      __Pyx_GIVEREF(__pyx_t_8);
       __Pyx_INCREF(__pyx_v_dim);
-      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_dim);
+      PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_dim);
       __Pyx_GIVEREF(__pyx_v_dim);
-      __pyx_t_4 = 0;
-      __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_48), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
-      __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
-      __pyx_t_4 = 0;
-      __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_4);
-      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
-      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+      __pyx_t_8 = 0;
+      __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_48), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_8));
+      __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
+      __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
+      PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_t_8));
+      __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
+      __pyx_t_8 = 0;
+      __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_8);
+      __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
+      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
+      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
       {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L9;
     }
@@ -10753,7 +10890,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  */
     __pyx_v_idx = (__pyx_v_idx + 1);
   }
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
   /* "View.MemoryView":152
  *             idx += 1
@@ -10763,21 +10900,21 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  */
   __Pyx_INCREF(__pyx_v_mode);
-  __pyx_t_5 = __pyx_v_mode;
-  __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, ((PyObject *)__pyx_n_s__fortran), Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  if (((int)__pyx_t_8)) {
-    __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, ((PyObject *)__pyx_n_s__c), Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_7 = ((int)__pyx_t_2);
+  __pyx_t_3 = __pyx_v_mode;
+  __pyx_t_8 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__fortran), Py_NE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+  if (((int)__pyx_t_6)) {
+    __pyx_t_8 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__c), Py_NE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    __pyx_t_5 = ((int)__pyx_t_2);
   } else {
-    __pyx_t_7 = ((int)__pyx_t_8);
+    __pyx_t_5 = ((int)__pyx_t_6);
   }
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __pyx_t_8 = __pyx_t_7;
-  if (__pyx_t_8) {
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_6 = (__pyx_t_5 != 0);
+  if (__pyx_t_6) {
 
     /* "View.MemoryView":153
  * 
@@ -10786,18 +10923,18 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  * 
  *         cdef char order
  */
-    __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_49), __pyx_v_mode); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
-    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_5));
-    __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
-    __pyx_t_5 = 0;
-    __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_49), __pyx_v_mode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+    __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_8);
+    PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_3));
+    __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
+    __pyx_t_3 = 0;
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
+    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L10;
   }
@@ -10810,10 +10947,10 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             order = 'F'
  *         else:
  */
-  __pyx_t_5 = PyObject_RichCompare(__pyx_v_mode, ((PyObject *)__pyx_n_s__fortran), Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  if (__pyx_t_8) {
+  __pyx_t_3 = PyObject_RichCompare(__pyx_v_mode, ((PyObject *)__pyx_n_s__fortran), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  if (__pyx_t_6) {
 
     /* "View.MemoryView":157
  *         cdef char order
@@ -10854,14 +10991,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *         if decode:
  *             mode = decode('ASCII')
  */
-  __pyx_t_5 = ((PyObject *)__pyx_n_s__decode);
-  __Pyx_INCREF(__pyx_t_5);
-  __pyx_t_4 = Py_None;
-  __Pyx_INCREF(__pyx_t_4);
-  __pyx_t_3 = __Pyx_GetAttr3(__pyx_v_mode, __pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_GetAttr3(__pyx_v_mode, ((PyObject *)__pyx_n_s__decode), Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   __pyx_v_decode = __pyx_t_3;
   __pyx_t_3 = 0;
 
@@ -10872,8 +11003,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             mode = decode('ASCII')
  *         self.mode = mode
  */
-  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_decode); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__pyx_t_8) {
+  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_decode); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__pyx_t_6) {
 
     /* "View.MemoryView":166
  *         decode = getattr(mode, 'decode', None)
@@ -10884,8 +11015,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  */
     __pyx_t_3 = PyObject_Call(__pyx_v_decode, ((PyObject *)__pyx_k_tuple_50), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_v_mode);
-    __pyx_v_mode = __pyx_t_3;
+    __Pyx_DECREF_SET(__pyx_v_mode, __pyx_t_3);
     __pyx_t_3 = 0;
     goto __pyx_L12;
   }
@@ -10922,9 +11052,9 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             self.data = <char *>malloc(self.len)
  */
   __pyx_t_3 = PyObject_RichCompare(__pyx_v_format, ((PyObject *)__pyx_n_b__O), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_v_self->dtype_is_object = __pyx_t_8;
+  __pyx_v_self->dtype_is_object = __pyx_t_6;
 
   /* "View.MemoryView":171
  *         self.free_data = allocate_buffer
@@ -10933,7 +11063,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *             self.data = <char *>malloc(self.len)
  *             if not self.data:
  */
-  if (__pyx_v_allocate_buffer) {
+  __pyx_t_6 = (__pyx_v_allocate_buffer != 0);
+  if (__pyx_t_6) {
 
     /* "View.MemoryView":172
  *         self.dtype_is_object = format == b'O'
@@ -10951,8 +11082,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *                 raise MemoryError("unable to allocate array data.")
  * 
  */
-    __pyx_t_8 = (!(__pyx_v_self->data != 0));
-    if (__pyx_t_8) {
+    __pyx_t_6 = ((!(__pyx_v_self->data != 0)) != 0);
+    if (__pyx_t_6) {
 
       /* "View.MemoryView":174
  *             self.data = <char *>malloc(self.len)
@@ -10977,7 +11108,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *                 p = <PyObject **> self.data
  *                 for i in range(self.len / itemsize):
  */
-    if (__pyx_v_self->dtype_is_object) {
+    __pyx_t_6 = (__pyx_v_self->dtype_is_object != 0);
+    if (__pyx_t_6) {
 
       /* "View.MemoryView":177
  * 
@@ -10996,11 +11128,23 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
  *                     Py_INCREF(Py_None)
  */
       if (unlikely(__pyx_v_itemsize == 0)) {
+        #ifdef WITH_THREAD
+        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+        #endif
         PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero");
+        #ifdef WITH_THREAD
+        PyGILState_Release(__pyx_gilstate_save);
+        #endif
         {__pyx_filename = __pyx_f[2]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       }
       else if (sizeof(Py_ssize_t) == sizeof(long) && unlikely(__pyx_v_itemsize == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) {
+        #ifdef WITH_THREAD
+        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+        #endif
         PyErr_Format(PyExc_OverflowError, "value too large to perform division");
+        #ifdef WITH_THREAD
+        PyGILState_Release(__pyx_gilstate_save);
+        #endif
         {__pyx_filename = __pyx_f[2]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       }
       __pyx_t_1 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_itemsize);
@@ -11036,8 +11180,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_XDECREF(__pyx_t_4);
-  __Pyx_XDECREF(__pyx_t_5);
+  __Pyx_XDECREF(__pyx_t_8);
+  __Pyx_XDECREF(__pyx_t_9);
   __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
@@ -11051,8 +11195,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx
 }
 
 /* Python wrapper */
-static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
-static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
+static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
+static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
@@ -11074,8 +11218,12 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
-  PyObject *__pyx_t_2 = NULL;
-  int __pyx_t_3;
+  int __pyx_t_2;
+  PyObject *__pyx_t_3 = NULL;
+  char *__pyx_t_4;
+  Py_ssize_t __pyx_t_5;
+  int __pyx_t_6;
+  Py_ssize_t *__pyx_t_7;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -11102,7 +11250,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         elif self.mode == b"fortran":
  */
   __pyx_t_1 = (__Pyx_PyUnicode_Equals(((PyObject *)__pyx_v_self->mode), ((PyObject *)__pyx_n_b__c), Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":186
  *         cdef int bufmode = -1
@@ -11122,7 +11271,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
  *         if not (flags & bufmode):
  */
-  __pyx_t_1 = (__Pyx_PyUnicode_Equals(((PyObject *)__pyx_v_self->mode), ((PyObject *)__pyx_n_b__fortran), Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = (__Pyx_PyUnicode_Equals(((PyObject *)__pyx_v_self->mode), ((PyObject *)__pyx_n_b__fortran), Py_EQ)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = (__pyx_t_2 != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":188
@@ -11144,7 +11294,7 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
  *         info.buf = self.data
  */
-  __pyx_t_1 = (!(__pyx_v_flags & __pyx_v_bufmode));
+  __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":190
@@ -11154,10 +11304,10 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.buf = self.data
  *         info.len = self.len
  */
-    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_54), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_54), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L4;
   }
@@ -11170,7 +11320,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.len = self.len
  *         info.ndim = self.ndim
  */
-  __pyx_v_info->buf = __pyx_v_self->data;
+  __pyx_t_4 = __pyx_v_self->data;
+  __pyx_v_info->buf = __pyx_t_4;
 
   /* "View.MemoryView":192
  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
@@ -11179,7 +11330,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.ndim = self.ndim
  *         info.shape = self._shape
  */
-  __pyx_v_info->len = __pyx_v_self->len;
+  __pyx_t_5 = __pyx_v_self->len;
+  __pyx_v_info->len = __pyx_t_5;
 
   /* "View.MemoryView":193
  *         info.buf = self.data
@@ -11188,7 +11340,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.shape = self._shape
  *         info.strides = self._strides
  */
-  __pyx_v_info->ndim = __pyx_v_self->ndim;
+  __pyx_t_6 = __pyx_v_self->ndim;
+  __pyx_v_info->ndim = __pyx_t_6;
 
   /* "View.MemoryView":194
  *         info.len = self.len
@@ -11197,7 +11350,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.strides = self._strides
  *         info.suboffsets = NULL
  */
-  __pyx_v_info->shape = __pyx_v_self->_shape;
+  __pyx_t_7 = __pyx_v_self->_shape;
+  __pyx_v_info->shape = __pyx_t_7;
 
   /* "View.MemoryView":195
  *         info.ndim = self.ndim
@@ -11206,7 +11360,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.suboffsets = NULL
  *         info.itemsize = self.itemsize
  */
-  __pyx_v_info->strides = __pyx_v_self->_strides;
+  __pyx_t_7 = __pyx_v_self->_strides;
+  __pyx_v_info->strides = __pyx_t_7;
 
   /* "View.MemoryView":196
  *         info.shape = self._shape
@@ -11224,7 +11379,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         info.readonly = 0
  * 
  */
-  __pyx_v_info->itemsize = __pyx_v_self->itemsize;
+  __pyx_t_5 = __pyx_v_self->itemsize;
+  __pyx_v_info->itemsize = __pyx_t_5;
 
   /* "View.MemoryView":198
  *         info.suboffsets = NULL
@@ -11242,8 +11398,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *             info.format = self.format
  *         else:
  */
-  __pyx_t_3 = (__pyx_v_flags & PyBUF_FORMAT);
-  if (__pyx_t_3) {
+  __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
+  if (__pyx_t_1) {
 
     /* "View.MemoryView":201
  * 
@@ -11252,7 +11408,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
  *         else:
  *             info.format = NULL
  */
-    __pyx_v_info->format = __pyx_v_self->format;
+    __pyx_t_4 = __pyx_v_self->format;
+    __pyx_v_info->format = __pyx_t_4;
     goto __pyx_L5;
   }
   /*else*/ {
@@ -11284,7 +11441,7 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a
   __pyx_r = 0;
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_2);
+  __Pyx_XDECREF(__pyx_t_3);
   __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) {
@@ -11331,7 +11488,7 @@ static void __pyx_array_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *_
  *             self.callback_free_data(self.data)
  *         elif self.free_data:
  */
-  __pyx_t_1 = (__pyx_v_self->callback_free_data != NULL);
+  __pyx_t_1 = ((__pyx_v_self->callback_free_data != NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":211
@@ -11352,7 +11509,8 @@ static void __pyx_array_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *_
  *             if self.dtype_is_object:
  *                 refcount_objects_in_slice(self.data, self._shape,
  */
-  if (__pyx_v_self->free_data) {
+  __pyx_t_1 = (__pyx_v_self->free_data != 0);
+  if (__pyx_t_1) {
 
     /* "View.MemoryView":213
  *             self.callback_free_data(self.data)
@@ -11361,7 +11519,8 @@ static void __pyx_array_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *_
  *                 refcount_objects_in_slice(self.data, self._shape,
  *                                           self._strides, self.ndim, False)
  */
-    if (__pyx_v_self->dtype_is_object) {
+    __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
+    if (__pyx_t_1) {
 
       /* "View.MemoryView":215
  *             if self.dtype_is_object:
@@ -11529,9 +11688,9 @@ static PyObject *__pyx_array_MemoryView_5array_6__getattr__(struct __pyx_array_o
  *     def __getitem__(self, item):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __pyx_r = __pyx_t_2;
@@ -11588,7 +11747,7 @@ static PyObject *__pyx_array_MemoryView_5array_8__getitem__(struct __pyx_array_o
  *     def __setitem__(self, item, value):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (!__pyx_t_2) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
@@ -11645,7 +11804,7 @@ static int __pyx_array_MemoryView_5array_10__setitem__(struct __pyx_array_obj *_
  * 
  * 
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   if (PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -11690,7 +11849,7 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize
  *         result = array(shape, itemsize, format, mode.decode('ASCII'))
  *     else:
  */
-  __pyx_t_1 = (__pyx_v_buf == NULL);
+  __pyx_t_1 = ((__pyx_v_buf == NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":245
@@ -11702,7 +11861,7 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize
  */
     __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_3 = PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_3));
     __pyx_t_4 = ((PyObject *)__Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_4));
@@ -11738,7 +11897,7 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize
  */
     __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_5 = PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_5));
     __pyx_t_3 = ((PyObject *)__Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_3));
@@ -11820,6 +11979,9 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize
 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_name = 0;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
@@ -11976,7 +12138,7 @@ static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment)
  *         aligned_p += alignment - offset
  * 
  */
-  __pyx_t_1 = (__pyx_v_offset > 0);
+  __pyx_t_1 = ((__pyx_v_offset > 0) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":303
@@ -12012,6 +12174,9 @@ static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_ar
   PyObject *__pyx_v_obj = 0;
   int __pyx_v_flags;
   int __pyx_v_dtype_is_object;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
@@ -12129,11 +12294,11 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor
  *             if <PyObject *> self.view.obj == NULL:
  */
   __pyx_t_1 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)((PyObject *)__pyx_memoryview_type)));
-  if (!__pyx_t_1) {
+  if (!(__pyx_t_1 != 0)) {
     __pyx_t_2 = (__pyx_v_obj != Py_None);
-    __pyx_t_3 = __pyx_t_2;
+    __pyx_t_3 = (__pyx_t_2 != 0);
   } else {
-    __pyx_t_3 = __pyx_t_1;
+    __pyx_t_3 = (__pyx_t_1 != 0);
   }
   if (__pyx_t_3) {
 
@@ -12153,7 +12318,7 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor
  *                 (<__pyx_buffer *> &self.view).obj = Py_None
  *                 Py_INCREF(Py_None)
  */
-    __pyx_t_3 = (((PyObject *)__pyx_v_self->view.obj) == NULL);
+    __pyx_t_3 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0);
     if (__pyx_t_3) {
 
       /* "View.MemoryView":329
@@ -12196,7 +12361,7 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor
  *             raise MemoryError
  * 
  */
-  __pyx_t_3 = (__pyx_v_self->lock == NULL);
+  __pyx_t_3 = ((__pyx_v_self->lock == NULL) != 0);
   if (__pyx_t_3) {
 
     /* "View.MemoryView":334
@@ -12218,8 +12383,8 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor
  *             self.dtype_is_object = self.view.format == b'O'
  *         else:
  */
-  __pyx_t_4 = (__pyx_v_flags & PyBUF_FORMAT);
-  if (__pyx_t_4) {
+  __pyx_t_3 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
+  if (__pyx_t_3) {
 
     /* "View.MemoryView":337
  * 
@@ -12228,7 +12393,7 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor
  *         else:
  *             self.dtype_is_object = dtype_is_object
  */
-    __pyx_t_5 = PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_5));
     __pyx_t_6 = PyObject_RichCompare(((PyObject *)__pyx_t_5), ((PyObject *)__pyx_n_b__O), Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
@@ -12300,6 +12465,7 @@ static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) {
 static void __pyx_memoryview_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) {
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
+  int __pyx_t_2;
   __Pyx_RefNannySetupContext("__dealloc__", 0);
 
   /* "View.MemoryView":346
@@ -12310,7 +12476,8 @@ static void __pyx_memoryview_MemoryView_10memoryview_2__dealloc__(struct __pyx_m
  * 
  */
   __pyx_t_1 = (__pyx_v_self->obj != Py_None);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":347
  *     def __dealloc__(memoryview self):
@@ -12331,8 +12498,8 @@ static void __pyx_memoryview_MemoryView_10memoryview_2__dealloc__(struct __pyx_m
  *             PyThread_free_lock(self.lock)
  * 
  */
-  __pyx_t_1 = (__pyx_v_self->lock != NULL);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((__pyx_v_self->lock != NULL) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":350
  * 
@@ -12426,8 +12593,7 @@ static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__py
       }
       __Pyx_GOTREF(__pyx_t_5);
     }
-    __Pyx_XDECREF(__pyx_v_idx);
-    __pyx_v_idx = __pyx_t_5;
+    __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5);
     __pyx_t_5 = 0;
     __pyx_v_dim = __pyx_t_1;
     __pyx_t_1 = (__pyx_t_1 + 1);
@@ -12494,12 +12660,13 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
-  PyObject *__pyx_t_2 = NULL;
+  int __pyx_t_2;
   PyObject *__pyx_t_3 = NULL;
   PyObject *__pyx_t_4 = NULL;
   PyObject *__pyx_t_5 = NULL;
-  PyObject *(*__pyx_t_6)(PyObject *);
-  char *__pyx_t_7;
+  PyObject *__pyx_t_6 = NULL;
+  PyObject *(*__pyx_t_7)(PyObject *);
+  char *__pyx_t_8;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -12513,7 +12680,8 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  * 
  */
   __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":364
  *     def __getitem__(memoryview self, object index):
@@ -12537,10 +12705,10 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  * 
  *         cdef char *itemp
  */
-  __pyx_t_2 = ((PyObject *)_unellipsify(__pyx_v_index, __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_2);
-  if (likely(PyTuple_CheckExact(__pyx_t_2))) {
-    PyObject* sequence = __pyx_t_2;
+  __pyx_t_3 = ((PyObject *)_unellipsify(__pyx_v_index, __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  if (likely(PyTuple_CheckExact(__pyx_t_3))) {
+    PyObject* sequence = __pyx_t_3;
     #if CYTHON_COMPILING_IN_CPYTHON
     Py_ssize_t size = Py_SIZE(sequence);
     #else
@@ -12552,43 +12720,45 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
       {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     #if CYTHON_COMPILING_IN_CPYTHON
-    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
-    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
-    __Pyx_INCREF(__pyx_t_3);
+    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
+    __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
     __Pyx_INCREF(__pyx_t_4);
+    __Pyx_INCREF(__pyx_t_5);
     #else
-    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
     #endif
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   } else if (1) {
     __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   } else
   {
     Py_ssize_t index = -1;
-    __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
-    index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L4_unpacking_failed;
-    __Pyx_GOTREF(__pyx_t_3);
-    index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed;
+    __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
+    index = 0; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed;
     __Pyx_GOTREF(__pyx_t_4);
-    if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_6 = NULL;
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L4_unpacking_failed;
+    __Pyx_GOTREF(__pyx_t_5);
+    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_7 = NULL;
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
     goto __pyx_L5_unpacking_done;
     __pyx_L4_unpacking_failed:;
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    __pyx_t_6 = NULL;
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __pyx_t_7 = NULL;
     if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_L5_unpacking_done:;
   }
-  __pyx_v_have_slices = __pyx_t_3;
-  __pyx_t_3 = 0;
-  __pyx_v_indices = __pyx_t_4;
+  __pyx_v_have_slices = __pyx_t_4;
   __pyx_t_4 = 0;
+  __pyx_v_indices = __pyx_t_5;
+  __pyx_t_5 = 0;
 
   /* "View.MemoryView":369
  * 
@@ -12597,8 +12767,8 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  *             return memview_slice(self, indices)
  *         else:
  */
-  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__pyx_t_1) {
+  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":370
  *         cdef char *itemp
@@ -12608,10 +12778,10 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  *             itemp = self.get_item_pointer(indices)
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_2 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_r = __pyx_t_2;
-    __pyx_t_2 = 0;
+    __pyx_t_3 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_r = __pyx_t_3;
+    __pyx_t_3 = 0;
     goto __pyx_L0;
     goto __pyx_L6;
   }
@@ -12624,8 +12794,8 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  *             return self.convert_item_to_object(itemp)
  * 
  */
-    __pyx_t_7 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_v_itemp = __pyx_t_7;
+    __pyx_t_8 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_8 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_v_itemp = __pyx_t_8;
 
     /* "View.MemoryView":373
  *         else:
@@ -12635,10 +12805,10 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
  *     def __setitem__(memoryview self, object index, object value):
  */
     __Pyx_XDECREF(__pyx_r);
-    __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_r = __pyx_t_2;
-    __pyx_t_2 = 0;
+    __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_r = __pyx_t_3;
+    __pyx_t_3 = 0;
     goto __pyx_L0;
   }
   __pyx_L6:;
@@ -12646,10 +12816,10 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_5);
+  __Pyx_XDECREF(__pyx_t_6);
   __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
@@ -12724,7 +12894,9 @@ static int __pyx_memoryview_MemoryView_10memoryview_6__setitem__(struct __pyx_me
     __Pyx_INCREF(__pyx_t_3);
     #else
     __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
     __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
     #endif
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   } else if (1) {
@@ -12753,8 +12925,7 @@ static int __pyx_memoryview_MemoryView_10memoryview_6__setitem__(struct __pyx_me
   }
   __pyx_v_have_slices = __pyx_t_2;
   __pyx_t_2 = 0;
-  __Pyx_DECREF(__pyx_v_index);
-  __pyx_v_index = __pyx_t_3;
+  __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_3);
   __pyx_t_3 = 0;
 
   /* "View.MemoryView":378
@@ -12867,9 +13038,9 @@ static int __pyx_memoryview_MemoryView_10memoryview_6__setitem__(struct __pyx_me
 static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) {
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
+  int __pyx_t_1;
   int __pyx_t_2;
-  int __pyx_t_3;
+  PyObject *__pyx_t_3 = NULL;
   PyObject *__pyx_t_4 = NULL;
   PyObject *__pyx_t_5 = NULL;
   PyObject *__pyx_t_6 = NULL;
@@ -12889,12 +13060,9 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
  *             try:
  *                 obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS,
  */
-  __pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryview_type));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = (!__pyx_t_2);
-  if (__pyx_t_3) {
+  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, ((PyObject *)__pyx_memoryview_type)); 
+  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":389
  *     cdef is_slice(self, obj):
@@ -12904,10 +13072,10 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
  *                                  self.dtype_is_object)
  */
     {
-      __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
+      __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
+      __Pyx_XGOTREF(__pyx_t_3);
       __Pyx_XGOTREF(__pyx_t_4);
       __Pyx_XGOTREF(__pyx_t_5);
-      __Pyx_XGOTREF(__pyx_t_6);
       /*try:*/ {
 
         /* "View.MemoryView":390
@@ -12917,8 +13085,8 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
  *                                  self.dtype_is_object)
  *             except TypeError:
  */
-        __pyx_t_1 = PyInt_FromLong((__pyx_v_self->flags | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
-        __Pyx_GOTREF(__pyx_t_1);
+        __pyx_t_6 = PyInt_FromLong((__pyx_v_self->flags | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
+        __Pyx_GOTREF(__pyx_t_6);
 
         /* "View.MemoryView":391
  *             try:
@@ -12934,25 +13102,24 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
         __Pyx_INCREF(__pyx_v_obj);
         PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj);
         __Pyx_GIVEREF(__pyx_v_obj);
-        PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_1);
-        __Pyx_GIVEREF(__pyx_t_1);
+        PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
+        __Pyx_GIVEREF(__pyx_t_6);
         PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
         __Pyx_GIVEREF(__pyx_t_7);
-        __pyx_t_1 = 0;
+        __pyx_t_6 = 0;
         __pyx_t_7 = 0;
         __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject *)__pyx_memoryview_type)), ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
         __Pyx_GOTREF(__pyx_t_7);
         __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
-        __Pyx_DECREF(__pyx_v_obj);
-        __pyx_v_obj = __pyx_t_7;
+        __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7);
         __pyx_t_7 = 0;
       }
+      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
-      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
       goto __pyx_L11_try_end;
       __pyx_L4_error:;
-      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
       __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
 
@@ -12966,10 +13133,10 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
       __pyx_t_9 = PyErr_ExceptionMatches(__pyx_builtin_TypeError);
       if (__pyx_t_9) {
         __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
-        if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
+        if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
         __Pyx_GOTREF(__pyx_t_7);
         __Pyx_GOTREF(__pyx_t_8);
-        __Pyx_GOTREF(__pyx_t_1);
+        __Pyx_GOTREF(__pyx_t_6);
 
         /* "View.MemoryView":393
  *                                  self.dtype_is_object)
@@ -12981,32 +13148,32 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
         __Pyx_XDECREF(__pyx_r);
         __Pyx_INCREF(Py_None);
         __pyx_r = Py_None;
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
         goto __pyx_L7_except_return;
         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
         goto __pyx_L5_exception_handled;
       }
       __pyx_L6_except_error:;
+      __Pyx_XGIVEREF(__pyx_t_3);
       __Pyx_XGIVEREF(__pyx_t_4);
       __Pyx_XGIVEREF(__pyx_t_5);
-      __Pyx_XGIVEREF(__pyx_t_6);
-      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
+      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
       goto __pyx_L1_error;
       __pyx_L7_except_return:;
+      __Pyx_XGIVEREF(__pyx_t_3);
       __Pyx_XGIVEREF(__pyx_t_4);
       __Pyx_XGIVEREF(__pyx_t_5);
-      __Pyx_XGIVEREF(__pyx_t_6);
-      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
+      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
       goto __pyx_L0;
       __pyx_L5_exception_handled:;
+      __Pyx_XGIVEREF(__pyx_t_3);
       __Pyx_XGIVEREF(__pyx_t_4);
       __Pyx_XGIVEREF(__pyx_t_5);
-      __Pyx_XGIVEREF(__pyx_t_6);
-      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
+      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
       __pyx_L11_try_end:;
     }
     goto __pyx_L3;
@@ -13028,7 +13195,7 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_XDECREF(__pyx_t_6);
   __Pyx_XDECREF(__pyx_t_7);
   __Pyx_XDECREF(__pyx_t_8);
   __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -13054,11 +13221,9 @@ static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryvi
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
-  PyObject *__pyx_t_2 = NULL;
-  PyObject *__pyx_t_3 = NULL;
+  int __pyx_t_2;
+  int __pyx_t_3;
   int __pyx_t_4;
-  int __pyx_t_5;
-  int __pyx_t_6;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -13072,8 +13237,6 @@ static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryvi
  *                                  src.ndim, dst.ndim, self.dtype_is_object)
  */
   if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_1 = __pyx_v_src;
-  __Pyx_INCREF(__pyx_t_1);
 
   /* "View.MemoryView":402
  * 
@@ -13083,8 +13246,6 @@ static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryvi
  * 
  */
   if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_2 = __pyx_v_dst;
-  __Pyx_INCREF(__pyx_t_2);
 
   /* "View.MemoryView":403
  *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
@@ -13093,24 +13254,20 @@ static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryvi
  * 
  *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):
  */
-  __pyx_t_3 = PyObject_GetAttr(__pyx_v_src, __pyx_n_s__ndim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_3 = PyObject_GetAttr(__pyx_v_dst, __pyx_n_s__ndim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_6 = __pyx_memoryview_copy_contents((__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_t_1), (&__pyx_v_src_slice))[0]), (__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_t_2), (&__pyx_v_dst_slice))[0]), __pyx_t_4, __pyx_t_5, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s__ndim); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __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_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s__ndim); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_4 = __pyx_memoryview_copy_contents((__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice))[0]), (__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice))[0]), __pyx_t_2, __pyx_t_3, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_2);
-  __Pyx_XDECREF(__pyx_t_3);
   __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
@@ -13172,7 +13329,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor
  *             tmp = malloc(self.view.itemsize)
  *             if tmp == NULL:
  */
-  __pyx_t_1 = (((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array)));
+  __pyx_t_1 = ((((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":414
@@ -13191,7 +13348,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor
  *                 raise MemoryError
  *             item = tmp
  */
-    __pyx_t_1 = (__pyx_v_tmp == NULL);
+    __pyx_t_1 = ((__pyx_v_tmp == NULL) != 0);
     if (__pyx_t_1) {
 
       /* "View.MemoryView":416
@@ -13236,7 +13393,8 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor
  *             (<PyObject **> item)[0] = <PyObject *> value
  *         else:
  */
-  if (__pyx_v_self->dtype_is_object) {
+  __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
+  if (__pyx_t_1) {
 
     /* "View.MemoryView":422
  * 
@@ -13346,7 +13504,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor
  *             assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
  *         slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
  */
-  __pyx_t_1 = (__pyx_v_self->view.suboffsets != NULL);
+  __pyx_t_1 = ((__pyx_v_self->view.suboffsets != NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":433
@@ -13495,9 +13653,9 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview
  *         try:
  *             result = struct.unpack(self.view.format, bytesitem)
  */
-  __pyx_t_1 = PyBytes_FromStringAndSize(((const char*)__pyx_v_itemp) + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  __pyx_v_bytesitem = __pyx_t_1;
+  __pyx_v_bytesitem = ((PyObject*)__pyx_t_1);
   __pyx_t_1 = 0;
 
   /* "View.MemoryView":449
@@ -13521,9 +13679,9 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview
  *         except struct.error:
  *             raise ValueError("Unable to convert item to object")
  */
-      __pyx_t_1 = PyObject_GetAttr(__pyx_v_struct, __pyx_n_s__unpack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s__unpack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       __Pyx_GOTREF(__pyx_t_1);
-      __pyx_t_5 = PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_5));
       __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       __Pyx_GOTREF(__pyx_t_6);
@@ -13550,7 +13708,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview
  *             return result
  */
       __pyx_t_7 = strlen(__pyx_v_self->view.format); 
-      __pyx_t_8 = (__pyx_t_7 == 1);
+      __pyx_t_8 = ((__pyx_t_7 == 1) != 0);
       if (__pyx_t_8) {
 
         /* "View.MemoryView":455
@@ -13561,7 +13719,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview
  * 
  */
         __Pyx_XDECREF(__pyx_r);
-        __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_result, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
+        __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_result, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_5) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
         __Pyx_GOTREF(__pyx_t_5);
         __pyx_r = __pyx_t_5;
         __pyx_t_5 = 0;
@@ -13598,7 +13756,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview
  *             raise ValueError("Unable to convert item to object")
  *         else:
  */
-    __pyx_t_5 = PyObject_GetAttr(__pyx_v_struct, __pyx_n_s__error); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
+    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s__error); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __pyx_t_9 = PyErr_ExceptionMatches(__pyx_t_5);
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
@@ -13681,15 +13839,16 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
   int __pyx_t_2;
-  PyObject *__pyx_t_3 = NULL;
+  int __pyx_t_3;
   PyObject *__pyx_t_4 = NULL;
   PyObject *__pyx_t_5 = NULL;
-  Py_ssize_t __pyx_t_6;
-  PyObject *__pyx_t_7 = NULL;
-  char *__pyx_t_8;
+  PyObject *__pyx_t_6 = NULL;
+  Py_ssize_t __pyx_t_7;
+  PyObject *__pyx_t_8 = NULL;
   char *__pyx_t_9;
   char *__pyx_t_10;
   char *__pyx_t_11;
+  char *__pyx_t_12;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -13714,11 +13873,9 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  *             bytesvalue = struct.pack(self.view.format, *value)
  *         else:
  */
-  __pyx_t_1 = ((PyObject *)((PyObject*)(&PyTuple_Type)));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_value, __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (__pyx_t_2) {
+  __pyx_t_2 = PyTuple_Check(__pyx_v_value); 
+  __pyx_t_3 = (__pyx_t_2 != 0);
+  if (__pyx_t_3) {
 
     /* "View.MemoryView":467
  * 
@@ -13727,28 +13884,28 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  *         else:
  *             bytesvalue = struct.pack(self.view.format, value)
  */
-    __pyx_t_1 = PyObject_GetAttr(__pyx_v_struct, __pyx_n_s__pack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s__pack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_3 = PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
-    __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
-    __pyx_t_3 = 0;
-    __pyx_t_3 = PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-    __pyx_t_5 = PyNumber_Add(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+    __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4));
+    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
+    __pyx_t_4 = 0;
+    __pyx_t_4 = PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+    __pyx_t_6 = PyNumber_Add(((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
+    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-    __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
-    if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_v_bytesvalue = ((PyObject*)__pyx_t_3);
-    __pyx_t_3 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+    if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_4)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
+    __pyx_t_4 = 0;
     goto __pyx_L3;
   }
   /*else*/ {
@@ -13760,25 +13917,25 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  * 
  *         for i, c in enumerate(bytesvalue):
  */
-    __pyx_t_3 = PyObject_GetAttr(__pyx_v_struct, __pyx_n_s__pack); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_5 = PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s__pack); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
     __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_5));
-    __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
+    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_6));
+    __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
     __Pyx_INCREF(__pyx_v_value);
     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_value);
     __Pyx_GIVEREF(__pyx_v_value);
-    __pyx_t_5 = 0;
-    __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __pyx_t_6 = 0;
+    __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-    if (!(likely(PyBytes_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_5)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_v_bytesvalue = ((PyObject*)__pyx_t_5);
-    __pyx_t_5 = 0;
+    if (!(likely(PyBytes_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_6)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_v_bytesvalue = ((PyObject*)__pyx_t_6);
+    __pyx_t_6 = 0;
   }
   __pyx_L3:;
 
@@ -13789,18 +13946,18 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  *             itemp[i] = c
  * 
  */
-  __pyx_t_6 = 0;
+  __pyx_t_7 = 0;
   if (unlikely(((PyObject *)__pyx_v_bytesvalue) == Py_None)) {
     PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   __Pyx_INCREF(((PyObject *)__pyx_v_bytesvalue));
-  __pyx_t_7 = __pyx_v_bytesvalue;
-  __pyx_t_9 = PyBytes_AS_STRING(__pyx_t_7);
-  __pyx_t_10 = (__pyx_t_9 + PyBytes_GET_SIZE(__pyx_t_7));
-  for (__pyx_t_11 = __pyx_t_9; __pyx_t_11 < __pyx_t_10; __pyx_t_11++) {
-    __pyx_t_8 = __pyx_t_11;
-    __pyx_v_c = (__pyx_t_8[0]);
+  __pyx_t_8 = __pyx_v_bytesvalue;
+  __pyx_t_10 = PyBytes_AS_STRING(__pyx_t_8);
+  __pyx_t_11 = (__pyx_t_10 + PyBytes_GET_SIZE(__pyx_t_8));
+  for (__pyx_t_12 = __pyx_t_10; __pyx_t_12 < __pyx_t_11; __pyx_t_12++) {
+    __pyx_t_9 = __pyx_t_12;
+    __pyx_v_c = (__pyx_t_9[0]);
 
     /* "View.MemoryView":472
  * 
@@ -13809,7 +13966,7 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  * 
  *     @cname('getbuffer')
  */
-    __pyx_v_i = __pyx_t_6;
+    __pyx_v_i = __pyx_t_7;
 
     /* "View.MemoryView":471
  *             bytesvalue = struct.pack(self.view.format, value)
@@ -13818,7 +13975,7 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  *             itemp[i] = c
  * 
  */
-    __pyx_t_6 = (__pyx_t_6 + 1);
+    __pyx_t_7 = (__pyx_t_7 + 1);
 
     /* "View.MemoryView":472
  * 
@@ -13829,16 +13986,16 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
  */
     (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c;
   }
-  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
-  __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_5);
-  __Pyx_XDECREF(((PyObject *)__pyx_t_7));
+  __Pyx_XDECREF(__pyx_t_6);
+  __Pyx_XDECREF(((PyObject *)__pyx_t_8));
   __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
@@ -13850,8 +14007,8 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie
 }
 
 /* Python wrapper */
-static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
-static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
+static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
+static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
@@ -13872,6 +14029,11 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
   int __pyx_r;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
+  Py_ssize_t *__pyx_t_2;
+  char *__pyx_t_3;
+  void *__pyx_t_4;
+  int __pyx_t_5;
+  Py_ssize_t __pyx_t_6;
   __Pyx_RefNannySetupContext("__getbuffer__", 0);
   if (__pyx_v_info != NULL) {
     __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
@@ -13885,7 +14047,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *             info.shape = self.view.shape
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_flags & PyBUF_STRIDES);
+  __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":477
@@ -13895,7 +14057,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         else:
  *             info.shape = NULL
  */
-    __pyx_v_info->shape = __pyx_v_self->view.shape;
+    __pyx_t_2 = __pyx_v_self->view.shape;
+    __pyx_v_info->shape = __pyx_t_2;
     goto __pyx_L3;
   }
   /*else*/ {
@@ -13918,7 +14081,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *             info.strides = self.view.strides
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_flags & PyBUF_STRIDES);
+  __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":482
@@ -13928,7 +14091,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         else:
  *             info.strides = NULL
  */
-    __pyx_v_info->strides = __pyx_v_self->view.strides;
+    __pyx_t_2 = __pyx_v_self->view.strides;
+    __pyx_v_info->strides = __pyx_t_2;
     goto __pyx_L4;
   }
   /*else*/ {
@@ -13951,7 +14115,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *             info.suboffsets = self.view.suboffsets
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_flags & PyBUF_INDIRECT);
+  __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":487
@@ -13961,7 +14125,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         else:
  *             info.suboffsets = NULL
  */
-    __pyx_v_info->suboffsets = __pyx_v_self->view.suboffsets;
+    __pyx_t_2 = __pyx_v_self->view.suboffsets;
+    __pyx_v_info->suboffsets = __pyx_t_2;
     goto __pyx_L5;
   }
   /*else*/ {
@@ -13984,7 +14149,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *             info.format = self.view.format
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_flags & PyBUF_FORMAT);
+  __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":492
@@ -13994,7 +14159,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         else:
  *             info.format = NULL
  */
-    __pyx_v_info->format = __pyx_v_self->view.format;
+    __pyx_t_3 = __pyx_v_self->view.format;
+    __pyx_v_info->format = __pyx_t_3;
     goto __pyx_L6;
   }
   /*else*/ {
@@ -14017,7 +14183,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         info.ndim = self.view.ndim
  *         info.itemsize = self.view.itemsize
  */
-  __pyx_v_info->buf = __pyx_v_self->view.buf;
+  __pyx_t_4 = __pyx_v_self->view.buf;
+  __pyx_v_info->buf = __pyx_t_4;
 
   /* "View.MemoryView":497
  * 
@@ -14026,7 +14193,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         info.itemsize = self.view.itemsize
  *         info.len = self.view.len
  */
-  __pyx_v_info->ndim = __pyx_v_self->view.ndim;
+  __pyx_t_5 = __pyx_v_self->view.ndim;
+  __pyx_v_info->ndim = __pyx_t_5;
 
   /* "View.MemoryView":498
  *         info.buf = self.view.buf
@@ -14035,7 +14203,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         info.len = self.view.len
  *         info.readonly = 0
  */
-  __pyx_v_info->itemsize = __pyx_v_self->view.itemsize;
+  __pyx_t_6 = __pyx_v_self->view.itemsize;
+  __pyx_v_info->itemsize = __pyx_t_6;
 
   /* "View.MemoryView":499
  *         info.ndim = self.view.ndim
@@ -14044,7 +14213,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str
  *         info.readonly = 0
  *         info.obj = self
  */
-  __pyx_v_info->len = __pyx_v_self->view.len;
+  __pyx_t_6 = __pyx_v_self->view.len;
+  __pyx_v_info->len = __pyx_t_6;
 
   /* "View.MemoryView":500
  *         info.itemsize = self.view.itemsize
@@ -14244,10 +14414,10 @@ static PyObject *__pyx_memoryview_get_shape_MemoryView_10memoryview_5shape___get
     __pyx_v_i = __pyx_t_3;
     __pyx_t_4 = PyInt_FromSsize_t((__pyx_v_self->view.shape[__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    if (unlikely(__Pyx_PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   }
-  __pyx_t_4 = ((PyObject *)PyList_AsTuple(__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = ((PyObject *)PyList_AsTuple(((PyObject*)__pyx_t_1))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_4));
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   __pyx_r = ((PyObject *)__pyx_t_4);
@@ -14307,7 +14477,7 @@ static PyObject *__pyx_memoryview_get_strides_MemoryView_10memoryview_7strides__
  * 
  *                 raise ValueError("Buffer view does not expose strides")
  */
-  __pyx_t_1 = (__pyx_v_self->view.strides == NULL);
+  __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":528
@@ -14341,10 +14511,10 @@ static PyObject *__pyx_memoryview_get_strides_MemoryView_10memoryview_7strides__
     __pyx_v_i = __pyx_t_4;
     __pyx_t_5 = PyInt_FromSsize_t((__pyx_v_self->view.strides[__pyx_v_i])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    if (unlikely(__Pyx_PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
   }
-  __pyx_t_5 = ((PyObject *)PyList_AsTuple(__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = ((PyObject *)PyList_AsTuple(((PyObject*)__pyx_t_2))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_5));
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __pyx_r = ((PyObject *)__pyx_t_5);
@@ -14404,7 +14574,7 @@ static PyObject *__pyx_memoryview_get_suboffsets_MemoryView_10memoryview_10subof
  *                 return [-1] * self.view.ndim
  * 
  */
-  __pyx_t_1 = (__pyx_v_self->view.suboffsets == NULL);
+  __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":536
@@ -14446,10 +14616,10 @@ static PyObject *__pyx_memoryview_get_suboffsets_MemoryView_10memoryview_10subof
     __pyx_v_i = __pyx_t_4;
     __pyx_t_5 = PyInt_FromSsize_t((__pyx_v_self->view.suboffsets[__pyx_v_i])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    if (unlikely(__Pyx_PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
   }
-  __pyx_t_5 = ((PyObject *)PyList_AsTuple(__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = ((PyObject *)PyList_AsTuple(((PyObject*)__pyx_t_2))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_5));
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __pyx_r = ((PyObject *)__pyx_t_5);
@@ -14615,7 +14785,7 @@ static PyObject *__pyx_memoryview_get_nbytes_MemoryView_10memoryview_6nbytes___g
  *     property size:
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
@@ -14666,10 +14836,11 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   int __pyx_t_1;
-  PyObject *__pyx_t_2 = NULL;
+  int __pyx_t_2;
   PyObject *__pyx_t_3 = NULL;
-  Py_ssize_t __pyx_t_4;
-  PyObject *(*__pyx_t_5)(PyObject *);
+  PyObject *__pyx_t_4 = NULL;
+  Py_ssize_t __pyx_t_5;
+  PyObject *(*__pyx_t_6)(PyObject *);
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -14683,7 +14854,8 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__
  * 
  */
   __pyx_t_1 = (__pyx_v_self->_size == Py_None);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":559
  *         def __get__(self):
@@ -14702,46 +14874,45 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__
  *                     result *= length
  * 
  */
-    __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
-      __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
-      __pyx_t_5 = NULL;
+    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) {
+      __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
+      __pyx_t_6 = NULL;
     } else {
-      __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext;
+      __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_4);
+      __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext;
     }
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     for (;;) {
-      if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_3)) {
-        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
+      if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_4)) {
+        if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
         #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         #else
-        __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         #endif
-      } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_3)) {
-        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
+      } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_4)) {
+        if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
         #if CYTHON_COMPILING_IN_CPYTHON
-        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         #else
-        __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         #endif
       } else {
-        __pyx_t_2 = __pyx_t_5(__pyx_t_3);
-        if (unlikely(!__pyx_t_2)) {
+        __pyx_t_3 = __pyx_t_6(__pyx_t_4);
+        if (unlikely(!__pyx_t_3)) {
           if (PyErr_Occurred()) {
             if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
             else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           }
           break;
         }
-        __Pyx_GOTREF(__pyx_t_2);
+        __Pyx_GOTREF(__pyx_t_3);
       }
-      __Pyx_XDECREF(__pyx_v_length);
-      __pyx_v_length = __pyx_t_2;
-      __pyx_t_2 = 0;
+      __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_3);
+      __pyx_t_3 = 0;
 
       /* "View.MemoryView":562
  * 
@@ -14750,13 +14921,12 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__
  * 
  *                 self._size = result
  */
-      __pyx_t_2 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_DECREF(__pyx_v_result);
-      __pyx_v_result = __pyx_t_2;
-      __pyx_t_2 = 0;
+      __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_3);
+      __pyx_t_3 = 0;
     }
-    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
     /* "View.MemoryView":564
  *                     result *= length
@@ -14789,8 +14959,8 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
+  __Pyx_XDECREF(__pyx_t_4);
   __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
@@ -14833,7 +15003,7 @@ static Py_ssize_t __pyx_memoryview_MemoryView_10memoryview_10__len__(struct __py
  *             return self.view.shape[0]
  * 
  */
-  __pyx_t_1 = (__pyx_v_self->view.ndim >= 1);
+  __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":570
@@ -14903,12 +15073,12 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_12__repr__(struct __py
  * 
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__base); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__base); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____name__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s____name__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
@@ -14993,12 +15163,12 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_14__str__(struct __pyx
  * 
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__base); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__base); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____name__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s____name__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -15414,30 +15584,26 @@ static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, in
 /* "View.MemoryView":624
  * 
  * @cname('__pyx_memoryview_check')
- * cdef bint memoryview_check(object o):             # <<<<<<<<<<<<<<
+ * cdef inline bint memoryview_check(object o):             # <<<<<<<<<<<<<<
  *     return isinstance(o, memoryview)
  * 
  */
 
-static int __pyx_memoryview_check(PyObject *__pyx_v_o) {
+static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) {
   int __pyx_r;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
-  int __pyx_t_2;
+  int __pyx_t_1;
   __Pyx_RefNannySetupContext("memoryview_check", 0);
 
   /* "View.MemoryView":625
  * @cname('__pyx_memoryview_check')
- * cdef bint memoryview_check(object o):
+ * cdef inline bint memoryview_check(object o):
  *     return isinstance(o, memoryview)             # <<<<<<<<<<<<<<
  * 
  * cdef tuple _unellipsify(object index, int ndim):
  */
-  __pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryview_type));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_o, __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_r = __pyx_t_2;
+  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, ((PyObject *)__pyx_memoryview_type)); 
+  __pyx_r = __pyx_t_1;
   goto __pyx_L0;
 
   __pyx_r = 0;
@@ -15464,9 +15630,9 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
   PyObject *__pyx_v_nslices = NULL;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
+  int __pyx_t_1;
   int __pyx_t_2;
-  int __pyx_t_3;
+  PyObject *__pyx_t_3 = NULL;
   PyObject *__pyx_t_4 = NULL;
   Py_ssize_t __pyx_t_5;
   PyObject *(*__pyx_t_6)(PyObject *);
@@ -15488,12 +15654,9 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *         tup = (index,)
  *     else:
  */
-  __pyx_t_1 = ((PyObject *)((PyObject*)(&PyTuple_Type)));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_index, __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = (!__pyx_t_2);
-  if (__pyx_t_3) {
+  __pyx_t_1 = PyTuple_Check(__pyx_v_index); 
+  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":633
  *     """
@@ -15502,13 +15665,13 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *     else:
  *         tup = index
  */
-    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
     __Pyx_INCREF(__pyx_v_index);
-    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_index);
+    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index);
     __Pyx_GIVEREF(__pyx_v_index);
-    __pyx_v_tup = ((PyObject *)__pyx_t_1);
-    __pyx_t_1 = 0;
+    __pyx_v_tup = ((PyObject *)__pyx_t_3);
+    __pyx_t_3 = 0;
     goto __pyx_L3;
   }
   /*else*/ {
@@ -15532,10 +15695,10 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *     have_slices = False
  *     seen_ellipsis = False
  */
-  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_v_result = __pyx_t_1;
-  __pyx_t_1 = 0;
+  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_v_result = ((PyObject*)__pyx_t_3);
+  __pyx_t_3 = 0;
 
   /* "View.MemoryView":638
  * 
@@ -15544,10 +15707,10 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *     seen_ellipsis = False
  *     for idx, item in enumerate(tup):
  */
-  __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_v_have_slices = __pyx_t_1;
-  __pyx_t_1 = 0;
+  __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_v_have_slices = __pyx_t_3;
+  __pyx_t_3 = 0;
 
   /* "View.MemoryView":639
  *     result = []
@@ -15566,7 +15729,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *             if not seen_ellipsis:
  */
   __Pyx_INCREF(__pyx_int_0);
-  __pyx_t_1 = __pyx_int_0;
+  __pyx_t_3 = __pyx_int_0;
   if (PyList_CheckExact(__pyx_v_tup) || PyTuple_CheckExact(__pyx_v_tup)) {
     __pyx_t_4 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
     __pyx_t_6 = NULL;
@@ -15601,16 +15764,14 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
       }
       __Pyx_GOTREF(__pyx_t_7);
     }
-    __Pyx_XDECREF(__pyx_v_item);
-    __pyx_v_item = __pyx_t_7;
+    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7);
     __pyx_t_7 = 0;
-    __Pyx_INCREF(__pyx_t_1);
-    __Pyx_XDECREF(__pyx_v_idx);
-    __pyx_v_idx = __pyx_t_1;
-    __pyx_t_7 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_INCREF(__pyx_t_3);
+    __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3);
+    __pyx_t_7 = PyNumber_Add(__pyx_t_3, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_7);
-    __Pyx_DECREF(__pyx_t_1);
-    __pyx_t_1 = __pyx_t_7;
+    __Pyx_DECREF(__pyx_t_3);
+    __pyx_t_3 = __pyx_t_7;
     __pyx_t_7 = 0;
 
     /* "View.MemoryView":641
@@ -15620,8 +15781,9 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *             if not seen_ellipsis:
  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
  */
-    __pyx_t_3 = (__pyx_v_item == __pyx_builtin_Ellipsis);
-    if (__pyx_t_3) {
+    __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis);
+    __pyx_t_1 = (__pyx_t_2 != 0);
+    if (__pyx_t_1) {
 
       /* "View.MemoryView":642
  *     for idx, item in enumerate(tup):
@@ -15630,8 +15792,8 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
  *                 seen_ellipsis = True
  */
-      __pyx_t_3 = (!__pyx_v_seen_ellipsis);
-      if (__pyx_t_3) {
+      __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0);
+      if (__pyx_t_1) {
 
         /* "View.MemoryView":643
  *         if item is Ellipsis:
@@ -15640,7 +15802,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *                 seen_ellipsis = True
  *             else:
  */
-        __pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_v_result), __pyx_n_s__extend); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_result), __pyx_n_s__extend); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_7);
         __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_61), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_8);
@@ -15687,7 +15849,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  */
         __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_62), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_10);
-        __pyx_t_11 = PyList_Append(__pyx_v_result, __pyx_t_10); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_10); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
       }
       __pyx_L7:;
@@ -15701,8 +15863,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  */
       __pyx_t_10 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_10);
-      __Pyx_DECREF(__pyx_v_have_slices);
-      __pyx_v_have_slices = __pyx_t_10;
+      __Pyx_DECREF_SET(__pyx_v_have_slices, __pyx_t_10);
       __pyx_t_10 = 0;
       goto __pyx_L6;
     }
@@ -15715,14 +15876,11 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *                 raise TypeError("Cannot index with type '%s'" % type(item))
  * 
  */
-      __pyx_t_10 = ((PyObject *)((PyObject*)(&PySlice_Type)));
-      __Pyx_INCREF(__pyx_t_10);
-      __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_item, __pyx_t_10); 
-      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-      __pyx_t_2 = (!__pyx_t_3);
+      __pyx_t_1 = PySlice_Check(__pyx_v_item); 
+      __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
       if (__pyx_t_2) {
-        __pyx_t_3 = (!PyIndex_Check(__pyx_v_item));
-        __pyx_t_12 = __pyx_t_3;
+        __pyx_t_1 = ((!(__Pyx_PyIndex_Check(__pyx_v_item) != 0)) != 0);
+        __pyx_t_12 = __pyx_t_1;
       } else {
         __pyx_t_12 = __pyx_t_2;
       }
@@ -15761,10 +15919,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  */
       __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       if (!__pyx_t_12) {
-        __pyx_t_10 = ((PyObject *)((PyObject*)(&PySlice_Type)));
-        __Pyx_INCREF(__pyx_t_10);
-        __pyx_t_12 = __Pyx_TypeCheck(__pyx_v_item, __pyx_t_10); 
-        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+        __pyx_t_12 = PySlice_Check(__pyx_v_item); 
         __pyx_t_10 = __Pyx_PyBool_FromLong(__pyx_t_12); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_10);
         __pyx_t_8 = __pyx_t_10;
@@ -15773,8 +15928,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
         __Pyx_INCREF(__pyx_v_have_slices);
         __pyx_t_8 = __pyx_v_have_slices;
       }
-      __Pyx_DECREF(__pyx_v_have_slices);
-      __pyx_v_have_slices = __pyx_t_8;
+      __Pyx_DECREF_SET(__pyx_v_have_slices, __pyx_t_8);
       __pyx_t_8 = 0;
 
       /* "View.MemoryView":653
@@ -15784,12 +15938,12 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  * 
  *     nslices = ndim - len(result)
  */
-      __pyx_t_11 = PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     __pyx_L6:;
   }
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 
   /* "View.MemoryView":655
  *             result.append(item)
@@ -15799,10 +15953,10 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  *         result.extend([slice(None)] * nslices)
  */
   __pyx_t_5 = PyList_GET_SIZE(((PyObject *)__pyx_v_result)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_1 = PyInt_FromSsize_t((__pyx_v_ndim - __pyx_t_5)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_v_nslices = __pyx_t_1;
-  __pyx_t_1 = 0;
+  __pyx_t_3 = PyInt_FromSsize_t((__pyx_v_ndim - __pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_v_nslices = __pyx_t_3;
+  __pyx_t_3 = 0;
 
   /* "View.MemoryView":656
  * 
@@ -15821,8 +15975,8 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  * 
  *     return have_slices or nslices, tuple(result)
  */
-    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_result), __pyx_n_s__extend); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_result), __pyx_n_s__extend); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
     __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_64), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -15840,9 +15994,9 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
     PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
     __pyx_t_8 = 0;
-    __pyx_t_8 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_8 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_8);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
     goto __pyx_L9;
@@ -15867,22 +16021,22 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
   }
   __pyx_t_4 = ((PyObject *)PyList_AsTuple(__pyx_v_result)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_4));
-  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8);
+  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_8);
   __Pyx_GIVEREF(__pyx_t_8);
-  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_t_4));
+  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_t_4));
   __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
   __pyx_t_8 = 0;
   __pyx_t_4 = 0;
-  __pyx_r = __pyx_t_1;
-  __pyx_t_1 = 0;
+  __pyx_r = ((PyObject*)__pyx_t_3);
+  __pyx_t_3 = 0;
   goto __pyx_L0;
 
   __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_XDECREF(__pyx_t_3);
   __Pyx_XDECREF(__pyx_t_4);
   __Pyx_XDECREF(__pyx_t_7);
   __Pyx_XDECREF(__pyx_t_8);
@@ -15940,7 +16094,7 @@ static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __
  *             raise ValueError("Indirect dimensions not supported")
  * 
  */
-    __pyx_t_3 = ((__pyx_v_suboffsets[__pyx_v_i]) >= 0);
+    __pyx_t_3 = (((__pyx_v_suboffsets[__pyx_v_i]) >= 0) != 0);
     if (__pyx_t_3) {
 
       /* "View.MemoryView":665
@@ -15999,15 +16153,18 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
   PyObject *__pyx_v_index = NULL;
   struct __pyx_memoryview_obj *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
+  int __pyx_t_1;
   int __pyx_t_2;
-  int __pyx_t_3;
-  Py_ssize_t __pyx_t_4;
-  PyObject *(*__pyx_t_5)(PyObject *);
+  struct __pyx_memoryview_obj *__pyx_t_3;
+  char *__pyx_t_4;
+  int __pyx_t_5;
   PyObject *__pyx_t_6 = NULL;
-  int __pyx_t_7;
-  Py_ssize_t __pyx_t_8;
+  Py_ssize_t __pyx_t_7;
+  PyObject *(*__pyx_t_8)(PyObject *);
   PyObject *__pyx_t_9 = NULL;
+  Py_ssize_t __pyx_t_10;
+  int __pyx_t_11;
+  PyObject *__pyx_t_12 = NULL;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -16040,7 +16197,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *     if isinstance(memview, _memoryviewslice):
  */
   #ifndef CYTHON_WITHOUT_ASSERTIONS
-  if (unlikely(!(__pyx_v_memview->view.ndim > 0))) {
+  if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) {
     PyErr_SetNone(PyExc_AssertionError);
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
@@ -16053,10 +16210,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *         memviewsliceobj = memview
  *         p_src = &memviewsliceobj.from_slice
  */
-  __pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryviewslice_type));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), ((PyObject *)__pyx_memoryviewslice_type)); 
+  __pyx_t_2 = (__pyx_t_1 != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":687
@@ -16109,7 +16264,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *     dst.data = p_src.data
  * 
  */
-  __pyx_v_dst.memview = __pyx_v_p_src->memview;
+  __pyx_t_3 = __pyx_v_p_src->memview;
+  __pyx_v_dst.memview = __pyx_t_3;
 
   /* "View.MemoryView":698
  * 
@@ -16118,7 +16274,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  * 
  * 
  */
-  __pyx_v_dst.data = __pyx_v_p_src->data;
+  __pyx_t_4 = __pyx_v_p_src->data;
+  __pyx_v_dst.data = __pyx_t_4;
 
   /* "View.MemoryView":703
  * 
@@ -16145,46 +16302,45 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *         if PyIndex_Check(index):
  *             slice_memviewslice(
  */
-  __pyx_t_3 = 0;
+  __pyx_t_5 = 0;
   if (PyList_CheckExact(__pyx_v_indices) || PyTuple_CheckExact(__pyx_v_indices)) {
-    __pyx_t_1 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0;
-    __pyx_t_5 = NULL;
+    __pyx_t_6 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_6); __pyx_t_7 = 0;
+    __pyx_t_8 = NULL;
   } else {
-    __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext;
+    __pyx_t_7 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __pyx_t_8 = Py_TYPE(__pyx_t_6)->tp_iternext;
   }
   for (;;) {
-    if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_1)) {
-      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
+    if (!__pyx_t_8 && PyList_CheckExact(__pyx_t_6)) {
+      if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_6)) break;
       #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       #else
-      __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       #endif
-    } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_1)) {
-      if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+    } else if (!__pyx_t_8 && PyTuple_CheckExact(__pyx_t_6)) {
+      if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
       #if CYTHON_COMPILING_IN_CPYTHON
-      __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       #else
-      __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       #endif
     } else {
-      __pyx_t_6 = __pyx_t_5(__pyx_t_1);
-      if (unlikely(!__pyx_t_6)) {
+      __pyx_t_9 = __pyx_t_8(__pyx_t_6);
+      if (unlikely(!__pyx_t_9)) {
         if (PyErr_Occurred()) {
           if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
           else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         }
         break;
       }
-      __Pyx_GOTREF(__pyx_t_6);
+      __Pyx_GOTREF(__pyx_t_9);
     }
-    __Pyx_XDECREF(__pyx_v_index);
-    __pyx_v_index = __pyx_t_6;
-    __pyx_t_6 = 0;
-    __pyx_v_dim = __pyx_t_3;
-    __pyx_t_3 = (__pyx_t_3 + 1);
+    __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9);
+    __pyx_t_9 = 0;
+    __pyx_v_dim = __pyx_t_5;
+    __pyx_t_5 = (__pyx_t_5 + 1);
 
     /* "View.MemoryView":709
  * 
@@ -16193,8 +16349,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             slice_memviewslice(
  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
  */
-    __pyx_t_7 = PyIndex_Check(__pyx_v_index);
-    if (__pyx_t_7) {
+    __pyx_t_2 = (__Pyx_PyIndex_Check(__pyx_v_index) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":713
  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
@@ -16203,7 +16359,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *                 0, 0, 0, # have_{start,stop,step}
  *                 False)
  */
-      __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
       /* "View.MemoryView":715
  *                 index, 0, 0, # start, stop, step
@@ -16212,7 +16368,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *         elif index is None:
  *             p_dst.shape[new_ndim] = 1
  */
-      __pyx_t_7 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_8, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_10, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L6;
     }
 
@@ -16224,7 +16380,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             p_dst.strides[new_ndim] = 0
  */
     __pyx_t_2 = (__pyx_v_index == Py_None);
-    if (__pyx_t_2) {
+    __pyx_t_1 = (__pyx_t_2 != 0);
+    if (__pyx_t_1) {
 
       /* "View.MemoryView":717
  *                 False)
@@ -16272,20 +16429,20 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             stop = index.stop or 0
  *             step = index.step or 0
  */
-      __pyx_t_6 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_6);
-      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      if (!__pyx_t_2) {
-        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
+      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      if (!__pyx_t_1) {
+        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
         __Pyx_INCREF(__pyx_int_0);
-        __pyx_t_9 = __pyx_int_0;
+        __pyx_t_12 = __pyx_int_0;
       } else {
-        __pyx_t_9 = __pyx_t_6;
-        __pyx_t_6 = 0;
+        __pyx_t_12 = __pyx_t_9;
+        __pyx_t_9 = 0;
       }
-      __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_v_start = __pyx_t_8;
+      __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_12); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+      __pyx_v_start = __pyx_t_10;
 
       /* "View.MemoryView":723
  *         else:
@@ -16294,20 +16451,20 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             step = index.step or 0
  * 
  */
-      __pyx_t_9 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__stop); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      if (!__pyx_t_2) {
-        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__stop); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_12);
+      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      if (!__pyx_t_1) {
+        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
         __Pyx_INCREF(__pyx_int_0);
-        __pyx_t_6 = __pyx_int_0;
+        __pyx_t_9 = __pyx_int_0;
       } else {
-        __pyx_t_6 = __pyx_t_9;
-        __pyx_t_9 = 0;
+        __pyx_t_9 = __pyx_t_12;
+        __pyx_t_12 = 0;
       }
-      __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-      __pyx_v_stop = __pyx_t_8;
+      __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_v_stop = __pyx_t_10;
 
       /* "View.MemoryView":724
  *             start = index.start or 0
@@ -16316,20 +16473,20 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  * 
  *             have_start = index.start is not None
  */
-      __pyx_t_6 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_6);
-      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      if (!__pyx_t_2) {
-        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_9);
+      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      if (!__pyx_t_1) {
+        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
         __Pyx_INCREF(__pyx_int_0);
-        __pyx_t_9 = __pyx_int_0;
+        __pyx_t_12 = __pyx_int_0;
       } else {
-        __pyx_t_9 = __pyx_t_6;
-        __pyx_t_6 = 0;
+        __pyx_t_12 = __pyx_t_9;
+        __pyx_t_9 = 0;
       }
-      __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_v_step = __pyx_t_8;
+      __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_12); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+      __pyx_v_step = __pyx_t_10;
 
       /* "View.MemoryView":726
  *             step = index.step or 0
@@ -16338,11 +16495,11 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             have_stop = index.stop is not None
  *             have_step = index.step is not None
  */
-      __pyx_t_9 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_2 = (__pyx_t_9 != Py_None);
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_v_have_start = __pyx_t_2;
+      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_12);
+      __pyx_t_1 = (__pyx_t_12 != Py_None);
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+      __pyx_v_have_start = __pyx_t_1;
 
       /* "View.MemoryView":727
  * 
@@ -16351,11 +16508,11 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             have_step = index.step is not None
  * 
  */
-      __pyx_t_9 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__stop); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_2 = (__pyx_t_9 != Py_None);
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_v_have_stop = __pyx_t_2;
+      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__stop); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_12);
+      __pyx_t_1 = (__pyx_t_12 != Py_None);
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+      __pyx_v_have_stop = __pyx_t_1;
 
       /* "View.MemoryView":728
  *             have_start = index.start is not None
@@ -16364,11 +16521,11 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  * 
  *             slice_memviewslice(
  */
-      __pyx_t_9 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_2 = (__pyx_t_9 != Py_None);
-      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
-      __pyx_v_have_step = __pyx_t_2;
+      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_12);
+      __pyx_t_1 = (__pyx_t_12 != Py_None);
+      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+      __pyx_v_have_step = __pyx_t_1;
 
       /* "View.MemoryView":735
  *                 start, stop, step,
@@ -16377,7 +16534,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *             new_ndim += 1
  * 
  */
-      __pyx_t_7 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
       /* "View.MemoryView":736
  *                 have_start, have_stop, have_step,
@@ -16390,7 +16547,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
     }
     __pyx_L6:;
   }
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
 
   /* "View.MemoryView":738
  *             new_ndim += 1
@@ -16399,10 +16556,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *         return memoryview_fromslice(dst, new_ndim,
  *                                     memviewsliceobj.to_object_func,
  */
-  __pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryviewslice_type));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), ((PyObject *)__pyx_memoryviewslice_type)); 
+  __pyx_t_2 = (__pyx_t_1 != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":739
@@ -16430,11 +16585,11 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  *     else:
  *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,
  */
-    __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_1);
-    __pyx_t_1 = 0;
+    __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_6);
+    __pyx_t_6 = 0;
     goto __pyx_L0;
     goto __pyx_L7;
   }
@@ -16456,11 +16611,11 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
  * 
  * 
  */
-    __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_1);
-    __pyx_t_1 = 0;
+    __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_6);
+    __pyx_t_6 = 0;
     goto __pyx_L0;
   }
   __pyx_L7:;
@@ -16468,9 +16623,9 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_
   __pyx_r = ((struct __pyx_memoryview_obj *)Py_None); __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_6);
   __Pyx_XDECREF(__pyx_t_9);
+  __Pyx_XDECREF(__pyx_t_12);
   __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
@@ -16497,7 +16652,6 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
   int __pyx_t_2;
   int __pyx_t_3;
   int __pyx_t_4;
-  Py_ssize_t __pyx_t_5;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -16509,7 +16663,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  * 
  *         if start < 0:
  */
-  __pyx_t_1 = (!__pyx_v_is_slice);
+  __pyx_t_1 = ((!(__pyx_v_is_slice != 0)) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":791
@@ -16519,7 +16673,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             start += shape
  *         if not 0 <= start < shape:
  */
-    __pyx_t_1 = (__pyx_v_start < 0);
+    __pyx_t_1 = ((__pyx_v_start < 0) != 0);
     if (__pyx_t_1) {
 
       /* "View.MemoryView":792
@@ -16545,7 +16699,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
     if (__pyx_t_1) {
       __pyx_t_1 = (__pyx_v_start < __pyx_v_shape);
     }
-    __pyx_t_2 = (!__pyx_t_1);
+    __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":794
@@ -16586,11 +16740,11 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
  * 
  */
-    if (__pyx_v_have_step) {
+    if ((__pyx_v_have_step != 0)) {
       __pyx_t_4 = (__pyx_v_step == 0);
       __pyx_t_2 = __pyx_t_4;
     } else {
-      __pyx_t_2 = __pyx_v_have_step;
+      __pyx_t_2 = (__pyx_v_have_step != 0);
     }
     if (__pyx_t_2) {
 
@@ -16613,7 +16767,8 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             if start < 0:
  *                 start += shape
  */
-    if (__pyx_v_have_start) {
+    __pyx_t_2 = (__pyx_v_have_start != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":804
  * 
@@ -16622,7 +16777,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 start += shape
  *                 if start < 0:
  */
-      __pyx_t_2 = (__pyx_v_start < 0);
+      __pyx_t_2 = ((__pyx_v_start < 0) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":805
@@ -16641,7 +16796,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                     start = 0
  *             elif start >= shape:
  */
-        __pyx_t_2 = (__pyx_v_start < 0);
+        __pyx_t_2 = ((__pyx_v_start < 0) != 0);
         if (__pyx_t_2) {
 
           /* "View.MemoryView":807
@@ -16665,7 +16820,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 if negative_step:
  *                     start = shape - 1
  */
-      __pyx_t_2 = (__pyx_v_start >= __pyx_v_shape);
+      __pyx_t_2 = ((__pyx_v_start >= __pyx_v_shape) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":809
@@ -16675,7 +16830,8 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                     start = shape - 1
  *                 else:
  */
-        if (__pyx_v_negative_step) {
+        __pyx_t_2 = (__pyx_v_negative_step != 0);
+        if (__pyx_t_2) {
 
           /* "View.MemoryView":810
  *             elif start >= shape:
@@ -16713,7 +16869,8 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 start = shape - 1
  *             else:
  */
-      if (__pyx_v_negative_step) {
+      __pyx_t_2 = (__pyx_v_negative_step != 0);
+      if (__pyx_t_2) {
 
         /* "View.MemoryView":815
  *         else:
@@ -16747,7 +16904,8 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             if stop < 0:
  *                 stop += shape
  */
-    if (__pyx_v_have_stop) {
+    __pyx_t_2 = (__pyx_v_have_stop != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":820
  * 
@@ -16756,7 +16914,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 stop += shape
  *                 if stop < 0:
  */
-      __pyx_t_2 = (__pyx_v_stop < 0);
+      __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":821
@@ -16775,7 +16933,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                     stop = 0
  *             elif stop > shape:
  */
-        __pyx_t_2 = (__pyx_v_stop < 0);
+        __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
         if (__pyx_t_2) {
 
           /* "View.MemoryView":823
@@ -16799,7 +16957,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 stop = shape
  *         else:
  */
-      __pyx_t_2 = (__pyx_v_stop > __pyx_v_shape);
+      __pyx_t_2 = ((__pyx_v_stop > __pyx_v_shape) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":825
@@ -16824,7 +16982,8 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 stop = -1
  *             else:
  */
-      if (__pyx_v_negative_step) {
+      __pyx_t_2 = (__pyx_v_negative_step != 0);
+      if (__pyx_t_2) {
 
         /* "View.MemoryView":828
  *         else:
@@ -16858,7 +17017,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             step = 1
  * 
  */
-    __pyx_t_2 = (!__pyx_v_have_step);
+    __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":833
@@ -16878,23 +17037,23 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *         with cython.cdivision(True):
  *             new_shape = (stop - start) // step             # <<<<<<<<<<<<<<
  * 
- *             if (stop - start) % step:
+ *             if (stop - start) - step * new_shape:
  */
     __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step);
 
     /* "View.MemoryView":839
  *             new_shape = (stop - start) // step
  * 
- *             if (stop - start) % step:             # <<<<<<<<<<<<<<
+ *             if (stop - start) - step * new_shape:             # <<<<<<<<<<<<<<
  *                 new_shape += 1
  * 
  */
-    __pyx_t_5 = ((__pyx_v_stop - __pyx_v_start) % __pyx_v_step);
-    if (__pyx_t_5) {
+    __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":840
  * 
- *             if (stop - start) % step:
+ *             if (stop - start) - step * new_shape:
  *                 new_shape += 1             # <<<<<<<<<<<<<<
  * 
  *         if new_shape < 0:
@@ -16911,7 +17070,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             new_shape = 0
  * 
  */
-    __pyx_t_2 = (__pyx_v_new_shape < 0);
+    __pyx_t_2 = ((__pyx_v_new_shape < 0) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":843
@@ -16962,7 +17121,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *         dst.data += start * stride
  *     else:
  */
-  __pyx_t_2 = ((__pyx_v_suboffset_dim[0]) < 0);
+  __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":852
@@ -16996,7 +17155,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *         if not is_slice:
  *             if new_ndim == 0:
  */
-  __pyx_t_2 = (__pyx_v_suboffset >= 0);
+  __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":857
@@ -17006,7 +17165,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *             if new_ndim == 0:
  *                 dst.data = (<char **> dst.data)[0] + suboffset
  */
-    __pyx_t_2 = (!__pyx_v_is_slice);
+    __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":858
@@ -17016,7 +17175,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  *                 dst.data = (<char **> dst.data)[0] + suboffset
  *             else:
  */
-      __pyx_t_2 = (__pyx_v_new_ndim == 0);
+      __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":859
@@ -17090,11 +17249,11 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst,
  * 
  * @cname('__pyx_pybuffer_index')
  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,             # <<<<<<<<<<<<<<
- *                           int dim) except NULL:
+ *                           Py_ssize_t dim) except NULL:
  *     cdef Py_ssize_t shape, stride, suboffset = -1
  */
 
-static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, int __pyx_v_dim) {
+static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) {
   Py_ssize_t __pyx_v_shape;
   Py_ssize_t __pyx_v_stride;
   Py_ssize_t __pyx_v_suboffset;
@@ -17102,9 +17261,10 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
   char *__pyx_v_resultp;
   char *__pyx_r;
   __Pyx_RefNannyDeclarations
-  int __pyx_t_1;
-  PyObject *__pyx_t_2 = NULL;
+  Py_ssize_t __pyx_t_1;
+  int __pyx_t_2;
   PyObject *__pyx_t_3 = NULL;
+  PyObject *__pyx_t_4 = NULL;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -17112,7 +17272,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
 
   /* "View.MemoryView":874
  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,
- *                           int dim) except NULL:
+ *                           Py_ssize_t dim) except NULL:
  *     cdef Py_ssize_t shape, stride, suboffset = -1             # <<<<<<<<<<<<<<
  *     cdef Py_ssize_t itemsize = view.itemsize
  *     cdef char *resultp
@@ -17120,13 +17280,14 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
   __pyx_v_suboffset = -1;
 
   /* "View.MemoryView":875
- *                           int dim) except NULL:
+ *                           Py_ssize_t dim) except NULL:
  *     cdef Py_ssize_t shape, stride, suboffset = -1
  *     cdef Py_ssize_t itemsize = view.itemsize             # <<<<<<<<<<<<<<
  *     cdef char *resultp
  * 
  */
-  __pyx_v_itemsize = __pyx_v_view->itemsize;
+  __pyx_t_1 = __pyx_v_view->itemsize;
+  __pyx_v_itemsize = __pyx_t_1;
 
   /* "View.MemoryView":878
  *     cdef char *resultp
@@ -17135,8 +17296,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *         shape = view.len / itemsize
  *         stride = itemsize
  */
-  __pyx_t_1 = (__pyx_v_view->ndim == 0);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":879
  * 
@@ -17146,11 +17307,23 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *     else:
  */
     if (unlikely(__pyx_v_itemsize == 0)) {
+      #ifdef WITH_THREAD
+      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+      #endif
       PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero");
+      #ifdef WITH_THREAD
+      PyGILState_Release(__pyx_gilstate_save);
+      #endif
       {__pyx_filename = __pyx_f[2]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     else if (sizeof(Py_ssize_t) == sizeof(long) && unlikely(__pyx_v_itemsize == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) {
+      #ifdef WITH_THREAD
+      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+      #endif
       PyErr_Format(PyExc_OverflowError, "value too large to perform division");
+      #ifdef WITH_THREAD
+      PyGILState_Release(__pyx_gilstate_save);
+      #endif
       {__pyx_filename = __pyx_f[2]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize);
@@ -17192,8 +17365,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *             suboffset = view.suboffsets[dim]
  * 
  */
-    __pyx_t_1 = (__pyx_v_view->suboffsets != NULL);
-    if (__pyx_t_1) {
+    __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":885
  *         stride = view.strides[dim]
@@ -17216,8 +17389,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *         index += view.shape[dim]
  *         if index < 0:
  */
-  __pyx_t_1 = (__pyx_v_index < 0);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((__pyx_v_index < 0) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":888
  * 
@@ -17235,8 +17408,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
  * 
  */
-    __pyx_t_1 = (__pyx_v_index < 0);
-    if (__pyx_t_1) {
+    __pyx_t_2 = ((__pyx_v_index < 0) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":890
  *         index += view.shape[dim]
@@ -17245,21 +17418,21 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  * 
  *     if index >= shape:
  */
-      __pyx_t_2 = PyInt_FromLong(__pyx_v_dim); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_70), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3));
-      __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
-      __pyx_t_3 = 0;
-      __pyx_t_3 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
-      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+      __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_70), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
+      __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
+      __pyx_t_4 = 0;
+      __pyx_t_4 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_4);
+      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
+      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
       {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L6;
     }
@@ -17275,8 +17448,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
  * 
  */
-  __pyx_t_1 = (__pyx_v_index >= __pyx_v_shape);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":893
  * 
@@ -17285,21 +17458,21 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  * 
  *     resultp = bufp + index * stride
  */
-    __pyx_t_3 = PyInt_FromLong(__pyx_v_dim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_70), __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
+    __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
+    __pyx_t_3 = 0;
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_70), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
-    __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
-    __pyx_t_2 = 0;
-    __pyx_t_2 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L7;
   }
@@ -17321,8 +17494,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
  *         resultp = (<char **> resultp)[0] + suboffset
  * 
  */
-  __pyx_t_1 = (__pyx_v_suboffset >= 0);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":897
  *     resultp = bufp + index * stride
@@ -17349,8 +17522,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P
   __pyx_r = 0;
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
+  __Pyx_XDECREF(__pyx_t_4);
   __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
@@ -17373,14 +17546,15 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
   int __pyx_v_i;
   int __pyx_v_j;
   int __pyx_r;
-  long __pyx_t_1;
-  int __pyx_t_2;
-  Py_ssize_t __pyx_t_3;
+  int __pyx_t_1;
+  Py_ssize_t *__pyx_t_2;
+  long __pyx_t_3;
   Py_ssize_t __pyx_t_4;
-  int __pyx_t_5;
+  Py_ssize_t __pyx_t_5;
   int __pyx_t_6;
   int __pyx_t_7;
   int __pyx_t_8;
+  int __pyx_t_9;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -17392,7 +17566,8 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  * 
  *     cdef Py_ssize_t *shape = memslice.shape
  */
-  __pyx_v_ndim = __pyx_v_memslice->memview->view.ndim;
+  __pyx_t_1 = __pyx_v_memslice->memview->view.ndim;
+  __pyx_v_ndim = __pyx_t_1;
 
   /* "View.MemoryView":908
  *     cdef int ndim = memslice.memview.view.ndim
@@ -17401,7 +17576,8 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  *     cdef Py_ssize_t *strides = memslice.strides
  * 
  */
-  __pyx_v_shape = __pyx_v_memslice->shape;
+  __pyx_t_2 = __pyx_v_memslice->shape;
+  __pyx_v_shape = __pyx_t_2;
 
   /* "View.MemoryView":909
  * 
@@ -17410,7 +17586,8 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  * 
  * 
  */
-  __pyx_v_strides = __pyx_v_memslice->strides;
+  __pyx_t_2 = __pyx_v_memslice->strides;
+  __pyx_v_strides = __pyx_t_2;
 
   /* "View.MemoryView":913
  * 
@@ -17419,9 +17596,9 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  *         j = ndim - 1 - i
  *         strides[i], strides[j] = strides[j], strides[i]
  */
-  __pyx_t_1 = __Pyx_div_long(__pyx_v_ndim, 2);
-  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
-    __pyx_v_i = __pyx_t_2;
+  __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2);
+  for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_3; __pyx_t_1+=1) {
+    __pyx_v_i = __pyx_t_1;
 
     /* "View.MemoryView":914
  *     cdef int i, j
@@ -17439,10 +17616,10 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  *         shape[i], shape[j] = shape[j], shape[i]
  * 
  */
-    __pyx_t_3 = (__pyx_v_strides[__pyx_v_j]);
-    __pyx_t_4 = (__pyx_v_strides[__pyx_v_i]);
-    (__pyx_v_strides[__pyx_v_i]) = __pyx_t_3;
-    (__pyx_v_strides[__pyx_v_j]) = __pyx_t_4;
+    __pyx_t_4 = (__pyx_v_strides[__pyx_v_j]);
+    __pyx_t_5 = (__pyx_v_strides[__pyx_v_i]);
+    (__pyx_v_strides[__pyx_v_i]) = __pyx_t_4;
+    (__pyx_v_strides[__pyx_v_j]) = __pyx_t_5;
 
     /* "View.MemoryView":916
  *         j = ndim - 1 - i
@@ -17451,10 +17628,10 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  * 
  *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
  */
-    __pyx_t_4 = (__pyx_v_shape[__pyx_v_j]);
-    __pyx_t_3 = (__pyx_v_shape[__pyx_v_i]);
-    (__pyx_v_shape[__pyx_v_i]) = __pyx_t_4;
-    (__pyx_v_shape[__pyx_v_j]) = __pyx_t_3;
+    __pyx_t_5 = (__pyx_v_shape[__pyx_v_j]);
+    __pyx_t_4 = (__pyx_v_shape[__pyx_v_i]);
+    (__pyx_v_shape[__pyx_v_i]) = __pyx_t_5;
+    (__pyx_v_shape[__pyx_v_j]) = __pyx_t_4;
 
     /* "View.MemoryView":918
  *         shape[i], shape[j] = shape[j], shape[i]
@@ -17463,14 +17640,14 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
  * 
  */
-    __pyx_t_5 = ((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0);
-    if (!__pyx_t_5) {
-      __pyx_t_6 = ((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0);
-      __pyx_t_7 = __pyx_t_6;
+    __pyx_t_6 = (((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0) != 0);
+    if (!__pyx_t_6) {
+      __pyx_t_7 = (((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0) != 0);
+      __pyx_t_8 = __pyx_t_7;
     } else {
-      __pyx_t_7 = __pyx_t_5;
+      __pyx_t_8 = __pyx_t_6;
     }
-    if (__pyx_t_7) {
+    if (__pyx_t_8) {
 
       /* "View.MemoryView":919
  * 
@@ -17479,7 +17656,7 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  * 
  *     return 1
  */
-      __pyx_t_8 = __pyx_memoryview_err(__pyx_builtin_ValueError, __pyx_k_71); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_9 = __pyx_memoryview_err(__pyx_builtin_ValueError, __pyx_k_71); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L5;
     }
     __pyx_L5:;
@@ -17570,7 +17747,7 @@ static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memor
  *             return self.to_object_func(itemp)
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_self->to_object_func != NULL);
+  __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":943
@@ -17644,7 +17821,7 @@ static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memo
  *             self.to_dtype_func(itemp, value)
  *         else:
  */
-  __pyx_t_1 = (__pyx_v_self->to_dtype_func != NULL);
+  __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":949
@@ -17743,8 +17920,11 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
   int __pyx_t_1;
   PyObject *__pyx_t_2 = NULL;
   PyObject *__pyx_t_3 = NULL;
-  int __pyx_t_4;
-  int __pyx_t_5;
+  __Pyx_TypeInfo *__pyx_t_4;
+  Py_buffer __pyx_t_5;
+  Py_ssize_t __pyx_t_6;
+  int __pyx_t_7;
+  int __pyx_t_8;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -17757,7 +17937,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
  *         return None
  * 
  */
-  __pyx_t_1 = (((PyObject *)__pyx_v_memviewslice.memview) == Py_None);
+  __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":972
@@ -17826,7 +18006,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
  *     result.typeinfo = memviewslice.memview.typeinfo
  * 
  */
-  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s__base); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s__base); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_GIVEREF(__pyx_t_2);
   __Pyx_GOTREF(__pyx_v_result->from_object);
@@ -17841,7 +18021,8 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
  * 
  *     result.view = memviewslice.memview.view
  */
-  __pyx_v_result->__pyx_base.typeinfo = __pyx_v_memviewslice.memview->typeinfo;
+  __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo;
+  __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4;
 
   /* "View.MemoryView":985
  *     result.typeinfo = memviewslice.memview.typeinfo
@@ -17850,7 +18031,8 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
  *     result.view.buf = <void *> memviewslice.data
  *     result.view.ndim = ndim
  */
-  __pyx_v_result->__pyx_base.view = __pyx_v_memviewslice.memview->view;
+  __pyx_t_5 = __pyx_v_memviewslice.memview->view;
+  __pyx_v_result->__pyx_base.view = __pyx_t_5;
 
   /* "View.MemoryView":986
  * 
@@ -17931,7 +18113,8 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
  *     for i in range(ndim):
  *         result.view.len *= result.view.shape[i]
  */
-  __pyx_v_result->__pyx_base.view.len = __pyx_v_result->__pyx_base.view.itemsize;
+  __pyx_t_6 = __pyx_v_result->__pyx_base.view.itemsize;
+  __pyx_v_result->__pyx_base.view.len = __pyx_t_6;
 
   /* "View.MemoryView":998
  * 
@@ -17940,9 +18123,9 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl
  *         result.view.len *= result.view.shape[i]
  * 
  */
-  __pyx_t_4 = __pyx_v_ndim;
-  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
-    __pyx_v_i = __pyx_t_5;
+  __pyx_t_7 = __pyx_v_ndim;
+  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
+    __pyx_v_i = __pyx_t_8;
 
     /* "View.MemoryView":999
  *     result.view.len = result.view.itemsize
@@ -18010,7 +18193,7 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p
   struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0;
   __Pyx_memviewslice *__pyx_r;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
+  int __pyx_t_1;
   int __pyx_t_2;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
@@ -18024,10 +18207,8 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p
  *         obj = memview
  *         return &obj.from_slice
  */
-  __pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryviewslice_type));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), ((PyObject *)__pyx_memoryviewslice_type)); 
+  __pyx_t_2 = (__pyx_t_1 != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":1011
@@ -18078,7 +18259,6 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p
   __pyx_r = 0;
   goto __pyx_L0;
   __pyx_L1_error:;
-  __Pyx_XDECREF(__pyx_t_1);
   __Pyx_WriteUnraisable("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
@@ -18101,9 +18281,10 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem
   Py_ssize_t *__pyx_v_strides;
   Py_ssize_t *__pyx_v_suboffsets;
   __Pyx_RefNannyDeclarations
-  int __pyx_t_1;
+  Py_ssize_t *__pyx_t_1;
   int __pyx_t_2;
   int __pyx_t_3;
+  int __pyx_t_4;
   __Pyx_RefNannySetupContext("slice_copy", 0);
 
   /* "View.MemoryView":1022
@@ -18113,7 +18294,8 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem
  *     strides = memview.view.strides
  *     suboffsets = memview.view.suboffsets
  */
-  __pyx_v_shape = __pyx_v_memview->view.shape;
+  __pyx_t_1 = __pyx_v_memview->view.shape;
+  __pyx_v_shape = __pyx_t_1;
 
   /* "View.MemoryView":1023
  * 
@@ -18122,7 +18304,8 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem
  *     suboffsets = memview.view.suboffsets
  * 
  */
-  __pyx_v_strides = __pyx_v_memview->view.strides;
+  __pyx_t_1 = __pyx_v_memview->view.strides;
+  __pyx_v_strides = __pyx_t_1;
 
   /* "View.MemoryView":1024
  *     shape = memview.view.shape
@@ -18131,7 +18314,8 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem
  * 
  *     dst.memview = <__pyx_memoryview *> memview
  */
-  __pyx_v_suboffsets = __pyx_v_memview->view.suboffsets;
+  __pyx_t_1 = __pyx_v_memview->view.suboffsets;
+  __pyx_v_suboffsets = __pyx_t_1;
 
   /* "View.MemoryView":1026
  *     suboffsets = memview.view.suboffsets
@@ -18158,9 +18342,9 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem
  *         dst.shape[dim] = shape[dim]
  *         dst.strides[dim] = strides[dim]
  */
-  __pyx_t_1 = __pyx_v_memview->view.ndim;
-  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
-    __pyx_v_dim = __pyx_t_2;
+  __pyx_t_2 = __pyx_v_memview->view.ndim;
+  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
+    __pyx_v_dim = __pyx_t_3;
 
     /* "View.MemoryView":1030
  * 
@@ -18187,8 +18371,8 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem
  *             dst.suboffsets[dim] = -1
  *         else:
  */
-    __pyx_t_3 = (__pyx_v_suboffsets == NULL);
-    if (__pyx_t_3) {
+    __pyx_t_4 = ((__pyx_v_suboffsets == NULL) != 0);
+    if (__pyx_t_4) {
 
       /* "View.MemoryView":1033
  *         dst.strides[dim] = strides[dim]
@@ -18283,8 +18467,11 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview
   int (*__pyx_v_to_dtype_func)(char *, PyObject *);
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
-  PyObject *__pyx_t_1 = NULL;
+  int __pyx_t_1;
   int __pyx_t_2;
+  PyObject *(*__pyx_t_3)(char *);
+  int (*__pyx_t_4)(char *, PyObject *);
+  PyObject *__pyx_t_5 = NULL;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -18297,10 +18484,8 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview
  *         to_object_func = (<_memoryviewslice> memview).to_object_func
  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
  */
-  __pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryviewslice_type));
-  __Pyx_INCREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_t_1); 
-  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), ((PyObject *)__pyx_memoryviewslice_type)); 
+  __pyx_t_2 = (__pyx_t_1 != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":1053
@@ -18310,7 +18495,8 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview
  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
  *     else:
  */
-    __pyx_v_to_object_func = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
+    __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
+    __pyx_v_to_object_func = __pyx_t_3;
 
     /* "View.MemoryView":1054
  *     if isinstance(memview, _memoryviewslice):
@@ -18319,7 +18505,8 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview
  *     else:
  *         to_object_func = NULL
  */
-    __pyx_v_to_dtype_func = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
+    __pyx_t_4 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
+    __pyx_v_to_dtype_func = __pyx_t_4;
     goto __pyx_L3;
   }
   /*else*/ {
@@ -18360,16 +18547,16 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview
  * 
  * 
  */
-  __pyx_t_1 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_1);
-  __pyx_r = __pyx_t_1;
-  __pyx_t_1 = 0;
+  __pyx_t_5 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
+  __pyx_r = __pyx_t_5;
+  __pyx_t_5 = 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_5);
   __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = 0;
   __pyx_L0:;
@@ -18397,7 +18584,7 @@ static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) {
  *         return -arg
  *     else:
  */
-  __pyx_t_1 = (__pyx_v_arg < 0);
+  __pyx_t_1 = ((__pyx_v_arg < 0) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":1069
@@ -18482,7 +18669,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _
  *             c_stride = mslice.strides[i]
  *             break
  */
-    __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1);
+    __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":1084
@@ -18526,7 +18713,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _
  *             f_stride = mslice.strides[i]
  *             break
  */
-    __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1);
+    __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
     if (__pyx_t_2) {
 
       /* "View.MemoryView":1089
@@ -18559,7 +18746,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _
  *         return 'C'
  *     else:
  */
-  __pyx_t_2 = (abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride));
+  __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0);
   if (__pyx_t_2) {
 
     /* "View.MemoryView":1093
@@ -18656,7 +18843,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v
  *        if (src_stride > 0 and dst_stride > 0 and
  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
  */
-  __pyx_t_1 = (__pyx_v_ndim == 1);
+  __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":1111
@@ -18666,9 +18853,9 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v
  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
  *            memcpy(dst_data, src_data, itemsize * dst_extent)
  */
-    __pyx_t_1 = (__pyx_v_src_stride > 0);
+    __pyx_t_1 = ((__pyx_v_src_stride > 0) != 0);
     if (__pyx_t_1) {
-      __pyx_t_2 = (__pyx_v_dst_stride > 0);
+      __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0);
       if (__pyx_t_2) {
 
         /* "View.MemoryView":1112
@@ -18682,7 +18869,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v
         if (__pyx_t_3) {
           __pyx_t_3 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride));
         }
-        __pyx_t_4 = __pyx_t_3;
+        __pyx_t_4 = (__pyx_t_3 != 0);
       } else {
         __pyx_t_4 = __pyx_t_2;
       }
@@ -18824,8 +19011,9 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_sr
   int __pyx_v_i;
   Py_ssize_t __pyx_v_size;
   Py_ssize_t __pyx_r;
-  int __pyx_t_1;
+  Py_ssize_t __pyx_t_1;
   int __pyx_t_2;
+  int __pyx_t_3;
 
   /* "View.MemoryView":1138
  *     "Return the size of the memory occupied by the slice in number of bytes"
@@ -18834,7 +19022,8 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_sr
  * 
  *     for i in range(ndim):
  */
-  __pyx_v_size = __pyx_v_src->memview->view.itemsize;
+  __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
+  __pyx_v_size = __pyx_t_1;
 
   /* "View.MemoryView":1140
  *     cdef Py_ssize_t size = src.memview.view.itemsize
@@ -18843,9 +19032,9 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_sr
  *         size *= src.shape[i]
  * 
  */
-  __pyx_t_1 = __pyx_v_ndim;
-  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
-    __pyx_v_i = __pyx_t_2;
+  __pyx_t_2 = __pyx_v_ndim;
+  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
+    __pyx_v_i = __pyx_t_3;
 
     /* "View.MemoryView":1141
  * 
@@ -18894,7 +19083,7 @@ static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_
  *         for idx in range(ndim):
  *             strides[idx] = stride
  */
-  __pyx_t_1 = (__pyx_v_order == 'F');
+  __pyx_t_1 = ((__pyx_v_order == 'F') != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":1156
@@ -18990,9 +19179,11 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
   size_t __pyx_v_itemsize;
   size_t __pyx_v_size;
   void *__pyx_r;
-  int __pyx_t_1;
+  Py_ssize_t __pyx_t_1;
   int __pyx_t_2;
   int __pyx_t_3;
+  struct __pyx_memoryview_obj *__pyx_t_4;
+  int __pyx_t_5;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -19004,7 +19195,8 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *     cdef size_t size = slice_get_size(src, ndim)
  * 
  */
-  __pyx_v_itemsize = __pyx_v_src->memview->view.itemsize;
+  __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
+  __pyx_v_itemsize = __pyx_t_1;
 
   /* "View.MemoryView":1179
  * 
@@ -19031,8 +19223,8 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *         _err(MemoryError, NULL)
  * 
  */
-  __pyx_t_1 = (!(__pyx_v_result != 0));
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":1183
  *     result = malloc(size)
@@ -19041,7 +19233,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  * 
  * 
  */
-    __pyx_t_2 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L3;
   }
   __pyx_L3:;
@@ -19062,7 +19254,8 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *     for i in range(ndim):
  *         tmpslice.shape[i] = src.shape[i]
  */
-  __pyx_v_tmpslice->memview = __pyx_v_src->memview;
+  __pyx_t_4 = __pyx_v_src->memview;
+  __pyx_v_tmpslice->memview = __pyx_t_4;
 
   /* "View.MemoryView":1188
  *     tmpslice.data = <char *> result
@@ -19071,9 +19264,9 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *         tmpslice.shape[i] = src.shape[i]
  *         tmpslice.suboffsets[i] = -1
  */
-  __pyx_t_2 = __pyx_v_ndim;
-  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
-    __pyx_v_i = __pyx_t_3;
+  __pyx_t_3 = __pyx_v_ndim;
+  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_3; __pyx_t_5+=1) {
+    __pyx_v_i = __pyx_t_5;
 
     /* "View.MemoryView":1189
  *     tmpslice.memview = src.memview
@@ -19110,9 +19303,9 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *         if tmpslice.shape[i] == 1:
  *             tmpslice.strides[i] = 0
  */
-  __pyx_t_2 = __pyx_v_ndim;
-  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
-    __pyx_v_i = __pyx_t_3;
+  __pyx_t_3 = __pyx_v_ndim;
+  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_3; __pyx_t_5+=1) {
+    __pyx_v_i = __pyx_t_5;
 
     /* "View.MemoryView":1197
  * 
@@ -19121,8 +19314,8 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *             tmpslice.strides[i] = 0
  * 
  */
-    __pyx_t_1 = ((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1);
-    if (__pyx_t_1) {
+    __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1198
  *     for i in range(ndim):
@@ -19144,8 +19337,8 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src,
  *         memcpy(result, src.data, size)
  *     else:
  */
-  __pyx_t_1 = __pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":1201
  * 
@@ -19373,7 +19566,7 @@ static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) {
  *         raise error(msg.decode('ascii'))
  *     else:
  */
-  __pyx_t_1 = (__pyx_v_msg != NULL);
+  __pyx_t_1 = ((__pyx_v_msg != NULL) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":1222
@@ -19446,11 +19639,13 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
   __Pyx_memviewslice __pyx_v_tmp;
   int __pyx_v_ndim;
   int __pyx_r;
-  int __pyx_t_1;
+  Py_ssize_t __pyx_t_1;
   int __pyx_t_2;
   int __pyx_t_3;
   int __pyx_t_4;
-  void *__pyx_t_5;
+  int __pyx_t_5;
+  void *__pyx_t_6;
+  int __pyx_t_7;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
@@ -19471,7 +19666,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *     cdef int i
  *     cdef char order = get_best_order(&src, src_ndim)
  */
-  __pyx_v_itemsize = __pyx_v_src.memview->view.itemsize;
+  __pyx_t_1 = __pyx_v_src.memview->view.itemsize;
+  __pyx_v_itemsize = __pyx_t_1;
 
   /* "View.MemoryView":1238
  *     cdef size_t itemsize = src.memview.view.itemsize
@@ -19507,8 +19703,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *         broadcast_leading(&src, src_ndim, dst_ndim)
  *     elif dst_ndim < src_ndim:
  */
-  __pyx_t_1 = (__pyx_v_src_ndim < __pyx_v_dst_ndim);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":1244
  * 
@@ -19528,8 +19724,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *         broadcast_leading(&dst, dst_ndim, src_ndim)
  * 
  */
-  __pyx_t_1 = (__pyx_v_dst_ndim < __pyx_v_src_ndim);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":1246
  *         broadcast_leading(&src, src_ndim, dst_ndim)
@@ -19550,14 +19746,14 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  *     for i in range(ndim):
  */
-  __pyx_t_2 = __pyx_v_dst_ndim;
-  __pyx_t_3 = __pyx_v_src_ndim;
-  if ((__pyx_t_2 > __pyx_t_3)) {
-    __pyx_t_4 = __pyx_t_2;
+  __pyx_t_3 = __pyx_v_dst_ndim;
+  __pyx_t_4 = __pyx_v_src_ndim;
+  if (((__pyx_t_3 > __pyx_t_4) != 0)) {
+    __pyx_t_5 = __pyx_t_3;
   } else {
-    __pyx_t_4 = __pyx_t_3;
+    __pyx_t_5 = __pyx_t_4;
   }
-  __pyx_v_ndim = __pyx_t_4;
+  __pyx_v_ndim = __pyx_t_5;
 
   /* "View.MemoryView":1250
  *     cdef int ndim = max(src_ndim, dst_ndim)
@@ -19566,9 +19762,9 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *         if src.shape[i] != dst.shape[i]:
  *             if src.shape[i] == 1:
  */
-  __pyx_t_4 = __pyx_v_ndim;
-  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_4; __pyx_t_2+=1) {
-    __pyx_v_i = __pyx_t_2;
+  __pyx_t_5 = __pyx_v_ndim;
+  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_5; __pyx_t_3+=1) {
+    __pyx_v_i = __pyx_t_3;
 
     /* "View.MemoryView":1251
  * 
@@ -19577,8 +19773,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *             if src.shape[i] == 1:
  *                 broadcasting = True
  */
-    __pyx_t_1 = ((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i]));
-    if (__pyx_t_1) {
+    __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1252
  *     for i in range(ndim):
@@ -19587,8 +19783,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *                 broadcasting = True
  *                 src.strides[i] = 0
  */
-      __pyx_t_1 = ((__pyx_v_src.shape[__pyx_v_i]) == 1);
-      if (__pyx_t_1) {
+      __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0);
+      if (__pyx_t_2) {
 
         /* "View.MemoryView":1253
  *         if src.shape[i] != dst.shape[i]:
@@ -19618,7 +19814,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  *         if src.suboffsets[i] >= 0:
  */
-        __pyx_t_3 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_4 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       }
       __pyx_L7:;
       goto __pyx_L6;
@@ -19632,8 +19828,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *             _err_dim(ValueError, "Dimension %d is not direct", i)
  * 
  */
-    __pyx_t_1 = ((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0);
-    if (__pyx_t_1) {
+    __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1259
  * 
@@ -19642,7 +19838,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  *     if slices_overlap(&src, &dst, ndim, itemsize):
  */
-      __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, __pyx_k_73, __pyx_v_i); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, __pyx_k_73, __pyx_v_i); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L8;
     }
     __pyx_L8:;
@@ -19655,8 +19851,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  *         if not slice_is_contig(&src, order, ndim):
  */
-  __pyx_t_1 = __pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize);
-  if (__pyx_t_1) {
+  __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":1263
  *     if slices_overlap(&src, &dst, ndim, itemsize):
@@ -19665,8 +19861,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *             order = get_best_order(&dst, ndim)
  * 
  */
-    __pyx_t_1 = (!__pyx_memviewslice_is_contig((&__pyx_v_src), __pyx_v_order, __pyx_v_ndim));
-    if (__pyx_t_1) {
+    __pyx_t_2 = ((!(__pyx_memviewslice_is_contig((&__pyx_v_src), __pyx_v_order, __pyx_v_ndim) != 0)) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1264
  * 
@@ -19687,8 +19883,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *         src = tmp
  * 
  */
-    __pyx_t_5 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_v_tmpdata = __pyx_t_5;
+    __pyx_t_6 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_v_tmpdata = __pyx_t_6;
 
     /* "View.MemoryView":1267
  * 
@@ -19709,8 +19905,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  * 
  */
-  __pyx_t_1 = (!__pyx_v_broadcasting);
-  if (__pyx_t_1) {
+  __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0);
+  if (__pyx_t_2) {
 
     /* "View.MemoryView":1272
  * 
@@ -19719,8 +19915,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *             direct_copy = slice_is_contig(&dst, 'C', ndim)
  *         elif slice_is_contig(&src, 'F', ndim):
  */
-    __pyx_t_1 = __pyx_memviewslice_is_contig((&__pyx_v_src), 'C', __pyx_v_ndim);
-    if (__pyx_t_1) {
+    __pyx_t_2 = (__pyx_memviewslice_is_contig((&__pyx_v_src), 'C', __pyx_v_ndim) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1273
  * 
@@ -19740,8 +19936,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *             direct_copy = slice_is_contig(&dst, 'F', ndim)
  * 
  */
-    __pyx_t_1 = __pyx_memviewslice_is_contig((&__pyx_v_src), 'F', __pyx_v_ndim);
-    if (__pyx_t_1) {
+    __pyx_t_2 = (__pyx_memviewslice_is_contig((&__pyx_v_src), 'F', __pyx_v_ndim) != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1275
  *             direct_copy = slice_is_contig(&dst, 'C', ndim)
@@ -19762,7 +19958,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  *             refcount_copying(&dst, dtype_is_object, ndim, False)
  */
-    if (__pyx_v_direct_copy) {
+    __pyx_t_2 = (__pyx_v_direct_copy != 0);
+    if (__pyx_t_2) {
 
       /* "View.MemoryView":1279
  *         if direct_copy:
@@ -19814,11 +20011,12 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  * 
  */
-  __pyx_t_1 = (__pyx_v_order == 'F');
-  if (__pyx_t_1) {
-    __pyx_t_1 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
+  __pyx_t_2 = (__pyx_v_order == 'F');
+  if (__pyx_t_2) {
+    __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
   }
-  if (__pyx_t_1) {
+  __pyx_t_7 = (__pyx_t_2 != 0);
+  if (__pyx_t_7) {
 
     /* "View.MemoryView":1287
  * 
@@ -19827,7 +20025,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  *         transpose_memslice(&dst)
  * 
  */
-    __pyx_t_4 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_4 == 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
     /* "View.MemoryView":1288
  * 
@@ -19836,7 +20034,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_
  * 
  *     refcount_copying(&dst, dtype_is_object, ndim, False)
  */
-    __pyx_t_4 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_4 == 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L14;
   }
   __pyx_L14:;
@@ -20015,6 +20213,7 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_slice
  */
 
 static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) {
+  int __pyx_t_1;
 
   /* "View.MemoryView":1324
  * 
@@ -20023,7 +20222,8 @@ static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, i
  *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,
  *                                            dst.strides, ndim, inc)
  */
-  if (__pyx_v_dtype_is_object) {
+  __pyx_t_1 = (__pyx_v_dtype_is_object != 0);
+  if (__pyx_t_1) {
 
     /* "View.MemoryView":1326
  *     if dtype_is_object:
@@ -20103,7 +20303,7 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss
  *             if inc:
  *                 Py_INCREF((<PyObject **> data)[0])
  */
-    __pyx_t_3 = (__pyx_v_ndim == 1);
+    __pyx_t_3 = ((__pyx_v_ndim == 1) != 0);
     if (__pyx_t_3) {
 
       /* "View.MemoryView":1341
@@ -20113,7 +20313,8 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss
  *                 Py_INCREF((<PyObject **> data)[0])
  *             else:
  */
-      if (__pyx_v_inc) {
+      __pyx_t_3 = (__pyx_v_inc != 0);
+      if (__pyx_t_3) {
 
         /* "View.MemoryView":1342
  *         if ndim == 1:
@@ -20245,7 +20446,7 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t
  *         for i in range(extent):
  *             memcpy(data, item, itemsize)
  */
-  __pyx_t_1 = (__pyx_v_ndim == 1);
+  __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
   if (__pyx_t_1) {
 
     /* "View.MemoryView":1373
@@ -20314,60 +20515,77 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t
   __pyx_L3:;
 
 }
+static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;
 
-static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
-  struct __pyx_array_obj *p;
-  PyObject *o = (*t->tp_alloc)(t, 0);
-  if (!o) return 0;
-  p = ((struct __pyx_array_obj *)o);
-  p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
-  p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
-  if (__pyx_array___cinit__(o, a, k) < 0) {
+static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
+  struct __pyx_memoryview_obj *p;
+  PyObject *o;
+  o = (*t->tp_alloc)(t, 0);
+  if (unlikely(!o)) return 0;
+  p = ((struct __pyx_memoryview_obj *)o);
+  p->__pyx_vtab = __pyx_vtabptr_memoryview;
+  p->obj = Py_None; Py_INCREF(Py_None);
+  p->_size = Py_None; Py_INCREF(Py_None);
+  p->_array_interface = Py_None; Py_INCREF(Py_None);
+  p->view.obj = NULL;
+  if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) {
     Py_DECREF(o); o = 0;
   }
   return o;
 }
 
-static void __pyx_tp_dealloc_array(PyObject *o) {
-  struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
+static void __pyx_tp_dealloc_memoryview(PyObject *o) {
+  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
+  PyObject_GC_UnTrack(o);
   {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
     ++Py_REFCNT(o);
-    __pyx_array___dealloc__(o);
+    __pyx_memoryview___dealloc__(o);
     if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
     --Py_REFCNT(o);
     PyErr_Restore(etype, eval, etb);
   }
-  Py_CLEAR(p->mode);
-  Py_CLEAR(p->_format);
+  Py_CLEAR(p->obj);
+  Py_CLEAR(p->_size);
+  Py_CLEAR(p->_array_interface);
   (*Py_TYPE(o)->tp_free)(o);
 }
 
-static int __pyx_tp_traverse_array(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) {
   int e;
-  struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
-  if (p->mode) {
-    e = (*v)(p->mode, a); if (e) return e;
+  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
+  if (p->obj) {
+    e = (*v)(p->obj, a); if (e) return e;
   }
-  if (p->_format) {
-    e = (*v)(p->_format, a); if (e) return e;
+  if (p->_size) {
+    e = (*v)(p->_size, a); if (e) return e;
+  }
+  if (p->_array_interface) {
+    e = (*v)(p->_array_interface, a); if (e) return e;
+  }
+  if (p->view.obj) {
+    e = (*v)(p->view.obj, a); if (e) return e;
   }
   return 0;
 }
 
-static int __pyx_tp_clear_array(PyObject *o) {
-  struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
+static int __pyx_tp_clear_memoryview(PyObject *o) {
+  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
   PyObject* tmp;
-  tmp = ((PyObject*)p->mode);
-  p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
+  tmp = ((PyObject*)p->obj);
+  p->obj = Py_None; Py_INCREF(Py_None);
   Py_XDECREF(tmp);
-  tmp = ((PyObject*)p->_format);
-  p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
+  tmp = ((PyObject*)p->_size);
+  p->_size = Py_None; Py_INCREF(Py_None);
   Py_XDECREF(tmp);
+  tmp = ((PyObject*)p->_array_interface);
+  p->_array_interface = Py_None; Py_INCREF(Py_None);
+  Py_XDECREF(tmp);
+  Py_CLEAR(p->view.obj);
   return 0;
 }
-static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
+static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
   PyObject *r;
   PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
   r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
@@ -20375,9 +20593,9 @@ static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
   return r;
 }
 
-static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) {
+static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) {
   if (v) {
-    return __pyx_array___setitem__(o, i, v);
+    return __pyx_memoryview___setitem__(o, i, v);
   }
   else {
     PyErr_Format(PyExc_NotImplementedError,
@@ -20386,107 +20604,83 @@ static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) {
   }
 }
 
-static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) {
-  PyObject *v = PyObject_GenericGetAttr(o, n);
-  if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
-    PyErr_Clear();
-    v = __pyx_array___getattr__(o, n);
-  }
-  return v;
+static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_transpose(o);
 }
 
-static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) {
-  return get_memview(o);
+static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview__get__base(o);
 }
 
-static PyMethodDef __pyx_methods_array[] = {
-  {__Pyx_NAMESTR("__getattr__"), (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, __Pyx_DOCSTR(0)},
-  {0, 0, 0, 0}
-};
+static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_shape(o);
+}
 
-static struct PyGetSetDef __pyx_getsets_array[] = {
-  {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, 0, 0},
-  {0, 0, 0, 0, 0}
-};
+static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_strides(o);
+}
 
-static PyNumberMethods __pyx_tp_as_number_array = {
-  0, /*nb_add*/
-  0, /*nb_subtract*/
-  0, /*nb_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_divide*/
-  #endif
-  0, /*nb_remainder*/
-  0, /*nb_divmod*/
-  0, /*nb_power*/
-  0, /*nb_negative*/
-  0, /*nb_positive*/
-  0, /*nb_absolute*/
-  0, /*nb_nonzero*/
-  0, /*nb_invert*/
-  0, /*nb_lshift*/
-  0, /*nb_rshift*/
-  0, /*nb_and*/
-  0, /*nb_xor*/
-  0, /*nb_or*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_coerce*/
-  #endif
-  0, /*nb_int*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_long*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*nb_float*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_oct*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_hex*/
-  #endif
-  0, /*nb_inplace_add*/
-  0, /*nb_inplace_subtract*/
-  0, /*nb_inplace_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_inplace_divide*/
-  #endif
-  0, /*nb_inplace_remainder*/
-  0, /*nb_inplace_power*/
-  0, /*nb_inplace_lshift*/
-  0, /*nb_inplace_rshift*/
-  0, /*nb_inplace_and*/
-  0, /*nb_inplace_xor*/
-  0, /*nb_inplace_or*/
-  0, /*nb_floor_divide*/
-  0, /*nb_true_divide*/
-  0, /*nb_inplace_floor_divide*/
-  0, /*nb_inplace_true_divide*/
-  #if PY_VERSION_HEX >= 0x02050000
-  0, /*nb_index*/
-  #endif
-};
+static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_suboffsets(o);
+}
 
-static PySequenceMethods __pyx_tp_as_sequence_array = {
-  0, /*sq_length*/
-  0, /*sq_concat*/
-  0, /*sq_repeat*/
-  __pyx_sq_item_array, /*sq_item*/
-  0, /*sq_slice*/
-  0, /*sq_ass_item*/
-  0, /*sq_ass_slice*/
+static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_ndim(o);
+}
+
+static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_itemsize(o);
+}
+
+static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_nbytes(o);
+}
+
+static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryview_get_size(o);
+}
+
+static PyMethodDef __pyx_methods_memoryview[] = {
+  {__Pyx_NAMESTR("is_c_contig"), (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, __Pyx_DOCSTR(0)},
+  {__Pyx_NAMESTR("is_f_contig"), (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, __Pyx_DOCSTR(0)},
+  {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, __Pyx_DOCSTR(0)},
+  {__Pyx_NAMESTR("copy_fortran"), (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, __Pyx_DOCSTR(0)},
+  {0, 0, 0, 0}
+};
+
+static struct PyGetSetDef __pyx_getsets_memoryview[] = {
+  {(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, 0, 0},
+  {(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, 0, 0},
+  {(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, 0, 0},
+  {(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, 0, 0},
+  {(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, 0, 0},
+  {(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, 0, 0},
+  {(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, 0, 0},
+  {(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, 0, 0},
+  {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, 0, 0},
+  {0, 0, 0, 0, 0}
+};
+
+static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
+  __pyx_memoryview___len__, /*sq_length*/
+  0, /*sq_concat*/
+  0, /*sq_repeat*/
+  __pyx_sq_item_memoryview, /*sq_item*/
+  0, /*sq_slice*/
+  0, /*sq_ass_item*/
+  0, /*sq_ass_slice*/
   0, /*sq_contains*/
   0, /*sq_inplace_concat*/
   0, /*sq_inplace_repeat*/
 };
 
-static PyMappingMethods __pyx_tp_as_mapping_array = {
-  0, /*mp_length*/
-  __pyx_array___getitem__, /*mp_subscript*/
-  __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/
+static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
+  __pyx_memoryview___len__, /*mp_length*/
+  __pyx_memoryview___getitem__, /*mp_subscript*/
+  __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/
 };
 
-static PyBufferProcs __pyx_tp_as_buffer_array = {
+static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
   #if PY_MAJOR_VERSION < 3
   0, /*bf_getreadbuffer*/
   #endif
@@ -20500,19 +20694,19 @@ static PyBufferProcs __pyx_tp_as_buffer_array = {
   0, /*bf_getcharbuffer*/
   #endif
   #if PY_VERSION_HEX >= 0x02060000
-  __pyx_array_getbuffer, /*bf_getbuffer*/
+  __pyx_memoryview_getbuffer, /*bf_getbuffer*/
   #endif
   #if PY_VERSION_HEX >= 0x02060000
   0, /*bf_releasebuffer*/
   #endif
 };
 
-static PyTypeObject __pyx_type___pyx_array = {
+static PyTypeObject __pyx_type___pyx_memoryview = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("splitPixel.array"), /*tp_name*/
-  sizeof(struct __pyx_array_obj), /*tp_basicsize*/
+  __Pyx_NAMESTR("splitPixel.memoryview"), /*tp_name*/
+  sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_array, /*tp_dealloc*/
+  __pyx_tp_dealloc_memoryview, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -20521,27 +20715,27 @@ static PyTypeObject __pyx_type___pyx_array = {
   #else
   0, /*reserved*/
   #endif
-  0, /*tp_repr*/
-  &__pyx_tp_as_number_array, /*tp_as_number*/
-  &__pyx_tp_as_sequence_array, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping_array, /*tp_as_mapping*/
+  __pyx_memoryview___repr__, /*tp_repr*/
+  0, /*tp_as_number*/
+  &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/
+  &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/
   0, /*tp_hash*/
   0, /*tp_call*/
-  0, /*tp_str*/
-  __pyx_tp_getattro_array, /*tp_getattro*/
+  __pyx_memoryview___str__, /*tp_str*/
+  0, /*tp_getattro*/
   0, /*tp_setattro*/
-  &__pyx_tp_as_buffer_array, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+  &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
   0, /*tp_doc*/
-  __pyx_tp_traverse_array, /*tp_traverse*/
-  __pyx_tp_clear_array, /*tp_clear*/
+  __pyx_tp_traverse_memoryview, /*tp_traverse*/
+  __pyx_tp_clear_memoryview, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
   0, /*tp_iter*/
   0, /*tp_iternext*/
-  __pyx_methods_array, /*tp_methods*/
+  __pyx_methods_memoryview, /*tp_methods*/
   0, /*tp_members*/
-  __pyx_getsets_array, /*tp_getset*/
+  __pyx_getsets_memoryview, /*tp_getset*/
   0, /*tp_base*/
   0, /*tp_dict*/
   0, /*tp_descr_get*/
@@ -20549,7 +20743,7 @@ static PyTypeObject __pyx_type___pyx_array = {
   0, /*tp_dictoffset*/
   0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_array, /*tp_new*/
+  __pyx_tp_new_memoryview, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -20561,108 +20755,112 @@ static PyTypeObject __pyx_type___pyx_array = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
-static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
-  struct __pyx_MemviewEnum_obj *p;
-  PyObject *o = (*t->tp_alloc)(t, 0);
-  if (!o) return 0;
-  p = ((struct __pyx_MemviewEnum_obj *)o);
-  p->name = Py_None; Py_INCREF(Py_None);
+static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
+  struct __pyx_array_obj *p;
+  PyObject *o;
+  o = (*t->tp_alloc)(t, 0);
+  if (unlikely(!o)) return 0;
+  p = ((struct __pyx_array_obj *)o);
+  p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
+  p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
+  if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) {
+    Py_DECREF(o); o = 0;
+  }
   return o;
 }
 
-static void __pyx_tp_dealloc_Enum(PyObject *o) {
-  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
-  Py_CLEAR(p->name);
+static void __pyx_tp_dealloc_array(PyObject *o) {
+  struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
+  PyObject_GC_UnTrack(o);
+  {
+    PyObject *etype, *eval, *etb;
+    PyErr_Fetch(&etype, &eval, &etb);
+    ++Py_REFCNT(o);
+    __pyx_array___dealloc__(o);
+    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
+    --Py_REFCNT(o);
+    PyErr_Restore(etype, eval, etb);
+  }
+  Py_CLEAR(p->mode);
+  Py_CLEAR(p->_format);
   (*Py_TYPE(o)->tp_free)(o);
 }
 
-static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_array(PyObject *o, visitproc v, void *a) {
   int e;
-  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
-  if (p->name) {
-    e = (*v)(p->name, a); if (e) return e;
+  struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
+  if (p->mode) {
+    e = (*v)(p->mode, a); if (e) return e;
+  }
+  if (p->_format) {
+    e = (*v)(p->_format, a); if (e) return e;
   }
   return 0;
 }
 
-static int __pyx_tp_clear_Enum(PyObject *o) {
-  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
+static int __pyx_tp_clear_array(PyObject *o) {
+  struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
   PyObject* tmp;
-  tmp = ((PyObject*)p->name);
-  p->name = Py_None; Py_INCREF(Py_None);
+  tmp = ((PyObject*)p->mode);
+  p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
+  Py_XDECREF(tmp);
+  tmp = ((PyObject*)p->_format);
+  p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
   Py_XDECREF(tmp);
   return 0;
 }
+static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
+  PyObject *r;
+  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
+  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
+  Py_DECREF(x);
+  return r;
+}
 
-static PyMethodDef __pyx_methods_Enum[] = {
+static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) {
+  if (v) {
+    return __pyx_array___setitem__(o, i, v);
+  }
+  else {
+    PyErr_Format(PyExc_NotImplementedError,
+      "Subscript deletion not supported by %s", Py_TYPE(o)->tp_name);
+    return -1;
+  }
+}
+
+static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) {
+  PyObject *v = PyObject_GenericGetAttr(o, n);
+  if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
+    PyErr_Clear();
+    v = __pyx_array___getattr__(o, n);
+  }
+  return v;
+}
+
+static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) {
+  return get_memview(o);
+}
+
+static PyMethodDef __pyx_methods_array[] = {
+  {__Pyx_NAMESTR("__getattr__"), (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, __Pyx_DOCSTR(0)},
   {0, 0, 0, 0}
 };
 
-static PyNumberMethods __pyx_tp_as_number_Enum = {
-  0, /*nb_add*/
-  0, /*nb_subtract*/
-  0, /*nb_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_divide*/
-  #endif
-  0, /*nb_remainder*/
-  0, /*nb_divmod*/
-  0, /*nb_power*/
-  0, /*nb_negative*/
-  0, /*nb_positive*/
-  0, /*nb_absolute*/
-  0, /*nb_nonzero*/
-  0, /*nb_invert*/
-  0, /*nb_lshift*/
-  0, /*nb_rshift*/
-  0, /*nb_and*/
-  0, /*nb_xor*/
-  0, /*nb_or*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_coerce*/
-  #endif
-  0, /*nb_int*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_long*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*nb_float*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_oct*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_hex*/
-  #endif
-  0, /*nb_inplace_add*/
-  0, /*nb_inplace_subtract*/
-  0, /*nb_inplace_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_inplace_divide*/
-  #endif
-  0, /*nb_inplace_remainder*/
-  0, /*nb_inplace_power*/
-  0, /*nb_inplace_lshift*/
-  0, /*nb_inplace_rshift*/
-  0, /*nb_inplace_and*/
-  0, /*nb_inplace_xor*/
-  0, /*nb_inplace_or*/
-  0, /*nb_floor_divide*/
-  0, /*nb_true_divide*/
-  0, /*nb_inplace_floor_divide*/
-  0, /*nb_inplace_true_divide*/
-  #if PY_VERSION_HEX >= 0x02050000
-  0, /*nb_index*/
-  #endif
+static struct PyGetSetDef __pyx_getsets_array[] = {
+  {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, 0, 0},
+  {0, 0, 0, 0, 0}
 };
 
-static PySequenceMethods __pyx_tp_as_sequence_Enum = {
+static PySequenceMethods __pyx_tp_as_sequence_array = {
   0, /*sq_length*/
   0, /*sq_concat*/
   0, /*sq_repeat*/
-  0, /*sq_item*/
+  __pyx_sq_item_array, /*sq_item*/
   0, /*sq_slice*/
   0, /*sq_ass_item*/
   0, /*sq_ass_slice*/
@@ -20671,13 +20869,13 @@ static PySequenceMethods __pyx_tp_as_sequence_Enum = {
   0, /*sq_inplace_repeat*/
 };
 
-static PyMappingMethods __pyx_tp_as_mapping_Enum = {
+static PyMappingMethods __pyx_tp_as_mapping_array = {
   0, /*mp_length*/
-  0, /*mp_subscript*/
-  0, /*mp_ass_subscript*/
+  __pyx_array___getitem__, /*mp_subscript*/
+  __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/
 };
 
-static PyBufferProcs __pyx_tp_as_buffer_Enum = {
+static PyBufferProcs __pyx_tp_as_buffer_array = {
   #if PY_MAJOR_VERSION < 3
   0, /*bf_getreadbuffer*/
   #endif
@@ -20691,19 +20889,19 @@ static PyBufferProcs __pyx_tp_as_buffer_Enum = {
   0, /*bf_getcharbuffer*/
   #endif
   #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_getbuffer*/
+  __pyx_array_getbuffer, /*bf_getbuffer*/
   #endif
   #if PY_VERSION_HEX >= 0x02060000
   0, /*bf_releasebuffer*/
   #endif
 };
 
-static PyTypeObject __pyx_type___pyx_MemviewEnum = {
+static PyTypeObject __pyx_type___pyx_array = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("splitPixel.Enum"), /*tp_name*/
-  sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/
+  __Pyx_NAMESTR("splitPixel.array"), /*tp_name*/
+  sizeof(struct __pyx_array_obj), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_Enum, /*tp_dealloc*/
+  __pyx_tp_dealloc_array, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -20712,35 +20910,35 @@ static PyTypeObject __pyx_type___pyx_MemviewEnum = {
   #else
   0, /*reserved*/
   #endif
-  __pyx_MemviewEnum___repr__, /*tp_repr*/
-  &__pyx_tp_as_number_Enum, /*tp_as_number*/
-  &__pyx_tp_as_sequence_Enum, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping_Enum, /*tp_as_mapping*/
+  0, /*tp_repr*/
+  0, /*tp_as_number*/
+  &__pyx_tp_as_sequence_array, /*tp_as_sequence*/
+  &__pyx_tp_as_mapping_array, /*tp_as_mapping*/
   0, /*tp_hash*/
   0, /*tp_call*/
   0, /*tp_str*/
-  0, /*tp_getattro*/
+  __pyx_tp_getattro_array, /*tp_getattro*/
   0, /*tp_setattro*/
-  &__pyx_tp_as_buffer_Enum, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+  &__pyx_tp_as_buffer_array, /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
   0, /*tp_doc*/
-  __pyx_tp_traverse_Enum, /*tp_traverse*/
-  __pyx_tp_clear_Enum, /*tp_clear*/
+  __pyx_tp_traverse_array, /*tp_traverse*/
+  __pyx_tp_clear_array, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
   0, /*tp_iter*/
   0, /*tp_iternext*/
-  __pyx_methods_Enum, /*tp_methods*/
+  __pyx_methods_array, /*tp_methods*/
   0, /*tp_members*/
-  0, /*tp_getset*/
+  __pyx_getsets_array, /*tp_getset*/
   0, /*tp_base*/
   0, /*tp_dict*/
   0, /*tp_descr_get*/
   0, /*tp_descr_set*/
   0, /*tp_dictoffset*/
-  __pyx_MemviewEnum___init__, /*tp_init*/
+  0, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_Enum, /*tp_new*/
+  __pyx_tp_new_array, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -20752,255 +20950,56 @@ static PyTypeObject __pyx_type___pyx_MemviewEnum = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
-static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;
 
-static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
-  struct __pyx_memoryview_obj *p;
-  PyObject *o = (*t->tp_alloc)(t, 0);
-  if (!o) return 0;
-  p = ((struct __pyx_memoryview_obj *)o);
-  p->__pyx_vtab = __pyx_vtabptr_memoryview;
-  p->obj = Py_None; Py_INCREF(Py_None);
-  p->_size = Py_None; Py_INCREF(Py_None);
-  p->_array_interface = Py_None; Py_INCREF(Py_None);
-  p->view.obj = NULL;
-  if (__pyx_memoryview___cinit__(o, a, k) < 0) {
-    Py_DECREF(o); o = 0;
-  }
+static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+  struct __pyx_MemviewEnum_obj *p;
+  PyObject *o;
+  o = (*t->tp_alloc)(t, 0);
+  if (unlikely(!o)) return 0;
+  p = ((struct __pyx_MemviewEnum_obj *)o);
+  p->name = Py_None; Py_INCREF(Py_None);
   return o;
 }
 
-static void __pyx_tp_dealloc_memoryview(PyObject *o) {
-  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
-  {
-    PyObject *etype, *eval, *etb;
-    PyErr_Fetch(&etype, &eval, &etb);
-    ++Py_REFCNT(o);
-    __pyx_memoryview___dealloc__(o);
-    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
-    --Py_REFCNT(o);
-    PyErr_Restore(etype, eval, etb);
-  }
-  Py_CLEAR(p->obj);
-  Py_CLEAR(p->_size);
-  Py_CLEAR(p->_array_interface);
+static void __pyx_tp_dealloc_Enum(PyObject *o) {
+  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
+  PyObject_GC_UnTrack(o);
+  Py_CLEAR(p->name);
   (*Py_TYPE(o)->tp_free)(o);
 }
 
-static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) {
   int e;
-  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
-  if (p->obj) {
-    e = (*v)(p->obj, a); if (e) return e;
-  }
-  if (p->_size) {
-    e = (*v)(p->_size, a); if (e) return e;
-  }
-  if (p->_array_interface) {
-    e = (*v)(p->_array_interface, a); if (e) return e;
-  }
-  if (p->view.obj) {
-    e = (*v)(p->view.obj, a); if (e) return e;
+  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
+  if (p->name) {
+    e = (*v)(p->name, a); if (e) return e;
   }
   return 0;
 }
 
-static int __pyx_tp_clear_memoryview(PyObject *o) {
-  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
+static int __pyx_tp_clear_Enum(PyObject *o) {
+  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
   PyObject* tmp;
-  tmp = ((PyObject*)p->obj);
-  p->obj = Py_None; Py_INCREF(Py_None);
-  Py_XDECREF(tmp);
-  tmp = ((PyObject*)p->_size);
-  p->_size = Py_None; Py_INCREF(Py_None);
-  Py_XDECREF(tmp);
-  tmp = ((PyObject*)p->_array_interface);
-  p->_array_interface = Py_None; Py_INCREF(Py_None);
+  tmp = ((PyObject*)p->name);
+  p->name = Py_None; Py_INCREF(Py_None);
   Py_XDECREF(tmp);
-  Py_CLEAR(p->view.obj);
   return 0;
 }
-static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
-  PyObject *r;
-  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
-  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
-  Py_DECREF(x);
-  return r;
-}
-
-static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) {
-  if (v) {
-    return __pyx_memoryview___setitem__(o, i, v);
-  }
-  else {
-    PyErr_Format(PyExc_NotImplementedError,
-      "Subscript deletion not supported by %s", Py_TYPE(o)->tp_name);
-    return -1;
-  }
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_transpose(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview__get__base(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_shape(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_strides(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_suboffsets(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_ndim(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_itemsize(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_nbytes(o);
-}
-
-static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryview_get_size(o);
-}
 
-static PyMethodDef __pyx_methods_memoryview[] = {
-  {__Pyx_NAMESTR("is_c_contig"), (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, __Pyx_DOCSTR(0)},
-  {__Pyx_NAMESTR("is_f_contig"), (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, __Pyx_DOCSTR(0)},
-  {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, __Pyx_DOCSTR(0)},
-  {__Pyx_NAMESTR("copy_fortran"), (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, __Pyx_DOCSTR(0)},
+static PyMethodDef __pyx_methods_Enum[] = {
   {0, 0, 0, 0}
 };
 
-static struct PyGetSetDef __pyx_getsets_memoryview[] = {
-  {(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, 0, 0},
-  {(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, 0, 0},
-  {(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, 0, 0},
-  {(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, 0, 0},
-  {(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, 0, 0},
-  {(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, 0, 0},
-  {(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, 0, 0},
-  {(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, 0, 0},
-  {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, 0, 0},
-  {0, 0, 0, 0, 0}
-};
-
-static PyNumberMethods __pyx_tp_as_number_memoryview = {
-  0, /*nb_add*/
-  0, /*nb_subtract*/
-  0, /*nb_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_divide*/
-  #endif
-  0, /*nb_remainder*/
-  0, /*nb_divmod*/
-  0, /*nb_power*/
-  0, /*nb_negative*/
-  0, /*nb_positive*/
-  0, /*nb_absolute*/
-  0, /*nb_nonzero*/
-  0, /*nb_invert*/
-  0, /*nb_lshift*/
-  0, /*nb_rshift*/
-  0, /*nb_and*/
-  0, /*nb_xor*/
-  0, /*nb_or*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_coerce*/
-  #endif
-  0, /*nb_int*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_long*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*nb_float*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_oct*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_hex*/
-  #endif
-  0, /*nb_inplace_add*/
-  0, /*nb_inplace_subtract*/
-  0, /*nb_inplace_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_inplace_divide*/
-  #endif
-  0, /*nb_inplace_remainder*/
-  0, /*nb_inplace_power*/
-  0, /*nb_inplace_lshift*/
-  0, /*nb_inplace_rshift*/
-  0, /*nb_inplace_and*/
-  0, /*nb_inplace_xor*/
-  0, /*nb_inplace_or*/
-  0, /*nb_floor_divide*/
-  0, /*nb_true_divide*/
-  0, /*nb_inplace_floor_divide*/
-  0, /*nb_inplace_true_divide*/
-  #if PY_VERSION_HEX >= 0x02050000
-  0, /*nb_index*/
-  #endif
-};
-
-static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
-  __pyx_memoryview___len__, /*sq_length*/
-  0, /*sq_concat*/
-  0, /*sq_repeat*/
-  __pyx_sq_item_memoryview, /*sq_item*/
-  0, /*sq_slice*/
-  0, /*sq_ass_item*/
-  0, /*sq_ass_slice*/
-  0, /*sq_contains*/
-  0, /*sq_inplace_concat*/
-  0, /*sq_inplace_repeat*/
-};
-
-static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
-  __pyx_memoryview___len__, /*mp_length*/
-  __pyx_memoryview___getitem__, /*mp_subscript*/
-  __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/
-};
-
-static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getreadbuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getwritebuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getsegcount*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getcharbuffer*/
-  #endif
-  #if PY_VERSION_HEX >= 0x02060000
-  __pyx_memoryview_getbuffer, /*bf_getbuffer*/
-  #endif
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_releasebuffer*/
-  #endif
-};
-
-static PyTypeObject __pyx_type___pyx_memoryview = {
+static PyTypeObject __pyx_type___pyx_MemviewEnum = {
   PyVarObject_HEAD_INIT(0, 0)
-  __Pyx_NAMESTR("splitPixel.memoryview"), /*tp_name*/
-  sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/
+  __Pyx_NAMESTR("splitPixel.Enum"), /*tp_name*/
+  sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/
   0, /*tp_itemsize*/
-  __pyx_tp_dealloc_memoryview, /*tp_dealloc*/
+  __pyx_tp_dealloc_Enum, /*tp_dealloc*/
   0, /*tp_print*/
   0, /*tp_getattr*/
   0, /*tp_setattr*/
@@ -21009,35 +21008,35 @@ static PyTypeObject __pyx_type___pyx_memoryview = {
   #else
   0, /*reserved*/
   #endif
-  __pyx_memoryview___repr__, /*tp_repr*/
-  &__pyx_tp_as_number_memoryview, /*tp_as_number*/
-  &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/
+  __pyx_MemviewEnum___repr__, /*tp_repr*/
+  0, /*tp_as_number*/
+  0, /*tp_as_sequence*/
+  0, /*tp_as_mapping*/
   0, /*tp_hash*/
   0, /*tp_call*/
-  __pyx_memoryview___str__, /*tp_str*/
+  0, /*tp_str*/
   0, /*tp_getattro*/
   0, /*tp_setattro*/
-  &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+  0, /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
   0, /*tp_doc*/
-  __pyx_tp_traverse_memoryview, /*tp_traverse*/
-  __pyx_tp_clear_memoryview, /*tp_clear*/
+  __pyx_tp_traverse_Enum, /*tp_traverse*/
+  __pyx_tp_clear_Enum, /*tp_clear*/
   0, /*tp_richcompare*/
   0, /*tp_weaklistoffset*/
   0, /*tp_iter*/
   0, /*tp_iternext*/
-  __pyx_methods_memoryview, /*tp_methods*/
+  __pyx_methods_Enum, /*tp_methods*/
   0, /*tp_members*/
-  __pyx_getsets_memoryview, /*tp_getset*/
+  0, /*tp_getset*/
   0, /*tp_base*/
   0, /*tp_dict*/
   0, /*tp_descr_get*/
   0, /*tp_descr_set*/
   0, /*tp_dictoffset*/
-  0, /*tp_init*/
+  __pyx_MemviewEnum___init__, /*tp_init*/
   0, /*tp_alloc*/
-  __pyx_tp_new_memoryview, /*tp_new*/
+  __pyx_tp_new_Enum, /*tp_new*/
   0, /*tp_free*/
   0, /*tp_is_gc*/
   0, /*tp_bases*/
@@ -21049,13 +21048,16 @@ static PyTypeObject __pyx_type___pyx_memoryview = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice;
 
 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) {
   struct __pyx_memoryviewslice_obj *p;
   PyObject *o = __pyx_tp_new_memoryview(t, a, k);
-  if (!o) return 0;
+  if (unlikely(!o)) return 0;
   p = ((struct __pyx_memoryviewslice_obj *)o);
   p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice;
   p->from_object = Py_None; Py_INCREF(Py_None);
@@ -21065,6 +21067,7 @@ static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyO
 
 static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) {
   struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
+  PyObject_GC_UnTrack(o);
   {
     PyObject *etype, *eval, *etb;
     PyErr_Fetch(&etype, &eval, &etb);
@@ -21075,6 +21078,7 @@ static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) {
     PyErr_Restore(etype, eval, etb);
   }
   Py_CLEAR(p->from_object);
+  PyObject_GC_Track(o);
   __pyx_tp_dealloc_memoryview(o);
 }
 
@@ -21095,135 +21099,21 @@ static int __pyx_tp_clear__memoryviewslice(PyObject *o) {
   tmp = ((PyObject*)p->from_object);
   p->from_object = Py_None; Py_INCREF(Py_None);
   Py_XDECREF(tmp);
-  __PYX_XDEC_MEMVIEW(&p->from_slice, 1);
-  return 0;
-}
-
-static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UNUSED void *x) {
-  return __pyx_memoryviewslice__get__base(o);
-}
-
-static PyMethodDef __pyx_methods__memoryviewslice[] = {
-  {0, 0, 0, 0}
-};
-
-static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = {
-  {(char *)"base", __pyx_getprop___pyx_memoryviewslice_base, 0, 0, 0},
-  {0, 0, 0, 0, 0}
-};
-
-static PyNumberMethods __pyx_tp_as_number__memoryviewslice = {
-  0, /*nb_add*/
-  0, /*nb_subtract*/
-  0, /*nb_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_divide*/
-  #endif
-  0, /*nb_remainder*/
-  0, /*nb_divmod*/
-  0, /*nb_power*/
-  0, /*nb_negative*/
-  0, /*nb_positive*/
-  0, /*nb_absolute*/
-  0, /*nb_nonzero*/
-  0, /*nb_invert*/
-  0, /*nb_lshift*/
-  0, /*nb_rshift*/
-  0, /*nb_and*/
-  0, /*nb_xor*/
-  0, /*nb_or*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_coerce*/
-  #endif
-  0, /*nb_int*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_long*/
-  #else
-  0, /*reserved*/
-  #endif
-  0, /*nb_float*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_oct*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_hex*/
-  #endif
-  0, /*nb_inplace_add*/
-  0, /*nb_inplace_subtract*/
-  0, /*nb_inplace_multiply*/
-  #if PY_MAJOR_VERSION < 3
-  0, /*nb_inplace_divide*/
-  #endif
-  0, /*nb_inplace_remainder*/
-  0, /*nb_inplace_power*/
-  0, /*nb_inplace_lshift*/
-  0, /*nb_inplace_rshift*/
-  0, /*nb_inplace_and*/
-  0, /*nb_inplace_xor*/
-  0, /*nb_inplace_or*/
-  0, /*nb_floor_divide*/
-  0, /*nb_true_divide*/
-  0, /*nb_inplace_floor_divide*/
-  0, /*nb_inplace_true_divide*/
-  #if PY_VERSION_HEX >= 0x02050000
-  0, /*nb_index*/
-  #endif
-};
-
-static PySequenceMethods __pyx_tp_as_sequence__memoryviewslice = {
-  #if CYTHON_COMPILING_IN_PYPY
-  __pyx_memoryview___len__, /*sq_length*/
-  #else
-  0, /*sq_length*/
-  #endif
-  0, /*sq_concat*/
-  0, /*sq_repeat*/
-  0, /*sq_item*/
-  0, /*sq_slice*/
-  0, /*sq_ass_item*/
-  0, /*sq_ass_slice*/
-  0, /*sq_contains*/
-  0, /*sq_inplace_concat*/
-  0, /*sq_inplace_repeat*/
-};
-
-static PyMappingMethods __pyx_tp_as_mapping__memoryviewslice = {
-  #if CYTHON_COMPILING_IN_PYPY
-  __pyx_memoryview___len__, /*mp_length*/
-  #else
-  0, /*mp_length*/
-  #endif
-  #if CYTHON_COMPILING_IN_PYPY
-  __pyx_memoryview___getitem__, /*mp_subscript*/
-  #else
-  0, /*mp_subscript*/
-  #endif
-  0, /*mp_ass_subscript*/
-};
-
-static PyBufferProcs __pyx_tp_as_buffer__memoryviewslice = {
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getreadbuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getwritebuffer*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getsegcount*/
-  #endif
-  #if PY_MAJOR_VERSION < 3
-  0, /*bf_getcharbuffer*/
-  #endif
-  #if CYTHON_COMPILING_IN_PYPY
-  __pyx_memoryview_getbuffer, /*bf_getbuffer*/
-  #else
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_getbuffer*/
-  #endif
-  #endif
-  #if PY_VERSION_HEX >= 0x02060000
-  0, /*bf_releasebuffer*/
-  #endif
+  __PYX_XDEC_MEMVIEW(&p->from_slice, 1);
+  return 0;
+}
+
+static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UNUSED void *x) {
+  return __pyx_memoryviewslice__get__base(o);
+}
+
+static PyMethodDef __pyx_methods__memoryviewslice[] = {
+  {0, 0, 0, 0}
+};
+
+static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = {
+  {(char *)"base", __pyx_getprop___pyx_memoryviewslice_base, 0, 0, 0},
+  {0, 0, 0, 0, 0}
 };
 
 static PyTypeObject __pyx_type___pyx_memoryviewslice = {
@@ -21245,9 +21135,9 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = {
   #else
   0, /*tp_repr*/
   #endif
-  &__pyx_tp_as_number__memoryviewslice, /*tp_as_number*/
-  &__pyx_tp_as_sequence__memoryviewslice, /*tp_as_sequence*/
-  &__pyx_tp_as_mapping__memoryviewslice, /*tp_as_mapping*/
+  0, /*tp_as_number*/
+  0, /*tp_as_sequence*/
+  0, /*tp_as_mapping*/
   0, /*tp_hash*/
   0, /*tp_call*/
   #if CYTHON_COMPILING_IN_PYPY
@@ -21257,8 +21147,8 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = {
   #endif
   0, /*tp_getattro*/
   0, /*tp_setattro*/
-  &__pyx_tp_as_buffer__memoryviewslice, /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+  0, /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
   __Pyx_DOCSTR("Internal class for passing memoryview slices to Python"), /*tp_doc*/
   __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/
   __pyx_tp_clear__memoryviewslice, /*tp_clear*/
@@ -21288,6 +21178,9 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = {
   #if PY_VERSION_HEX >= 0x02060000
   0, /*tp_version_tag*/
   #endif
+  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
+  0, /*tp_finalize*/
+  #endif
 };
 
 static PyMethodDef __pyx_methods[] = {
@@ -21296,7 +21189,11 @@ static PyMethodDef __pyx_methods[] = {
 
 #if PY_MAJOR_VERSION >= 3
 static struct PyModuleDef __pyx_moduledef = {
+  #if PY_VERSION_HEX < 0x03020000
+    { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
+  #else
     PyModuleDef_HEAD_INIT,
+  #endif
     __Pyx_NAMESTR("splitPixel"),
     0, /* m_doc */
     -1, /* m_size */
@@ -21346,9 +21243,12 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {&__pyx_n_s__TypeError, __pyx_k__TypeError, sizeof(__pyx_k__TypeError), 0, 0, 1, 1},
   {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1},
   {&__pyx_n_s____class__, __pyx_k____class__, sizeof(__pyx_k____class__), 0, 0, 1, 1},
+  {&__pyx_n_s____import__, __pyx_k____import__, sizeof(__pyx_k____import__), 0, 0, 1, 1},
   {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
   {&__pyx_n_s____name__, __pyx_k____name__, sizeof(__pyx_k____name__), 0, 0, 1, 1},
   {&__pyx_n_s____pyx_getbuffer, __pyx_k____pyx_getbuffer, sizeof(__pyx_k____pyx_getbuffer), 0, 0, 1, 1},
+  {&__pyx_n_s____pyx_releasebuffer, __pyx_k____pyx_releasebuffer, sizeof(__pyx_k____pyx_releasebuffer), 0, 0, 1, 1},
+  {&__pyx_n_s____pyx_vtable__, __pyx_k____pyx_vtable__, sizeof(__pyx_k____pyx_vtable__), 0, 0, 1, 1},
   {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
   {&__pyx_n_s__a0, __pyx_k__a0, sizeof(__pyx_k__a0), 0, 0, 1, 1},
   {&__pyx_n_s__a1, __pyx_k__a1, sizeof(__pyx_k__a1), 0, 0, 1, 1},
@@ -21483,22 +21383,22 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
   {0, 0, 0, 0, 0, 0, 0}
 };
 static int __Pyx_InitCachedBuiltins(void) {
-  __pyx_builtin_min = __Pyx_GetName(__pyx_b, __pyx_n_s__min); if (!__pyx_builtin_min) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_max = __Pyx_GetName(__pyx_b, __pyx_n_s__max); if (!__pyx_builtin_max) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_MemoryError = __Pyx_GetName(__pyx_b, __pyx_n_s__MemoryError); if (!__pyx_builtin_MemoryError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_enumerate = __Pyx_GetName(__pyx_b, __pyx_n_s__enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_Ellipsis = __Pyx_GetName(__pyx_b, __pyx_n_s__Ellipsis); if (!__pyx_builtin_Ellipsis) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_min = __Pyx_GetBuiltinName(__pyx_n_s__min); if (!__pyx_builtin_min) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_max = __Pyx_GetBuiltinName(__pyx_n_s__max); if (!__pyx_builtin_max) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s__MemoryError); if (!__pyx_builtin_MemoryError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s__enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s__Ellipsis); if (!__pyx_builtin_Ellipsis) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   #if PY_MAJOR_VERSION >= 3
-  __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   #else
-  __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__xrange); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s__xrange); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   #endif
-  __pyx_builtin_id = __Pyx_GetName(__pyx_b, __pyx_n_s__id); if (!__pyx_builtin_id) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_builtin_IndexError = __Pyx_GetName(__pyx_b, __pyx_n_s__IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s__id); if (!__pyx_builtin_id) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s__IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   return 0;
   __pyx_L1_error:;
   return -1;
@@ -21515,23 +21415,11 @@ static int __Pyx_InitCachedConstants(void) {
  *     assert pos.shape[0] == size
  *     assert pos.shape[1] == 4
  */
-  __pyx_k_tuple_1 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_1 = PyTuple_Pack(3, __pyx_int_neg_1, __pyx_int_4, __pyx_int_2); if (unlikely(!__pyx_k_tuple_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_1);
-  __Pyx_INCREF(__pyx_int_neg_1);
-  PyTuple_SET_ITEM(__pyx_k_tuple_1, 0, __pyx_int_neg_1);
-  __Pyx_GIVEREF(__pyx_int_neg_1);
-  __Pyx_INCREF(__pyx_int_4);
-  PyTuple_SET_ITEM(__pyx_k_tuple_1, 1, __pyx_int_4);
-  __Pyx_GIVEREF(__pyx_int_4);
-  __Pyx_INCREF(__pyx_int_2);
-  PyTuple_SET_ITEM(__pyx_k_tuple_1, 2, __pyx_int_2);
-  __Pyx_GIVEREF(__pyx_int_2);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_1));
-  __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_2 = PyTuple_Pack(1, ((PyObject *)__pyx_k_tuple_1)); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_2);
-  __Pyx_INCREF(((PyObject *)__pyx_k_tuple_1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_k_tuple_1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_1));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2));
 
   /* "splitPixel.pyx":166
@@ -21547,17 +21435,8 @@ static int __Pyx_InitCachedConstants(void) {
   __pyx_k_slice_4 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_slice_4);
   __Pyx_GIVEREF(__pyx_k_slice_4);
-  __pyx_k_tuple_5 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_5 = PyTuple_Pack(3, __pyx_k_slice_3, __pyx_k_slice_4, __pyx_int_0); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_5);
-  __Pyx_INCREF(__pyx_k_slice_3);
-  PyTuple_SET_ITEM(__pyx_k_tuple_5, 0, __pyx_k_slice_3);
-  __Pyx_GIVEREF(__pyx_k_slice_3);
-  __Pyx_INCREF(__pyx_k_slice_4);
-  PyTuple_SET_ITEM(__pyx_k_tuple_5, 1, __pyx_k_slice_4);
-  __Pyx_GIVEREF(__pyx_k_slice_4);
-  __Pyx_INCREF(__pyx_int_0);
-  PyTuple_SET_ITEM(__pyx_k_tuple_5, 2, __pyx_int_0);
-  __Pyx_GIVEREF(__pyx_int_0);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5));
 
   /* "splitPixel.pyx":167
@@ -21573,17 +21452,8 @@ static int __Pyx_InitCachedConstants(void) {
   __pyx_k_slice_7 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_slice_7);
   __Pyx_GIVEREF(__pyx_k_slice_7);
-  __pyx_k_tuple_8 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_8 = PyTuple_Pack(3, __pyx_k_slice_6, __pyx_k_slice_7, __pyx_int_0); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_8);
-  __Pyx_INCREF(__pyx_k_slice_6);
-  PyTuple_SET_ITEM(__pyx_k_tuple_8, 0, __pyx_k_slice_6);
-  __Pyx_GIVEREF(__pyx_k_slice_6);
-  __Pyx_INCREF(__pyx_k_slice_7);
-  PyTuple_SET_ITEM(__pyx_k_tuple_8, 1, __pyx_k_slice_7);
-  __Pyx_GIVEREF(__pyx_k_slice_7);
-  __Pyx_INCREF(__pyx_int_0);
-  PyTuple_SET_ITEM(__pyx_k_tuple_8, 2, __pyx_int_0);
-  __Pyx_GIVEREF(__pyx_int_0);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8));
 
   /* "splitPixel.pyx":174
@@ -21599,17 +21469,8 @@ static int __Pyx_InitCachedConstants(void) {
   __pyx_k_slice_10 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_slice_10);
   __Pyx_GIVEREF(__pyx_k_slice_10);
-  __pyx_k_tuple_11 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_11 = PyTuple_Pack(3, __pyx_k_slice_9, __pyx_k_slice_10, __pyx_int_1); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_11);
-  __Pyx_INCREF(__pyx_k_slice_9);
-  PyTuple_SET_ITEM(__pyx_k_tuple_11, 0, __pyx_k_slice_9);
-  __Pyx_GIVEREF(__pyx_k_slice_9);
-  __Pyx_INCREF(__pyx_k_slice_10);
-  PyTuple_SET_ITEM(__pyx_k_tuple_11, 1, __pyx_k_slice_10);
-  __Pyx_GIVEREF(__pyx_k_slice_10);
-  __Pyx_INCREF(__pyx_int_1);
-  PyTuple_SET_ITEM(__pyx_k_tuple_11, 2, __pyx_int_1);
-  __Pyx_GIVEREF(__pyx_int_1);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11));
 
   /* "splitPixel.pyx":175
@@ -21625,17 +21486,8 @@ static int __Pyx_InitCachedConstants(void) {
   __pyx_k_slice_13 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_slice_13);
   __Pyx_GIVEREF(__pyx_k_slice_13);
-  __pyx_k_tuple_14 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_14 = PyTuple_Pack(3, __pyx_k_slice_12, __pyx_k_slice_13, __pyx_int_1); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_14);
-  __Pyx_INCREF(__pyx_k_slice_12);
-  PyTuple_SET_ITEM(__pyx_k_tuple_14, 0, __pyx_k_slice_12);
-  __Pyx_GIVEREF(__pyx_k_slice_12);
-  __Pyx_INCREF(__pyx_k_slice_13);
-  PyTuple_SET_ITEM(__pyx_k_tuple_14, 1, __pyx_k_slice_13);
-  __Pyx_GIVEREF(__pyx_k_slice_13);
-  __Pyx_INCREF(__pyx_int_1);
-  PyTuple_SET_ITEM(__pyx_k_tuple_14, 2, __pyx_int_1);
-  __Pyx_GIVEREF(__pyx_int_1);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14));
 
   /* "splitPixel.pyx":340
@@ -21645,23 +21497,11 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *     assert pos.shape[0] == size
  */
-  __pyx_k_tuple_15 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_15 = PyTuple_Pack(3, __pyx_int_neg_1, __pyx_int_4, __pyx_int_2); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_15);
-  __Pyx_INCREF(__pyx_int_neg_1);
-  PyTuple_SET_ITEM(__pyx_k_tuple_15, 0, __pyx_int_neg_1);
-  __Pyx_GIVEREF(__pyx_int_neg_1);
-  __Pyx_INCREF(__pyx_int_4);
-  PyTuple_SET_ITEM(__pyx_k_tuple_15, 1, __pyx_int_4);
-  __Pyx_GIVEREF(__pyx_int_4);
-  __Pyx_INCREF(__pyx_int_2);
-  PyTuple_SET_ITEM(__pyx_k_tuple_15, 2, __pyx_int_2);
-  __Pyx_GIVEREF(__pyx_int_2);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15));
-  __pyx_k_tuple_16 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_16 = PyTuple_Pack(1, ((PyObject *)__pyx_k_tuple_15)); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_16);
-  __Pyx_INCREF(((PyObject *)__pyx_k_tuple_15));
-  PyTuple_SET_ITEM(__pyx_k_tuple_16, 0, ((PyObject *)__pyx_k_tuple_15));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16));
 
   /* "splitPixel.pyx":380
@@ -21677,17 +21517,8 @@ static int __Pyx_InitCachedConstants(void) {
   __pyx_k_slice_18 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_slice_18);
   __Pyx_GIVEREF(__pyx_k_slice_18);
-  __pyx_k_tuple_19 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_19 = PyTuple_Pack(3, __pyx_k_slice_17, __pyx_k_slice_18, __pyx_int_0); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_19);
-  __Pyx_INCREF(__pyx_k_slice_17);
-  PyTuple_SET_ITEM(__pyx_k_tuple_19, 0, __pyx_k_slice_17);
-  __Pyx_GIVEREF(__pyx_k_slice_17);
-  __Pyx_INCREF(__pyx_k_slice_18);
-  PyTuple_SET_ITEM(__pyx_k_tuple_19, 1, __pyx_k_slice_18);
-  __Pyx_GIVEREF(__pyx_k_slice_18);
-  __Pyx_INCREF(__pyx_int_0);
-  PyTuple_SET_ITEM(__pyx_k_tuple_19, 2, __pyx_int_0);
-  __Pyx_GIVEREF(__pyx_int_0);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_19));
 
   /* "splitPixel.pyx":381
@@ -21703,17 +21534,8 @@ static int __Pyx_InitCachedConstants(void) {
   __pyx_k_slice_21 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_slice_21);
   __Pyx_GIVEREF(__pyx_k_slice_21);
-  __pyx_k_tuple_22 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_22 = PyTuple_Pack(3, __pyx_k_slice_20, __pyx_k_slice_21, __pyx_int_0); if (unlikely(!__pyx_k_tuple_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_22);
-  __Pyx_INCREF(__pyx_k_slice_20);
-  PyTuple_SET_ITEM(__pyx_k_tuple_22, 0, __pyx_k_slice_20);
-  __Pyx_GIVEREF(__pyx_k_slice_20);
-  __Pyx_INCREF(__pyx_k_slice_21);
-  PyTuple_SET_ITEM(__pyx_k_tuple_22, 1, __pyx_k_slice_21);
-  __Pyx_GIVEREF(__pyx_k_slice_21);
-  __Pyx_INCREF(__pyx_int_0);
-  PyTuple_SET_ITEM(__pyx_k_tuple_22, 2, __pyx_int_0);
-  __Pyx_GIVEREF(__pyx_int_0);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_22));
 
   /* "splitPixel.pyx":388
@@ -21729,17 +21551,8 @@ static int __Pyx_InitCachedConstants(void) {
   __pyx_k_slice_24 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_slice_24);
   __Pyx_GIVEREF(__pyx_k_slice_24);
-  __pyx_k_tuple_25 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_25 = PyTuple_Pack(3, __pyx_k_slice_23, __pyx_k_slice_24, __pyx_int_1); if (unlikely(!__pyx_k_tuple_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_25);
-  __Pyx_INCREF(__pyx_k_slice_23);
-  PyTuple_SET_ITEM(__pyx_k_tuple_25, 0, __pyx_k_slice_23);
-  __Pyx_GIVEREF(__pyx_k_slice_23);
-  __Pyx_INCREF(__pyx_k_slice_24);
-  PyTuple_SET_ITEM(__pyx_k_tuple_25, 1, __pyx_k_slice_24);
-  __Pyx_GIVEREF(__pyx_k_slice_24);
-  __Pyx_INCREF(__pyx_int_1);
-  PyTuple_SET_ITEM(__pyx_k_tuple_25, 2, __pyx_int_1);
-  __Pyx_GIVEREF(__pyx_int_1);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_25));
 
   /* "splitPixel.pyx":389
@@ -21755,17 +21568,8 @@ static int __Pyx_InitCachedConstants(void) {
   __pyx_k_slice_27 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_slice_27);
   __Pyx_GIVEREF(__pyx_k_slice_27);
-  __pyx_k_tuple_28 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_28 = PyTuple_Pack(3, __pyx_k_slice_26, __pyx_k_slice_27, __pyx_int_1); if (unlikely(!__pyx_k_tuple_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_28);
-  __Pyx_INCREF(__pyx_k_slice_26);
-  PyTuple_SET_ITEM(__pyx_k_tuple_28, 0, __pyx_k_slice_26);
-  __Pyx_GIVEREF(__pyx_k_slice_26);
-  __Pyx_INCREF(__pyx_k_slice_27);
-  PyTuple_SET_ITEM(__pyx_k_tuple_28, 1, __pyx_k_slice_27);
-  __Pyx_GIVEREF(__pyx_k_slice_27);
-  __Pyx_INCREF(__pyx_int_1);
-  PyTuple_SET_ITEM(__pyx_k_tuple_28, 2, __pyx_int_1);
-  __Pyx_GIVEREF(__pyx_int_1);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_28));
 
   /* "numpy.pxd":215
@@ -21775,11 +21579,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
  */
-  __pyx_k_tuple_30 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_30)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_30 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_29)); if (unlikely(!__pyx_k_tuple_30)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_30);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_29));
-  PyTuple_SET_ITEM(__pyx_k_tuple_30, 0, ((PyObject *)__pyx_kp_u_29));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_29));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_30));
 
   /* "numpy.pxd":219
@@ -21789,11 +21590,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *             info.buf = PyArray_DATA(self)
  */
-  __pyx_k_tuple_32 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_32)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_32 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_31)); if (unlikely(!__pyx_k_tuple_32)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_32);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_31));
-  PyTuple_SET_ITEM(__pyx_k_tuple_32, 0, ((PyObject *)__pyx_kp_u_31));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_31));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_32));
 
   /* "numpy.pxd":257
@@ -21803,11 +21601,8 @@ static int __Pyx_InitCachedConstants(void) {
  *                 if   t == NPY_BYTE:        f = "b"
  *                 elif t == NPY_UBYTE:       f = "B"
  */
-  __pyx_k_tuple_34 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_34)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_34 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_33)); if (unlikely(!__pyx_k_tuple_34)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_34);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_33));
-  PyTuple_SET_ITEM(__pyx_k_tuple_34, 0, ((PyObject *)__pyx_kp_u_33));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_33));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_34));
 
   /* "numpy.pxd":799
@@ -21817,11 +21612,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *         if ((child.byteorder == c'>' and little_endian) or
  */
-  __pyx_k_tuple_37 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_37)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_37 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_36)); if (unlikely(!__pyx_k_tuple_37)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_37);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_36));
-  PyTuple_SET_ITEM(__pyx_k_tuple_37, 0, ((PyObject *)__pyx_kp_u_36));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_36));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_37));
 
   /* "numpy.pxd":803
@@ -21831,11 +21623,8 @@ static int __Pyx_InitCachedConstants(void) {
  *             # One could encode it in the format string and have Cython
  *             # complain instead, BUT: < and > in format strings also imply
  */
-  __pyx_k_tuple_38 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_38)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_38 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_33)); if (unlikely(!__pyx_k_tuple_38)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_38);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_33));
-  PyTuple_SET_ITEM(__pyx_k_tuple_38, 0, ((PyObject *)__pyx_kp_u_33));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_33));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_38));
 
   /* "numpy.pxd":823
@@ -21845,11 +21634,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *             # Until ticket #99 is fixed, use integers to avoid warnings
  */
-  __pyx_k_tuple_40 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_40)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_40 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_39)); if (unlikely(!__pyx_k_tuple_40)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_40);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_u_39));
-  PyTuple_SET_ITEM(__pyx_k_tuple_40, 0, ((PyObject *)__pyx_kp_u_39));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_39));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_40));
 
   /* "View.MemoryView":124
@@ -21859,11 +21645,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *         if self.itemsize <= 0:
  */
-  __pyx_k_tuple_42 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_42)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_42 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_41)); if (unlikely(!__pyx_k_tuple_42)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_42);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_41));
-  PyTuple_SET_ITEM(__pyx_k_tuple_42, 0, ((PyObject *)__pyx_kp_s_41));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_41));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_42));
 
   /* "View.MemoryView":127
@@ -21873,11 +21656,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *         encode = getattr(format, 'encode', None)
  */
-  __pyx_k_tuple_44 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_44)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_44 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_43)); if (unlikely(!__pyx_k_tuple_44)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_44);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_43));
-  PyTuple_SET_ITEM(__pyx_k_tuple_44, 0, ((PyObject *)__pyx_kp_s_43));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_43));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_44));
 
   /* "View.MemoryView":131
@@ -21887,11 +21667,8 @@ static int __Pyx_InitCachedConstants(void) {
  *         self._format = format
  *         self.format = self._format
  */
-  __pyx_k_tuple_45 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_45)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_45 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__ASCII)); if (unlikely(!__pyx_k_tuple_45)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_45);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__ASCII));
-  PyTuple_SET_ITEM(__pyx_k_tuple_45, 0, ((PyObject *)__pyx_n_s__ASCII));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ASCII));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_45));
 
   /* "View.MemoryView":141
@@ -21901,11 +21678,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  * 
  */
-  __pyx_k_tuple_47 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_47)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_47 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_46)); if (unlikely(!__pyx_k_tuple_47)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_47);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_46));
-  PyTuple_SET_ITEM(__pyx_k_tuple_47, 0, ((PyObject *)__pyx_kp_s_46));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_46));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_47));
 
   /* "View.MemoryView":166
@@ -21915,11 +21689,8 @@ static int __Pyx_InitCachedConstants(void) {
  *         self.mode = mode
  * 
  */
-  __pyx_k_tuple_50 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_50)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_50 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__ASCII)); if (unlikely(!__pyx_k_tuple_50)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_50);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__ASCII));
-  PyTuple_SET_ITEM(__pyx_k_tuple_50, 0, ((PyObject *)__pyx_n_s__ASCII));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ASCII));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_50));
 
   /* "View.MemoryView":174
@@ -21929,11 +21700,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *             if self.dtype_is_object:
  */
-  __pyx_k_tuple_52 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_52)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_52 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_51)); if (unlikely(!__pyx_k_tuple_52)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_52);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_51));
-  PyTuple_SET_ITEM(__pyx_k_tuple_52, 0, ((PyObject *)__pyx_kp_s_51));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_51));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_52));
 
   /* "View.MemoryView":190
@@ -21943,11 +21711,8 @@ static int __Pyx_InitCachedConstants(void) {
  *         info.buf = self.data
  *         info.len = self.len
  */
-  __pyx_k_tuple_54 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_54)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_54 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_53)); if (unlikely(!__pyx_k_tuple_54)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_54);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_53));
-  PyTuple_SET_ITEM(__pyx_k_tuple_54, 0, ((PyObject *)__pyx_kp_s_53));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_53));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_54));
 
   /* "View.MemoryView":452
@@ -21957,11 +21722,8 @@ static int __Pyx_InitCachedConstants(void) {
  *         else:
  *             if len(self.view.format) == 1:
  */
-  __pyx_k_tuple_56 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_56)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_56 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_55)); if (unlikely(!__pyx_k_tuple_56)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_56);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_55));
-  PyTuple_SET_ITEM(__pyx_k_tuple_56, 0, ((PyObject *)__pyx_kp_s_55));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_55));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_56));
 
   /* "View.MemoryView":528
@@ -21971,11 +21733,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *             return tuple([self.view.strides[i] for i in xrange(self.view.ndim)])
  */
-  __pyx_k_tuple_58 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_58)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_58 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_57)); if (unlikely(!__pyx_k_tuple_58)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_58);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_57));
-  PyTuple_SET_ITEM(__pyx_k_tuple_58, 0, ((PyObject *)__pyx_kp_s_57));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_57));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_58));
 
   /* "View.MemoryView":643
@@ -21985,11 +21744,8 @@ static int __Pyx_InitCachedConstants(void) {
  *                 seen_ellipsis = True
  *             else:
  */
-  __pyx_k_tuple_61 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_61)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_61 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_k_tuple_61)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_61);
-  __Pyx_INCREF(Py_None);
-  PyTuple_SET_ITEM(__pyx_k_tuple_61, 0, Py_None);
-  __Pyx_GIVEREF(Py_None);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_61));
 
   /* "View.MemoryView":646
@@ -21999,11 +21755,8 @@ static int __Pyx_InitCachedConstants(void) {
  *             have_slices = True
  *         else:
  */
-  __pyx_k_tuple_62 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_62)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_62 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_k_tuple_62)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_62);
-  __Pyx_INCREF(Py_None);
-  PyTuple_SET_ITEM(__pyx_k_tuple_62, 0, Py_None);
-  __Pyx_GIVEREF(Py_None);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_62));
 
   /* "View.MemoryView":657
@@ -22013,11 +21766,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  *     return have_slices or nslices, tuple(result)
  */
-  __pyx_k_tuple_64 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_64)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_64 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_k_tuple_64)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_64);
-  __Pyx_INCREF(Py_None);
-  PyTuple_SET_ITEM(__pyx_k_tuple_64, 0, Py_None);
-  __Pyx_GIVEREF(Py_None);
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_64));
 
   /* "View.MemoryView":665
@@ -22027,11 +21777,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  * 
  */
-  __pyx_k_tuple_66 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_66)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_66 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_65)); if (unlikely(!__pyx_k_tuple_66)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_66);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_65));
-  PyTuple_SET_ITEM(__pyx_k_tuple_66, 0, ((PyObject *)__pyx_kp_s_65));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_65));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_66));
 
   /* "splitPixel.pyx":101
@@ -22041,212 +21788,8 @@ static int __Pyx_InitCachedConstants(void) {
  *                 numpy.ndarray weights not None,
  *                 size_t bins=100,
  */
-  __pyx_k_tuple_74 = PyTuple_New(68); if (unlikely(!__pyx_k_tuple_74)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_74 = PyTuple_Pack(68, ((PyObject *)__pyx_n_s__pos), ((PyObject *)__pyx_n_s__weights), ((PyObject *)__pyx_n_s__bins), ((PyObject *)__pyx_n_s__pos0Range), ((PyObject *)__pyx_n_s__pos1Range), ((PyObject *)__pyx_n_s__dummy), ((PyObject *)__pyx_n_s__delta_dummy), ((PyObject *)__pyx_n_s__mask), ((PyObject *)__pyx_n_s__dark), ((PyObject *)__pyx_n_s__flat), ((PyObject *)__pyx_n_s__solidangle), ((PyObject *)__pyx_n_s__polarization), ((PyObject *)__pyx_n_s__size), ((PyObject *)__py [...]
   __Pyx_GOTREF(__pyx_k_tuple_74);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 0, ((PyObject *)__pyx_n_s__pos));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__weights));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 1, ((PyObject *)__pyx_n_s__weights));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__weights));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__bins));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 2, ((PyObject *)__pyx_n_s__bins));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bins));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0Range));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 3, ((PyObject *)__pyx_n_s__pos0Range));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0Range));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1Range));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 4, ((PyObject *)__pyx_n_s__pos1Range));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1Range));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__dummy));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 5, ((PyObject *)__pyx_n_s__dummy));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dummy));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__delta_dummy));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 6, ((PyObject *)__pyx_n_s__delta_dummy));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__delta_dummy));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__mask));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 7, ((PyObject *)__pyx_n_s__mask));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mask));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__dark));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 8, ((PyObject *)__pyx_n_s__dark));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dark));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__flat));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 9, ((PyObject *)__pyx_n_s__flat));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__flat));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__solidangle));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 10, ((PyObject *)__pyx_n_s__solidangle));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__solidangle));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__polarization));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 11, ((PyObject *)__pyx_n_s__polarization));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__polarization));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__size));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 12, ((PyObject *)__pyx_n_s__size));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__size));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cpos));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 13, ((PyObject *)__pyx_n_s__cpos));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cpos));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cdata));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 14, ((PyObject *)__pyx_n_s__cdata));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cdata));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__outData));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 15, ((PyObject *)__pyx_n_s__outData));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outData));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__outCount));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 16, ((PyObject *)__pyx_n_s__outCount));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outCount));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__outMerge));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 17, ((PyObject *)__pyx_n_s__outMerge));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outMerge));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cmask));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 18, ((PyObject *)__pyx_n_s__cmask));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cmask));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cflat));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 19, ((PyObject *)__pyx_n_s__cflat));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cflat));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cdark));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 20, ((PyObject *)__pyx_n_s__cdark));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cdark));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cpolarization));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 21, ((PyObject *)__pyx_n_s__cpolarization));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cpolarization));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__csolidangle));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 22, ((PyObject *)__pyx_n_s__csolidangle));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__csolidangle));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cdummy));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 23, ((PyObject *)__pyx_n_s__cdummy));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cdummy));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cddummy));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 24, ((PyObject *)__pyx_n_s__cddummy));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cddummy));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__data));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 25, ((PyObject *)__pyx_n_s__data));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__data));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__deltaR));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 26, ((PyObject *)__pyx_n_s__deltaR));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__deltaR));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__deltaL));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 27, ((PyObject *)__pyx_n_s__deltaL));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__deltaL));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__deltaA));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 28, ((PyObject *)__pyx_n_s__deltaA));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__deltaA));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0_min));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 29, ((PyObject *)__pyx_n_s__pos0_min));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0_min));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0_max));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 30, ((PyObject *)__pyx_n_s__pos0_max));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0_max));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0_maxin));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 31, ((PyObject *)__pyx_n_s__pos0_maxin));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0_maxin));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1_min));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 32, ((PyObject *)__pyx_n_s__pos1_min));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1_min));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1_max));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 33, ((PyObject *)__pyx_n_s__pos1_max));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1_max));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1_maxin));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 34, ((PyObject *)__pyx_n_s__pos1_maxin));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1_maxin));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__aeraPixel));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 35, ((PyObject *)__pyx_n_s__aeraPixel));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__aeraPixel));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__dpos));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 36, ((PyObject *)__pyx_n_s__dpos));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dpos));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__fbin0_min));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 37, ((PyObject *)__pyx_n_s__fbin0_min));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fbin0_min));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__fbin0_max));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 38, ((PyObject *)__pyx_n_s__fbin0_max));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fbin0_max));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__a0));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 39, ((PyObject *)__pyx_n_s__a0));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__a0));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__b0));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 40, ((PyObject *)__pyx_n_s__b0));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__b0));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__c0));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 41, ((PyObject *)__pyx_n_s__c0));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__c0));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__d0));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 42, ((PyObject *)__pyx_n_s__d0));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__d0));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__max0));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 43, ((PyObject *)__pyx_n_s__max0));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__max0));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__min0));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 44, ((PyObject *)__pyx_n_s__min0));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__min0));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__a1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 45, ((PyObject *)__pyx_n_s__a1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__a1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__b1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 46, ((PyObject *)__pyx_n_s__b1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__b1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__c1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 47, ((PyObject *)__pyx_n_s__c1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__c1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__d1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 48, ((PyObject *)__pyx_n_s__d1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__d1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__max1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 49, ((PyObject *)__pyx_n_s__max1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__max1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__min1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 50, ((PyObject *)__pyx_n_s__min1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__min1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__epsilon));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 51, ((PyObject *)__pyx_n_s__epsilon));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__epsilon));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__check_pos1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 52, ((PyObject *)__pyx_n_s__check_pos1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__check_pos1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__check_mask));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 53, ((PyObject *)__pyx_n_s__check_mask));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__check_mask));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__do_dummy));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 54, ((PyObject *)__pyx_n_s__do_dummy));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__do_dummy));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__do_dark));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 55, ((PyObject *)__pyx_n_s__do_dark));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__do_dark));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__do_flat));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 56, ((PyObject *)__pyx_n_s__do_flat));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__do_flat));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__do_polarization));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 57, ((PyObject *)__pyx_n_s__do_polarization));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__do_polarization));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__do_solidangle));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 58, ((PyObject *)__pyx_n_s__do_solidangle));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__do_solidangle));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 59, ((PyObject *)__pyx_n_s__i));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 60, ((PyObject *)__pyx_n_s__idx));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__bin));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 61, ((PyObject *)__pyx_n_s__bin));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__bin0_max));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 62, ((PyObject *)__pyx_n_s__bin0_max));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin0_max));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__bin0_min));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 63, ((PyObject *)__pyx_n_s__bin0_min));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin0_min));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__do_pos1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 64, ((PyObject *)__pyx_n_s__do_pos1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__do_pos1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__outPos));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 65, ((PyObject *)__pyx_n_s__outPos));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outPos));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__check_dummy));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 66, ((PyObject *)__pyx_n_s__check_dummy));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__check_dummy));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__tmp));
-  PyTuple_SET_ITEM(__pyx_k_tuple_74, 67, ((PyObject *)__pyx_n_s__tmp));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tmp));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_74));
   __pyx_k_codeobj_75 = (PyObject*)__Pyx_PyCode_New(12, 0, 68, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_74, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_76, __pyx_n_s__fullSplit1D, 101, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_75)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
@@ -22257,233 +21800,8 @@ static int __Pyx_InitCachedConstants(void) {
  *                 numpy.ndarray weights not None,
  *                 bins not None,
  */
-  __pyx_k_tuple_77 = PyTuple_New(75); if (unlikely(!__pyx_k_tuple_77)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_77 = PyTuple_Pack(75, ((PyObject *)__pyx_n_s__pos), ((PyObject *)__pyx_n_s__weights), ((PyObject *)__pyx_n_s__bins), ((PyObject *)__pyx_n_s__pos0Range), ((PyObject *)__pyx_n_s__pos1Range), ((PyObject *)__pyx_n_s__dummy), ((PyObject *)__pyx_n_s__delta_dummy), ((PyObject *)__pyx_n_s__mask), ((PyObject *)__pyx_n_s__dark), ((PyObject *)__pyx_n_s__flat), ((PyObject *)__pyx_n_s__solidangle), ((PyObject *)__pyx_n_s__polarization), ((PyObject *)__pyx_n_s__bins0), ((PyObject *)__p [...]
   __Pyx_GOTREF(__pyx_k_tuple_77);
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 0, ((PyObject *)__pyx_n_s__pos));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__weights));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 1, ((PyObject *)__pyx_n_s__weights));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__weights));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__bins));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 2, ((PyObject *)__pyx_n_s__bins));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bins));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0Range));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 3, ((PyObject *)__pyx_n_s__pos0Range));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0Range));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1Range));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 4, ((PyObject *)__pyx_n_s__pos1Range));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1Range));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__dummy));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 5, ((PyObject *)__pyx_n_s__dummy));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dummy));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__delta_dummy));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 6, ((PyObject *)__pyx_n_s__delta_dummy));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__delta_dummy));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__mask));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 7, ((PyObject *)__pyx_n_s__mask));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mask));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__dark));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 8, ((PyObject *)__pyx_n_s__dark));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dark));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__flat));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 9, ((PyObject *)__pyx_n_s__flat));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__flat));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__solidangle));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 10, ((PyObject *)__pyx_n_s__solidangle));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__solidangle));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__polarization));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 11, ((PyObject *)__pyx_n_s__polarization));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__polarization));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__bins0));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 12, ((PyObject *)__pyx_n_s__bins0));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bins0));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__bins1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 13, ((PyObject *)__pyx_n_s__bins1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bins1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__size));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 14, ((PyObject *)__pyx_n_s__size));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__size));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cpos));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 15, ((PyObject *)__pyx_n_s__cpos));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cpos));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cdata));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 16, ((PyObject *)__pyx_n_s__cdata));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cdata));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__outData));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 17, ((PyObject *)__pyx_n_s__outData));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outData));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__outCount));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 18, ((PyObject *)__pyx_n_s__outCount));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outCount));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__outMerge));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 19, ((PyObject *)__pyx_n_s__outMerge));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outMerge));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__edges0));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 20, ((PyObject *)__pyx_n_s__edges0));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__edges0));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__edges1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 21, ((PyObject *)__pyx_n_s__edges1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__edges1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cmask));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 22, ((PyObject *)__pyx_n_s__cmask));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cmask));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cflat));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 23, ((PyObject *)__pyx_n_s__cflat));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cflat));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cdark));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 24, ((PyObject *)__pyx_n_s__cdark));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cdark));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cpolarization));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 25, ((PyObject *)__pyx_n_s__cpolarization));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cpolarization));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__csolidangle));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 26, ((PyObject *)__pyx_n_s__csolidangle));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__csolidangle));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__check_mask));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 27, ((PyObject *)__pyx_n_s__check_mask));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__check_mask));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__do_dummy));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 28, ((PyObject *)__pyx_n_s__do_dummy));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__do_dummy));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__do_dark));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 29, ((PyObject *)__pyx_n_s__do_dark));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__do_dark));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__do_flat));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 30, ((PyObject *)__pyx_n_s__do_flat));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__do_flat));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__do_polarization));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 31, ((PyObject *)__pyx_n_s__do_polarization));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__do_polarization));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__do_solidangle));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 32, ((PyObject *)__pyx_n_s__do_solidangle));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__do_solidangle));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cdummy));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 33, ((PyObject *)__pyx_n_s__cdummy));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cdummy));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__cddummy));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 34, ((PyObject *)__pyx_n_s__cddummy));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cddummy));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__data));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 35, ((PyObject *)__pyx_n_s__data));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__data));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__min0));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 36, ((PyObject *)__pyx_n_s__min0));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__min0));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__max0));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 37, ((PyObject *)__pyx_n_s__max0));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__max0));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__min1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 38, ((PyObject *)__pyx_n_s__min1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__min1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__max1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 39, ((PyObject *)__pyx_n_s__max1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__max1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__deltaR));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 40, ((PyObject *)__pyx_n_s__deltaR));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__deltaR));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__deltaL));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 41, ((PyObject *)__pyx_n_s__deltaL));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__deltaL));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__deltaU));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 42, ((PyObject *)__pyx_n_s__deltaU));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__deltaU));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__deltaD));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 43, ((PyObject *)__pyx_n_s__deltaD));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__deltaD));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__deltaA));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 44, ((PyObject *)__pyx_n_s__deltaA));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__deltaA));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0_min));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 45, ((PyObject *)__pyx_n_s__pos0_min));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0_min));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0_max));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 46, ((PyObject *)__pyx_n_s__pos0_max));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0_max));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1_min));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 47, ((PyObject *)__pyx_n_s__pos1_min));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1_min));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1_max));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 48, ((PyObject *)__pyx_n_s__pos1_max));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1_max));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos0_maxin));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 49, ((PyObject *)__pyx_n_s__pos0_maxin));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos0_maxin));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__pos1_maxin));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 50, ((PyObject *)__pyx_n_s__pos1_maxin));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos1_maxin));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__aeraPixel));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 51, ((PyObject *)__pyx_n_s__aeraPixel));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__aeraPixel));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__fbin0_min));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 52, ((PyObject *)__pyx_n_s__fbin0_min));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fbin0_min));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__fbin0_max));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 53, ((PyObject *)__pyx_n_s__fbin0_max));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fbin0_max));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__fbin1_min));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 54, ((PyObject *)__pyx_n_s__fbin1_min));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fbin1_min));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__fbin1_max));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 55, ((PyObject *)__pyx_n_s__fbin1_max));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fbin1_max));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__a0));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 56, ((PyObject *)__pyx_n_s__a0));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__a0));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__a1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 57, ((PyObject *)__pyx_n_s__a1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__a1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__b0));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 58, ((PyObject *)__pyx_n_s__b0));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__b0));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__b1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 59, ((PyObject *)__pyx_n_s__b1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__b1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__c0));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 60, ((PyObject *)__pyx_n_s__c0));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__c0));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__c1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 61, ((PyObject *)__pyx_n_s__c1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__c1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__d0));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 62, ((PyObject *)__pyx_n_s__d0));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__d0));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__d1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 63, ((PyObject *)__pyx_n_s__d1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__d1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__epsilon));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 64, ((PyObject *)__pyx_n_s__epsilon));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__epsilon));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__bin0_max));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 65, ((PyObject *)__pyx_n_s__bin0_max));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin0_max));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__bin0_min));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 66, ((PyObject *)__pyx_n_s__bin0_min));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin0_min));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__bin1_max));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 67, ((PyObject *)__pyx_n_s__bin1_max));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin1_max));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__bin1_min));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 68, ((PyObject *)__pyx_n_s__bin1_min));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin1_min));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 69, ((PyObject *)__pyx_n_s__i));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 70, ((PyObject *)__pyx_n_s__j));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 71, ((PyObject *)__pyx_n_s__idx));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__dpos0));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 72, ((PyObject *)__pyx_n_s__dpos0));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dpos0));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__dpos1));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 73, ((PyObject *)__pyx_n_s__dpos1));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dpos1));
-  __Pyx_INCREF(((PyObject *)__pyx_n_s__check_dummy));
-  PyTuple_SET_ITEM(__pyx_k_tuple_77, 74, ((PyObject *)__pyx_n_s__check_dummy));
-  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__check_dummy));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_77));
   __pyx_k_codeobj_78 = (PyObject*)__Pyx_PyCode_New(12, 0, 75, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_77, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_76, __pyx_n_s__fullSplit2D, 305, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_78)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
@@ -22494,11 +21812,8 @@ static int __Pyx_InitCachedConstants(void) {
  * cdef strided = Enum("<strided and direct>") # default
  * cdef indirect = Enum("<strided and indirect>")
  */
-  __pyx_k_tuple_81 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_81)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_81 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_80)); if (unlikely(!__pyx_k_tuple_81)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_81);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_80));
-  PyTuple_SET_ITEM(__pyx_k_tuple_81, 0, ((PyObject *)__pyx_kp_s_80));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_80));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_81));
 
   /* "View.MemoryView":283
@@ -22508,11 +21823,8 @@ static int __Pyx_InitCachedConstants(void) {
  * cdef indirect = Enum("<strided and indirect>")
  * 
  */
-  __pyx_k_tuple_83 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_83)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_83 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_82)); if (unlikely(!__pyx_k_tuple_83)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_83);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_82));
-  PyTuple_SET_ITEM(__pyx_k_tuple_83, 0, ((PyObject *)__pyx_kp_s_82));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_82));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_83));
 
   /* "View.MemoryView":284
@@ -22522,11 +21834,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  * 
  */
-  __pyx_k_tuple_85 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_85)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_85 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_84)); if (unlikely(!__pyx_k_tuple_85)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_85);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_84));
-  PyTuple_SET_ITEM(__pyx_k_tuple_85, 0, ((PyObject *)__pyx_kp_s_84));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_84));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_85));
 
   /* "View.MemoryView":287
@@ -22536,11 +21845,8 @@ static int __Pyx_InitCachedConstants(void) {
  * cdef indirect_contiguous = Enum("<contiguous and indirect>")
  * 
  */
-  __pyx_k_tuple_87 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_87)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_87 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_86)); if (unlikely(!__pyx_k_tuple_87)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_87);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_86));
-  PyTuple_SET_ITEM(__pyx_k_tuple_87, 0, ((PyObject *)__pyx_kp_s_86));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_86));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_87));
 
   /* "View.MemoryView":288
@@ -22550,11 +21856,8 @@ static int __Pyx_InitCachedConstants(void) {
  * 
  * 
  */
-  __pyx_k_tuple_89 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_89)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_k_tuple_89 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_88)); if (unlikely(!__pyx_k_tuple_89)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_89);
-  __Pyx_INCREF(((PyObject *)__pyx_kp_s_88));
-  PyTuple_SET_ITEM(__pyx_k_tuple_89, 0, ((PyObject *)__pyx_kp_s_88));
-  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_88));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_89));
   __Pyx_RefNannyFinishContext();
   return 0;
@@ -22585,6 +21888,9 @@ PyMODINIT_FUNC PyInit_splitPixel(void)
 #endif
 {
   PyObject *__pyx_t_1 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannyDeclarations
   #if CYTHON_REFNANNY
   __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
@@ -22622,6 +21928,16 @@ PyMODINIT_FUNC PyInit_splitPixel(void)
   __pyx_m = PyModule_Create(&__pyx_moduledef);
   #endif
   if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  Py_INCREF(__pyx_d);
+  #if PY_MAJOR_VERSION >= 3
+  {
+    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (!PyDict_GetItemString(modules, "splitPixel")) {
+      if (unlikely(PyDict_SetItemString(modules, "splitPixel", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    }
+  }
+  #endif
   __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   #if CYTHON_COMPILING_IN_PYPY
   Py_INCREF(__pyx_b);
@@ -22629,6 +21945,9 @@ PyMODINIT_FUNC PyInit_splitPixel(void)
   if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
   /*--- Initialize various global constants etc. ---*/
   if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
+  if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  #endif
   if (__pyx_module_is_main_splitPixel) {
     if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
   }
@@ -22645,12 +21964,6 @@ PyMODINIT_FUNC PyInit_splitPixel(void)
   /*--- Variable export code ---*/
   /*--- Function export code ---*/
   /*--- Type init code ---*/
-  if (PyType_Ready(&__pyx_type___pyx_array) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "array", (PyObject *)&__pyx_type___pyx_array) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_array_type = &__pyx_type___pyx_array;
-  if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "Enum", (PyObject *)&__pyx_type___pyx_MemviewEnum) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
   __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview;
   __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer;
   __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice;
@@ -22661,8 +21974,11 @@ PyMODINIT_FUNC PyInit_splitPixel(void)
   __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object;
   if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "memoryview", (PyObject *)&__pyx_type___pyx_memoryview) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_memoryview_type = &__pyx_type___pyx_memoryview;
+  if (PyType_Ready(&__pyx_type___pyx_array) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_array_type = &__pyx_type___pyx_array;
+  if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
   __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice;
   __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview;
   __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object;
@@ -22670,7 +21986,6 @@ PyMODINIT_FUNC PyInit_splitPixel(void)
   __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type;
   if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (__Pyx_SetAttrString(__pyx_m, "_memoryviewslice", (PyObject *)&__pyx_type___pyx_memoryviewslice) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice;
   /*--- Type import code ---*/
   __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", 
@@ -22698,7 +22013,7 @@ PyMODINIT_FUNC PyInit_splitPixel(void)
  */
   __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__numpy, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s__numpy, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
   /* "splitPixel.pyx":101
@@ -22710,7 +22025,7 @@ PyMODINIT_FUNC PyInit_splitPixel(void)
  */
   __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10splitPixel_1fullSplit1D, NULL, __pyx_n_s__splitPixel); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__fullSplit1D, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s__fullSplit1D, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
   /* "splitPixel.pyx":305
@@ -22722,7 +22037,7 @@ PyMODINIT_FUNC PyInit_splitPixel(void)
  */
   __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10splitPixel_3fullSplit2D, NULL, __pyx_n_s__splitPixel); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__fullSplit2D, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s__fullSplit2D, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
   /* "splitPixel.pyx":1
@@ -22732,7 +22047,7 @@ PyMODINIT_FUNC PyInit_splitPixel(void)
  */
   __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
   /* "View.MemoryView":207
@@ -22758,9 +22073,8 @@ PyMODINIT_FUNC PyInit_splitPixel(void)
   __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_81), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_XGOTREF(generic);
-  __Pyx_DECREF(generic);
+  __Pyx_DECREF_SET(generic, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
-  generic = __pyx_t_1;
   __pyx_t_1 = 0;
 
   /* "View.MemoryView":283
@@ -22773,9 +22087,8 @@ PyMODINIT_FUNC PyInit_splitPixel(void)
   __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_83), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_XGOTREF(strided);
-  __Pyx_DECREF(strided);
+  __Pyx_DECREF_SET(strided, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
-  strided = __pyx_t_1;
   __pyx_t_1 = 0;
 
   /* "View.MemoryView":284
@@ -22788,9 +22101,8 @@ PyMODINIT_FUNC PyInit_splitPixel(void)
   __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_85), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_XGOTREF(indirect);
-  __Pyx_DECREF(indirect);
+  __Pyx_DECREF_SET(indirect, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
-  indirect = __pyx_t_1;
   __pyx_t_1 = 0;
 
   /* "View.MemoryView":287
@@ -22803,9 +22115,8 @@ PyMODINIT_FUNC PyInit_splitPixel(void)
   __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_87), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_XGOTREF(contiguous);
-  __Pyx_DECREF(contiguous);
+  __Pyx_DECREF_SET(contiguous, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
-  contiguous = __pyx_t_1;
   __pyx_t_1 = 0;
 
   /* "View.MemoryView":288
@@ -22818,9 +22129,8 @@ PyMODINIT_FUNC PyInit_splitPixel(void)
   __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_89), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_XGOTREF(indirect_contiguous);
-  __Pyx_DECREF(indirect_contiguous);
+  __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
-  indirect_contiguous = __pyx_t_1;
   __pyx_t_1 = 0;
 
   /* "View.MemoryView":503
@@ -22891,17 +22201,15 @@ end:
 }
 #endif /* CYTHON_REFNANNY */
 
-static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
-    PyObject *result;
-    result = PyObject_GetAttr(dict, name);
-    if (!result) {
-        if (dict != __pyx_b) {
-            PyErr_Clear();
-            result = PyObject_GetAttr(__pyx_b, name);
-        }
-        if (!result) {
-            PyErr_SetObject(PyExc_NameError, name);
-        }
+static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
+    PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
+    if (unlikely(!result)) {
+        PyErr_Format(PyExc_NameError,
+#if PY_MAJOR_VERSION >= 3
+            "name '%U' is not defined", name);
+#else
+            "name '%s' is not defined", PyString_AS_STRING(name));
+#endif
     }
     return result;
 }
@@ -23077,6 +22385,23 @@ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
     return 0;
 }
 
+static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
+    PyObject *result;
+#if CYTHON_COMPILING_IN_CPYTHON
+    result = PyDict_GetItem(__pyx_d, name);
+    if (result) {
+        Py_INCREF(result);
+    } else {
+#else
+    result = PyObject_GetItem(__pyx_d, name);
+    if (!result) {
+        PyErr_Clear();
+#endif
+        result = __Pyx_GetBuiltinName(name);
+    }
+    return result;
+}
+
 static CYTHON_INLINE int __Pyx_IsLittleEndian(void) {
   unsigned int n = 1;
   return *(unsigned char*)(&n) != 0;
@@ -23612,245 +22937,67 @@ static CYTHON_INLINE int __Pyx_GetBufferAndValidate(
   return 0;
 fail:;
   __Pyx_ZeroBuffer(buf);
-  return -1;
-}
-static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
-  if (info->buf == NULL) return;
-  if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
-  __Pyx_ReleaseBuffer(info);
-}
-
-static double __Pyx__PyObject_AsDouble(PyObject* obj) {
-    PyObject* float_value;
-#if CYTHON_COMPILING_IN_PYPY
-    float_value = PyNumber_Float(obj);
-#else
-    if (Py_TYPE(obj)->tp_as_number && Py_TYPE(obj)->tp_as_number->nb_float) {
-        return PyFloat_AsDouble(obj);
-    } else if (PyUnicode_CheckExact(obj) || PyBytes_CheckExact(obj)) {
-#if PY_MAJOR_VERSION >= 3
-        float_value = PyFloat_FromString(obj);
-#else
-        float_value = PyFloat_FromString(obj, 0);
-#endif
-    } else {
-        PyObject* args = PyTuple_New(1);
-        if (unlikely(!args)) goto bad;
-        PyTuple_SET_ITEM(args, 0, obj);
-        float_value = PyObject_Call((PyObject*)&PyFloat_Type, args, 0);
-        PyTuple_SET_ITEM(args, 0, 0);
-        Py_DECREF(args);
-    }
-#endif
-    if (likely(float_value)) {
-        double value = PyFloat_AS_DOUBLE(float_value);
-        Py_DECREF(float_value);
-        return value;
-    }
-bad:
-    return (double)-1;
-}
-
-static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
-    PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
-}
-
-static void __Pyx_RaiseUnboundMemoryviewSliceNogil(const char *varname) {
-    #ifdef WITH_THREAD
-    PyGILState_STATE gilstate = PyGILState_Ensure();
-    #endif
-    __Pyx_RaiseUnboundLocalError(varname);
-    #ifdef WITH_THREAD
-    PyGILState_Release(gilstate);
-    #endif
-}
-
-static int
-__pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b)
-{
-    int i;
-    if (!a || !b)
-        return 0;
-    if (a == b)
-        return 1;
-    if (a->size != b->size || a->typegroup != b->typegroup ||
-            a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) {
-        if (a->typegroup == 'H' || b->typegroup == 'H') {
-            return a->size == b->size;
-        } else {
-            return 0;
-        }
-    }
-    if (a->ndim) {
-        for (i = 0; i < a->ndim; i++)
-            if (a->arraysize[i] != b->arraysize[i])
-                return 0;
-    }
-    if (a->typegroup == 'S') {
-        if (a->flags != b->flags)
-            return 0;
-        if (a->fields || b->fields) {
-            if (!(a->fields && b->fields))
-                return 0;
-            for (i = 0; a->fields[i].type && b->fields[i].type; i++) {
-                __Pyx_StructField *field_a = a->fields + i;
-                __Pyx_StructField *field_b = b->fields + i;
-                if (field_a->offset != field_b->offset ||
-                    !__pyx_typeinfo_cmp(field_a->type, field_b->type))
-                    return 0;
-            }
-            return !a->fields[i].type && !b->fields[i].type;
-        }
-    }
-    return 1;
-}
-
-static int __Pyx_ValidateAndInit_memviewslice(
-                int *axes_specs,
-                int c_or_f_flag,
-                int buf_flags,
-                int ndim,
-                __Pyx_TypeInfo *dtype,
-                __Pyx_BufFmt_StackElem stack[],
-                __Pyx_memviewslice *memviewslice,
-                PyObject *original_obj)
-{
-    struct __pyx_memoryview_obj *memview, *new_memview;
-    __Pyx_RefNannyDeclarations
-    Py_buffer *buf;
-    int i, spec = 0, retval = -1;
-    __Pyx_BufFmt_Context ctx;
-    int from_memoryview = __pyx_memoryview_check(original_obj);
-    __Pyx_RefNannySetupContext("ValidateAndInit_memviewslice", 0);
-    if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((struct __pyx_memoryview_obj *)
-                                                            original_obj)->typeinfo)) {
-        memview = (struct __pyx_memoryview_obj *) original_obj;
-        new_memview = NULL;
-    } else {
-        memview = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
-                                            original_obj, buf_flags, 0, dtype);
-        new_memview = memview;
-        if (unlikely(!memview))
-            goto fail;
-    }
-    buf = &memview->view;
-    if (buf->ndim != ndim) {
-        PyErr_Format(PyExc_ValueError,
-                "Buffer has wrong number of dimensions (expected %d, got %d)",
-                ndim, buf->ndim);
-        goto fail;
-    }
-    if (new_memview) {
-        __Pyx_BufFmt_Init(&ctx, stack, dtype);
-        if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
-    }
-    if ((unsigned)buf->itemsize != dtype->size) {
-        PyErr_Format(PyExc_ValueError,
-                     "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "u byte%s) "
-                     "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "u byte%s)",
-                     buf->itemsize,
-                     (buf->itemsize > 1) ? "s" : "",
-                     dtype->name,
-                     dtype->size,
-                     (dtype->size > 1) ? "s" : "");
-        goto fail;
-    }
-    for (i = 0; i < ndim; i++) {
-        spec = axes_specs[i];
-        if (buf->strides) {
-            if (spec & __Pyx_MEMVIEW_CONTIG) {
-                if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) {
-                    if (buf->strides[i] != sizeof(void *)) {
-                        PyErr_Format(PyExc_ValueError,
-                            "Buffer is not indirectly contiguous in dimension %d.", i);
-                        goto fail;
-                    }
-                } else if (buf->strides[i] != buf->itemsize) {
-                    PyErr_SetString(PyExc_ValueError,
-                        "Buffer and memoryview are not contiguous in the same dimension.");
-                    goto fail;
-                }
-            }
-            if (spec & __Pyx_MEMVIEW_FOLLOW) {
-                Py_ssize_t stride = buf->strides[i];
-                if (stride < 0)
-                    stride = -stride;
-                if (stride < buf->itemsize) {
-                    PyErr_SetString(PyExc_ValueError,
-                        "Buffer and memoryview are not contiguous in the same dimension.");
-                    goto fail;
-                }
-            }
-        } else {
-            if (spec & __Pyx_MEMVIEW_CONTIG && i != ndim - 1) {
-                PyErr_Format(PyExc_ValueError,
-                             "C-contiguous buffer is not contiguous in "
-                             "dimension %d", i);
-                goto fail;
-            } else if (spec & (__Pyx_MEMVIEW_PTR)) {
-                PyErr_Format(PyExc_ValueError,
-                             "C-contiguous buffer is not indirect in "
-                             "dimension %d", i);
-                goto fail;
-            } else if (buf->suboffsets) {
-                PyErr_SetString(PyExc_ValueError,
-                                "Buffer exposes suboffsets but no strides");
-                goto fail;
-            }
-        }
-        /* Todo: without PyBUF_INDIRECT we may not have suboffset information, i.e., the
-           ptr may not be set to NULL but may be uninitialized? */
-        if (spec & __Pyx_MEMVIEW_DIRECT) {
-            if (buf->suboffsets && buf->suboffsets[i] >= 0) {
-                PyErr_Format(PyExc_ValueError,
-                    "Buffer not compatible with direct access in dimension %d.", i);
-                goto fail;
-            }
-        }
-        if (spec & __Pyx_MEMVIEW_PTR) {
-            if (!buf->suboffsets || (buf->suboffsets && buf->suboffsets[i] < 0)) {
-                PyErr_Format(PyExc_ValueError,
-                    "Buffer is not indirectly accessisble in dimension %d.", i);
-                goto fail;
-            }
-        }
-    }
-    if (buf->strides) {
-        if (c_or_f_flag & __Pyx_IS_F_CONTIG) {
-            Py_ssize_t stride = 1;
-            for (i=0; i<ndim; i++) {
-                if (stride * buf->itemsize != buf->strides[i]) {
-                    PyErr_SetString(PyExc_ValueError,
-                        "Buffer not fortran contiguous.");
-                    goto fail;
-                }
-                stride = stride * buf->shape[i];
-            }
-        } else if (c_or_f_flag & __Pyx_IS_C_CONTIG) {
-            Py_ssize_t stride = 1;
-            for (i = ndim-1; i>-1; i--) {
-                if(stride * buf->itemsize != buf->strides[i]) {
-                    PyErr_SetString(PyExc_ValueError,
-                        "Buffer not C contiguous.");
-                    goto fail;
-                }
-                stride = stride * buf->shape[i];
-            }
+  return -1;
+}
+static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
+  if (info->buf == NULL) return;
+  if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
+  __Pyx_ReleaseBuffer(info);
+}
+
+static double __Pyx__PyObject_AsDouble(PyObject* obj) {
+    PyObject* float_value;
+#if CYTHON_COMPILING_IN_PYPY
+    float_value = PyNumber_Float(obj);
+#else
+    PyNumberMethods *nb = Py_TYPE(obj)->tp_as_number;
+    if (likely(nb) && likely(nb->nb_float)) {
+        float_value = nb->nb_float(obj);
+        if (likely(float_value) && unlikely(!PyFloat_Check(float_value))) {
+            PyErr_Format(PyExc_TypeError,
+                "__float__ returned non-float (type %.200s)",
+                Py_TYPE(float_value)->tp_name);
+            Py_DECREF(float_value);
+            goto bad;
         }
+    } else if (PyUnicode_CheckExact(obj) || PyBytes_CheckExact(obj)) {
+#if PY_MAJOR_VERSION >= 3
+        float_value = PyFloat_FromString(obj);
+#else
+        float_value = PyFloat_FromString(obj, 0);
+#endif
+    } else {
+        PyObject* args = PyTuple_New(1);
+        if (unlikely(!args)) goto bad;
+        PyTuple_SET_ITEM(args, 0, obj);
+        float_value = PyObject_Call((PyObject*)&PyFloat_Type, args, 0);
+        PyTuple_SET_ITEM(args, 0, 0);
+        Py_DECREF(args);
     }
-    if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice,
-                                         new_memview != NULL) == -1)) {
-        goto fail;
+#endif
+    if (likely(float_value)) {
+        double value = PyFloat_AS_DOUBLE(float_value);
+        Py_DECREF(float_value);
+        return value;
     }
-    retval = 0;
-    goto no_fail;
-fail:
-    Py_XDECREF(new_memview);
-    retval = -1;
-no_fail:
-    __Pyx_RefNannyFinishContext();
-    return retval;
+bad:
+    return (double)-1;
+}
+
+static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
+    PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
+}
+
+static void __Pyx_RaiseUnboundMemoryviewSliceNogil(const char *varname) {
+    #ifdef WITH_THREAD
+    PyGILState_STATE gilstate = PyGILState_Ensure();
+    #endif
+    __Pyx_RaiseUnboundLocalError(varname);
+    #ifdef WITH_THREAD
+    PyGILState_Release(gilstate);
+    #endif
 }
+
 static int
 __Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview,
                         int ndim,
@@ -24177,24 +23324,23 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
         }
         value = type;
         #if PY_VERSION_HEX < 0x02050000
-            if (PyInstance_Check(type)) {
-                type = (PyObject*) ((PyInstanceObject*)type)->in_class;
-                Py_INCREF(type);
-            }
-            else {
-                type = 0;
-                PyErr_SetString(PyExc_TypeError,
-                    "raise: exception must be an old-style class or instance");
-                goto raise_error;
-            }
-        #else
-            type = (PyObject*) Py_TYPE(type);
+        if (PyInstance_Check(type)) {
+            type = (PyObject*) ((PyInstanceObject*)type)->in_class;
             Py_INCREF(type);
-            if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
-                PyErr_SetString(PyExc_TypeError,
-                    "raise: exception class must be a subclass of BaseException");
-                goto raise_error;
-            }
+        } else {
+            type = 0;
+            PyErr_SetString(PyExc_TypeError,
+                "raise: exception must be an old-style class or instance");
+            goto raise_error;
+        }
+        #else
+        type = (PyObject*) Py_TYPE(type);
+        Py_INCREF(type);
+        if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
+            PyErr_SetString(PyExc_TypeError,
+                "raise: exception class must be a subclass of BaseException");
+            goto raise_error;
+        }
         #endif
     }
     __Pyx_ErrRestore(type, value, tb);
@@ -24226,46 +23372,62 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject
         value = type;
         type = (PyObject*) Py_TYPE(value);
     } else if (PyExceptionClass_Check(type)) {
-        PyObject *args;
-        if (!value)
-            args = PyTuple_New(0);
-        else if (PyTuple_Check(value)) {
-            Py_INCREF(value);
-            args = value;
+        PyObject *instance_class = NULL;
+        if (value && PyExceptionInstance_Check(value)) {
+            instance_class = (PyObject*) Py_TYPE(value);
+            if (instance_class != type) {
+                if (PyObject_IsSubclass(instance_class, type)) {
+                    type = instance_class;
+                } else {
+                    instance_class = NULL;
+                }
+            }
         }
-        else
-            args = PyTuple_Pack(1, value);
-        if (!args)
-            goto bad;
-        owned_instance = PyEval_CallObject(type, args);
-        Py_DECREF(args);
-        if (!owned_instance)
-            goto bad;
-        value = owned_instance;
-        if (!PyExceptionInstance_Check(value)) {
-            PyErr_Format(PyExc_TypeError,
-                         "calling %R should have returned an instance of "
-                         "BaseException, not %R",
-                         type, Py_TYPE(value));
-            goto bad;
+        if (!instance_class) {
+            PyObject *args;
+            if (!value)
+                args = PyTuple_New(0);
+            else if (PyTuple_Check(value)) {
+                Py_INCREF(value);
+                args = value;
+            } else
+                args = PyTuple_Pack(1, value);
+            if (!args)
+                goto bad;
+            owned_instance = PyObject_Call(type, args, NULL);
+            Py_DECREF(args);
+            if (!owned_instance)
+                goto bad;
+            value = owned_instance;
+            if (!PyExceptionInstance_Check(value)) {
+                PyErr_Format(PyExc_TypeError,
+                             "calling %R should have returned an instance of "
+                             "BaseException, not %R",
+                             type, Py_TYPE(value));
+                goto bad;
+            }
         }
     } else {
         PyErr_SetString(PyExc_TypeError,
             "raise: exception class must be a subclass of BaseException");
         goto bad;
     }
+#if PY_VERSION_HEX >= 0x03030000
+    if (cause) {
+#else
     if (cause && cause != Py_None) {
+#endif
         PyObject *fixed_cause;
-        if (PyExceptionClass_Check(cause)) {
+        if (cause == Py_None) {
+            fixed_cause = NULL;
+        } else if (PyExceptionClass_Check(cause)) {
             fixed_cause = PyObject_CallObject(cause, NULL);
             if (fixed_cause == NULL)
                 goto bad;
-        }
-        else if (PyExceptionInstance_Check(cause)) {
+        } else if (PyExceptionInstance_Check(cause)) {
             fixed_cause = cause;
             Py_INCREF(fixed_cause);
-        }
-        else {
+        } else {
             PyErr_SetString(PyExc_TypeError,
                             "exception causes must derive from "
                             "BaseException");
@@ -24289,8 +23451,20 @@ bad:
 }
 #endif
 
+static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
+#if CYTHON_COMPILING_IN_CPYTHON
+#if PY_MAJOR_VERSION >= 3
+    if (likely(PyUnicode_Check(n)))
+#else
+    if (likely(PyString_Check(n)))
+#endif
+        return __Pyx_PyObject_GetAttrStr(o, n);
+#endif
+    return PyObject_GetAttr(o, n);
+}
+
 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
-    PyObject *r = PyObject_GetAttr(o, n);
+    PyObject *r = __Pyx_GetAttr(o, n);
     if (!r) {
         if (!PyErr_ExceptionMatches(PyExc_AttributeError))
             goto bad;
@@ -24382,6 +23556,84 @@ static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
     }
 }
 
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
+    PyObject *r;
+    if (!j) return NULL;
+    r = PyObject_GetItem(o, j);
+    Py_DECREF(j);
+    return r;
+}
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
+                                                              int wraparound, int boundscheck) {
+#if CYTHON_COMPILING_IN_CPYTHON
+    if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o);
+    if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
+        PyObject *r = PyList_GET_ITEM(o, i);
+        Py_INCREF(r);
+        return r;
+    }
+    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+#else
+    return PySequence_GetItem(o, i);
+#endif
+}
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
+                                                              int wraparound, int boundscheck) {
+#if CYTHON_COMPILING_IN_CPYTHON
+    if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o);
+    if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
+        PyObject *r = PyTuple_GET_ITEM(o, i);
+        Py_INCREF(r);
+        return r;
+    }
+    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+#else
+    return PySequence_GetItem(o, i);
+#endif
+}
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
+                                                     int is_list, int wraparound, int boundscheck) {
+#if CYTHON_COMPILING_IN_CPYTHON
+    if (is_list || PyList_CheckExact(o)) {
+        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
+        if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) {
+            PyObject *r = PyList_GET_ITEM(o, n);
+            Py_INCREF(r);
+            return r;
+        }
+    }
+    else if (PyTuple_CheckExact(o)) {
+        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
+        if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
+            PyObject *r = PyTuple_GET_ITEM(o, n);
+            Py_INCREF(r);
+            return r;
+        }
+    } else {
+        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
+        if (likely(m && m->sq_item)) {
+            if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
+                Py_ssize_t l = m->sq_length(o);
+                if (likely(l >= 0)) {
+                    i += l;
+                } else {
+                    if (PyErr_ExceptionMatches(PyExc_OverflowError))
+                        PyErr_Clear();
+                    else
+                        return NULL;
+                }
+            }
+            return m->sq_item(o, i);
+        }
+    }
+#else
+    if (is_list || PySequence_Check(o)) {
+        return PySequence_GetItem(o, i);
+    }
+#endif
+    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+}
+
 static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
     long q = a / b;
     long r = a - q*b;
@@ -24389,6 +23641,42 @@ static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
     return q;
 }
 
+static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
+                                  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename) {
+    PyObject *old_exc, *old_val, *old_tb;
+    PyObject *ctx;
+    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
+    #if PY_MAJOR_VERSION < 3
+    ctx = PyString_FromString(name);
+    #else
+    ctx = PyUnicode_FromString(name);
+    #endif
+    __Pyx_ErrRestore(old_exc, old_val, old_tb);
+    if (!ctx) {
+        PyErr_WriteUnraisable(Py_None);
+    } else {
+        PyErr_WriteUnraisable(ctx);
+        Py_DECREF(ctx);
+    }
+}
+
+static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
+#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
+    PyObject *ob = PyCapsule_New(vtable, 0, 0);
+#else
+    PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
+#endif
+    if (!ob)
+        goto bad;
+    if (PyDict_SetItem(dict, __pyx_n_s____pyx_vtable__, ob) < 0)
+        goto bad;
+    Py_DECREF(ob);
+    return 0;
+bad:
+    Py_XDECREF(ob);
+    return -1;
+}
+
 static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
 #if CYTHON_COMPILING_IN_CPYTHON
     PyThreadState *tstate = PyThreadState_GET();
@@ -24422,7 +23710,6 @@ static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb)
 
 #if PY_MAJOR_VERSION < 3
 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
-    CYTHON_UNUSED PyObject *getbuffer_cobj;
   #if PY_VERSION_HEX >= 0x02060000
     if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
   #endif
@@ -24430,21 +23717,18 @@ static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
         if (PyObject_TypeCheck(obj, __pyx_array_type)) return __pyx_array_getbuffer(obj, view, flags);
         if (PyObject_TypeCheck(obj, __pyx_memoryview_type)) return __pyx_memoryview_getbuffer(obj, view, flags);
   #if PY_VERSION_HEX < 0x02060000
-    if (obj->ob_type->tp_dict &&
-        (getbuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict,
-                                             "__pyx_getbuffer"))) {
-        getbufferproc func;
-      #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0)
-        func = (getbufferproc) PyCapsule_GetPointer(getbuffer_cobj, "getbuffer(obj, view, flags)");
-      #else
-        func = (getbufferproc) PyCObject_AsVoidPtr(getbuffer_cobj);
-      #endif
-        Py_DECREF(getbuffer_cobj);
-        if (!func)
-            goto fail;
-        return func(obj, view, flags);
-    } else {
-        PyErr_Clear();
+    if (obj->ob_type->tp_dict) {
+        PyObject *getbuffer_cobj = PyObject_GetItem(
+            obj->ob_type->tp_dict, __pyx_n_s____pyx_getbuffer);
+        if (getbuffer_cobj) {
+            getbufferproc func = (getbufferproc) PyCObject_AsVoidPtr(getbuffer_cobj);
+            Py_DECREF(getbuffer_cobj);
+            if (!func)
+                goto fail;
+            return func(obj, view, flags);
+        } else {
+            PyErr_Clear();
+        }
     }
   #endif
     PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
@@ -24455,7 +23739,6 @@ fail:
 }
 static void __Pyx_ReleaseBuffer(Py_buffer *view) {
     PyObject *obj = view->obj;
-    CYTHON_UNUSED PyObject *releasebuffer_cobj;
     if (!obj) return;
   #if PY_VERSION_HEX >= 0x02060000
     if (PyObject_CheckBuffer(obj)) {
@@ -24465,22 +23748,19 @@ static void __Pyx_ReleaseBuffer(Py_buffer *view) {
   #endif
         if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) { __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view); return; }
   #if PY_VERSION_HEX < 0x02060000
-    if (obj->ob_type->tp_dict &&
-        (releasebuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict,
-                                                      "__pyx_releasebuffer"))) {
-        releasebufferproc func;
-      #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0)
-        func = (releasebufferproc) PyCapsule_GetPointer(releasebuffer_cobj, "releasebuffer(obj, view)");
-      #else
-        func = (releasebufferproc) PyCObject_AsVoidPtr(releasebuffer_cobj);
-      #endif
-        Py_DECREF(releasebuffer_cobj);
-        if (!func)
-            goto fail;
-        func(obj, view);
-        return;
-    } else {
-        PyErr_Clear();
+    if (obj->ob_type->tp_dict) {
+        PyObject *releasebuffer_cobj = PyObject_GetItem(
+            obj->ob_type->tp_dict, __pyx_n_s____pyx_releasebuffer);
+        if (releasebuffer_cobj) {
+            releasebufferproc func = (releasebufferproc) PyCObject_AsVoidPtr(releasebuffer_cobj);
+            Py_DECREF(releasebuffer_cobj);
+            if (!func)
+                goto fail;
+            func(obj, view);
+            return;
+        } else {
+            PyErr_Clear();
+        }
     }
   #endif
     goto nofail;
@@ -24495,16 +23775,18 @@ nofail:
 #endif /*  PY_MAJOR_VERSION < 3 */
 
 
-      static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) {
-    PyObject *py_import = 0;
+          static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
     PyObject *empty_list = 0;
     PyObject *module = 0;
     PyObject *global_dict = 0;
     PyObject *empty_dict = 0;
     PyObject *list;
-    py_import = __Pyx_GetAttrString(__pyx_b, "__import__");
+    #if PY_VERSION_HEX < 0x03030000
+    PyObject *py_import;
+    py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s____import__);
     if (!py_import)
         goto bad;
+    #endif
     if (from_list)
         list = from_list;
     else {
@@ -24524,13 +23806,17 @@ nofail:
         #if PY_MAJOR_VERSION >= 3
         if (level == -1) {
             if (strchr(__Pyx_MODULE_NAME, '.')) {
-                /* try package relative import first */
+                #if PY_VERSION_HEX < 0x03030000
                 PyObject *py_level = PyInt_FromLong(1);
                 if (!py_level)
                     goto bad;
                 module = PyObject_CallFunctionObjArgs(py_import,
                     name, global_dict, empty_dict, list, py_level, NULL);
                 Py_DECREF(py_level);
+                #else
+                module = PyImport_ImportModuleLevelObject(
+                    name, global_dict, empty_dict, list, 1);
+                #endif
                 if (!module) {
                     if (!PyErr_ExceptionMatches(PyExc_ImportError))
                         goto bad;
@@ -24541,12 +23827,17 @@ nofail:
         }
         #endif
         if (!module) {
+            #if PY_VERSION_HEX < 0x03030000
             PyObject *py_level = PyInt_FromLong(level);
             if (!py_level)
                 goto bad;
             module = PyObject_CallFunctionObjArgs(py_import,
                 name, global_dict, empty_dict, list, py_level, NULL);
             Py_DECREF(py_level);
+            #else
+            module = PyImport_ImportModuleLevelObject(
+                name, global_dict, empty_dict, list, level);
+            #endif
         }
     }
     #else
@@ -24558,8 +23849,10 @@ nofail:
         name, global_dict, empty_dict, list, NULL);
     #endif
 bad:
-    Py_XDECREF(empty_list);
+    #if PY_VERSION_HEX < 0x03030000
     Py_XDECREF(py_import);
+    #endif
+    Py_XDECREF(empty_list);
     Py_XDECREF(empty_dict);
     return module;
 }
@@ -24915,7 +24208,7 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
     }
     __Pyx_GOTREF(shape_tuple);
     for(i = 0; i < ndim; i++) {
-        temp_int = PyInt_FromLong(from_mvs->shape[i]);
+        temp_int = PyInt_FromSsize_t(from_mvs->shape[i]);
         if(unlikely(!temp_int)) {
             goto fail;
         } else {
@@ -24953,7 +24246,7 @@ no_fail:
 }
 
 static CYTHON_INLINE PyObject *
-__pyx_capsule_create(void *p, const char *sig)
+__pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig)
 {
     PyObject *cobj;
 #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0)
@@ -25154,10 +24447,15 @@ static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) {
     return (int)__Pyx_PyInt_AsLong(x);
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
     const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -25170,6 +24468,16 @@ static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(unsigned long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (unsigned long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to unsigned long");
@@ -25177,6 +24485,17 @@ static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
             }
             return (unsigned long)PyLong_AsUnsignedLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(unsigned long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(unsigned long) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(unsigned long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (unsigned long)PyLong_AsLong(x);
         }
     } else {
@@ -25189,10 +24508,15 @@ static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
     }
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
     const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -25205,6 +24529,16 @@ static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObje
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to unsigned PY_LONG_LONG");
@@ -25212,6 +24546,17 @@ static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObje
             }
             return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x);
         }
     } else {
@@ -25224,10 +24569,15 @@ static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObje
     }
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
     const long neg_one = (long)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -25240,6 +24590,16 @@ static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to long");
@@ -25247,6 +24607,17 @@ static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
             }
             return (long)PyLong_AsUnsignedLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(long) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (long)PyLong_AsLong(x);
         }
     } else {
@@ -25259,10 +24630,15 @@ static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
     }
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
     const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -25275,6 +24651,16 @@ static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to PY_LONG_LONG");
@@ -25282,6 +24668,17 @@ static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
             }
             return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (PY_LONG_LONG)PyLong_AsLongLong(x);
         }
     } else {
@@ -25294,10 +24691,15 @@ static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
     }
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
     const signed long neg_one = (signed long)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -25310,6 +24712,16 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(signed long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (signed long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to signed long");
@@ -25317,6 +24729,17 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
             }
             return (signed long)PyLong_AsUnsignedLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(signed long)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(signed long) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(signed long) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (signed long)PyLong_AsLong(x);
         }
     } else {
@@ -25329,10 +24752,15 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
     }
 }
 
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+#include "longintrepr.h"
+#endif
+#endif
 static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
     const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0;
     const int is_unsigned = neg_one > const_zero;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (likely(PyInt_Check(x))) {
         long val = PyInt_AS_LONG(x);
         if (is_unsigned && unlikely(val < 0)) {
@@ -25345,6 +24773,16 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject*
 #endif
     if (likely(PyLong_Check(x))) {
         if (is_unsigned) {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return (signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             if (unlikely(Py_SIZE(x) < 0)) {
                 PyErr_SetString(PyExc_OverflowError,
                                 "can't convert negative value to signed PY_LONG_LONG");
@@ -25352,6 +24790,17 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject*
             }
             return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
         } else {
+#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+#if CYTHON_USE_PYLONG_INTERNALS
+            if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) {
+                switch (Py_SIZE(x)) {
+                    case  0: return 0;
+                    case  1: return +(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                    case -1: return -(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
+                }
+            }
+#endif
+#endif
             return (signed PY_LONG_LONG)PyLong_AsLongLong(x);
         }
     } else {
@@ -25364,6 +24813,227 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject*
     }
 }
 
+static int
+__pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b)
+{
+    int i;
+    if (!a || !b)
+        return 0;
+    if (a == b)
+        return 1;
+    if (a->size != b->size || a->typegroup != b->typegroup ||
+            a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) {
+        if (a->typegroup == 'H' || b->typegroup == 'H') {
+            return a->size == b->size;
+        } else {
+            return 0;
+        }
+    }
+    if (a->ndim) {
+        for (i = 0; i < a->ndim; i++)
+            if (a->arraysize[i] != b->arraysize[i])
+                return 0;
+    }
+    if (a->typegroup == 'S') {
+        if (a->flags != b->flags)
+            return 0;
+        if (a->fields || b->fields) {
+            if (!(a->fields && b->fields))
+                return 0;
+            for (i = 0; a->fields[i].type && b->fields[i].type; i++) {
+                __Pyx_StructField *field_a = a->fields + i;
+                __Pyx_StructField *field_b = b->fields + i;
+                if (field_a->offset != field_b->offset ||
+                    !__pyx_typeinfo_cmp(field_a->type, field_b->type))
+                    return 0;
+            }
+            return !a->fields[i].type && !b->fields[i].type;
+        }
+    }
+    return 1;
+}
+
+static int
+__pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec)
+{
+    if (buf->shape[dim] <= 1)
+        return 1;
+    if (buf->strides) {
+        if (spec & __Pyx_MEMVIEW_CONTIG) {
+            if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) {
+                if (buf->strides[dim] != sizeof(void *)) {
+                    PyErr_Format(PyExc_ValueError,
+                                 "Buffer is not indirectly contiguous "
+                                 "in dimension %d.", dim);
+                    goto fail;
+                }
+            } else if (buf->strides[dim] != buf->itemsize) {
+                PyErr_SetString(PyExc_ValueError,
+                                "Buffer and memoryview are not contiguous "
+                                "in the same dimension.");
+                goto fail;
+            }
+        }
+        if (spec & __Pyx_MEMVIEW_FOLLOW) {
+            Py_ssize_t stride = buf->strides[dim];
+            if (stride < 0)
+                stride = -stride;
+            if (stride < buf->itemsize) {
+                PyErr_SetString(PyExc_ValueError,
+                                "Buffer and memoryview are not contiguous "
+                                "in the same dimension.");
+                goto fail;
+            }
+        }
+    } else {
+        if (spec & __Pyx_MEMVIEW_CONTIG && dim != ndim - 1) {
+            PyErr_Format(PyExc_ValueError,
+                         "C-contiguous buffer is not contiguous in "
+                         "dimension %d", dim);
+            goto fail;
+        } else if (spec & (__Pyx_MEMVIEW_PTR)) {
+            PyErr_Format(PyExc_ValueError,
+                         "C-contiguous buffer is not indirect in "
+                         "dimension %d", dim);
+            goto fail;
+        } else if (buf->suboffsets) {
+            PyErr_SetString(PyExc_ValueError,
+                            "Buffer exposes suboffsets but no strides");
+            goto fail;
+        }
+    }
+    return 1;
+fail:
+    return 0;
+}
+static int
+__pyx_check_suboffsets(Py_buffer *buf, int dim, CYTHON_UNUSED int ndim, int spec)
+{
+    if (spec & __Pyx_MEMVIEW_DIRECT) {
+        if (buf->suboffsets && buf->suboffsets[dim] >= 0) {
+            PyErr_Format(PyExc_ValueError,
+                         "Buffer not compatible with direct access "
+                         "in dimension %d.", dim);
+            goto fail;
+        }
+    }
+    if (spec & __Pyx_MEMVIEW_PTR) {
+        if (!buf->suboffsets || (buf->suboffsets && buf->suboffsets[dim] < 0)) {
+            PyErr_Format(PyExc_ValueError,
+                         "Buffer is not indirectly accessisble "
+                         "in dimension %d.", dim);
+            goto fail;
+        }
+    }
+    return 1;
+fail:
+    return 0;
+}
+static int
+__pyx_verify_contig(Py_buffer *buf, int ndim, int c_or_f_flag)
+{
+    int i;
+    if (c_or_f_flag & __Pyx_IS_F_CONTIG) {
+        Py_ssize_t stride = 1;
+        for (i = 0; i < ndim; i++) {
+            if (stride * buf->itemsize != buf->strides[i] &&
+                    buf->shape[i] > 1)
+            {
+                PyErr_SetString(PyExc_ValueError,
+                    "Buffer not fortran contiguous.");
+                goto fail;
+            }
+            stride = stride * buf->shape[i];
+        }
+    } else if (c_or_f_flag & __Pyx_IS_C_CONTIG) {
+        Py_ssize_t stride = 1;
+        for (i = ndim - 1; i >- 1; i--) {
+            if (stride * buf->itemsize != buf->strides[i] &&
+                    buf->shape[i] > 1) {
+                PyErr_SetString(PyExc_ValueError,
+                    "Buffer not C contiguous.");
+                goto fail;
+            }
+            stride = stride * buf->shape[i];
+        }
+    }
+    return 1;
+fail:
+    return 0;
+}
+static int __Pyx_ValidateAndInit_memviewslice(
+                int *axes_specs,
+                int c_or_f_flag,
+                int buf_flags,
+                int ndim,
+                __Pyx_TypeInfo *dtype,
+                __Pyx_BufFmt_StackElem stack[],
+                __Pyx_memviewslice *memviewslice,
+                PyObject *original_obj)
+{
+    struct __pyx_memoryview_obj *memview, *new_memview;
+    __Pyx_RefNannyDeclarations
+    Py_buffer *buf;
+    int i, spec = 0, retval = -1;
+    __Pyx_BufFmt_Context ctx;
+    int from_memoryview = __pyx_memoryview_check(original_obj);
+    __Pyx_RefNannySetupContext("ValidateAndInit_memviewslice", 0);
+    if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((struct __pyx_memoryview_obj *)
+                                                            original_obj)->typeinfo)) {
+        memview = (struct __pyx_memoryview_obj *) original_obj;
+        new_memview = NULL;
+    } else {
+        memview = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
+                                            original_obj, buf_flags, 0, dtype);
+        new_memview = memview;
+        if (unlikely(!memview))
+            goto fail;
+    }
+    buf = &memview->view;
+    if (buf->ndim != ndim) {
+        PyErr_Format(PyExc_ValueError,
+                "Buffer has wrong number of dimensions (expected %d, got %d)",
+                ndim, buf->ndim);
+        goto fail;
+    }
+    if (new_memview) {
+        __Pyx_BufFmt_Init(&ctx, stack, dtype);
+        if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
+    }
+    if ((unsigned) buf->itemsize != dtype->size) {
+        PyErr_Format(PyExc_ValueError,
+                     "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "u byte%s) "
+                     "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "u byte%s)",
+                     buf->itemsize,
+                     (buf->itemsize > 1) ? "s" : "",
+                     dtype->name,
+                     dtype->size,
+                     (dtype->size > 1) ? "s" : "");
+        goto fail;
+    }
+    for (i = 0; i < ndim; i++) {
+        spec = axes_specs[i];
+        if (!__pyx_check_strides(buf, i, ndim, spec))
+            goto fail;
+        if (!__pyx_check_suboffsets(buf, i, ndim, spec))
+            goto fail;
+    }
+    if (buf->strides && !__pyx_verify_contig(buf, ndim, c_or_f_flag))
+        goto fail;
+    if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice,
+                                         new_memview != NULL) == -1)) {
+        goto fail;
+    }
+    retval = 0;
+    goto no_fail;
+fail:
+    Py_XDECREF(new_memview);
+    retval = -1;
+no_fail:
+    __Pyx_RefNannyFinishContext();
+    return retval;
+}
+
 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int8_t(PyObject *obj) {
     __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
     __Pyx_BufFmt_StackElem stack[1];
@@ -25408,25 +25078,6 @@ __pyx_fail:
     return result;
 }
 
-static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
-                                  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename) {
-    PyObject *old_exc, *old_val, *old_tb;
-    PyObject *ctx;
-    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
-    #if PY_MAJOR_VERSION < 3
-    ctx = PyString_FromString(name);
-    #else
-    ctx = PyUnicode_FromString(name);
-    #endif
-    __Pyx_ErrRestore(old_exc, old_val, old_tb);
-    if (!ctx) {
-        PyErr_WriteUnraisable(Py_None);
-    } else {
-        PyErr_WriteUnraisable(ctx);
-        Py_DECREF(ctx);
-    }
-}
-
 static int __Pyx_check_binary_version(void) {
     char ctversion[4], rtversion[4];
     PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
@@ -25446,23 +25097,6 @@ static int __Pyx_check_binary_version(void) {
     return 0;
 }
 
-static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
-#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
-    PyObject *ob = PyCapsule_New(vtable, 0, 0);
-#else
-    PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
-#endif
-    if (!ob)
-        goto bad;
-    if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0)
-        goto bad;
-    Py_DECREF(ob);
-    return 0;
-bad:
-    Py_XDECREF(ob);
-    return -1;
-}
-
 #ifndef __PYX_HAVE_RT_ImportModule
 #define __PYX_HAVE_RT_ImportModule
 static PyObject *__Pyx_ImportModule(const char *name) {
@@ -25489,6 +25123,10 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class
     PyObject *result = 0;
     PyObject *py_name = 0;
     char warning[200];
+    Py_ssize_t basicsize;
+#ifdef Py_LIMITED_API
+    PyObject *py_basicsize;
+#endif
     py_module = __Pyx_ImportModule(module_name);
     if (!py_module)
         goto bad;
@@ -25508,7 +25146,19 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class
             module_name, class_name);
         goto bad;
     }
-    if (!strict && (size_t)((PyTypeObject *)result)->tp_basicsize > size) {
+#ifndef Py_LIMITED_API
+    basicsize = ((PyTypeObject *)result)->tp_basicsize;
+#else
+    py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
+    if (!py_basicsize)
+        goto bad;
+    basicsize = PyLong_AsSsize_t(py_basicsize);
+    Py_DECREF(py_basicsize);
+    py_basicsize = 0;
+    if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
+        goto bad;
+#endif
+    if (!strict && (size_t)basicsize > size) {
         PyOS_snprintf(warning, sizeof(warning),
             "%s.%s size changed, may indicate binary incompatibility",
             module_name, class_name);
@@ -25518,7 +25168,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class
         if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
         #endif
     }
-    else if ((size_t)((PyTypeObject *)result)->tp_basicsize != size) {
+    else if ((size_t)basicsize != size) {
         PyErr_Format(PyExc_ValueError,
             "%s.%s has the wrong size, try recompiling",
             module_name, class_name);
@@ -25724,27 +25374,82 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
     return 0;
 }
 
-
-/* Type Conversion Functions */
-
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char* c_str) {
+    return __Pyx_PyUnicode_FromStringAndSize(c_str, strlen(c_str));
+}
+static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
+    Py_ssize_t ignore;
+    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
+}
+static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
+    if (
+#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+            __Pyx_sys_getdefaultencoding_not_ascii &&
+#endif
+            PyUnicode_Check(o)) {
+#if PY_VERSION_HEX < 0x03030000
+        char* defenc_c;
+        PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
+        if (!defenc) return NULL;
+        defenc_c = PyBytes_AS_STRING(defenc);
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+        {
+            char* end = defenc_c + PyBytes_GET_SIZE(defenc);
+            char* c;
+            for (c = defenc_c; c < end; c++) {
+                if ((unsigned char) (*c) >= 128) {
+                    PyUnicode_AsASCIIString(o);
+                    return NULL;
+                }
+            }
+        }
+#endif /*__PYX_DEFAULT_STRING_ENCODING_IS_ASCII*/
+        *length = PyBytes_GET_SIZE(defenc);
+        return defenc_c;
+#else /* PY_VERSION_HEX < 0x03030000 */
+        if (PyUnicode_READY(o) == -1) return NULL;
+#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+        if (PyUnicode_IS_ASCII(o)) {
+            *length = PyUnicode_GET_DATA_SIZE(o);
+            return PyUnicode_AsUTF8(o);
+        } else {
+            PyUnicode_AsASCIIString(o);
+            return NULL;
+        }
+#else /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
+        return PyUnicode_AsUTF8AndSize(o, length);
+#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
+#endif /* PY_VERSION_HEX < 0x03030000 */
+    } else
+#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII  || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT */
+    {
+        char* result;
+        int r = PyBytes_AsStringAndSize(o, &result, length);
+        if (r < 0) {
+            return NULL;
+        } else {
+            return result;
+        }
+    }
+}
 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
    int is_true = x == Py_True;
    if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
    else return PyObject_IsTrue(x);
 }
-
 static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
   PyNumberMethods *m;
   const char *name = NULL;
   PyObject *res = NULL;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
   if (PyInt_Check(x) || PyLong_Check(x))
 #else
   if (PyLong_Check(x))
 #endif
     return Py_INCREF(x), x;
   m = Py_TYPE(x)->tp_as_number;
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
   if (m && m->nb_int) {
     name = "int";
     res = PyNumber_Int(x);
@@ -25760,7 +25465,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
   }
 #endif
   if (res) {
-#if PY_VERSION_HEX < 0x03000000
+#if PY_MAJOR_VERSION < 3
     if (!PyInt_Check(res) && !PyLong_Check(res)) {
 #else
     if (!PyLong_Check(res)) {
@@ -25778,7 +25483,6 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
   }
   return res;
 }
-
 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
   Py_ssize_t ival;
   PyObject* x = PyNumber_Index(b);
@@ -25787,7 +25491,6 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
   Py_DECREF(x);
   return ival;
 }
-
 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
 #if PY_VERSION_HEX < 0x02050000
    if (ival <= LONG_MAX)
@@ -25801,14 +25504,12 @@ static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
    return PyInt_FromSize_t(ival);
 #endif
 }
-
 static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
    unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
-   if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) {
-       return (size_t)-1;
-   } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
-       PyErr_SetString(PyExc_OverflowError,
-                       "value too large to convert to size_t");
+   if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
+       if ((val != (unsigned PY_LONG_LONG)-1) || !PyErr_Occurred())
+           PyErr_SetString(PyExc_OverflowError,
+                           "value too large to convert to size_t");
        return (size_t)-1;
    }
    return (size_t)val;
diff --git a/test/testAzimuthalIntegrator.py b/test/testAzimuthalIntegrator.py
index 8fb3cc7..eadf160 100755
--- a/test/testAzimuthalIntegrator.py
+++ b/test/testAzimuthalIntegrator.py
@@ -29,7 +29,7 @@ __author__ = "Jérôme Kieffer"
 __contact__ = "Jerome.Kieffer at ESRF.eu"
 __license__ = "GPLv3+"
 __copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
-__date__ = "17/10/2011"
+__date__ = "20140106"
 
 
 import unittest
@@ -38,7 +38,7 @@ import numpy
 import logging, time
 import sys
 import fabio
-
+import tempfile
 from utilstest import UtilsTest, Rwp, getLogger
 logger = getLogger(__file__)
 pyFAI = sys.modules["pyFAI"]
@@ -54,28 +54,47 @@ class test_azim_halfFrelon(unittest.TestCase):
     poniFile = "1463/LaB6.poni"
     ai = None
     fit2d = None
+    tmp_dir = os.environ.get("PYFAI_TEMPDIR", os.path.join(os.path.dirname(os.path.abspath(__file__)), "tmp"))
+    tmpfiles = {"cython":os.path.join(tmp_dir, "cython.dat"),
+               "cythonSP":os.path.join(tmp_dir, "cythonSP.dat"),
+               "numpy": os.path.join(tmp_dir, "numpy.dat")}
 
     def setUp(self):
         """Download files"""
         self.fit2dFile = UtilsTest.getimage(self.__class__.fit2dFile)
         self.halfFrelon = UtilsTest.getimage(self.__class__.halfFrelon)
         self.splineFile = UtilsTest.getimage(self.__class__.splineFile)
-        self.poniFile = UtilsTest.getimage(self.__class__.poniFile)
-        with open(self.poniFile) as f:
+        poniFile = UtilsTest.getimage(self.__class__.poniFile)
+
+        with open(poniFile) as f:
             data = []
             for line in f:
                 if line.startswith("SplineFile:"):
                     data.append("SplineFile: " + self.splineFile)
                 else:
                     data.append(line.strip())
+        self.poniFile = os.path.join(self.tmp_dir, os.path.basename(poniFile))
+        if not os.path.isdir(self.tmp_dir):
+            os.makedirs(self.tmp_dir)
+
         with open(self.poniFile, "w") as f:
             f.write(os.linesep.join(data))
         self.fit2d = numpy.loadtxt(self.fit2dFile)
         self.ai = AzimuthalIntegrator()
         self.ai.load(self.poniFile)
         self.data = fabio.open(self.halfFrelon).data
-        if not os.path.isdir("tmp"):
-            os.mkdir("tmp")
+        for tmpfile in self.tmpfiles.values():
+            if os.path.isfile(tmpfile):
+                os.unlink(tmpfile)
+
+    def tearDown(self):
+        """Remove temporary files"""
+        unittest.TestCase.tearDown(self)
+        for tmpfile in self.tmpfiles.values():
+            if os.path.isfile(tmpfile):
+                os.unlink(tmpfile)
+        if os.path.isfile(self.poniFile):
+            os.unlink(self.poniFile)
 
     def test_numpy_vs_fit2d(self):
         """
@@ -83,7 +102,7 @@ class test_azim_halfFrelon(unittest.TestCase):
         """
 #        logger.info(self.ai.__repr__())
         tth, I = self.ai.xrpd_numpy(self.data,
-                                     len(self.fit2d), "tmp/numpy.dat", correctSolidAngle=False)
+                                     len(self.fit2d), self.tmpfiles["numpy"], correctSolidAngle=False)
         rwp = Rwp((tth, I), self.fit2d.T)
         logger.info("Rwp numpy/fit2d = %.3f" % rwp)
         if logger.getEffectiveLevel() == logging.DEBUG:
@@ -133,7 +152,7 @@ class test_azim_halfFrelon(unittest.TestCase):
         logger.info("in test_cythonSP_vs_fit2d Before SP")
 
         tth, I = self.ai.xrpd_splitPixel(self.data,
-                                     len(self.fit2d), "tmp/cythonSP.dat", correctSolidAngle=False)
+                                     len(self.fit2d), self.tmpfiles["cythonSP"], correctSolidAngle=False)
         logger.info("in test_cythonSP_vs_fit2d Before")
         t1 = time.time() - t0
 #        logger.info(tth)
@@ -232,6 +251,7 @@ class test_saxs(unittest.TestCase):
     maskDummy = "1488/bioSaxsMaskDummy.edf"
     poniFile = "1489/bioSaxs.poni"
     ai = None
+    tmp_dir = os.environ.get("PYFAI_TEMPDIR", os.path.join(os.path.dirname(os.path.abspath(__file__)), "tmp"))
 
     def setUp(self):
         self.edfPilatus = UtilsTest.getimage(self.__class__.saxsPilatus)
@@ -241,8 +261,8 @@ class test_saxs(unittest.TestCase):
         self.maskDummy = UtilsTest.getimage(self.__class__.maskDummy)
         self.ai = AzimuthalIntegrator()
         self.ai.load(self.poniFile)
-        if not os.path.isdir("tmp"):
-            os.mkdir("tmp")
+        if not os.path.isdir(self.tmp_dir):
+            os.mkdir(self.tmp_dir)
 
     def test_mask(self):
         """test the generation of mask"""
@@ -252,6 +272,37 @@ class test_saxs(unittest.TestCase):
         assert abs(self.ai.makeMask(data, mask=mask).astype(int) - fabio.open(self.maskRef).data).max() == 0
         assert abs(self.ai.makeMask(data, mask=mask, dummy= -2, delta_dummy=1.1).astype(int) - fabio.open(self.maskDummy).data).max() == 0
 
+class test_setter(unittest.TestCase):
+    tmp_dir = os.environ.get("PYFAI_TEMPDIR", os.path.join(os.path.dirname(os.path.abspath(__file__)), "tmp"))
+
+    def setUp(self):
+        self.ai = AzimuthalIntegrator()
+        shape = (10, 15)
+        self.rnd1 = numpy.random.random(shape).astype(numpy.float32)
+        self.rnd2 = numpy.random.random(shape).astype(numpy.float32)
+        if not os.path.isdir(self.tmp_dir):
+            os.mkdir(self.tmp_dir)
+
+        fd, self.edf1 = tempfile.mkstemp(".edf", "testAI1", self.tmp_dir)
+        os.close(fd)
+        fd, self.edf2 = tempfile.mkstemp(".edf", "testAI2", self.tmp_dir)
+        os.close(fd)
+        fabio.edfimage.edfimage(data=self.rnd1).write(self.edf1)
+        fabio.edfimage.edfimage(data=self.rnd2).write(self.edf2)
+    def tearDown(self):
+        if os.path.exists(self.edf1):
+            os.unlink(self.edf1)
+        if os.path.exists(self.edf2):
+            os.unlink(self.edf2)
+    def test_flat(self):
+        self.ai.set_flatfiles((self.edf1,self.edf2), method="mean")
+        self.assert_(self.ai.flatfiles == "%s(%s,%s)" % ("mean", self.edf1, self.edf2), "flatfiles string is OK")
+        self.assert_(abs(self.ai.flatfield-0.5*(self.rnd1+self.rnd2)).max() == 0, "Flat array is OK")
+    def test_dark(self):
+        self.ai.set_darkfiles((self.edf1, self.edf2), method="mean")
+        self.assert_(self.ai.darkfiles == "%s(%s,%s)" % ("mean", self.edf1, self.edf2), "darkfiles string is OK")
+        self.assert_(abs(self.ai.darkcurrent-0.5*(self.rnd1+self.rnd2)).max() == 0, "Dark array is OK")
+
 def test_suite_all_AzimuthalIntegration():
     testSuite = unittest.TestSuite()
     testSuite.addTest(test_azim_halfFrelon("test_cython_vs_fit2d"))
@@ -260,6 +311,8 @@ def test_suite_all_AzimuthalIntegration():
     testSuite.addTest(test_azim_halfFrelon("test_cython_vs_numpy"))
     testSuite.addTest(test_flatimage("test_splitPixel"))
     testSuite.addTest(test_flatimage("test_splitBBox"))
+    testSuite.addTest(test_setter("test_flat"))
+    testSuite.addTest(test_setter("test_dark"))
 # This test is known to be broken ...
 #    testSuite.addTest(test_saxs("test_mask"))
 
diff --git a/test/testBilinear.py b/test/testBilinear.py
index 0d0cdea..582efd0 100755
--- a/test/testBilinear.py
+++ b/test/testBilinear.py
@@ -42,10 +42,12 @@ import sys
 from utilstest import getLogger  # UtilsTest, Rwp, getLogger
 logger = getLogger(__file__)
 pyFAI = sys.modules["pyFAI"]
+from pyFAI import bilinear
 # from pyFAI.azimuthalIntegrator import AzimuthalIntegrator
 # if logger.getEffectiveLevel() <= logging.INFO:
 #    import pylab
-from pyFAI import bilinear
+#from pyFAI import bilinear
+#bilinear = sys.modules["pyFAI.bilinear"]
 
 class test_bilinear(unittest.TestCase):
     """basic maximum search test"""
diff --git a/test/testDetector.py b/test/testDetector.py
new file mode 100755
index 0000000..0bd6d41
--- /dev/null
+++ b/test/testDetector.py
@@ -0,0 +1,81 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+#    Project: Azimuthal integration
+#             https://forge.epn-campus.eu/projects/azimuthal
+#
+#    File: "$Id$"
+#
+#    Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
+#
+#    author: Picca Frédéric-Emmanuel <picca at synchrotron-soleil.fr>
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+"test suite for masked arrays"
+
+__author__ = "Picca Frédéric-Emmanuel"
+__contact__ = "picca at synchrotron-soleil.fr"
+__license__ = "GPLv3+"
+__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
+__date__ = "24/09/2013"
+
+import sys
+import unittest
+import numpy
+from utilstest import getLogger  # UtilsTest, Rwp, getLogger
+logger = getLogger(__file__)
+pyFAI = sys.modules["pyFAI"]
+from pyFAI.detectors import detector_factory
+
+
+class TestDetector(unittest.TestCase):
+
+    def test_detector_imxpad_s140(self):
+        """
+        The masked image has a masked ring around 1.5deg with value
+        -10 without mask the pixels should be at -10 ; with mask they
+        are at 0
+        """
+        imxpad = detector_factory("imxpad_s140")
+
+        # check that the cartesian coordinates is cached
+        self.assertEqual(hasattr(imxpad, 'COORDINATES'), False)
+        y, x = imxpad.calc_cartesian_positions()
+        self.assertEqual(hasattr(imxpad, 'COORDINATES'), True)
+
+        # now check that the cached values are identical for each
+        # method call
+        y1, x1 = imxpad.calc_cartesian_positions()
+        self.assertEqual(numpy.all(numpy.equal(y1, y)), True)
+        self.assertEqual(numpy.all(numpy.equal(x1, x)), True)
+
+        # check that a few pixel positiopns are ok.
+        self.assertAlmostEqual(y[0], 130e-6 / 2.)
+        self.assertAlmostEqual(y[1], y[0] + 130e-6)
+        self.assertAlmostEqual(y[119], y[118] + 130e-6 * 3.5 / 2.)
+
+        self.assertAlmostEqual(x[0], 130e-6 / 2.)
+        self.assertAlmostEqual(x[1], x[0] + 130e-6)
+        self.assertAlmostEqual(x[79], x[78] + 130e-6 * 3.5 / 2.)
+
+def test_suite_all_detectors():
+    testSuite = unittest.TestSuite()
+    testSuite.addTest(TestDetector("test_detector_imxpad_s140"))
+    return testSuite
+
+if __name__ == '__main__':
+    mysuite = test_suite_all_detectors()
+    runner = unittest.TextTestRunner()
+    runner.run(mysuite)
diff --git a/test/testDistortion.py b/test/testDistortion.py
index 2a2c2c0..a38dc9f 100755
--- a/test/testDistortion.py
+++ b/test/testDistortion.py
@@ -42,6 +42,8 @@ from utilstest import UtilsTest, getLogger
 logger = getLogger(__file__)
 pyFAI = sys.modules["pyFAI"]
 from pyFAI import _distortion, detectors
+#_distortion = sys.modules["pyFAI._distortion"]
+#detectors = sys.modules["pyFAI.detectors"]
 
 class test_halfccd(unittest.TestCase):
     """basic test"""
diff --git a/test/testGeometry.py b/test/testGeometry.py
index fcc5c9c..6570427 100755
--- a/test/testGeometry.py
+++ b/test/testGeometry.py
@@ -10,9 +10,9 @@ import unittest, numpy, os, sys, time
 from utilstest import UtilsTest, getLogger
 logger = getLogger(__file__)
 pyFAI = sys.modules["pyFAI"]
-#from pyFAI import AzimuthalIntegrator
-import pyFAI.geometry
-geometry = pyFAI.geometry
+
+from pyFAI import geometry
+from pyFAI import AzimuthalIntegrator
 import fabio
 
 class TestSolidAngle(unittest.TestCase):
@@ -36,7 +36,7 @@ class TestSolidAngle(unittest.TestCase):
         self.fit2dFile = UtilsTest.getimage(self.__class__.fit2dFile)
         self.pilatusFile = UtilsTest.getimage(self.__class__.pilatusFile)
         self.tth_fit2d, self.I_fit2d = numpy.loadtxt(self.fit2dFile, unpack=True)
-        self.ai = pyFAI.AzimuthalIntegrator(dist=1.994993e-01,
+        self.ai = AzimuthalIntegrator(dist=1.994993e-01,
                                       poni1=2.143248e-01,
                                       poni2=2.133315e-01,
                                       rot1=0.007823,
@@ -68,6 +68,24 @@ class TestSolidAngle(unittest.TestCase):
         self.assert_(delta_I < 5, 'Error on (good) I are small: %s <5' % delta_I)
         self.assert_(I < 0.05, 'Error on (good) I are small: %s <0.05' % I)
 
+class TestBug88SolidAngle(unittest.TestCase):
+    """
+    Test case for solid angle where data got modified inplace.
+    
+    https://github.com/kif/pyFAI/issues/88
+    """
+
+
+    def testSolidAngle(self):
+        img = numpy.ones((1000, 1000), dtype=numpy.float32)
+        ai = pyFAI.AzimuthalIntegrator(dist=0.01, detector="Titan", wavelength=1e-10)
+        t = ai.integrate1d(img, 1000, method="numpy")[1].max()
+        f = ai.integrate1d(img, 1000, method="numpy", correctSolidAngle=False)[1].max()
+        self.assertAlmostEqual(f, 1, 5, "uncorrected flat data are unchanged")
+        self.assertNotAlmostEqual(f, t, 1, "corrected and uncorrected flat data are different")
+
+
+
 class ParameterisedTestCase(unittest.TestCase):
     """ TestCase classes that want to be parameterised should
         inherit from this class.
@@ -182,6 +200,7 @@ TESTCASES = [
 def test_suite_all_Geometry():
     testSuite = unittest.TestSuite()
     testSuite.addTest(TestSolidAngle("testSolidAngle"))
+    testSuite.addTest(TestBug88SolidAngle("testSolidAngle"))
     for param in TESTCASES:
         testSuite.addTest(ParameterisedTestCase.parameterise(
                 TestGeometry, param))
diff --git a/test/testGeometryRefinement.py b/test/testGeometryRefinement.py
index 29d100c..ddde3e1 100755
--- a/test/testGeometryRefinement.py
+++ b/test/testGeometryRefinement.py
@@ -40,7 +40,8 @@ import sys
 from utilstest import UtilsTest, Rwp, getLogger
 logger = getLogger(__file__)
 pyFAI = sys.modules["pyFAI"]
-from pyFAI.geometryRefinement import GeometryRefinement
+from pyFAI import geometryRefinement
+GeometryRefinement = geometryRefinement.GeometryRefinement
 class test_geometryRefinement(unittest.TestCase):
     """ tests geometric refinements with or without spline"""
 
@@ -106,23 +107,23 @@ class test_geometryRefinement(unittest.TestCase):
         ring = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3,
                 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5,
                 5, 5, 5, 5, 5]
-        ds = [ 4.15695   ,  2.93940753,  2.4000162 ,  2.078475  ,  1.85904456,
-        1.69706773,  1.46970377,  1.38565   ,  1.31454301,  1.25336758,
-        1.2000081 ,  1.15293049,  1.11099162,  1.0392375 ,  1.00820847,
-        0.97980251,  0.95366973,  0.92952228,  0.90712086,  0.88626472,
-        0.84853387,  0.83139   ,  0.81524497,  0.8000054 ,  0.77192624,
-        0.75895176,  0.73485188,  0.72363211,  0.71291104,  0.7026528 ,
-        0.692825  ,  0.68339837,  0.67434634,  0.65727151,  0.64920652,
-        0.64143131,  0.63392893,  0.62668379,  0.61968152,  0.61290884,
-        0.60000405,  0.59385   ,  0.58788151,  0.58208943,  0.57646525,
-        0.571001  ,  0.56568924,  0.55549581,  0.55060148,  0.54583428,
-        0.54118879,  0.53224291,  0.52793318,  0.52372647,  0.51961875,
-        0.51560619,  0.51168517,  0.50785227,  0.50410423,  0.50043797,
+        ds = [ 4.15695   , 2.93940753, 2.4000162 , 2.078475  , 1.85904456,
+        1.69706773, 1.46970377, 1.38565   , 1.31454301, 1.25336758,
+        1.2000081 , 1.15293049, 1.11099162, 1.0392375 , 1.00820847,
+        0.97980251, 0.95366973, 0.92952228, 0.90712086, 0.88626472,
+        0.84853387, 0.83139   , 0.81524497, 0.8000054 , 0.77192624,
+        0.75895176, 0.73485188, 0.72363211, 0.71291104, 0.7026528 ,
+        0.692825  , 0.68339837, 0.67434634, 0.65727151, 0.64920652,
+        0.64143131, 0.63392893, 0.62668379, 0.61968152, 0.61290884,
+        0.60000405, 0.59385   , 0.58788151, 0.58208943, 0.57646525,
+        0.571001  , 0.56568924, 0.55549581, 0.55060148, 0.54583428,
+        0.54118879, 0.53224291, 0.52793318, 0.52372647, 0.51961875,
+        0.51560619, 0.51168517, 0.50785227, 0.50410423, 0.50043797,
         0.49685056]#LaB6
 
         data[:, 2] = ring
 
-        r = GeometryRefinement(data, pixel1=pixelSize[0], pixel2=pixelSize[1], 
+        r = GeometryRefinement(data, pixel1=pixelSize[0], pixel2=pixelSize[1],
                                wavelength=1.54e-10, dSpacing=ds)
         r.refine2(10000000)
 
diff --git a/test/testHistogram.py b/test/testHistogram.py
index c0677c0..301a4ed 100755
--- a/test/testHistogram.py
+++ b/test/testHistogram.py
@@ -41,7 +41,8 @@ from utilstest import UtilsTest, Rwp, getLogger
 logger = getLogger(__file__)
 pyFAI = sys.modules["pyFAI"]
 from pyFAI.histogram import histogram, histogram2d
-
+#histogram = sys.modules["pyFAI.histogram"].histogram
+#histogram2d = sys.modules["pyFAI.histogram"].histogram2d
 if logger.getEffectiveLevel() == logging.DEBUG:
     import pylab
 EPS32 = (1.0 + numpy.finfo(numpy.float32).eps)
diff --git a/test/testIntegrate.py b/test/testIntegrate.py
index f04739e..ed5ae32 100755
--- a/test/testIntegrate.py
+++ b/test/testIntegrate.py
@@ -102,7 +102,7 @@ class TestIntegrate2D(unittest.TestCase):
     ai = pyFAI.AzimuthalIntegrator(1.58323111834, 0.0334170169115, 0.0412277798782, 0.00648735642526, 0.00755810191106, 0.0, detector=pyFAI.detectors.Pilatus1M())
     ai.wavelength = 1e-10
     Rmax = 20
-
+    delta_pos_azim_max = 0.28
 
     def testQ(self):
         res = {}
@@ -121,7 +121,7 @@ class TestIntegrate2D(unittest.TestCase):
                 else:
                     logger.info(mesg)
                 self.assertTrue(delta_pos_rad <= 0.01, mesg)
-                self.assertTrue(delta_pos_azim <= 0.2, mesg)
+                self.assertTrue(delta_pos_azim <= self.delta_pos_azim_max, mesg)
                 self.assertTrue(R <= self.Rmax, mesg)
 
     def testR(self):
@@ -140,8 +140,8 @@ class TestIntegrate2D(unittest.TestCase):
                     logger.error(mesg)
                 else:
                     logger.info(mesg)
-                self.assertTrue(delta_pos_rad <= 0.2, mesg)
-                self.assertTrue(delta_pos_azim <= 0.2, mesg)
+                self.assertTrue(delta_pos_rad <= 0.28, mesg)
+                self.assertTrue(delta_pos_azim <= self.delta_pos_azim_max, mesg)
                 self.assertTrue(R <= self.Rmax, mesg)
     def test2th(self):
         res = {}
@@ -162,7 +162,6 @@ class TestIntegrate2D(unittest.TestCase):
                 else:
                     logger.info(mesg)
                 self.assertTrue(delta_pos_rad <= 0.01, mesg)
-                self.assertTrue(delta_pos_azim <= 0.2, mesg)
                 self.assertTrue(R <= self.Rmax, mesg)
 
 
diff --git a/test/testMask.py b/test/testMask.py
index 70b4dde..d4a3901 100755
--- a/test/testMask.py
+++ b/test/testMask.py
@@ -53,6 +53,7 @@ class test_mask(unittest.TestCase):
         self.dataFile = UtilsTest.getimage(self.__class__.dataFile)
         self.poniFile = UtilsTest.getimage(self.__class__.poniFile)
         self.ai = pyFAI.load(self.poniFile)
+#        self.ai.mask = None
         self.data = fabio.open(self.dataFile).data
         self.mask = self.data < 0
 
@@ -61,16 +62,18 @@ class test_mask(unittest.TestCase):
         The masked image has a masked ring around 1.5deg with value -10
         without mask the pixels should be at -10 ; with mask they are at 0
         """
-        x1 = self.ai.xrpd_splitBBox(self.data, 1000)
-        x2 = self.ai.xrpd_splitBBox(self.data, 1000, mask=self.mask)
-        x3 = self.ai.xrpd_splitBBox(self.data, 1000, dummy= -20.0, delta_dummy=19.5)
+        x1 = self.ai.integrate1d(self.data, 1000, unit="2th_deg")
+        x2 = self.ai.integrate1d(self.data, 1000, mask=self.mask, unit="2th_deg")
+        x3 = self.ai.integrate1d(self.data, 1000, dummy= -20.0, delta_dummy=19.5, unit="2th_deg")
         res1 = numpy.interp(1.5, *x1)
         res2 = numpy.interp(1.5, *x2)
         res3 = numpy.interp(1.5, *x3)
         if logger.getEffectiveLevel() == logging.DEBUG:
-            pylab.plot(*x1)
-            pylab.plot(*x2)
-            pylab.plot(*x3)
+            pylab.plot(*x1, label="no mask")
+            pylab.plot(*x2, label="with mask")
+            pylab.plot(*x3, label="with dummy")
+            pylab.title("test_mask_splitBBox")
+            pylab.legend()
             pylab.show()
             raw_input()
 
@@ -131,12 +134,94 @@ class test_mask(unittest.TestCase):
         self.assertAlmostEqual(res2, 0., 4, msg="With mask the bad pixels are actually at 0 (got %.4f)" % res2)
         self.assertAlmostEqual(res3, -20., 4, msg="Without mask but dummy=-20 the dummy pixels are actually at -20 (got % .4f)" % res3)
 
+class test_mask_beamstop(unittest.TestCase):
+    """
+    Test for https://github.com/kif/pyFAI/issues/76
+    """
+    dataFile = "1788/moke.tif"
+
+    def setUp(self):
+        """
+        Download files 
+        Create a mask for tth<3.7 deg
+        """
+        self.dataFile = UtilsTest.getimage(self.__class__.dataFile)
+        detector = pyFAI.detectors.Detector(pixel1=0.0001, pixel2=0.0001)
+        self.ai = pyFAI.AzimuthalIntegrator(dist=0.1, poni1=0.03, poni2=0.03, detector=detector)
+        self.data = fabio.open(self.dataFile).data
+        self.tth, self.I = self.ai.integrate1d(self.data, 1000, unit="2th_deg")
+        self.mask = self.ai.ttha < numpy.deg2rad(3.7)
+
+    def test_nomask(self):
+        """
+        without mask, tth value should start at 0
+        """
+        if logger.getEffectiveLevel() == logging.DEBUG:
+            pylab.plot(self.tth, self.I, label="nomask")
+            pylab.legend()
+            pylab.show()
+            raw_input()
+
+        self.assertAlmostEqual(self.tth[0], 0.0, 1, "tth without mask starts at 0")
+
+    def test_mask_splitBBox(self):
+        """
+        With a mask with and without limits
+        """
+        tth, I = self.ai.integrate1d(self.data, 1000, mask=self.mask, unit="2th_deg", method="splitBBox")
+        self.assertAlmostEqual(tth[0], 3.7, 1, msg="tth range starts at 3.7 (got %.4f)" % tth[0])
+        tth, I = self.ai.integrate1d(self.data, 1000, mask=self.mask, unit="2th_deg", method="splitBBox", radial_range=[1, 10])
+        self.assertAlmostEqual(tth[0], 1.0, 1, msg="tth range should start at 1.0 (got %.4f)" % tth[0])
+
+    def test_mask_LUT(self):
+        """
+        With a mask with and without limits
+        """
+        tth, I = self.ai.integrate1d(self.data, 1000, mask=self.mask, unit="2th_deg", method="LUT")
+        self.assertAlmostEqual(tth[0], 3.7, 1, msg="tth range starts at 3.7 (got %.4f)" % tth[0])
+        tth, I = self.ai.integrate1d(self.data, 1000, mask=self.mask, unit="2th_deg", method="LUT", radial_range=[1, 10])
+        self.assertAlmostEqual(tth[0], 1.0, 1, msg="tth range should start at 1.0 (got %.4f)" % tth[0])
+
+    def test_mask_LUT_OCL(self):
+        """
+        With a mask with and without limits
+        """
+        tth, I = self.ai.integrate1d(self.data, 1000, mask=self.mask, unit="2th_deg", method="lut_ocl")
+        self.assert_(tth[0] > 3.5, msg="tth range starts at 3.7 (got %.4f)" % tth[0])
+        tth, I = self.ai.integrate1d(self.data, 1000, mask=self.mask, unit="2th_deg", method="lut_ocl", radial_range=[1, 10])
+        self.assertAlmostEqual(tth[0], 1.0, 1, msg="tth range should start at 1.0 (got %.4f)" % tth[0])
+
+    def test_nomask_LUT(self):
+        """
+        without mask, tth value should start at 0
+        """
+        tth, I = self.ai.integrate1d(self.data, 1000, unit="2th_deg", method="lut")
+        self.assertAlmostEqual(tth[0], 0.0, 1, msg="tth range starts at 3.7 (got %.4f)" % tth[0])
+        tth, I = self.ai.integrate1d(self.data, 1000, unit="2th_deg", method="lut", radial_range=[1, 10])
+        self.assertAlmostEqual(tth[0], 1.0, 1, msg="tth range should start at 1.0 (got %.4f)" % tth[0])
+
+
+    def test_nomask_LUT_OCL(self):
+        """
+        without mask, tth value should start at 0
+        """
+        tth, I = self.ai.integrate1d(self.data, 1000, unit="2th_deg", method="lut_ocl")
+        self.assertAlmostEqual(tth[0], 0.0, 1, msg="tth range starts at 3.7 (got %.4f)" % tth[0])
+        tth, I = self.ai.integrate1d(self.data, 1000, unit="2th_deg", method="lut_ocl", radial_range=[1, 10])
+        self.assertAlmostEqual(tth[0], 1.0, 1, msg="tth range should start at 1.0 (got %.4f)" % tth[0])
+
 
 def test_suite_all_Mask():
     testSuite = unittest.TestSuite()
     testSuite.addTest(test_mask("test_mask_splitBBox"))
     testSuite.addTest(test_mask("test_mask_LUT"))
     testSuite.addTest(test_mask("test_mask_LUT_OCL"))
+    testSuite.addTest(test_mask_beamstop("test_nomask"))
+    testSuite.addTest(test_mask_beamstop("test_mask_splitBBox"))
+    testSuite.addTest(test_mask_beamstop("test_mask_LUT"))
+    testSuite.addTest(test_mask_beamstop("test_mask_LUT_OCL"))
+    testSuite.addTest(test_mask_beamstop("test_nomask_LUT"))
+    testSuite.addTest(test_mask_beamstop("test_nomask_LUT_OCL"))
     return testSuite
 
 if __name__ == '__main__':
diff --git a/test/testOpenCL.py b/test/testOpenCL.py
index 3aceaec..90debe7 100755
--- a/test/testOpenCL.py
+++ b/test/testOpenCL.py
@@ -48,11 +48,14 @@ else:
     skip = False
 
 pyFAI = sys.modules["pyFAI"]
-ocl = pyFAI.opencl.ocl
+from pyFAI.opencl import ocl
+# = sys.modules["pyFAI.opencl"].ocl
 
 class test_mask(unittest.TestCase):
+    tmp_dir = os.environ.get("PYFAI_TEMPDIR", os.path.join(os.path.dirname(os.path.abspath(__file__)), "tmp"))
 
     def setUp(self):
+
         self.datasets = [{"img":UtilsTest.getimage("1883/Pilatus1M.edf"), "poni":UtilsTest.getimage("1893/Pilatus1M.poni"), "spline": None},
             {"img":UtilsTest.getimage("1882/halfccd.edf"), "poni":UtilsTest.getimage("1895/halfccd.poni"), "spline": UtilsTest.getimage("1461/halfccd.spline")},
             {"img":UtilsTest.getimage("1881/Frelon2k.edf"), "poni":UtilsTest.getimage("1896/Frelon2k.poni"), "spline": UtilsTest.getimage("1900/frelon.spline")},
@@ -70,9 +73,17 @@ class test_mask(unittest.TestCase):
                             data.append("SplineFile: " + ds["spline"])
                         else:
                             data.append(line.strip())
+                ds["poni"] = os.path.join(self.tmp_dir, os.path.basename(ds["poni"]))
                 with open(ds["poni"], "w") as f:
                     f.write(os.linesep.join(data))
 
+    def tearDown(self):
+        unittest.TestCase.tearDown(self)
+        for ds in self.datasets:
+            if ds["spline"] is not None:
+                if os.path.isfile(ds["poni"]):
+                    os.unlink(ds["poni"])
+
     def test_OpenCL(self):
         logger.info("Testing histogram-based algorithm (forward-integration)")
         for devtype in ("GPU", "CPU"):
diff --git a/test/testPeakPicking.py b/test/testPeakPicking.py
index b37b7df..adb1992 100755
--- a/test/testPeakPicking.py
+++ b/test/testPeakPicking.py
@@ -29,7 +29,7 @@ __author__ = "Jérôme Kieffer"
 __contact__ = "Jerome.Kieffer at ESRF.eu"
 __license__ = "GPLv3+"
 __copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
-__date__ = "04/02/2013"
+__date__ = "20140106"
 
 
 import unittest
@@ -41,9 +41,10 @@ import fabio
 from utilstest import UtilsTest, Rwp, getLogger
 logger = getLogger(__file__)
 pyFAI = sys.modules["pyFAI"]
+import pyFAI.peakPicker
+import pyFAI.geometryRefinement
 from pyFAI.peakPicker import PeakPicker
 from pyFAI.geometryRefinement import GeometryRefinement
-
 if logger.getEffectiveLevel() <= logging.INFO:
     import pylab
 
@@ -67,29 +68,38 @@ class test_peak_picking(unittest.TestCase):
     wavelength = 1e-10
     ds = wavelength * 5e9 / numpy.sin(tth / 2)
     maxiter = 100
-
+    tmp_dir = os.environ.get("PYFAI_TEMPDIR", os.path.join(os.path.dirname(os.path.abspath(__file__)), "tmp"))
+    logfile = os.path.join(tmp_dir, "testpeakPicking.log")
+    nptfile = os.path.join(tmp_dir, "testpeakPicking.npt")
     def setUp(self):
         """Download files"""
         self.img = UtilsTest.getimage(self.__class__.calibFile)
         self.pp = PeakPicker(self.img, dSpacing=self.ds, wavelength=self.wavelength)
-        dirname = os.path.dirname(os.path.abspath(__file__))
-        self.tmpdir = os.path.join(dirname, "tmp")
-        if not os.path.isdir(self.tmpdir):
-            os.mkdir(self.tmpdir)
+        if not os.path.isdir(self.tmp_dir):
+            os.makedirs(self.tmp_dir)
+        if os.path.isfile(self.logfile):
+            os.unlink(self.logfile)
+        if os.path.isfile(self.nptfile):
+            os.unlink(self.nptfile)
+    def tearDown(self):
+        """Remove temporary files"""
+        unittest.TestCase.tearDown(self)
+        if os.path.isfile(self.logfile):
+            os.unlink(self.logfile)
+        if os.path.isfile(self.nptfile):
+            os.unlink(self.nptfile)
 
     def test_peakPicking(self):
         """first test peak-picking then checks the geometry found is OK"""
-        logfile = os.path.join(self.tmpdir, "testpeakPicking.log")
-
         for i in self.ctrlPt:
-            pts = self.pp.massif.find_peaks(self.ctrlPt[i], stdout=open(logfile, "a"))
+            pts = self.pp.massif.find_peaks(self.ctrlPt[i], stdout=open(self.logfile, "a"))
             logger.info("point %s at ring #%i (tth=%.1f deg) generated %i points", self.ctrlPt[i], i, self.tth[i], len(pts))
             if len(pts) > 0:
                 self.pp.points.append(pts, angle=self.tth[i], ring=i)
             else:
                 logger.error("point %s caused error (%s) ", i, self.ctrlPt[i])
 
-        self.pp.points.save(os.path.join(self.tmpdir, "testpeakPicking.npt"))
+        self.pp.points.save(self.nptfile)
         lstPeak = self.pp.points.getListRing()
 #        print self.pp.points
 #        print lstPeak
diff --git a/test/testUtils.py b/test/testUtils.py
index e32a924..b749a4a 100755
--- a/test/testUtils.py
+++ b/test/testUtils.py
@@ -27,13 +27,14 @@ __author__ = "Jérôme Kieffer"
 __contact__ = "Jerome.Kieffer at ESRF.eu"
 __license__ = "GPLv3+"
 __copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
-__date__ = "11/04/2013"
+__date__ = "20140106"
 
 
 import unittest
 import numpy
 import logging
 import sys
+import os
 import fabio
 from utilstest import UtilsTest, getLogger
 logger = getLogger(__file__)
@@ -63,9 +64,21 @@ class test_utils(unittest.TestCase):
     dark = unbinned.astype("float32")
     flat = 1 + numpy.random.random((64, 32))
     raw = flat + dark
+    tmp_dir = os.environ.get("PYFAI_TEMPDIR",os.path.join(os.path.dirname(os.path.abspath(__file__)), "tmp"))
+    tmp_file = os.path.join(tmp_dir, "testUtils_average.edf")
     def setUp(self):
-        """Download files"""
-        pass
+        """Download files & create tmp directory if needed"""
+        if not os.path.isdir(self.tmp_dir):
+            os.makedirs(self.tmp_dir)
+            
+    def tearDown(self):
+        """Remove tmp files if needed"""
+        if os.path.isfile(self.tmp_file):
+            try:
+                os.unlink(self.tmp_file)
+            except OSError as error:
+                logger.error("Unable to remove file %s" % self.tmp_file)
+
     def test_binning(self):
         """
         test the binning and unbinning functions
@@ -98,7 +111,7 @@ class test_utils(unittest.TestCase):
         six = pyFAI.utils.averageDark([numpy.ones_like(self.dark), self.dark, numpy.zeros_like(self.dark), self.dark, self.dark ], "median", .001)
         self.assert_(abs(self.dark - six).max() < 1e-4, "data are the same: test threshold")
 
-        seven = pyFAI.utils.averageImages([self.raw], darks=[self.dark], flats=[self.flat], threshold=0)
+        seven = pyFAI.utils.averageImages([self.raw], darks=[self.dark], flats=[self.flat], threshold=0, output=self.tmp_file)
         self.assert_(abs(numpy.ones_like(self.dark) - fabio.open(seven).data).mean() < 1e-2, "averageImages")
 
     def test_shift(self):
diff --git a/test/test_all.py b/test/test_all.py
index 0da05a6..1f232f7 100755
--- a/test/test_all.py
+++ b/test/test_all.py
@@ -54,6 +54,7 @@ from testDistortion           import test_suite_all_distortion
 from testFlat                 import test_suite_all_Flat
 from testUtils                import test_suite_all_Utils
 from testPolarization         import test_suite_all_Polarization
+from testDetector             import test_suite_all_detectors
 
 def test_suite_all():
     testSuite = unittest.TestSuite()
@@ -71,6 +72,7 @@ def test_suite_all():
     testSuite.addTest(test_suite_all_distortion())
     testSuite.addTest(test_suite_all_Flat())
     testSuite.addTest(test_suite_all_Utils())
+    testSuite.addTest(test_suite_all_detectors())
     return testSuite
 
 if __name__ == '__main__':
diff --git a/test/testimages/Frelon2k.poni b/test/testimages/Frelon2k.poni
index 47d9c01..1daf167 100644
--- a/test/testimages/Frelon2k.poni
+++ b/test/testimages/Frelon2k.poni
@@ -1,4 +1,4 @@
-# Nota: C-Order, 1 refers to the Y axis, 2 to the X axis
+# Nota: C-Order, 1 refers to the Y axis, 2 to the X axis 
 PixelSize1: 4.683152e-05
 PixelSize2: 4.722438e-05
 Distance: 0.1057363
@@ -7,4 +7,4 @@ Poni2: 0.05660461
 Rot1: 0.027767
 Rot2: 0.016991
 Rot3: -1.8e-05
-SplineFile: /users/kieffer/workspace-ssd/tmp/pyFAI/test/testimages/frelon.spline
\ No newline at end of file
+SplineFile: frelon.spline
diff --git a/test/testimages/LaB6.poni b/test/testimages/LaB6.poni
index de21e67..50a0910 100644
--- a/test/testimages/LaB6.poni
+++ b/test/testimages/LaB6.poni
@@ -1,4 +1,4 @@
-# Nota: C-Order, 1 refers to the Y axis, 2 to the X axis
+# Nota: C-Order, 1 refers to the Y axis, 2 to the X axis 
 PixelSize1: 4.842252e-05
 PixelSize2: 4.684483e-05
 Distance: 0.0994744403007
@@ -7,4 +7,4 @@ Poni2: 0.0481217639198
 Rot1: -0.000125830018938
 Rot2: -0.0160719674782
 Rot3: 1.57079531561
-SplineFile: /users/kieffer/workspace-ssd/tmp/pyFAI/test/testimages/halfccd.spline
\ No newline at end of file
+SplineFile: halfccd.spline
diff --git a/test/testimages/halfccd.poni b/test/testimages/halfccd.poni
index de21e67..50a0910 100644
--- a/test/testimages/halfccd.poni
+++ b/test/testimages/halfccd.poni
@@ -1,4 +1,4 @@
-# Nota: C-Order, 1 refers to the Y axis, 2 to the X axis
+# Nota: C-Order, 1 refers to the Y axis, 2 to the X axis 
 PixelSize1: 4.842252e-05
 PixelSize2: 4.684483e-05
 Distance: 0.0994744403007
@@ -7,4 +7,4 @@ Poni2: 0.0481217639198
 Rot1: -0.000125830018938
 Rot2: -0.0160719674782
 Rot3: 1.57079531561
-SplineFile: /users/kieffer/workspace-ssd/tmp/pyFAI/test/testimages/halfccd.spline
\ No newline at end of file
+SplineFile: halfccd.spline
diff --git a/test/utilstest.py b/test/utilstest.py
index 6fc9726..9fb9f90 100644
--- a/test/utilstest.py
+++ b/test/utilstest.py
@@ -29,7 +29,7 @@ __author__ = "Jérôme Kieffer"
 __contact__ = "jerome.kieffer at esrf.eu"
 __license__ = "GPLv3+"
 __copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
-__data__ = "2012-11-08"
+__date__ = "2012-11-08"
 import os, imp, sys, subprocess, threading
 import distutils.util
 import logging
@@ -38,7 +38,7 @@ import bz2
 import gzip
 import numpy
 import shutil
-
+logging.basicConfig(level=logging.WARNING)
 logger = logging.getLogger("pyFAI.utilstest")
 
 def copy(infile, outfile):
@@ -73,6 +73,9 @@ class UtilsTest(object):
         logger.info("pyFAI module was already loaded from  %s" % sys.modules["pyFAI"])
         pyFAI = None
         sys.modules.pop("pyFAI")
+        for key in sys.modules.copy():
+            if key.startswith("pyFAI."):
+                sys.modules.pop(key)
 
     if not os.path.isdir(pyFAI_home):
         with sem:
@@ -86,14 +89,58 @@ class UtilsTest(object):
     for clf in os.listdir(opencl):
         if clf.endswith(".cl") and clf not in os.listdir(os.path.join(pyFAI_home, "pyFAI")):
             copy(os.path.join(opencl, clf), os.path.join(pyFAI_home, "pyFAI", clf))
-    pyFAI = imp.load_module(*((name,) + imp.find_module(name, [pyFAI_home])))
-    sys.modules[name] = pyFAI
-    logger.info("pyFAI loaded from %s" % pyFAI.__file__)
 
+    logger.info("Loading pyFAI")
+    try:
+        pyFAI = imp.load_module(*((name,) + imp.find_module(name, [pyFAI_home])))
+    except Exception as error:
+        logger.warning("Unable to loading pyFAI %s" % error)
+        if "-r" not in sys.argv:
+            logger.warning("Remove build and start from scratch %s" % error)
+            sys.argv.append("-r")
+
+
+    @classmethod
+    def deep_reload(cls):
+        logger.info("Loading pyFAI")
+        cls.pyFAI = None
+        pyFAI = None
+        sys.path.insert(0, cls.pyFAI_home)
+        for key in sys.modules.copy():
+            if key.startswith("pyFAI"):
+                sys.modules.pop(key)
+
+        import pyFAI
+        cls.pyFAI = pyFAI
+#        cls.pyFAI = imp.load_module(*((cls.name,) + imp.find_module(cls.name, [cls.pyFAI_home])))
+#        sys.modules[cls.name] = cls.pyFAI
+#        for module_name in [ "_distortion", '_geometry', 'fastcrc', 'histogram',
+#                            'splitBBox', 'splitBBoxLUT', 'splitPixel',
+#                            'utils', 'ocl_azim', 'ocl_azim_lut', 'opencl',
+#                            'units', 'spline', 'detectors', "geometry", 'azimuthalIntegrator',
+#                            "geometryRefinement"
+#                            ]:
+#            try:
+#                module = imp.load_module(*(("%s.%s" % (cls.name, module_name),) + imp.find_module(module_name, [os.path.join(cls.pyFAI_home, cls.name)])))
+#            except Exception as error:
+#                logger.error("Error while hard-loading %s: %s" % (module_name, error))
+#            else:
+#                sys.modules["%s.%s" % (cls.name, module_name)] = module
+#                cls.pyFAI.__setattr__(module_name, module)
+#        #last but not least:
+#        sys.modules["%s.azimuthalIntegrator" % (cls.name)] = cls.pyFAI.geometryRefinement.azimuthalIntegrator
+#        cls.pyFAI.__setattr__("azimuthalIntegrator", cls.pyFAI.geometryRefinement.azimuthalIntegrator)
+#        sys.modules["%s.geometry" % (cls.name)] = cls.pyFAI.azimuthalIntegrator.geometry
+#        cls.pyFAI.__setattr__("geometry", cls.pyFAI.azimuthalIntegrator.geometry)
+#        cls.pyFAI.AzimuthalIntegrator = cls.pyFAI.azimuthalIntegrator.AzimuthalIntegrator
+#        cls.pyFAI.load = cls.pyFAI.AzimuthalIntegrator.sload
 
+        logger.info("pyFAI loaded from %s" % cls.pyFAI.__file__)
+        sys.modules[cls.name] = cls.pyFAI
+        return cls.pyFAI
 
     @classmethod
-    def forceBuild(cls):
+    def forceBuild(cls, remove_first=True):
         """
         force the recompilation of pyFAI
         """
@@ -103,15 +150,21 @@ class UtilsTest(object):
                     logger.info("Building pyFAI to %s" % cls.pyFAI_home)
                     if "pyFAI" in sys.modules:
                         logger.info("pyFAI module was already loaded from  %s" % sys.modules["pyFAI"])
-                        pyFAI = None
+                        cls.pyFAI = None
                         sys.modules.pop("pyFAI")
-                    recursive_delete(cls.pyFAI_home)
+                    if remove_first:
+                        recursive_delete(cls.pyFAI_home)
                     p = subprocess.Popen([sys.executable, "setup.py", "build"],
                                      shell=False, cwd=os.path.dirname(cls.test_home))
                     logger.info("subprocess ended with rc= %s" % p.wait())
-                    pyFAI = imp.load_module(*((cls.name,) + imp.find_module(cls.name, [cls.pyFAI_home])))
-                    sys.modules[cls.name] = pyFAI
-                    logger.info("pyFAI loaded from %s" % pyFAI.__file__)
+                    opencl = os.path.join(os.path.dirname(cls.test_home), "openCL")
+                    for clf in os.listdir(opencl):
+                        if clf.endswith(".cl") and clf not in os.listdir(os.path.join(cls.pyFAI_home, "pyFAI")):
+                            copy(os.path.join(opencl, clf), os.path.join(cls.pyFAI_home, "pyFAI", clf))
+                    cls.pyFAI = cls.deep_reload()
+#                    pyFAI = imp.load_module(*((cls.name,) + imp.find_module(cls.name, [cls.pyFAI_home])))
+#                    sys.modules[cls.name] = pyFAI
+#                    logger.info("pyFAI loaded from %s" % pyFAI.__file__)
                     cls.recompiled = True
 
     @classmethod
@@ -234,6 +287,7 @@ def getLogger(filename=__file__):
     dirname, basename = os.path.split(os.path.abspath(filename))
     basename = os.path.splitext(basename)[0]
     force_build = False
+    force_remove = False
     level = logging.WARN
     for opts in sys.argv[1:]:
         if opts in ["-d", "--debug"]:
@@ -244,11 +298,16 @@ def getLogger(filename=__file__):
 #            sys.argv.pop(sys.argv.index(opts))
         elif opts in ["-f", "--force"]:
             force_build = True
+        elif opts in ["-r", "--really-force"]:
+            force_remove = True
+            force_build = True
 #            sys.argv.pop(sys.argv.index(opts))
     logger = logging.getLogger(basename)
     logger.setLevel(level)
     logger.debug("tests loaded from file: %s" % basename)
     if force_build:
-        UtilsTest.forceBuild()
+        UtilsTest.forceBuild(force_remove)
+    else:
+        UtilsTest.deep_reload()
     return logger
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/pyfai.git



More information about the debian-science-commits mailing list